Tripal v1.0 (6.x-1.0)
Map

Functions

 tripal_featuremap_admin ()
 get_tripal_featuremap_admin_form_cleanup_set (&$form)
 get_tripal_featuremap_admin_form_taxonomy_set (&$form)
 get_tripal_featuremap_admin_form_reindex_set (&$form)
 get_tripal_featuremap_admin_form_sync_set (&$form)
 tripal_featuremap_admin_validate ($form, &$form_state)
 tripal_featuremap_sync_featuremaps ($featuremap_id=NULL, $job_id=NULL)
 tripal_featuremap_cleanup ($dummy=NULL, $job_id=NULL)
 tripal_featuremap_add_taxonomy ($node, $featuremap_id)
 tripal_featuremap_help ($path, $arg)
 tripal_featuremap_node_info ()
 tripal_featuremap_perm ()
 chado_featuremap_access ($op, $node, $account)
 tripal_featuremap_menu ()
 tripal_featuremap_views_api ()
 tripal_featuremap_nodeapi (&$node, $op, $teaser, $page)
 tripal_featuremap_theme ()
 theme_tripal_featuremap_search_index ($node)
 tripal_featuremap_cron ()
 tripal_featuremap_map_access ($op, $node, $account)
 chado_featuremap_form ($node)
 chado_featuremap_validate ($node)
 chado_featuremap_insert ($node)
 chado_featuremap_update ($node)
 chado_featuremap_load ($node)
 chado_featuremap_view ($node, $teaser=FALSE, $page=FALSE)
 chado_featuremap_delete (&$node)

Detailed Description

Provides functions for managing chado maps including creating details pages for each map


Function Documentation

chado_featuremap_access ( op,
node,
account 
)

Set the permission types that the module uses.

Definition at line 77 of file tripal_featuremap.module.

                                                       {
  if ($op == 'create') {
    if (!user_access('create chado_featuremap content', $account)) {
      return FALSE;
    }
  }
  if ($op == 'update') {
    if (!user_access('edit chado_featuremap content', $account)) {
      return FALSE;
    }
  }
  if ($op == 'delete') {
    if (!user_access('delete chado_featuremap content', $account)) {
      return FALSE;
    }
  }
  if ($op == 'view') {
    if (!user_access('access chado_featuremap content', $account)) {
      return FALSE;
    }
  }
  return NULL;
}
chado_featuremap_delete ( &$  node)

Delete data from drupal and chado databases when a node is deleted

Definition at line 463 of file tripal_featuremap.module.

                                         {

  $featuremap_id = chado_get_id_for_node('featuremap', $node);
  
  // if we don't have a map id for this node then this isn't a node of
  // type chado_featuremap or the entry in the chado_featuremap table was lost.
  if (!$featuremap_id) {
    return;
  }
  
  // Remove data from {chado_featuremap}, {node} and {node_revisions} tables of
  // drupal database
  $sql_del = "DELETE FROM {chado_featuremap} ".
            "WHERE nid = %d ".
            "AND vid = %d";
  db_query($sql_del, $node->nid, $node->vid);
  $sql_del = "DELETE FROM {node} ".
            "WHERE nid = %d ".
            "AND vid = %d";
  db_query($sql_del, $node->nid, $node->vid);
  $sql_del = "DELETE FROM {node_revisions} ".
            "WHERE nid = %d ".
            "AND vid = %d";
  db_query($sql_del, $node->nid, $node->vid);

  // Remove data from map and mapprop tables of chado database as well
  chado_query("DELETE FROM {featuremap} WHERE featuremap_id = %d", $featuremap_id);
  chado_query("DELETE FROM {featuremapprop} WHERE featuremap_id = %d", $featuremap_id);
}
chado_featuremap_form ( node)

When editing or creating a new node of type 'chado_featuremap' we need a form. This function creates the form that will be used for this.

