123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928 |
- <?php
- function tripal_stock_node_info() {
- return array(
- 'chado_stock' => array(
- 'name' => t('Stock'),
- 'base' => 'chado_stock',
- 'description' => t('A Chado Stock is a collection of material that can be sampled and have experiments performed on it.'),
- 'has_title' => TRUE,
- 'locked' => TRUE,
- 'chado_node_api' => array(
- 'base_table' => 'stock',
- 'hook_prefix' => 'chado_stock',
- 'record_type_title' => array(
- 'singular' => t('Stock'),
- 'plural' => t('Stocks')
- ),
- 'sync_filters' => array(
- 'type_id' => TRUE,
- 'organism_id' => TRUE
- ),
- )
- ),
- );
- }
- function chado_stock_load($nodes) {
- foreach ($nodes as $nid => $node) {
-
- $stock_id = chado_get_id_from_nid('stock', $nid);
-
-
- if (!$stock_id) {
- continue;
- }
-
- $values = array('stock_id' => $stock_id);
- $stock = chado_generate_var('stock', $values);
- $stock = chado_expand_var($stock, 'field', 'stock.uniquename');
- $stock = chado_expand_var($stock, 'field', 'stock.description');
- $nodes[$nid]->stock = $stock;
-
- $node->title = chado_get_node_title($node);
- }
- }
- function chado_stock_form($node, $form_state) {
-
-
-
-
-
-
-
-
-
-
-
- $sname = '';
- $uniquename = '';
- $stock_id = 0;
- $type_id = 0;
- $organism_id = 0;
- $sdescription = '';
- $dbxref_accession = '';
- $dbxref_description = '';
- $dbxref_database = 0;
-
- if (property_exists($node, 'stock')) {
- $sname = $node->stock->name;
- $uniquename = $node->stock->uniquename;
- $stock_id = $node->stock->stock_id;
- $type_id = $node->stock->type_id->cvterm_id;
- $organism_id = $node->stock->organism_id->organism_id;
- $sdescription = $node->stock->description;
- if (isset($node->stock->dbxref_id->db_id)) {
- $dbxref_accession = $node->stock->dbxref_id->accession;
- $dbxref_description = $node->stock->dbxref_id->description;
- $dbxref_database = $node->stock->dbxref_id->db_id->db_id;
- }
- }
-
-
- if (array_key_exists('values', $form_state) AND isset($form_state['values']['uniquename'])) {
- $sname = $form_state['values']['sname'];
- $uniquename = $form_state['values']['uniquename'];
- $stock_id = $form_state['values']['stock_id'];
- $type_id = $form_state['values']['type_id'];
- $organism_id = $form_state['values']['organism_id'];
- $sdescription = $form_state['values']['stock_description'];
- $dbxref_accession = $form_state['values']['accession'];
- $dbxref_description = $form_state['values']['db_description'];
- $dbxref_database = $form_state['values']['database'];
- }
-
-
- if (array_key_exists('input', $form_state) and !empty($form_state['input'])) {
- $sname = $form_state['input']['sname'];
- $uniquename = $form_state['input']['uniquename'];
- $stock_id = $form_state['input']['stock_id'];
- $type_id = $form_state['input']['type_id'];
- $organism_id = $form_state['input']['organism_id'];
- $sdescription = $form_state['input']['stock_description'];
- $dbxref_accession = $form_state['input']['accession'];
- $dbxref_description = $form_state['input']['db_description'];
- $dbxref_database = $form_state['input']['database'];
- }
- $form['sname'] = array(
- '#type' => 'textfield',
- '#title' => t('Stock Name'),
- '#description' => t('Enter a human-readable name for this stock.'),
- '#default_value' => $sname,
- '#required' => TRUE
- );
- $form['uniquename'] = array(
- '#type' => 'textfield',
- '#title' => t('Unique Name'),
- '#default_value' => $uniquename,
- '#description' => t('Enter a unique name for this stock. This name must be unique for the organism and stock type.'),
- '#required' => TRUE
- );
- if ($stock_id > 0) {
- $form['stock_id'] = array(
- '#type' => 'hidden',
- '#value' => $stock_id,
- );
- }
-
-
- $st_cv = tripal_get_default_cv("stock", "type_id");
- $type_options = tripal_get_cvterm_default_select_options('stock', 'type_id', 'stock types');
- $type_options[0] = 'Select a Type';
- $st_message = tripal_set_message("To add additional items to the stock type drop down list,
- add a term to the " .
- l($st_cv->name . " controlled vocabulary",
- "admin/tripal/vocab/cv/" . $st_cv->cv_id . "/cvterm/add",
- array('attributes' => array('target' => '_blank'))
- ),
- TRIPAL_INFO, array('return_html' => TRUE)
- );
- $form['type_id'] = array(
- '#type' => 'select',
- '#title' => t('Type of Stock'),
- '#description' => t('Select the stock type.'),
- '#options' => $type_options,
- '#default_value' => $type_id,
- '#required' => TRUE,
- '#suffix' => $st_message,
- );
-
- $sql = "SELECT * FROM {organism} ORDER BY genus, species";
- $org_rset = chado_query($sql);
- $organisms = array();
- $organisms[''] = '';
- while ($organism = $org_rset->fetchObject()) {
- $organisms[$organism->organism_id] = "$organism->genus $organism->species ($organism->common_name)";
- }
- $form['organism_id'] = array(
- '#type' => 'select',
- '#title' => t('Organism'),
- '#default_value' => $organism_id,
- '#description' => t('Choose the organism with which this stock is associated.'),
- '#options' => $organisms,
- '#required' => TRUE
- );
- $form['stock_description'] = array(
- '#type' => 'text_format',
- '#title' => t('Notes'),
- '#default_value' => $sdescription,
- '#description' => t('Briefly enter any notes on the above stock. This should not include phenotypes or genotypes.'),
- );
- $form['database_reference'] = array(
- '#type' => 'fieldset',
- '#title' => t('Stock Database Reference'),
- '#description' => t('If this site is not the primary location for information
- about this stock, please provide the name of the database, the accession
- and an optional description using the fields below. If the database
- is not present in the list, then please ') .
- l(t('add the database '), 'admin/tripal/chado/tripal_db/add', array('attributes' => array('target' => '_blank'))) .
- t('then refresh this page.'),
- );
- $db_options = tripal_get_db_select_options();
- $form['database_reference']['database'] = array(
- '#type' => 'select',
- '#title' => t('Database'),
- '#options' => $db_options,
- '#default_value' => $dbxref_database,
- '#description' => t('Select the remote database.')
- );
- $form['database_reference']['accession'] = array(
- '#type' => 'textfield',
- '#title' => t('Accession'),
- '#default_value' => $dbxref_accession,
- '#description' => t('Please enter the accession in the remote database for this stock.')
- );
- $form['database_reference']['db_description'] = array(
- '#type' => 'textarea',
- '#title' => t('Description of Database Reference'),
- '#default_value' => $dbxref_description,
- '#description' => t('Optionally enter a description about the database accession.')
- );
-
-
- $prop_cv = tripal_get_default_cv('stockprop', 'type_id');
- $cv_id = $prop_cv ? $prop_cv->cv_id : NULL;
- $details = array(
- 'property_table' => 'stockprop',
- 'chado_id' => $stock_id,
- 'cv_id' => $cv_id
- );
- chado_add_node_form_properties($form, $form_state, $details);
-
-
- $details = array(
- 'linking_table' => 'stock_dbxref',
- 'base_foreign_key' => 'stock_id',
- 'base_key_value' => $stock_id
- );
- chado_add_node_form_dbxrefs($form, $form_state, $details);
-
-
- $relationship_cv = tripal_get_default_cv('stock_relationship', 'type_id');
- $cv_id = $relationship_cv ? $relationship_cv->cv_id : NULL;
- $details = array(
- 'relationship_table' => 'stock_relationship',
- 'base_table' => 'stock',
- 'base_foreign_key' => 'stock_id',
- 'base_key_value' => $stock_id,
- 'nodetype' => 'stock',
- 'cv_id' => $cv_id
- );
- chado_add_node_form_relationships($form, $form_state, $details);
- return $form;
- }
- function chado_stock_validate(&$node, $form, &$form_state) {
-
-
-
-
- if(property_exists($node, "op") and $node->op != 'Save') {
- return;
- }
-
-
- if (!property_exists($node, 'nid') and property_exists($node, 'stock_id') and $node->stock_id != 0) {
- return;
- }
-
- $node->uniquename = property_exists($node, 'uniquename') ? trim($node->uniquename) : '';
- $node->sname = property_exists($node, 'sname') ? trim($node->sname) : '';
- $node->accession = property_exists($node, 'accession') ? trim($node->accession) : '';
- $node->db_description = property_exists($node, 'db_description') ? trim($node->db_description) : '';
- $int_in_chado_sql = "SELECT count(*) as count FROM {:table} WHERE :column = :value";
- $string_in_chado_sql = "SELECT count(*) as count FROM {:table} WHERE :column = :value";
-
-
-
- if (property_exists($node, 'nid') and property_exists($node, 'stock_id')) {
- $sql = "
- SELECT *
- FROM {stock} S
- INNER JOIN {cvterm} CVT ON S.type_id = CVT.cvterm_id
- WHERE
- uniquename = :uname AND organism_id = :organism_id AND
- CVT.name = :cvtname AND NOT stock_id = :stock_id
- ";
- $result = chado_query($sql, array(':uname' => $node->uniquename,
- ':organism_id' => $node->organism_id, ':cvtname' => $node->type_id,
- ':stock_id' => $node->stock_id))->fetchObject();
- if ($result) {
- form_set_error('uniquename', t("Stock update cannot proceed. The stock name '$node->uniquename' is not unique for this organism. Please provide a unique name for this stock."));
- }
- }
-
-
- elseif (!empty($node->organism_id) AND !empty($node->type_id)) {
- $sql = "
- SELECT *
- FROM {stock} S
- INNER JOIN {cvterm} CVT ON S.type_id = CVT.cvterm_id
- WHERE uniquename = :uname AND organism_id = :organism_id AND CVT.name = :cvtname";
- $result = chado_query($sql, array(':uname' => $node->uniquename,
- ':organism_id' => $node->organism_id, ':cvtname' => $node->type_id))->fetchObject();
- if ($result) {
- form_set_error('uniquename', t("Stock insert cannot proceed. The stock name '$node->uniquename' already exists for this organism. Please provide a unique name for this stock."));
- }
- }
-
- if ($node->type_id == 0) {
- form_set_error('type_id', 'Please select a type of stock.');
- }
- else {
- $replace = array(':table' => 'cvterm', ':column' => 'cvterm_id');
- $new_sql = str_replace(array_keys($replace),$replace,$int_in_chado_sql);
- $num_rows = chado_query($new_sql, array(':value' => $node->type_id))->fetchObject();
- if ( $num_rows->count != 1) {
- form_set_error('type_id', "The type you selected is not valid. Please choose another one. (CODE:$num_rows)"); }
- }
-
- if ( $node->organism_id == 0) {
- form_set_error('organism_id', 'Please select a source organism for this stock');
- }
- else {
- $replace = array(':table' => 'organism', ':column' => 'organism_id');
- $new_sql = str_replace(array_keys($replace),$replace,$int_in_chado_sql);
- $num_rows = chado_query($new_sql, array(':value' => $node->organism_id))->fetchObject();
- if ( $num_rows->count != 1 ) {
- form_set_error('organism_id', "The organism you selected is not valid. Please choose another one. (CODE:$num_rows)"); }
- }
-
- if ($node->accession != '') {
- if ($node->database == 0) {
-
- form_set_error('database', 'You need to enter both a database and an accession for that database in order to add a database reference.');
- }
- }
- else {
- if ($node->database > 0) {
-
- form_set_error('accession', 'You need to enter both a database and an accession for that database in order to add a database reference.');
- }
- }
-
- if ( $node->database > 0) {
- $replace = array(':table' => 'db', ':column' => 'db_id');
- $new_sql = str_replace(array_keys($replace),$replace,$int_in_chado_sql);
- $num_rows = chado_query($new_sql, array(':value' => $node->database))->fetchObject();
- if ($num_rows->count != 1) {
- form_set_error('database', 'The database you selected is not valid. Please choose another one.'); }
- }
- }
- function chado_stock_insert($node) {
- $stock_id = '';
-
-
-
- if (!property_exists($node, 'stock_id')) {
- $node->uniquename = trim($node->uniquename);
- $node->sname = trim($node->sname);
- $node->accession = trim($node->accession);
- $node->stock_description = trim($node->stock_description['value']);
-
-
- $dbxref = NULL;
- if (!empty($node->accession) and !empty($node->database)) {
- $values = array(
- 'db_id' => $node->database,
- 'accession' => $node->accession,
- );
- if (!chado_select_record('dbxref', array('dbxref_id'), $values)) {
- $values['description'] = $node->db_description;
- $values['version'] = '1';
- $dbxref = chado_insert_record('dbxref', $values);
- if (!$dbxref) {
- drupal_set_message(t('Unable to add database reference to this stock.'), 'warning');
- tripal_report_error('tripal_stock', TRIPAL_WARNING,
- 'Insert Stock: Unable to create dbxref where values:%values',
- array('%values' => print_r($values, TRUE)));
- }
- }
- }
-
- $stock = '';
- $values = array(
- 'organism_id' => $node->organism_id,
- 'name' => $node->sname,
- 'uniquename' => $node->uniquename,
- 'description' => $node->stock_description,
- 'type_id' => $node->type_id
- );
- if ($dbxref) {
- $values['dbxref_id'] = array(
- 'db_id' => $node->database,
- 'accession' => $node->accession
- );
- }
- $stock = chado_insert_record('stock', $values);
- if (!$stock) {
- drupal_set_message(t('Unable to add stock.'), 'warning');
- tripal_report_error('tripal_stock', TRIPAL_WARNING, 'Insert stock: Unable to create stock where values: %values',
- array('%values' => print_r($values, TRUE)));
- return;
- }
- $stock_id = $stock['stock_id'];
-
- $details = array(
- 'property_table' => 'stockprop',
- 'base_table' => 'stock',
- 'foreignkey_name' => 'stock_id',
- 'foreignkey_value' => $stock_id
- );
- chado_update_node_form_properties($node, $details);
-
- $details = array(
- 'linking_table' => 'stock_dbxref',
- 'foreignkey_name' => 'stock_id',
- 'foreignkey_value' => $stock_id
- );
- chado_update_node_form_dbxrefs($node, $details);
-
- $details = array(
- 'relationship_table' => 'stock_relationship',
- 'foreignkey_value' => $stock_id
- );
- chado_update_node_form_relationships($node, $details);
- }
- else {
- $stock_id = $node->stock_id;
- }
-
-
- $check_org_id = chado_get_id_from_nid('stock', $node->nid);
- if (!$check_org_id) {
- $record = new stdClass();
- $record->nid = $node->nid;
- $record->vid = $node->vid;
- $record->stock_id = $stock_id;
- drupal_write_record('chado_stock', $record);
- }
- }
- function chado_stock_update($node) {
- $node->uniquename = trim($node->uniquename);
- $node->sname = trim($node->sname);
- $node->stock_description = trim($node->stock_description['value']);
- if ($node->revision) {
-
-
- }
-
- $dbxref_status = NULL;
- $dbxref_present = FALSE;
- if ($node->database) {
- $dbxref_present = TRUE;
- if ($node->accession) {
- $dbxref_mode = '';
- $stock = chado_select_record(
- 'stock',
- array('dbxref_id', 'type_id'),
- array('stock_id' => $node->stock_id)
- );
- if ($stock[0]->dbxref_id) {
- $values = array(
- 'db_id' => $node->database,
- 'accession' => $node->accession,
- 'description' => $node->db_description
- );
- $dbxref_status = chado_update_record(
- 'dbxref',
- array('dbxref_id' => $stock[0]->dbxref_id),
- $values
- );
- $dbxref_mode = 'Update';
- }
- else {
- if ($stock[0]->type_id) {
-
-
- $values = array(
- 'db_id' => $node->database,
- 'accession' => $node->accession,
- 'description' => $node->db_description,
- 'version' => '1',
- );
- $dbxref_status = chado_insert_record(
- 'dbxref',
- $values
- );
- $dbxref_mode = 'Create';
- }
- else {
- drupal_set_message(t('Unable to find stock to Update'), 'error');
- tripal_report_error('tripal_stock', TRIPAL_ERROR,
- 'Stock Update: Unable to find stock to update using values: %values',
- array('%values', print_r($values, TRUE))
- );
- return FALSE;
- }
- }
- }
- if (!$dbxref_status) {
- tripal_report_error('tripal_stock', TRIPAL_WARNING,
- 'Stock Update: Unable to %mode main stock dbxref with values: %values',
- array('%values' => print_r($values, TRUE), '%mode' => $dbxref_mode));
- }
- }
-
- $update_values = array(
- 'organism_id' => $node->organism_id,
- 'name' => $node->sname,
- 'uniquename' => $node->uniquename,
- 'description' => $node->stock_description,
- 'type_id' => $node->type_id,
- );
- if ($dbxref_present) {
- if ($dbxref_status) {
- $update_values['dbxref_id'] = array(
- 'db_id' => $node->database,
- 'accession' => $node->accession
- );
- }
- }
- $status = chado_update_record('stock', array('stock_id' => $node->stock_id), $update_values);
- if (!$status) {
- drupal_set_message(t('Unable to update stock'), 'error');
- tripal_report_error('tripal_stock', TRIPAL_ERROR,
- 'Stock Update: Unable to update stock using match values: %mvalues and update values: %uvalues',
- array('%mvalues' => print_r(array('stock_id' => $node->stock_id), TRUE), '%uvalues' => print_r($update_values, TRUE))
- );
- }
- else {
-
- $values = array('stock_id' => $node->stock_id);
- $stock = chado_select_record('stock', array('*'), $values);
- }
-
- if ($node->stock_id > 0) {
- $details = array(
- 'property_table' => 'stockprop',
- 'base_table' => 'stock',
- 'foreignkey_name' => 'stock_id',
- 'foreignkey_value' => $node->stock_id
- );
- chado_update_node_form_properties($node, $details);
- }
-
- if ($node->stock_id > 0) {
- $details = array(
- 'linking_table' => 'stock_dbxref',
- 'foreignkey_name' => 'stock_id',
- 'foreignkey_value' => $node->stock_id
- );
- chado_update_node_form_dbxrefs($node, $details);
- }
-
- if ($node->stock_id > 0) {
- $details = array(
- 'relationship_table' => 'stock_relationship',
- 'foreignkey_value' => $node->stock_id
- );
- chado_update_node_form_relationships($node, $details);
- }
- }
- function chado_stock_delete($node) {
-
- chado_query("DELETE FROM {stock} WHERE stock_id = :stock_id", array(':stock_id' => $node->stock->stock_id));
-
- db_query("DELETE FROM {chado_stock} WHERE nid = :nid", array(':nid' => $node->nid));
- }
- function chado_stock_chado_node_sync_create_new_node($new_node, $record) {
- $new_node->organism_id = $record->organism_id;
- $new_node->sname = $record->name;
- $new_node->uniquename = $record->uniquename;
- $new_node->type_id = $record->type_id;
- return $new_node;
- }
- function tripal_stock_node_presave($node) {
- switch ($node->type) {
-
-
-
-
-
-
- case 'chado_stock':
-
-
- $organism_id = null;
- $sname = '';
- $uniquename = '';
- $type = '';
- if(property_exists($node, 'organism_id')) {
- $organism_id = $node->organism_id;
- $sname = $node->sname;
- $uniquename = $node->uniquename;
- $type_id = $node->type_id;
- $values = array('cvterm_id' => $node->type_id);
- $cvterm = chado_select_record('cvterm', array('name'), $values);
- $type = $cvterm[0]->name;
- }
- else if (property_exists($node, 'stock')) {
- $organism_id = $node->stock->organism_id;
- $sname = $node->stock->name;
- $uniquename = $node->stock->uniquename;
- $type = $node->stock->type_id->name;
- }
- $values = array('organism_id' => $organism_id);
- $organism = chado_select_record('organism', array('genus','species'), $values);
- $node->title = "$sname, $uniquename ($type) " . $organism[0]->genus . ' ' . $organism[0]->species;
- break;
- }
- }
- function tripal_stock_node_view($node, $view_mode, $langcode) {
- switch ($node->type) {
- case 'chado_stock':
- if ($view_mode == 'full') {
- $node->content['tripal_stock_base'] = array(
- '#theme' => 'tripal_stock_base',
- '#node' => $node,
- '#tripal_toc_id' => 'base',
- '#tripal_toc_title' => 'Overview',
- '#weight' => -100,
- );
- $node->content['tripal_stock_collections'] = array(
- '#theme' => 'tripal_stock_collections',
- '#node' => $node,
- '#tripal_toc_id' => 'collections',
- '#tripal_toc_title' => 'Stock Collections',
- );
- $node->content['tripal_stock_properties'] = array(
- '#theme' => 'tripal_stock_properties',
- '#node' => $node,
- '#tripal_toc_id' => 'properties',
- '#tripal_toc_title' => 'Properties',
- );
- $node->content['tripal_stock_references'] = array(
- '#theme' => 'tripal_stock_references',
- '#node' => $node,
- '#tripal_toc_id' => 'references',
- '#tripal_toc_title' => 'Cross References',
- );
- $node->content['tripal_stock_relationships'] = array(
- '#theme' => 'tripal_stock_relationships',
- '#node' => $node,
- '#tripal_toc_id' => 'relationships',
- '#tripal_toc_title' => 'Relationships',
- );
- $node->content['tripal_stock_synonyms'] = array(
- '#theme' => 'tripal_stock_synonyms',
- '#node' => $node,
- '#tripal_toc_id' => 'synonyms',
- '#tripal_toc_title' => 'Synonyms',
- );
- $node->content['tripal_stock_publications'] = array(
- '#theme' => 'tripal_stock_publications',
- '#node' => $node,
- '#tripal_toc_id' => 'publications',
- '#tripal_toc_title' => 'Publications',
- );
- }
- if ($view_mode == 'teaser') {
- $node->content['tripal_stock_teaser'] = array(
- '#theme' => 'tripal_stock_teaser',
- '#node' => $node,
- );
- }
- break;
- case 'chado_organism':
- if ($view_mode == 'full') {
- $node->content['tripal_organism_stocks'] = array(
- '#theme' => 'tripal_organism_stocks',
- '#node' => $node,
- '#tripal_toc_id' => 'stocks',
- '#tripal_toc_title' => 'Stocks',
- );
- }
- break;
- }
- }
- function tripal_stock_node_insert($node) {
-
-
- switch ($node->type) {
- case 'chado_stock':
-
-
-
- $stock_id = chado_get_id_from_nid('stock', $node->nid);
- $stock = chado_generate_var('stock', array('stock_id' => $stock_id));
- $stock = chado_expand_var($stock, 'field', 'stock.uniquename');
- $stock = chado_expand_var($stock, 'field', 'stock.description');
- $node->stock = $stock;
-
- $node->title = chado_get_node_title($node);
-
- chado_set_node_url($node);
- break;
- }
- }
- function tripal_stock_node_update($node) {
-
- switch ($node->type) {
- case 'chado_stock':
-
- $node->title = chado_get_node_title($node);
-
- chado_set_node_url($node);
- break;
- }
- }
- function chado_stock_chado_node_default_title_format() {
- return '[stock.name], [stock.uniquename] ([stock.type_id>cvterm.name]) [stock.organism_id>organism.genus] [stock.organism_id>organism.species]';
- }
- function chado_stock_chado_node_default_url_format() {
- return '/stock/[stock.organism_id>organism.genus]/[stock.organism_id>organism.species]/[stock.type_id>cvterm.name]/[stock.uniquename]';
- }
|