|
@@ -42,12 +42,11 @@ function tripal_library_node_info() {
|
|
$nodes = array();
|
|
$nodes = array();
|
|
$nodes['chado_library'] = array(
|
|
$nodes['chado_library'] = array(
|
|
'name' => t('Library'),
|
|
'name' => t('Library'),
|
|
- 'module' => 'chado_library',
|
|
|
|
|
|
+ 'base' => 'chado_library',
|
|
'description' => t('A library from the chado database'),
|
|
'description' => t('A library from the chado database'),
|
|
'has_title' => FALSE,
|
|
'has_title' => FALSE,
|
|
'title_label' => t('Library'),
|
|
'title_label' => t('Library'),
|
|
'has_body' => FALSE,
|
|
'has_body' => FALSE,
|
|
- 'body_label' => t('Library Description'),
|
|
|
|
'locked' => TRUE
|
|
'locked' => TRUE
|
|
);
|
|
);
|
|
return $nodes;
|
|
return $nodes;
|
|
@@ -60,13 +59,28 @@ function tripal_library_node_info() {
|
|
*
|
|
*
|
|
* @ingroup tripal_library
|
|
* @ingroup tripal_library
|
|
*/
|
|
*/
|
|
-function tripal_library_perm() {
|
|
|
|
|
|
+function tripal_library_permisssions() {
|
|
return array(
|
|
return array(
|
|
- 'access chado_library content',
|
|
|
|
- 'create chado_library content',
|
|
|
|
- 'delete chado_library content',
|
|
|
|
- 'edit chado_library content',
|
|
|
|
- 'administer tripal libraries',
|
|
|
|
|
|
+ 'access chado_library content' => array(
|
|
|
|
+ 'title' => t('View Libraries'),
|
|
|
|
+ 'description' => t('Allow users to view library pages.'),
|
|
|
|
+ ),
|
|
|
|
+ 'create chado_library content' => array(
|
|
|
|
+ 'title' => t('Create Libraries'),
|
|
|
|
+ 'description' => t('Allow users to create new library pages.'),
|
|
|
|
+ ),
|
|
|
|
+ 'delete chado_library content' => array(
|
|
|
|
+ 'title' => t('Delete Libraries'),
|
|
|
|
+ 'description' => t('Allow users to delete library pages.'),
|
|
|
|
+ ),
|
|
|
|
+ 'edit chado_library content' => array(
|
|
|
|
+ 'title' => t('Edit Libraries'),
|
|
|
|
+ 'description' => t('Allow users to edit library pages.'),
|
|
|
|
+ ),
|
|
|
|
+ 'adminster tripal library' => array(
|
|
|
|
+ 'title' => t('Administer Libraries'),
|
|
|
|
+ 'description' => t('Allow users to administer all librarys.'),
|
|
|
|
+ ),
|
|
);
|
|
);
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
@@ -92,7 +106,7 @@ function tripal_library_perm() {
|
|
*
|
|
*
|
|
* @ingroup tripal_library
|
|
* @ingroup tripal_library
|
|
*/
|
|
*/
|
|
-function chado_library_access($op, $node, $account) {
|
|
|
|
|
|
+function chado_library_node_access($op, $node, $account) {
|
|
if ($op == 'create') {
|
|
if ($op == 'create') {
|
|
if (!user_access('create chado_library content', $account)) {
|
|
if (!user_access('create chado_library content', $account)) {
|
|
return FALSE;
|
|
return FALSE;
|
|
@@ -169,49 +183,27 @@ function tripal_library_views_api() {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Implementation of hook_nodeapi().
|
|
|
|
- * Display library information for associated features or organisms
|
|
|
|
- * This function also provides contents for indexing
|
|
|
|
- *
|
|
|
|
* @ingroup tripal_library
|
|
* @ingroup tripal_library
|
|
*/
|
|
*/
|
|
-function tripal_library_nodeapi(&$node, $op, $teaser, $page) {
|
|
|
|
-
|
|
|
|
- switch ($op) {
|
|
|
|
- // Note that this function only adds library view to an organism/feature
|
|
|
|
- // node.
|
|
|
|
- case 'view':
|
|
|
|
- // add the library to the organism/feature search indexing
|
|
|
|
- if ($node->build_mode == NODE_BUILD_SEARCH_INDEX) {
|
|
|
|
- $node->content['tripal_library_index_version'] = array(
|
|
|
|
- '#value' => theme('tripal_library_search_index', $node),
|
|
|
|
- );
|
|
|
|
- }
|
|
|
|
- elseif ($node->build_mode == NODE_BUILD_SEARCH_RESULT) {
|
|
|
|
- $node->content['tripal_library_index_version'] = array(
|
|
|
|
- '#value' => theme('tripal_library_search_result', $node),
|
|
|
|
- );
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- switch ($node->type) {
|
|
|
|
- case 'chado_organism':
|
|
|
|
- // Show library if the organism/feature is not at teaser view
|
|
|
|
- $node->content['tripal_organism_libraries'] = array(
|
|
|
|
- '#value' => theme('tripal_organism_libraries', $node),
|
|
|
|
- );
|
|
|
|
- break;
|
|
|
|
- case 'chado_feature':
|
|
|
|
- // Show library if the organism/feature is not at teaser view
|
|
|
|
- $node->content['tripal_feature_libraries'] = array(
|
|
|
|
- '#value' => theme('tripal_feature_libraries', $node),
|
|
|
|
- );
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
|
|
+function tripal_library_node_view(&$node, $view_mode, $langcode) {
|
|
|
|
+
|
|
|
|
+ switch ($node->type) {
|
|
|
|
+ case 'chado_organism':
|
|
|
|
+ if ($view_mode == 'full') {
|
|
|
|
+ $node->content['tripal_organism_libraries'] = array(
|
|
|
|
+ '#value' => theme('tripal_organism_libraries', $node),
|
|
|
|
+ );
|
|
}
|
|
}
|
|
- break;
|
|
|
|
|
|
+ break;
|
|
|
|
+ case 'chado_feature':
|
|
|
|
+ if ($view_mode == 'full') {
|
|
|
|
+ $node->content['tripal_feature_libraries'] = array(
|
|
|
|
+ '#value' => theme('tripal_feature_libraries', $node),
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* We need to let drupal know about our theme functions and their arguments.
|
|
* 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
|
|
* We create theme functions to allow users of the module to customize the
|
|
@@ -278,17 +270,19 @@ function theme_tripal_library_search_index($node) {
|
|
if ($node->type == 'chado_organism') {
|
|
if ($node->type == 'chado_organism') {
|
|
$content = "";
|
|
$content = "";
|
|
// get the libraries for the organism
|
|
// get the libraries for the organism
|
|
- $sql = "SELECT * FROM {library} L ".
|
|
|
|
- "WHERE L.organism_id = %d";
|
|
|
|
|
|
+ $sql = "SELECT * FROM {library} L WHERE L.organism_id = :organism_id";
|
|
$libraries = array();
|
|
$libraries = array();
|
|
- $results = chado_query($sql, $node->organism->organism_id);
|
|
|
|
- while ($library = db_fetch_object($results)) {
|
|
|
|
|
|
+ $results = chado_query($sql, array(':organism_id' => $node->organism->organism_id));
|
|
|
|
+ while ($library = $results->fetchObject()) {
|
|
// get the description
|
|
// get the description
|
|
- $sql = "SELECT * FROM {libraryprop} LP ".
|
|
|
|
- " INNER JOIN {CVTerm} CVT ON CVT.cvterm_id = LP.type_id ".
|
|
|
|
- "WHERE LP.library_id = $library->library_id ".
|
|
|
|
- " AND CVT.name = 'library_description'";
|
|
|
|
- $desc = db_fetch_object(chado_query($sql));
|
|
|
|
|
|
+ $sql = "
|
|
|
|
+ SELECT *
|
|
|
|
+ FROM {libraryprop} LP
|
|
|
|
+ INNER JOIN {cvterm} CVT ON CVT.cvterm_id = LP.type_id
|
|
|
|
+ WHERE LP.library_id = :library_id
|
|
|
|
+ AND CVT.name = 'library_description'
|
|
|
|
+ ";
|
|
|
|
+ $desc = chado_query($sql, array(':library_id' => $library->library_id))->fetchObject();
|
|
$library->description = $desc->value;
|
|
$library->description = $desc->value;
|
|
$libraries[] = $library;
|
|
$libraries[] = $library;
|
|
}
|
|
}
|
|
@@ -303,12 +297,15 @@ function theme_tripal_library_search_index($node) {
|
|
elseif ($node->type == 'chado_feature') {
|
|
elseif ($node->type == 'chado_feature') {
|
|
$content = "";
|
|
$content = "";
|
|
$organism_id = $node->feature->organism_id;
|
|
$organism_id = $node->feature->organism_id;
|
|
- $sql = "SELECT * FROM {library} L ".
|
|
|
|
- " INNER JOIN {Library_feature} LF ON L.library_id = LF.library_id ".
|
|
|
|
- "WHERE LF.feature_id = " . $node->feature->feature_id;
|
|
|
|
|
|
+ $sql = "
|
|
|
|
+ SELECT *
|
|
|
|
+ FROM {library} L
|
|
|
|
+ INNER JOIN {library_feature} LF ON L.library_id = LF.library_id
|
|
|
|
+ WHERE LF.feature_id = :feature_id
|
|
|
|
+ ";
|
|
$libraries = array();
|
|
$libraries = array();
|
|
- $results = chado_query($sql);
|
|
|
|
- while ($library = db_fetch_object($results)) {
|
|
|
|
|
|
+ $results = chado_query($sql, array(':feature_id' => $node->feature->feature_id));
|
|
|
|
+ while ($library = $results->fetchObject()) {
|
|
$libraries[] = $library;
|
|
$libraries[] = $library;
|
|
}
|
|
}
|
|
if (count($libraries) > 0) {
|
|
if (count($libraries) > 0) {
|
|
@@ -345,19 +342,22 @@ function theme_tripal_library_node_libraries($node) {
|
|
// when a feature is previewed at its creation
|
|
// when a feature is previewed at its creation
|
|
elseif ($node->type == 'chado_feature' && $node->feature->feature_id) {
|
|
elseif ($node->type == 'chado_feature' && $node->feature->feature_id) {
|
|
$organism_id = $node->feature->organism_id;
|
|
$organism_id = $node->feature->organism_id;
|
|
- $sql = "SELECT * FROM {library} L ".
|
|
|
|
- " INNER JOIN Library_feature LF ON L.library_id = LF.library_id ".
|
|
|
|
- "WHERE LF.feature_id = " . $node->feature->feature_id;
|
|
|
|
|
|
+ $sql = "
|
|
|
|
+ SELECT *
|
|
|
|
+ FROM {library} L
|
|
|
|
+ INNER JOIN Library_feature LF ON L.library_id = LF.library_id
|
|
|
|
+ WHERE LF.feature_id = :feature_id
|
|
|
|
+ ";
|
|
$libraries = array();
|
|
$libraries = array();
|
|
- $results = chado_query($sql);
|
|
|
|
- while ($library = db_fetch_object($results)) {
|
|
|
|
|
|
+ $results = chado_query($sql, array(':feature_id' => $node->feature->feature_id));
|
|
|
|
+ while ($library = $results->fetchObject()) {
|
|
$libraries[] = $library;
|
|
$libraries[] = $library;
|
|
}
|
|
}
|
|
if (count($libraries) > 0) {
|
|
if (count($libraries) > 0) {
|
|
$lib_additions = array();
|
|
$lib_additions = array();
|
|
foreach ($libraries as $library) {
|
|
foreach ($libraries as $library) {
|
|
- $sql = "SELECT nid FROM {chado_library} WHERE library_id = %d";
|
|
|
|
- $lib_nid = db_result(db_query($sql, $library->library_id));
|
|
|
|
|
|
+ $sql = "SELECT nid FROM {chado_library} WHERE library_id = :library_id";
|
|
|
|
+ $lib_nid = db_query($sql, array(':library_id' => $library->library_id))->fetchField();
|
|
if ($lib_nid) {
|
|
if ($lib_nid) {
|
|
$lib_url = url("node/$lib_nid");
|
|
$lib_url = url("node/$lib_nid");
|
|
}
|
|
}
|
|
@@ -383,7 +383,7 @@ function tripal_library_cron() {
|
|
*
|
|
*
|
|
* @ingroup tripal_library
|
|
* @ingroup tripal_library
|
|
*/
|
|
*/
|
|
-function tripal_library_library_access($op, $node, $account) {
|
|
|
|
|
|
+function tripal_library_node_access($op, $node, $account) {
|
|
if ($op == 'create') {
|
|
if ($op == 'create') {
|
|
if (!user_access('create chado_library content', $account)) {
|
|
if (!user_access('create chado_library content', $account)) {
|
|
return FALSE;
|
|
return FALSE;
|
|
@@ -497,12 +497,12 @@ function chado_library_form($node) {
|
|
);
|
|
);
|
|
|
|
|
|
// get the list of organisms
|
|
// get the list of organisms
|
|
- $sql = "SELECT * FROM {Organism}";
|
|
|
|
|
|
+ $sql = "SELECT * FROM {organism}";
|
|
$org_rset = chado_query($sql);
|
|
$org_rset = chado_query($sql);
|
|
|
|
|
|
$organisms = array();
|
|
$organisms = array();
|
|
$organisms[''] = '';
|
|
$organisms[''] = '';
|
|
- while ($organism = db_fetch_object($org_rset)) {
|
|
|
|
|
|
+ while ($organism = $org_rset->fetchObject()) {
|
|
$organisms[$organism->organism_id] =
|
|
$organisms[$organism->organism_id] =
|
|
"$organism->genus $organism->species ($organism->common_name)";
|
|
"$organism->genus $organism->species ($organism->common_name)";
|
|
}
|
|
}
|
|
@@ -539,21 +539,19 @@ function chado_library_validate($node) {
|
|
// check to make sure the unique name on the library is unique
|
|
// check to make sure the unique name on the library is unique
|
|
// before we try to insert into chado.
|
|
// before we try to insert into chado.
|
|
if ($node->library_id) {
|
|
if ($node->library_id) {
|
|
- $sql = "SELECT * FROM ".
|
|
|
|
- "{Library} WHERE ".
|
|
|
|
- "uniquename = '%s' ".
|
|
|
|
- "AND NOT library_id = %d";
|
|
|
|
- $lib = db_fetch_object(chado_query($sql, $node->uniquename, $node->library_id));
|
|
|
|
|
|
+ $sql = "
|
|
|
|
+ SELECT *
|
|
|
|
+ FROM {library}
|
|
|
|
+ WHERE uniquename = :uname AND NOT library_id = :library_id
|
|
|
|
+ ";
|
|
|
|
+ $lib = chado_query($sql, array(':uname' => $node->uniquename, ':library_id' => $node->library_id))->fetchObject();
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- $sql = "SELECT * FROM ".
|
|
|
|
- "{Library} ".
|
|
|
|
- "WHERE uniquename = '%s'";
|
|
|
|
- $lib = db_fetch_object(chado_query($sql, $node->uniquename));
|
|
|
|
|
|
+ $sql = "SELECT * FROM {library} WHERE uniquename = :uname";
|
|
|
|
+ $lib = chado_query($sql, array(':uname' => $node->uniquename))->fetchObject();
|
|
}
|
|
}
|
|
if ($lib) {
|
|
if ($lib) {
|
|
- form_set_error('uniquename', t('The unique library name already exists. '.
|
|
|
|
- 'Please choose another'));
|
|
|
|
|
|
+ form_set_error('uniquename', t('The unique library name already exists. Please choose another'));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
@@ -588,18 +586,17 @@ function chado_library_insert($node) {
|
|
$library_id = chado_get_id_for_node('library', $node->nid) ;
|
|
$library_id = chado_get_id_for_node('library', $node->nid) ;
|
|
if (!$library_id) {
|
|
if (!$library_id) {
|
|
// next add the item to the drupal table
|
|
// next add the item to the drupal table
|
|
- $sql = "INSERT INTO {chado_library} (nid, vid, library_id) ".
|
|
|
|
- "VALUES (%d, %d, %d)";
|
|
|
|
- db_query($sql, $node->nid, $node->vid, $library['library_id']);
|
|
|
|
|
|
+ $sql = "
|
|
|
|
+ INSERT INTO {chado_library} (nid, vid, library_id)
|
|
|
|
+ VALUES (:nid, :vid, :library_id)
|
|
|
|
+ ";
|
|
|
|
+ db_query($sql, array(':nid' => $node->nid, ':vid' => $node->vid, ':library_id' => $library['library_id']));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
drupal_set_message(t('Unable to add library.', 'warning'));
|
|
drupal_set_message(t('Unable to add library.', 'warning'));
|
|
- watchdog('tripal_library',
|
|
|
|
- 'Insert feature: Unable to create library where values: %values',
|
|
|
|
- array('%values' => print_r($values, TRUE)),
|
|
|
|
- WATCHDOG_WARNING
|
|
|
|
- );
|
|
|
|
|
|
+ watchdog('tripal_library', 'Insert feature: Unable to create library where values: %values',
|
|
|
|
+ array('%values' => print_r($values, TRUE)), WATCHDOG_WARNING);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
@@ -663,8 +660,8 @@ function chado_library_view($node, $teaser = FALSE, $page = FALSE) {
|
|
// but not genus/species/common_name. We need to get those from chado
|
|
// but not genus/species/common_name. We need to get those from chado
|
|
// database so they will show up in preview
|
|
// database so they will show up in preview
|
|
if (!$node->genus) {
|
|
if (!$node->genus) {
|
|
- $sql = "SELECT * FROM {organism} WHERE organism_id = %d";
|
|
|
|
- $data = db_fetch_object(chado_query($sql, $node->organism_id));
|
|
|
|
|
|
+ $sql = "SELECT * FROM {organism} WHERE organism_id = :organism_id";
|
|
|
|
+ $data = chado_query($sql, array(':organism_id' => $node->organism_id))->fetchObject();
|
|
$node->genus = $data->genus;
|
|
$node->genus = $data->genus;
|
|
$node->species = $data->species;
|
|
$node->species = $data->species;
|
|
$node->common_name = $data->common_name;
|
|
$node->common_name = $data->common_name;
|
|
@@ -689,97 +686,87 @@ function chado_library_delete(&$node) {
|
|
|
|
|
|
// Remove data from {chado_library}, {node} and {node_revisions} tables of
|
|
// Remove data from {chado_library}, {node} and {node_revisions} tables of
|
|
// drupal database
|
|
// drupal database
|
|
- $sql_del = "DELETE FROM {chado_library} ".
|
|
|
|
- "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);
|
|
|
|
- $sql_del = "DELETE FROM {node} ".
|
|
|
|
- "WHERE nid = %d ".
|
|
|
|
- "AND vid = %d";
|
|
|
|
- db_query($sql_del, $node->nid, $node->vid);
|
|
|
|
|
|
+ $sql_del = "DELETE FROM {chado_library} WHERE nid = :nid AND vid = :vid";
|
|
|
|
+ db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
|
|
|
|
+ $sql_del = "DELETE FROM {node_revision} WHERE nid = :nid AND vid = :vid";
|
|
|
|
+ db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
|
|
|
|
+ $sql_del = "DELETE FROM {node} WHERE nid = :nid AND vid = :vid";
|
|
|
|
+ db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
|
|
|
|
|
|
// Remove data from library and libraryprop tables of chado database as well
|
|
// Remove data from library and libraryprop tables of chado database as well
|
|
- chado_query("DELETE FROM {libraryprop} WHERE library_id = %d", $library_id);
|
|
|
|
- chado_query("DELETE FROM {library} WHERE library_id = %d", $library_id);
|
|
|
|
|
|
+ chado_query("DELETE FROM {libraryprop} WHERE library_id = :library_id", array(':library_id' => $library_id));
|
|
|
|
+ chado_query("DELETE FROM {library} WHERE library_id = :library_id", array(':library_id' => $library_id));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Display block with libraries
|
|
|
|
- * @param op - parameter to define the phase being called for the block
|
|
|
|
- * @param delta - id of the block to return (ignored when op is list)
|
|
|
|
- * @param edit - when op is save, contains the submitted form data
|
|
|
|
- *
|
|
|
|
* @ingroup tripal_library
|
|
* @ingroup tripal_library
|
|
*/
|
|
*/
|
|
-function tripal_library_block($op = 'list', $delta = '0', $edit = array()) {
|
|
|
|
- switch ($op) {
|
|
|
|
- case 'list':
|
|
|
|
-
|
|
|
|
- $blocks['libreferences']['info'] = t('Tripal Library Cross References');
|
|
|
|
- $blocks['libreferences']['cache'] = BLOCK_NO_CACHE;
|
|
|
|
-
|
|
|
|
- $blocks['libbase']['info'] = t('Tripal Library Details');
|
|
|
|
- $blocks['libbase']['cache'] = BLOCK_NO_CACHE;
|
|
|
|
-
|
|
|
|
- $blocks['libterms']['info'] = t('Tripal Library Terms');
|
|
|
|
- $blocks['libterms']['cache'] = BLOCK_NO_CACHE;
|
|
|
|
-
|
|
|
|
- $blocks['libsynonyms']['info'] = t('Tripal Library Synonyms');
|
|
|
|
- $blocks['libsynonyms']['cache'] = BLOCK_NO_CACHE;
|
|
|
|
-
|
|
|
|
- $blocks['libproperties']['info'] = t('Tripal Library Properties');
|
|
|
|
- $blocks['libproperties']['cache'] = BLOCK_NO_CACHE;
|
|
|
|
-
|
|
|
|
- $blocks['featurelibs']['info'] = t('Tripal Feature Libraries');
|
|
|
|
- $blocks['featurelibs']['cache'] = BLOCK_NO_CACHE;
|
|
|
|
-
|
|
|
|
- $blocks['orglibs']['info'] = t('Tripal Organism Libraries');
|
|
|
|
- $blocks['orglibs']['cache'] = BLOCK_NO_CACHE;
|
|
|
|
-
|
|
|
|
- return $blocks;
|
|
|
|
-
|
|
|
|
- case 'view':
|
|
|
|
- if (user_access('access chado_library content') and arg(0) == 'node' and is_numeric(arg(1))) {
|
|
|
|
- $nid = arg(1);
|
|
|
|
- $node = node_load($nid);
|
|
|
|
-
|
|
|
|
- $block = array();
|
|
|
|
- switch ($delta) {
|
|
|
|
- case 'libreferences':
|
|
|
|
- $block['subject'] = t('Cross References');
|
|
|
|
- $block['content'] = theme('tripal_library_references', $node);
|
|
|
|
- break;
|
|
|
|
- case 'libbase':
|
|
|
|
- $block['subject'] = t('Library Details');
|
|
|
|
- $block['content'] = theme('tripal_library_base', $node);
|
|
|
|
- break;
|
|
|
|
- case 'libsynonyms':
|
|
|
|
- $block['subject'] = t('Synonyms');
|
|
|
|
- $block['content'] = theme('tripal_library_synonyms', $node);
|
|
|
|
- break;
|
|
|
|
- case 'libproperties':
|
|
|
|
- $block['subject'] = t('Properties');
|
|
|
|
- $block['content'] = theme('tripal_library_properties', $node);
|
|
|
|
- break;
|
|
|
|
- case 'libterms':
|
|
|
|
- $block['subject'] = t('Library Terms');
|
|
|
|
- $block['content'] = theme('tripal_library_terms', $node);
|
|
|
|
- break;
|
|
|
|
- case 'featurelibs':
|
|
|
|
- $block['subject'] = t('Libraries');
|
|
|
|
- $block['content'] = theme('tripal_feature_libraries', $node);
|
|
|
|
- break;
|
|
|
|
- case 'orglibs':
|
|
|
|
- $block['subject'] = t('Libraries');
|
|
|
|
- $block['content'] = theme('tripal_organism_libraries', $node);
|
|
|
|
- break;
|
|
|
|
- default :
|
|
|
|
- }
|
|
|
|
- return $block;
|
|
|
|
- }
|
|
|
|
|
|
+function tripal_library_block_info() {
|
|
|
|
+
|
|
|
|
+ $blocks['libreferences']['info'] = t('Tripal Library Cross References');
|
|
|
|
+ $blocks['libreferences']['cache'] = BLOCK_NO_CACHE;
|
|
|
|
+
|
|
|
|
+ $blocks['libbase']['info'] = t('Tripal Library Details');
|
|
|
|
+ $blocks['libbase']['cache'] = BLOCK_NO_CACHE;
|
|
|
|
+
|
|
|
|
+ $blocks['libterms']['info'] = t('Tripal Library Terms');
|
|
|
|
+ $blocks['libterms']['cache'] = BLOCK_NO_CACHE;
|
|
|
|
+
|
|
|
|
+ $blocks['libsynonyms']['info'] = t('Tripal Library Synonyms');
|
|
|
|
+ $blocks['libsynonyms']['cache'] = BLOCK_NO_CACHE;
|
|
|
|
+
|
|
|
|
+ $blocks['libproperties']['info'] = t('Tripal Library Properties');
|
|
|
|
+ $blocks['libproperties']['cache'] = BLOCK_NO_CACHE;
|
|
|
|
+
|
|
|
|
+ $blocks['featurelibs']['info'] = t('Tripal Feature Libraries');
|
|
|
|
+ $blocks['featurelibs']['cache'] = BLOCK_NO_CACHE;
|
|
|
|
+
|
|
|
|
+ $blocks['orglibs']['info'] = t('Tripal Organism Libraries');
|
|
|
|
+ $blocks['orglibs']['cache'] = BLOCK_NO_CACHE;
|
|
|
|
+
|
|
|
|
+ return $blocks;
|
|
|
|
+}
|
|
|
|
+/**
|
|
|
|
+ * @ingroup tripal_library
|
|
|
|
+ */
|
|
|
|
+function tripal_library_block_view($delta = '') {
|
|
|
|
+
|
|
|
|
+ if (user_access('access chado_library content') and arg(0) == 'node' and is_numeric(arg(1))) {
|
|
|
|
+ $nid = arg(1);
|
|
|
|
+ $node = node_load($nid);
|
|
|
|
+
|
|
|
|
+ $block = array();
|
|
|
|
+ switch ($delta) {
|
|
|
|
+ case 'libreferences':
|
|
|
|
+ $block['subject'] = t('Cross References');
|
|
|
|
+ $block['content'] = theme('tripal_library_references', $node);
|
|
|
|
+ break;
|
|
|
|
+ case 'libbase':
|
|
|
|
+ $block['subject'] = t('Library Details');
|
|
|
|
+ $block['content'] = theme('tripal_library_base', $node);
|
|
|
|
+ break;
|
|
|
|
+ case 'libsynonyms':
|
|
|
|
+ $block['subject'] = t('Synonyms');
|
|
|
|
+ $block['content'] = theme('tripal_library_synonyms', $node);
|
|
|
|
+ break;
|
|
|
|
+ case 'libproperties':
|
|
|
|
+ $block['subject'] = t('Properties');
|
|
|
|
+ $block['content'] = theme('tripal_library_properties', $node);
|
|
|
|
+ break;
|
|
|
|
+ case 'libterms':
|
|
|
|
+ $block['subject'] = t('Library Terms');
|
|
|
|
+ $block['content'] = theme('tripal_library_terms', $node);
|
|
|
|
+ break;
|
|
|
|
+ case 'featurelibs':
|
|
|
|
+ $block['subject'] = t('Libraries');
|
|
|
|
+ $block['content'] = theme('tripal_feature_libraries', $node);
|
|
|
|
+ break;
|
|
|
|
+ case 'orglibs':
|
|
|
|
+ $block['subject'] = t('Libraries');
|
|
|
|
+ $block['content'] = theme('tripal_organism_libraries', $node);
|
|
|
|
+ break;
|
|
|
|
+ default :
|
|
|
|
+ }
|
|
|
|
+ return $block;
|
|
}
|
|
}
|
|
}
|
|
}
|