Definition at line 278 of file tripal_featuremap.module.

                                      {
  $type = node_get_types('type', $node);  
  $form = array();

  $featuremap = $node->featuremap;

  // keep track of the map id if we have.  If we do have one then
  // this is an update as opposed to an insert.
  $form['featuremap_id'] = array(
    '#type' => 'value',
    '#value' => $featuremap->featuremap_id,
  );

  $form['title']= array(
    '#type'          => 'textfield',
    '#title'         => t('Map Name'),
    '#description'   => t('Please enter a name for this map'),
    '#required'      => TRUE,
    '#default_value' => $featuremap->name,
  );

  $form['description']= array(
    '#type'          => 'textarea',
    '#title'         => t('Map Description'),
    '#description'   => t('A description of the map.'),
    '#required'      => TRUE,
    '#default_value' => $featuremap->description,
  );
  
  // get the list of unit types
  $values = array(
    'cv_id' => array(
      'name' => 'tripal_featuremap',
    )
  );
  $columns = array('cvterm_id','name');
  $options = array('order_by' => array('name' => 'ASC'));
  $featuremap_units = tripal_core_chado_select('cvterm', $columns, $values, $options);
  $units = array();
  $units[''] = '';
  foreach($featuremap_units as $unit) {
    $units[$unit->cvterm_id] = $unit->name;
  }

  $form['unittype_id'] = array(
    '#title'       => t('Map Units'),
    '#type'        => t('select'),
    '#description' => t("Chose the units for this map"),
    '#required'    => TRUE,
    '#default_value' => $featuremap->unittype_id->cvterm_id,
    '#options'     => $units,
  );

  return $form;
}
chado_featuremap_insert ( node)

When a new chado_featuremap node is created we also need to add information to our chado_featuremap table. This function is called on insert of a new node of type 'chado_featuremap' and inserts the necessary information.

Definition at line 370 of file tripal_featuremap.module.

                                        {

  if ($node->featuremap_id) {
    $featuremap['featuremap_id'] = $node->featuremap_id;
  }
  else {
    $values = array(
      'name' => $node->title,
      'description' => $node->description,
      'unittype_id' => $node->unittype_id
    );
    $featuremap = tripal_core_chado_insert('featuremap', $values);
  }

  if ($featuremap) {
    // make sure the entry for this feature doesn't already exist in the chado_featuremap table
    // if it doesn't exist then we want to add it.
    $featuremap_id = chado_get_id_for_node('featuremap', $node) ;
    if (!$featuremap_id) {
       // next add the item to the drupal table
      $sql = "INSERT INTO {chado_featuremap} (nid, vid, featuremap_id) ".
            "VALUES (%d, %d, %d)";
      db_query($sql, $node->nid, $node->vid, $featuremap['featuremap_id']);
    }
  }
  else {
    drupal_set_message(t('Unable to add featuremap.', 'warning'));
    watchdog('tripal_featuremap',
    'Insert feature: Unable to create featuremap where values: %values',
    array('%values' => print_r($values, TRUE)),
    WATCHDOG_WARNING
    );
  }
}
chado_featuremap_load ( node)

When a node is requested by the user this function is called to allow us to add auxiliary data to the node object.

Definition at line 432 of file tripal_featuremap.module.

                                      {
  // get the feature details from chado
  $featuremap_id = chado_get_id_for_node('featuremap', $node);

  $values = array('featuremap_id' => $featuremap_id);
  $featuremap = tripal_core_generate_chado_var('featuremap', $values);

  $additions = new stdClass();
  $additions->featuremap = $featuremap;
  return $additions;

}
chado_featuremap_update ( node)

Update nodes

Definition at line 409 of file tripal_featuremap.module.

                                        {
  if ($node->revision) {
    // there is no way to handle revisions in Chado but leave
    // this here just to make not we've addressed it.
  }
  $featuremap_id = chado_get_id_for_node('featuremap', $node) ;

  // update the map record
  $match = array(
    'featuremap_id' => $featuremap_id,
  );
  $values = array(
    'name' => $node->title,
    'unittype_id' => $node->unittype_id
  );
  $status = tripal_core_chado_update('featuremap', $match, $values);  
}
chado_featuremap_validate ( node)

validates submission of form when adding or updating a map node

