|
@@ -41,31 +41,42 @@ function tripal_stock_menu() {
|
|
|
$items = array();
|
|
|
|
|
|
//Administrative settings menu-----------------
|
|
|
- $items['admin/tripal/tripal_stock'] = array(
|
|
|
+ $items['admin/tripal/chado/tripal_stock'] = array(
|
|
|
'title' => 'Stocks',
|
|
|
- 'description' => 'Basic Description of Tripal Stock Module Functionality',
|
|
|
- 'page callback' => 'theme',
|
|
|
- 'page arguments' => array('tripal_stock_help'),
|
|
|
+ 'description' => 'A stock is the physical entities of an organism, either living or preserved.',
|
|
|
+ 'page callback' => 'tripal_stock_admin_stock_view',
|
|
|
'access arguments' => array('administer tripal stocks'),
|
|
|
'type' => MENU_NORMAL_ITEM
|
|
|
);
|
|
|
|
|
|
- $items['admin/tripal/tripal_stock/configuration'] = array(
|
|
|
- 'title' => 'Configuration',
|
|
|
+ $items['admin/tripal/chado/tripal_stock/configuration'] = array(
|
|
|
+ 'title' => 'Settings',
|
|
|
'description' => 'Settings for Chado Stocks',
|
|
|
'page callback' => 'drupal_get_form',
|
|
|
'page arguments' => array('tripal_stock_help'),
|
|
|
'access arguments' => array('administer tripal stocks'),
|
|
|
- 'type' => MENU_NORMAL_ITEM
|
|
|
+ 'type' => MENU_LOCAL_TASK,
|
|
|
+ 'weight' => 5
|
|
|
);
|
|
|
-
|
|
|
- $items['admin/tripal/tripal_stock/sync'] = array(
|
|
|
- 'title' => ' Sync Stocks',
|
|
|
+
|
|
|
+ $items['admin/tripal/chado/tripal_stock/sync'] = array(
|
|
|
+ 'title' => ' Sync',
|
|
|
'description' => 'Sync stocks from Chado with Drupal',
|
|
|
'page callback' => 'drupal_get_form',
|
|
|
'page arguments' => array('tripal_stock_sync_form'),
|
|
|
'access arguments' => array('administer tripal stocks'),
|
|
|
- 'type' => MENU_NORMAL_ITEM,
|
|
|
+ 'type' => MENU_LOCAL_TASK,
|
|
|
+ 'weight' => 0
|
|
|
+ );
|
|
|
+
|
|
|
+ $items['admin/tripal/chado/tripal_stock/help'] = array(
|
|
|
+ 'title' => 'Help',
|
|
|
+ 'description' => 'Basic Description of Tripal Stock Module Functionality',
|
|
|
+ 'page callback' => 'theme',
|
|
|
+ 'page arguments' => array('tripal_stock_help'),
|
|
|
+ 'access arguments' => array('administer tripal stocks'),
|
|
|
+ 'type' => MENU_LOCAL_TASK,
|
|
|
+ 'weight' => 10
|
|
|
);
|
|
|
|
|
|
// Adding Secondary Properties-----------------
|
|
@@ -126,7 +137,7 @@ function tripal_stock_menu() {
|
|
|
'type' => MENU_LOCAL_TASK,
|
|
|
'weight' => 10,
|
|
|
);
|
|
|
-
|
|
|
+
|
|
|
// the menu link for addressing any stock (by name, uniquename, synonym)
|
|
|
$items['stock/%'] = array(
|
|
|
'page callback' => 'tripal_stock_match_stocks_page',
|
|
@@ -203,7 +214,7 @@ function tripal_stock_permissions() {
|
|
|
* Implement hook_access().
|
|
|
*
|
|
|
* This hook allows node modules to limit access to the node types they define.
|
|
|
- *
|
|
|
+ *
|
|
|
* @param $node
|
|
|
* The node on which the operation is to be performed, or, if it does not yet exist, the
|
|
|
* type of node to be created
|
|
@@ -217,7 +228,7 @@ function tripal_stock_permissions() {
|
|
|
* @return
|
|
|
* If the permission for the specified operation is not set then return FALSE. If the
|
|
|
* permission is set then return NULL as this allows other modules to disable
|
|
|
- * access. The only exception is when the $op == 'create'. We will always
|
|
|
+ * access. The only exception is when the $op == 'create'. We will always
|
|
|
* return TRUE if the permission is set.
|
|
|
*
|
|
|
* @ingroup tripal_stock
|
|
@@ -335,18 +346,18 @@ function tripal_stock_theme() {
|
|
|
'arguments' => array('node' => NULL),
|
|
|
'template' => 'tripal_stock_locations',
|
|
|
'path' => "$theme_path/tripal_stock",
|
|
|
- ),
|
|
|
+ ),
|
|
|
// tripal_organism templates
|
|
|
'tripal_organism_stocks' => array(
|
|
|
'arguments' => array('node' => NULL),
|
|
|
'template' => 'tripal_organism_stocks',
|
|
|
'path' => "$theme_path/tripal_organism",
|
|
|
- ),
|
|
|
+ ),
|
|
|
// help template
|
|
|
'tripal_stock_help' => array(
|
|
|
- 'template' => 'tripal_stock_help',
|
|
|
- 'arguments' => array(NULL),
|
|
|
- 'path' => $theme_path,
|
|
|
+ 'template' => 'tripal_stock_help',
|
|
|
+ 'arguments' => array(NULL),
|
|
|
+ 'path' => $theme_path,
|
|
|
),
|
|
|
);
|
|
|
return $items;
|
|
@@ -395,12 +406,12 @@ function chado_stock_load($node) {
|
|
|
|
|
|
// get the stock details from chado
|
|
|
$stock_id = chado_get_id_for_node('stock', $node->nid);
|
|
|
-
|
|
|
+
|
|
|
// build the variable with all the stock details
|
|
|
$values = array('stock_id' => $stock_id);
|
|
|
$stock = tripal_core_generate_chado_var('stock', $values);
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
// by default, the titles are saved using the unique constraint. We will
|
|
|
// keep it the same, but remove the duplicate name if the unique name and name
|
|
|
// are identical
|
|
@@ -409,10 +420,10 @@ function chado_stock_load($node) {
|
|
|
if (strcmp($stock->name, $stock->uniquename)==0) {
|
|
|
$node->title = $stock->name . " (" . $stock->type_id->name . ") " . $stock->organism_id->genus . " " . $stock->organism_id->species ;
|
|
|
}
|
|
|
- // in previous version of Tripal, the stock title was simply the unique name.
|
|
|
+ // in previous version of Tripal, the stock title was simply the unique name.
|
|
|
// so, we recreate the title just to be sure all of our stock pages are consistent
|
|
|
else {
|
|
|
- $node->title = $stock->name . ", " . $stock->uniquename . " (" . $stock->type_id->name . ") " . $stock->organism_id->genus . " " . $stock->organism_id->species ;
|
|
|
+ $node->title = $stock->name . ", " . $stock->uniquename . " (" . $stock->type_id->name . ") " . $stock->organism_id->genus . " " . $stock->organism_id->species ;
|
|
|
}
|
|
|
}
|
|
|
// set the title to be the stock name or uniquename as configured
|
|
@@ -420,9 +431,9 @@ function chado_stock_load($node) {
|
|
|
$node->title = $stock->name;
|
|
|
}
|
|
|
if($title_type == 'stock_unique_name') {
|
|
|
- $node->title = $stock->uniquename;
|
|
|
+ $node->title = $stock->uniquename;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// add this to the node
|
|
|
$additions = new stdClass();
|
|
|
$additions->stock = $stock;
|
|
@@ -518,10 +529,10 @@ function chado_stock_form($node, $form_state) {
|
|
|
$type_options = tripal_cv_get_cvterm_options( variable_get('chado_stock_types_cv', 'NULL') );
|
|
|
$type_options[0] = 'Select a Type';
|
|
|
if ($node->nid == '') {
|
|
|
- $type_default = 0;
|
|
|
+ $type_default = 0;
|
|
|
}
|
|
|
- else {
|
|
|
- $type_default = $node->stock->type_id->cvterm_id;
|
|
|
+ else {
|
|
|
+ $type_default = $node->stock->type_id->cvterm_id;
|
|
|
}
|
|
|
$form['details']['type_id'] = array(
|
|
|
'#type' => 'select',
|
|
@@ -531,7 +542,7 @@ function chado_stock_form($node, $form_state) {
|
|
|
'#required' => TRUE,
|
|
|
);
|
|
|
|
|
|
-
|
|
|
+
|
|
|
// get the list of organisms
|
|
|
$sql = "SELECT * FROM {Organism} ORDER BY genus, species";
|
|
|
$org_rset = chado_query($sql);
|
|
@@ -612,12 +623,12 @@ function chado_stock_validate($node, &$form) {
|
|
|
SELECT *
|
|
|
FROM {stock} S
|
|
|
INNER JOIN {cvterm} CVT ON S.type_id = CVT.cvterm_id
|
|
|
- WHERE
|
|
|
- uniquename = :uname AND organism_id = :organism_id AND
|
|
|
+ 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->stock_type,
|
|
|
+ $result = chado_query($sql, array(':uname' => $node->uniquename,
|
|
|
+ ':organism_id' => $node->organism_id, ':cvtname' => $node->stock_type,
|
|
|
':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."));
|
|
@@ -632,13 +643,13 @@ function chado_stock_validate($node, &$form) {
|
|
|
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,
|
|
|
+ $result = chado_query($sql, array(':uname' => $node->uniquename,
|
|
|
':organism_id' => $node->organism_id, ':cvtname' => $node->stock_type))->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."));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
// Check Type of Stock is valid cvterm_id in chado ( $form['values']['details']['type_id'] )
|
|
|
if ( $node->type_id == 0) {
|
|
@@ -695,7 +706,7 @@ function chado_stock_validate($node, &$form) {
|
|
|
* @ingroup tripal_stock
|
|
|
*/
|
|
|
function chado_stock_insert($node) {
|
|
|
-
|
|
|
+
|
|
|
// If the chado stock exists (e.g. this is only a syncing operation)
|
|
|
// then don't create but simply link to node
|
|
|
if ($node->chado_stock_exists) {
|
|
@@ -703,7 +714,7 @@ function chado_stock_insert($node) {
|
|
|
$sql = "INSERT INTO {chado_stock} (nid, vid, stock_id) VALUES (:nid, :vid, :stock_id)";
|
|
|
db_query($sql, array(':nid' => $node->nid, ':vid' => $node->vid, ':stock_id' => $node->stock_id));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return $node;
|
|
|
}
|
|
|
|
|
@@ -729,7 +740,7 @@ function chado_stock_insert($node) {
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
- else {
|
|
|
+ else {
|
|
|
$dbxref_status = 1;
|
|
|
}
|
|
|
}
|
|
@@ -762,11 +773,11 @@ function chado_stock_insert($node) {
|
|
|
);
|
|
|
$stock = tripal_core_chado_insert('stock', $values);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// if the stock creation was succesful then add the URL and the entry in the
|
|
|
// chado_stock table
|
|
|
if (is_array($stock)) {
|
|
|
-
|
|
|
+
|
|
|
// convert the stock into an object
|
|
|
$stock = (object) $stock;
|
|
|
|
|
@@ -778,7 +789,7 @@ function chado_stock_insert($node) {
|
|
|
if ($node->simulate_multipart) {
|
|
|
$next_stage_path = preg_replace('/%node/', $node->nid, $node->next_step_path);
|
|
|
$_REQUEST['destination'] = $next_stage_path;
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
drupal_set_message(t('Error during stock creation.'), 'error');
|
|
@@ -888,7 +899,7 @@ function chado_stock_update($node) {
|
|
|
);
|
|
|
}
|
|
|
$status = tripal_core_chado_update('stock', array('stock_id' => $node->stock_id), $update_values);
|
|
|
-
|
|
|
+
|
|
|
|
|
|
if (!$status) {
|
|
|
drupal_set_message(t('Unable to update stock'), 'error');
|
|
@@ -902,7 +913,7 @@ function chado_stock_update($node) {
|
|
|
else {
|
|
|
// set the URL for this stock page
|
|
|
$values = array('stock_id' => $node->stock_id);
|
|
|
- $stock = tripal_core_chado_select('stock', array('*'), $values);
|
|
|
+ $stock = tripal_core_chado_select('stock', array('*'), $values);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -946,26 +957,26 @@ function tripal_stock_block_info() {
|
|
|
|
|
|
$blocks['synonyms']['info'] = t('Tripal Stock Synonyms');
|
|
|
$blocks['synonyms']['cache'] = BLOCK_NO_CACHE;
|
|
|
-
|
|
|
+
|
|
|
$blocks['collections']['info'] = t('Tripal Stock Collections');
|
|
|
$blocks['collections']['cache'] = BLOCK_NO_CACHE;
|
|
|
-
|
|
|
+
|
|
|
$blocks['phenotypes']['info'] = t('Tripal Stock Phenotypes');
|
|
|
$blocks['phenotypes']['cache'] = BLOCK_NO_CACHE;
|
|
|
-
|
|
|
+
|
|
|
$blocks['genotypes']['info'] = t('Tripal Stock Genotypes');
|
|
|
$blocks['genotypes']['cache'] = BLOCK_NO_CACHE;
|
|
|
-
|
|
|
+
|
|
|
$blocks['locations']['info'] = t('Tripal Stock Locations');
|
|
|
$blocks['locations']['cache'] = BLOCK_NO_CACHE;
|
|
|
-
|
|
|
+
|
|
|
$blocks['orgstocks']['info'] = t('Tripal Organism Stocks');
|
|
|
$blocks['orgstocks']['cache'] = BLOCK_NO_CACHE;
|
|
|
|
|
|
return $blocks;
|
|
|
}
|
|
|
/**
|
|
|
- *
|
|
|
+ *
|
|
|
* @ingroup tripal_stock
|
|
|
*/
|
|
|
function tripal_stock_block_view($delta = '') {
|
|
@@ -973,59 +984,59 @@ function tripal_stock_block_view($delta = '') {
|
|
|
if (user_access('access chado_stock content') and arg(0) == 'node' and is_numeric(arg(1))) {
|
|
|
$nid = arg(1);
|
|
|
$node = node_load($nid);
|
|
|
-
|
|
|
+
|
|
|
$block = array();
|
|
|
switch ($delta) {
|
|
|
case 'base':
|
|
|
$block['subject'] = t('Stock Details');
|
|
|
$block['content'] = theme('tripal_stock_base', $node);
|
|
|
break;
|
|
|
-
|
|
|
+
|
|
|
case 'properties':
|
|
|
$block['subject'] = t('Properties');
|
|
|
$block['content'] = theme('tripal_stock_properties', $node);
|
|
|
break;
|
|
|
-
|
|
|
+
|
|
|
case 'references':
|
|
|
$block['subject'] = t('References');
|
|
|
$block['content'] = theme('tripal_stock_references', $node);
|
|
|
break;
|
|
|
-
|
|
|
+
|
|
|
case 'relationships':
|
|
|
$block['subject'] = t('Relationships');
|
|
|
$block['content'] = theme('tripal_stock_relationships', $node);
|
|
|
break;
|
|
|
-
|
|
|
+
|
|
|
case 'synonyms':
|
|
|
$block['subject'] = t('Synonyms');
|
|
|
$block['content'] = theme('tripal_stock_synonyms', $node);
|
|
|
break;
|
|
|
-
|
|
|
+
|
|
|
case 'collections':
|
|
|
$block['subject'] = t('Stock Collections');
|
|
|
$block['content'] = theme('tripal_stock_collections', $node);
|
|
|
break;
|
|
|
-
|
|
|
+
|
|
|
case 'phenotypes':
|
|
|
$block['subject'] = t('Stock Phenotypes');
|
|
|
$block['content'] = theme('tripal_stock_phenotypes', $node);
|
|
|
break;
|
|
|
-
|
|
|
+
|
|
|
case 'genotypes':
|
|
|
$block['subject'] = t('Stock Genotypes');
|
|
|
$block['content'] = theme('tripal_stock_genotypes', $node);
|
|
|
break;
|
|
|
-
|
|
|
+
|
|
|
case 'locations':
|
|
|
$block['subject'] = t('Stock Locations');
|
|
|
$block['content'] = theme('tripal_stock_locations', $node);
|
|
|
break;
|
|
|
-
|
|
|
+
|
|
|
case 'orgstocks':
|
|
|
$block['subject'] = t('Organism Stocks');
|
|
|
$block['content'] = theme('tripal_organism_stocks', $node);
|
|
|
break;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
return $block;
|
|
|
}
|
|
@@ -1039,14 +1050,14 @@ function tripal_stock_block_view($delta = '') {
|
|
|
function tripal_stock_preprocess_tripal_stock_relationships(&$variables) {
|
|
|
// we want to provide a new variable that contains the matched stocks.
|
|
|
$stock = $variables['node']->stock;
|
|
|
-
|
|
|
+
|
|
|
// normally we would use tripal_core_expand_chado_vars to expand our
|
|
|
// organism object and add in the relationships, however whan a large
|
|
|
// number of relationships are present this significantly slows the
|
|
|
// query, therefore we will manually perform the query
|
|
|
$sql = "
|
|
|
- SELECT
|
|
|
- S.name, S.uniquename, S.stock_id, CS.nid,
|
|
|
+ SELECT
|
|
|
+ S.name, S.uniquename, S.stock_id, CS.nid,
|
|
|
CVT.name as rel_type, CVTs.name as obj_type,
|
|
|
SR.value
|
|
|
FROM {stock_relationship} SR
|
|
@@ -1058,8 +1069,8 @@ function tripal_stock_preprocess_tripal_stock_relationships(&$variables) {
|
|
|
";
|
|
|
$as_subject = chado_query($sql, array(':stock_id' => $stock->stock_id));
|
|
|
$sql = "
|
|
|
- SELECT
|
|
|
- S.name, S.uniquename, S.stock_id, CS.nid,
|
|
|
+ SELECT
|
|
|
+ S.name, S.uniquename, S.stock_id, CS.nid,
|
|
|
CVT.name as rel_type, CVTs.name as sub_type,
|
|
|
SR.value
|
|
|
FROM {stock_relationship} SR
|
|
@@ -1070,45 +1081,45 @@ function tripal_stock_preprocess_tripal_stock_relationships(&$variables) {
|
|
|
WHERE SR.object_id = :stock_id
|
|
|
";
|
|
|
$as_object = chado_query($sql, array(':stock_id' => $stock->stock_id));
|
|
|
-
|
|
|
+
|
|
|
// combine both object and subject relationshisp into a single array
|
|
|
$relationships = array();
|
|
|
$relationships['object'] = array();
|
|
|
$relationships['subject'] = array();
|
|
|
-
|
|
|
+
|
|
|
// iterate through the object relationships
|
|
|
while ($relationship = $as_object->fetchObject()) {
|
|
|
-
|
|
|
+
|
|
|
// get the relationship and child types
|
|
|
$rel_type = t(preg_replace('/_/', " ", $relationship->rel_type));
|
|
|
$sub_type = t(preg_replace('/_/', " ", $relationship->sub_type));
|
|
|
-
|
|
|
+
|
|
|
if (!array_key_exists($rel_type, $relationships['object'])) {
|
|
|
- $relationships['object'][$rel_type] = array();
|
|
|
+ $relationships['object'][$rel_type] = array();
|
|
|
}
|
|
|
if (!array_key_exists($sub_type, $relationships['object'][$rel_type])) {
|
|
|
- $relationships['object'][$rel_type][$sub_type] = array();
|
|
|
+ $relationships['object'][$rel_type][$sub_type] = array();
|
|
|
}
|
|
|
- $relationships['object'][$rel_type][$sub_type][] = $relationship;
|
|
|
+ $relationships['object'][$rel_type][$sub_type][] = $relationship;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// now add in the subject relationships
|
|
|
while ($relationship = $as_subject->fetchObject()) {
|
|
|
-
|
|
|
+
|
|
|
// get the relationship and child types
|
|
|
$rel_type = t(preg_replace('/_/', " ", $relationship->rel_type));
|
|
|
$obj_type = t(preg_replace('/_/', " ", $relationship->obj_type));
|
|
|
-
|
|
|
+
|
|
|
if (!array_key_exists($rel_type, $relationships['subject'])) {
|
|
|
- $relationships['subject'][$rel_type] = array();
|
|
|
+ $relationships['subject'][$rel_type] = array();
|
|
|
}
|
|
|
if (!array_key_exists($obj_type, $relationships['subject'][$rel_type])) {
|
|
|
- $relationships['subject'][$rel_type][$obj_type] = array();
|
|
|
+ $relationships['subject'][$rel_type][$obj_type] = array();
|
|
|
}
|
|
|
- $relationships['subject'][$rel_type][$obj_type][] = $relationship;
|
|
|
+ $relationships['subject'][$rel_type][$obj_type][] = $relationship;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
$stock->all_relationships = $relationships;
|
|
|
|
|
|
}
|
|
@@ -1138,10 +1149,10 @@ function tripal_stock_node_insert($node) {
|
|
|
$chado_stock = db_query($sql, array(':nid' => $node->nid))->fetchObject();
|
|
|
$node->stock_id = $chado_stock->stock_id;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// remove any previous alias
|
|
|
db_query("DELETE FROM {url_alias} WHERE src = :src", array(':src' => "node/$node->nid"));
|
|
|
-
|
|
|
+
|
|
|
// set the URL for this stock page
|
|
|
$url_alias = tripal_stock_get_stock_url($node);
|
|
|
path_set_alias("node/$node->nid", $url_alias);
|
|
@@ -1155,10 +1166,10 @@ function tripal_stock_node_update($node) {
|
|
|
|
|
|
switch ($node->type) {
|
|
|
case 'chado_stock':
|
|
|
-
|
|
|
+
|
|
|
// remove any previous alias
|
|
|
db_query("DELETE FROM {url_alias} WHERE src = :src", array(':src' => "node/$node->nid"));
|
|
|
-
|
|
|
+
|
|
|
// set the URL for this stock page
|
|
|
$url_alias = tripal_stock_get_stock_url($node);
|
|
|
path_set_alias("node/$node->nid", $url_alias);
|
|
@@ -1190,19 +1201,19 @@ function tripal_stock_node_view($node, $view_mode, $langcode) {
|
|
|
* stocks is shown.
|
|
|
*/
|
|
|
function tripal_stock_match_stocks_page($id) {
|
|
|
-
|
|
|
+
|
|
|
// if the URL alias configuration is set such that the URL
|
|
|
// always begins with 'stock' then we want to use the ID as it is and
|
|
|
// forward it on. Otherwise, try to find the matching stock.
|
|
|
- $url_alias = variable_get('chado_stock_url_string', '/stock/[genus]/[species]/[type]/[uniquename]');
|
|
|
+ $url_alias = variable_get('chado_stock_url_string', '/stock/[genus]/[species]/[type]/[uniquename]');
|
|
|
if (!$url_alias) {
|
|
|
$url_alias = '/stock/[genus]/[species]/[type]/[uniquename]';
|
|
|
- }
|
|
|
- $url_alias = preg_replace('/^\//', '', $url_alias); // remove any preceeding forward slash
|
|
|
+ }
|
|
|
+ $url_alias = preg_replace('/^\//', '', $url_alias); // remove any preceeding forward slash
|
|
|
if (preg_match('/^stock\//', $url_alias)) {
|
|
|
drupal_goto($id);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
$sql = "
|
|
|
SELECT
|