Definition at line 338 of file tripal_featuremap.module.

                                          {
  $map = 0;
  // check to make sure the unique name on the map is unique
  // before we try to insert into chado. If this is an update then we will
  // have a featuremap_id, therefore we want to look for another map with this 
  // name but with a different featuremap_id. If this is an insert, just look
  // for a case where the name already exists.
  if ($node->featuremap_id) {
    $sql = "SELECT * FROM ".
           "{featuremap} WHERE ".
           "name = '%s' ".
           "AND NOT featuremap_id = %d";
    $map = db_fetch_object(chado_query($sql, $node->title, $node->featuremap_id));
  }
  else {
    $sql = "SELECT * FROM ".
           "{featuremap} ".
           "WHERE name = '%s'";
    $map = db_fetch_object(chado_query($sql, $node->title));
  }
  if ($map) {
    form_set_error('name', t('The unique map name already exists. Please choose another'));
  }
}
chado_featuremap_view ( node,
teaser = FALSE,
page = FALSE 
)

This function customizes the view of the chado_featuremap node. It allows us to generate the markup. This function is required for node [Preview]

Definition at line 450 of file tripal_featuremap.module.

                                                                      {
   // use drupal's default node view:
  if (!$teaser) {

    $node = node_prepare($node, $teaser);    
  }
  return $node;
}
get_tripal_featuremap_admin_form_cleanup_set ( &$  form)

Definition at line 43 of file tripal_featuremap.admin.inc.

                                                              {
  $form['cleanup'] = array(
    '#type' => 'fieldset',
    '#title' => t('Clean Up')
  );
  $form['cleanup']['description'] = array(
     '#type' => 'item',
     '#value' => t("With Drupal and chado residing in different databases ".
        "it is possible that nodes in Drupal and maps in Chado become ".
        "\"orphaned\".  This can occur if an map node in Drupal is ".
        "deleted but the corresponding chado map is not and/or vice ".
        "versa. Click the button below to resolve these discrepancies."),
     '#weight' => 1,
  );
  $form['cleanup']['button'] = array(
    '#type' => 'submit',
    '#value' => t('Clean up orphaned maps'),
    '#weight' => 2,
  );
}
get_tripal_featuremap_admin_form_reindex_set ( &$  form)

Definition at line 113 of file tripal_featuremap.admin.inc.

                                                              {
   // define the fieldsets
  $form['reindex'] = array(
    '#type' => 'fieldset',
    '#title' => t('Reindex Map Features')
  );

  // get the list of maps
  $sql = "SELECT * FROM {featuremap} ORDER BY name";
  $lib_rset = chado_query($sql);

  // iterate through all of the maps
  $lib_boxes = array();
  while ($featuremap = db_fetch_object($lib_rset)) {
    $lib_boxes[$featuremap->featuremap_id] = "$featuremap->name";
  }
  $form['reindex']['description'] = array(
     '#type' => 'item',
     '#value' => t("This option allows for reindexing of only those features that belong to the selected maps below. All other features will be unaffected.  To reindex all features in the site see the Feature Administration page."),
   '#weight' => 1,
  );

  $form['reindex']['re-maps'] = array(
   '#title'       => t('Maps'),
   '#type'        => t('checkboxes'),
   '#description' => t("Check the maps whoee features you want to reindex. Note: this list contains all maps, even those that may not be synced."),
   '#required'    => FALSE,
   '#prefix'      => '<div id="lib_boxes">',
   '#suffix'      => '</div>',
   '#options'     => $lib_boxes,
   '#weight' => 2,
  );
  $form['reindex']['re-button'] = array(
    '#type' => 'submit',
    '#value' => t('Reindex Features'),
    '#weight' => 3,
  );
}
get_tripal_featuremap_admin_form_sync_set ( &$  form)

Definition at line 155 of file tripal_featuremap.admin.inc.

                                                           {
   // define the fieldsets
  $form['sync'] = array(
    '#type' => 'fieldset',
    '#title' => t('Sync Maps')
  );


  // get the list of maps
  $sql = "SELECT * FROM {featuremap} ORDER BY name";
  $lib_rset = chado_query($sql);

  // if we've added any maps to the list that can be synced
  // then we want to build the form components to allow the user
  // to select one or all of them.  Otherwise, just present
  // a message stating that all maps are currently synced.
  $lib_boxes = array();
  $added = 0;
  while ($featuremap = db_fetch_object($lib_rset)) {
    // check to see if the map is already present as a node in drupal.
    // if so, then skip it.
    $sql = "SELECT * FROM {chado_featuremap} WHERE featuremap_id = %d";
    if (!db_fetch_object(db_query($sql, $featuremap->featuremap_id))) {
      $lib_boxes[$featuremap->featuremap_id] = "$featuremap->name";
      $added++;
    }
  }

  // if we have maps we need to add to the checkbox then
  // build that form element
  if ($added > 0) {
    $lib_boxes['all'] = "All Maps";

    $form['reindex']['description'] = array(
     '#type' => 'item',
     '#value' => t("This option allows for the creation of Drupal content for maps in chado. Only the selected maps will be synced."),
   '#weight' => 1,
    );


    $form['sync']['featuremaps'] = array(
      '#title'       => t('Available Maps'),
      '#type'        => t('checkboxes'),
      '#description' => t("Check the maps you want to sync.  Drupal content will be created for each of the maps listed above.  Select 'All Maps' to sync all of them."),
      '#required'    => FALSE,
      '#prefix'      => '<div id="lib_boxes">',
      '#suffix'      => '</div>',
      '#options'     => $lib_boxes,
    '#weight' => 2,
    );
    $form['sync']['button'] = array(
       '#type' => 'submit',
       '#value' => t('Sync Maps'),
     '#weight' => 3,
    );
  }
   // we don't have any maps to select from
  else {
    $form['sync']['value'] = array(
       '#value' => t('All maps in Chado are currently synced with Drupal.')
    );
  }
}
get_tripal_featuremap_admin_form_taxonomy_set ( &$  form)

Definition at line 69 of file tripal_featuremap.admin.inc.

                                                               {
  $form['taxonify'] = array(
    '#type' => 'fieldset',
    '#title' => t('Assign Drupal Taxonomy to Map Features')
  );

  // get the list of maps
  $sql = "SELECT * FROM {featuremap} ORDER BY name";
  $lib_rset = chado_query($sql);

  // iterate through all of the maps
  $lib_boxes = array();
  while ($featuremap = db_fetch_object($lib_rset)) {
    $lib_boxes[$featuremap->featuremap_id] = "$featuremap->name";
  }

  $form['taxonify']['description'] = array(
     '#type' => 'item',
     '#value' => t("Drupal allows for assignment of \"taxonomy\" or catagorical terms to " .
                   "nodes. These terms allow for advanced filtering during searching. This option allows ".
                   "for setting taxonomy only for features that belong to the selected maps below.  All other features will be unaffected.  To set taxonomy for all features in the site see the Feature Administration page."),
   '#weight' => 1,
  );

  $form['taxonify']['tx-maps'] = array(
   '#title'       => t('Maps'),
   '#type'        => t('checkboxes'),
   '#description' => t("Check the maps whose features you want to reset taxonomy.  Note: this list contains all maps, even those that may not be synced."),
   '#required'    => FALSE,
   '#prefix'      => '<div id="lib_boxes">',
   '#suffix'      => '</div>',
   '#options'     => $lib_boxes,
   '#weight'      => 2
  );
  $form['taxonify']['tx-button'] = array(
    '#type' => 'submit',
    '#value' => t('Set Feature Taxonomy'),
    '#weight'      => 3
  );
}
theme_tripal_featuremap_search_index ( node)

This function is an extension of the chado_feature_view and chado_organism_view by providing the markup for the map object THAT WILL BE INDEXED.

Definition at line 225 of file tripal_featuremap.module.

                                                     {
}
tripal_featuremap_add_taxonomy ( node,
featuremap_id 
)

Add the map as a taxonomy term for associating with map_features

Definition at line 378 of file tripal_featuremap.admin.inc.

                                                               {

}
tripal_featuremap_admin ( )

Administrative settings form

Definition at line 7 of file tripal_featuremap.admin.inc.

                                   {
  $form = array();

  // before proceeding check to see if we have any
  // currently processing jobs. If so, we don't want
  // to give the opportunity to sync maps
  $active_jobs = FALSE;
  if (tripal_get_module_active_jobs('tripal_featuremap')) {
    $active_jobs = TRUE;
  }

  // add the field set for syncing maps
  if (!$active_jobs) {
    get_tripal_featuremap_admin_form_sync_set($form);
    get_tripal_featuremap_admin_form_cleanup_set($form);
// TODO: complete coding of indexing and taxonomy assignment to features.    
//    get_tripal_featuremap_admin_form_reindex_set($form);
//    get_tripal_featuremap_admin_form_taxonomy_set($form);
  }
  else {
    $form['notice'] = array(
     '#type' => 'fieldset',
     '#title' => t('Feature Map Management Temporarily Unavailable')
    );
    $form['notice']['message'] = array(
        '#value' => t('Currently, feature map management jobs are waiting or are running. Managemment features have been hidden until these jobs complete.  Please check back later once these jobs have finished.  You can view the status of pending jobs in the Tripal jobs page.'),
    );
  }

  return system_settings_form($form);
}
tripal_featuremap_admin_validate ( form,
&$  form_state 
)

Definition at line 222 of file tripal_featuremap.admin.inc.

                                                               {
  global $user;  // we need access to the user info
  $job_args = array();

  // Submit the Sync Job if selected
  if ($form_state['values']['op'] == t('Sync Maps')) {

    // check to see if the user wants to sync chado and drupal.  If
    // so then we need to register a job to do so with tripal
    $featuremaps = $form_state['values']['featuremaps'];
    $do_all = FALSE;
    $to_sync = array();

  foreach ($featuremaps as $featuremap_id) {
    if (preg_match("/^all$/i", $featuremap_id)) {
      $do_all = TRUE;
    }
    if ($featuremap_id and preg_match("/^\d+$/i", $featuremap_id)) {
      // get the map info
      $sql = "SELECT * FROM {featuremap} WHERE featuremap_id = %d";
      $featuremap = db_fetch_object(chado_query($sql, $featuremap_id));
      $to_sync[$featuremap_id] = $featuremap->name;
    }
  }

  // submit the job to the tripal job manager
  if ($do_all) {
    tripal_add_job('Sync all maps', 'tripal_featuremap', 'tripal_featuremap_sync_featuremaps', $job_args, $user->uid);
  }
  else{
    foreach ($to_sync as $featuremap_id => $name) {
      $job_args[0] = $featuremap_id;
      tripal_add_job("Sync map: $name", 'tripal_featuremap', 'tripal_featuremap_sync_featuremaps', $job_args, $user->uid);
      }
    }
  }

  // -------------------------------------
  // Submit the Reindex Job if selected
  if ($form_state['values']['op'] == t('Reindex Features')) {
    $featuremaps = $form_state['values']['re-maps'];
    foreach ($featuremaps as $featuremap_id) {
      if ($featuremap_id and preg_match("/^\d+$/i", $featuremap_id)) {
        // get the map info
        $sql = "SELECT * FROM {featuremap} WHERE featuremap_id = %d";
        $featuremap = db_fetch_object(chado_query($sql, $featuremap_id));
        $job_args[0] = $featuremap_id;
        tripal_add_job("Reindex features for map: $featuremap->name", 'tripal_featuremap',
         'tripal_featuremap_reindex_features', $job_args, $user->uid);
      }
    }
  }

  // -------------------------------------
  // Submit the Taxonomy Job if selected
  if ($form_state['values']['op'] == t('Set Feature Taxonomy')) {
    $featuremaps = $form_state['values']['tx-maps'];
    foreach ($featuremaps as $featuremap_id) {
      if ($featuremap_id and preg_match("/^\d+$/i", $featuremap_id)) {
        // get the map info
        $sql = "SELECT * FROM {featuremap} WHERE featuremap_id = %d";
        $featuremap = db_fetch_object(chado_query($sql, $featuremap_id));
        $job_args[0] = $featuremap_id;
        tripal_add_job("Set taxonomy for features in map: $featuremap->name", 'tripal_featuremap',
         'tripal_featuremap_taxonify_features', $job_args, $user->uid);
      }
    }
  }
    // -------------------------------------
    // Submit the Cleanup Job if selected
    if ($form_state['values']['op'] == t('Clean up orphaned maps')) {
      tripal_add_job('Cleanup orphaned maps', 'tripal_featuremap',
         'tripal_featuremap_cleanup', $job_args, $user->uid);
    }
}
tripal_featuremap_cleanup ( dummy = NULL,
job_id = NULL 
)

Remove orphaned drupal nodes

Parameters:
$dummyNot Used -kept for backwards compatibility
$job_idThe id of the tripal job executing this function

Definition at line 368 of file tripal_featuremap.admin.inc.

                                                                  {

  return tripal_core_clean_orphaned_nodes('featuremap', $job_id);
  
}
tripal_featuremap_cron ( )

Definition at line 232 of file tripal_featuremap.module.

                                  {

}
tripal_featuremap_help ( path,
arg 
)

Display help and module information

Parameters:
pathwhich path of the site we're displaying help
argarray that holds the current path as would be returned from arg() function
Returns:
help text for the path

Definition at line 23 of file tripal_featuremap.module.

                                             {
  $output = '';
  switch ($path) {
    case "admin/help#tripal_featuremap":
      $output = '<p>'.
      t("Displays links to nodes created on this date") .
               '</p>';
      break;
  }
  return $output;
}
tripal_featuremap_map_access ( op,
node,
account 
)

The following function proves access control for users trying to perform actions on data managed by this module

Definition at line 241 of file tripal_featuremap.module.

                                                            {
  if ($op == 'create') {
    if (!user_access('create chado_featuremap content', $account)) {
      return FALSE;
    }
  }

  if ($op == 'update') {
    if (!user_access('edit any chado_featuremap content', $account) &&
        !user_access('edit own chado_featuremap content', $account)) {
        return FALSE;
    }
    if (user_access('edit own chado_featuremap content', $account) &&
      $account->uid != $node->uid) {
      return FALSE;
    }
  }

  if ($op == 'delete') {
    if (!user_access('delete any chado_featuremap content', $account) &&
      !user_access('delete own chado_featuremap content', $account)) {
      return FALSE;
    }
    if (user_access('delete own chado_featuremap content', $account) &&
      $account->uid != $node->uid) {
      return FALSE;
    }
  }
  return NULL;
}
tripal_featuremap_menu ( )

Menu items are automatically added for the new node types created by this module to the 'Create Content' Navigation menu item. This function adds more menu items needed for this module.

Definition at line 107 of file tripal_featuremap.module.

                                  {
  $items = array();
  
  // The administative settings menu
  $items['admin/tripal/tripal_featuremap'] = array(
    'title' => 'Maps',
    'description' => 'Basic Description of Tripal Map Module Functionality',
    'page callback' => 'theme',
    'page arguments' => array('tripal_featuremap_admin'),
    'access arguments' => array('administer tripal featuremap'),
    'type' => MENU_NORMAL_ITEM,
  );

  $items['admin/tripal/tripal_featuremap/configuration'] = array(
    'title' => 'Configuration',
    'description' => 'Manage integration of Chado maps including associated features.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('tripal_featuremap_admin'),
    'access arguments' => array('administer tripal featuremap'),
    'type' => MENU_NORMAL_ITEM,
  );

  // Synchronizing maps from Chado to Drupal
  $items['chado_sync_featuremaps'] = array(
    'title' => 'Sync Data',
    'page callback' => 'tripal_featuremap_sync_featuremaps',
    'access arguments' => array('administer tripal featuremap'),
    'type' => MENU_CALLBACK
  );
  
  return $items;
}
tripal_featuremap_node_info ( )

Provide information to drupal about the node types that we're creating in this module

Definition at line 41 of file tripal_featuremap.module.

                                       {
  $nodes = array();
  $nodes['chado_featuremap'] = array(
      'name' => t('Map'),
      'module' => 'chado_featuremap',
      'description' => t('A feature map from the chado database (e.g. genetic map)'),
      'has_title' => FALSE,
      'title_label' => t('Feature Map'),
      'has_body' => FALSE,
      'body_label' => t('Feature Map Description'),
      'locked' => TRUE
  );
  return $nodes;
}
tripal_featuremap_nodeapi ( &$  node,
op,
teaser,
page 
)

Implementation of hook_nodeapi(). Display map information for associated features or organisms This function also provides contents for indexing

Definition at line 163 of file tripal_featuremap.module.

                                                                {

  switch ($op) {
    // Note that this function only adds map view to an organism/feature
    // node.
    case 'view':
      // add the map to the organism/feature search indexing
      if ($node->build_mode == NODE_BUILD_SEARCH_INDEX) {
        $node->content['tripal_featuremap_index_version'] = array(
          '#value' => theme('tripal_featuremap_search_index', $node),
        );
      }
      elseif ($node->build_mode == NODE_BUILD_SEARCH_RESULT) {
        $node->content['tripal_featuremap_index_version'] = array(
          '#value' => theme('tripal_featuremap_search_result', $node),
        );
      }      
  }
}
tripal_featuremap_perm ( )

Set the permission types that the chado module uses. Essentially we want permissionis that protect creation, editing and deleting of chado data objects

Definition at line 63 of file tripal_featuremap.module.

                                  {
  return array(
    'access chado_featuremap content',
    'create chado_featuremap content',
    'delete chado_featuremap content',
    'edit chado_featuremap content',
    'administer tripal featuremap',
  );
}
tripal_featuremap_sync_featuremaps ( featuremap_id = NULL,
job_id = NULL 
)

Definition at line 303 of file tripal_featuremap.admin.inc.

                                                                                   {

  global $user;
  $page_content = '';

  // get the list of featuremaps and create new nodes
  if (!$featuremap_id) {
    $sql = "SELECT * FROM {featuremap} L";
    $results = chado_query($sql);
  }
  else {
    $sql = "SELECT * FROM {featuremap} L WHERE featuremap_id = %d";
    $results = chado_query($sql, $featuremap_id);
  }

  // We'll use the following SQL statement for checking if the map
  // already exists as a drupal node.
  $sql = "SELECT * FROM {chado_featuremap} ".
        "WHERE featuremap_id = %d";

  while ($featuremap = db_fetch_object($results)) {

    // check if this map already exists in the drupal database. if it
    // does then skip this map and go to the next one.
    if (!db_fetch_object(db_query($sql, $featuremap->featuremap_id))) {

    $new_node = new stdClass();
    $new_node->type = 'chado_featuremap';
    $new_node->uid = $user->uid;
    $new_node->title = "$featuremap->name";
    $new_node->featuremap_id = $featuremap->featuremap_id;

    node_validate($new_node);
    $errors = form_get_errors();
    if (!$errors) {
      $node = node_submit($new_node);
      node_save($node);
      if ($node->nid) {
        print "Added " . $featuremap->name . "\n";
      }
      else {
        print "ERROR: Unable to create " . $featuremap->name . "\n";
      }
    }
    else {
      print "ERROR: Unable to create " . $featuremap->name . "\n" . print_r($errors, TRUE) . "\n";
    }
    }
    else {
      print "Skipped " . $featuremap->name . "\n";
    }
  }
  return $page_content;
}
tripal_featuremap_theme ( )

We need to let drupal know about our theme functions and their arguments. We create theme functions to allow users of the module to customize the look and feel of the output generated in this module

Definition at line 190 of file tripal_featuremap.module.

                                   {
  return array(
    'tripal_featuremap_search_index' => array(
       'arguments' => array('node'),
    ),
    'tripal_featuremap_search_result' => array(
       'arguments' => array('node'),
    ),
    'tripal_featuremap_base' => array(
       'arguments' => array('node' => NULL),
       'template' => 'tripal_featuremap_base',
    ),
    'tripal_featuremap_properties' => array(
      'arguments' => array('node' => NULL),
      'template' => 'tripal_featuremap_properties',
    ),
    'tripal_featuremap_publication' => array(
      'arguments' => array('node' => NULL),
      'template' => 'tripal_featuremap_publication',
    ),
    'tripal_featuremap_admin' => array(
      'template' => 'tripal_featuremap_admin',  
      'arguments' =>  array(NULL),  
      'path' => drupal_get_path('module', 'tripal_featuremap') . '/theme' 
    ),
  );
}
tripal_featuremap_views_api ( )

Implements hook_views_api() Purpose: Essentially this hook tells drupal that there is views support for for this module which then includes tripal_db.views.inc where all the views integration code is

Definition at line 148 of file tripal_featuremap.module.

                                       {
  return array(
    'api' => 2.0,
  );
}
 All Classes Files Functions Variables