|
@@ -1,34 +1,34 @@
|
|
|
<?php
|
|
|
/* Typically in a Tripal template, the data needed is retrieved using a call to
|
|
|
* tripal_core_expand_chado_vars function. For example, to retrieve all
|
|
|
- * of the pub relationships for this node, the following function call would be made:
|
|
|
+ * of the example relationships for this node, the following function call would be made:
|
|
|
*
|
|
|
- * $pub = tripal_core_expand_chado_vars($pub,'table','pub_relationship');
|
|
|
+ * $example = tripal_core_expand_chado_vars($example,'table','example_relationship');
|
|
|
*
|
|
|
* However, this function call can be extremely slow when there are numerous relationships.
|
|
|
* This is because the tripal_core_expand_chado_vars function is recursive and expands
|
|
|
* all data following the foreign key relationships tree. Therefore, to speed retrieval
|
|
|
* of data, a special variable is provided to this template:
|
|
|
*
|
|
|
- * $pub->all_relationships;
|
|
|
+ * $example->all_relationships;
|
|
|
*
|
|
|
* This variable is an array with two sub arrays with the keys 'object' and 'subject'. The array with
|
|
|
- * key 'object' contains relationships where the pub is the object, and the array with
|
|
|
- * the key 'subject' contains relationships where the pub is the subject
|
|
|
+ * key 'object' contains relationships where the example is the object, and the array with
|
|
|
+ * the key 'subject' contains relationships where the example is the subject
|
|
|
*/
|
|
|
-$pub = $variables['node']->pub;
|
|
|
+$example = $variables['node']->example;
|
|
|
|
|
|
-$all_relationships = $pub->all_relationships;
|
|
|
+$all_relationships = $example->all_relationships;
|
|
|
$object_rels = $all_relationships['object'];
|
|
|
$subject_rels = $all_relationships['subject'];
|
|
|
|
|
|
if (count($object_rels) > 0 or count($subject_rels) > 0) { ?>
|
|
|
- <div class="tripal_pub-data-block-desc tripal-data-block-desc"></div> <?php
|
|
|
+ <div class="tripal_example-data-block-desc tripal-data-block-desc"></div> <?php
|
|
|
|
|
|
// first add in the subject relationships.
|
|
|
foreach ($subject_rels as $rel_type => $rels){
|
|
|
foreach ($rels as $obj_type => $objects){ ?>
|
|
|
- <p>This <?php print $pub->type_id->name;?> is <?php print $rel_type ?> the following <b><?php print $obj_type ?></b> pub(s): <?php
|
|
|
+ <p>This <?php print $example->type_id->name;?> is <?php print $rel_type ?> the following <b><?php print $obj_type ?></b> example(s): <?php
|
|
|
|
|
|
// the $headers array is an array of fields to use as the colum headers.
|
|
|
// additional documentation can be found here
|
|
@@ -42,7 +42,7 @@ if (count($object_rels) > 0 or count($subject_rels) > 0) { ?>
|
|
|
$rows = array();
|
|
|
|
|
|
foreach ($objects as $object){
|
|
|
- // link the pub to it's node
|
|
|
+ // link the example to it's node
|
|
|
$title = $object->record->object_id->title;
|
|
|
if (property_exists($object->record, 'nid')) {
|
|
|
$title = l($title, "node/" . $object->record->nid, array('attributes' => array('target' => "_blank")));
|
|
@@ -50,13 +50,13 @@ if (count($object_rels) > 0 or count($subject_rels) > 0) { ?>
|
|
|
|
|
|
// get the citation
|
|
|
$values = array(
|
|
|
- 'pub_id' => $object->record->object_id->pub_id,
|
|
|
+ 'example_id' => $object->record->object_id->example_id,
|
|
|
'type_id' => array(
|
|
|
'name' => 'Citation',
|
|
|
),
|
|
|
);
|
|
|
- $citation = tripal_core_generate_chado_var('pubprop', $values);
|
|
|
- $citation = tripal_core_expand_chado_vars($citation, 'field', 'pubprop.value');
|
|
|
+ $citation = tripal_core_generate_chado_var('exampleprop', $values);
|
|
|
+ $citation = tripal_core_expand_chado_vars($citation, 'field', 'exampleprop.value');
|
|
|
|
|
|
$rows[] = array(
|
|
|
$title . '<br>' . htmlspecialchars($citation->value),
|
|
@@ -70,7 +70,7 @@ if (count($object_rels) > 0 or count($subject_rels) > 0) { ?>
|
|
|
'header' => $headers,
|
|
|
'rows' => $rows,
|
|
|
'attributes' => array(
|
|
|
- 'id' => 'tripal_pub-table-relationship-object',
|
|
|
+ 'id' => 'tripal_example-table-relationship-object',
|
|
|
'class' => 'tripal-data-table'
|
|
|
),
|
|
|
'sticky' => FALSE,
|
|
@@ -90,7 +90,7 @@ if (count($object_rels) > 0 or count($subject_rels) > 0) { ?>
|
|
|
// second add in the object relationships.
|
|
|
foreach ($object_rels as $rel_type => $rels){
|
|
|
foreach ($rels as $subject_type => $subjects){?>
|
|
|
- <p>The following <b><?php print $subjects[0]->record->subject_id->type_id->name ?></b> pub(s) are <?php print $rel_type ?> this <?php print $pub->type_id->name;?>: <?php
|
|
|
+ <p>The following <b><?php print $subjects[0]->record->subject_id->type_id->name ?></b> example(s) are <?php print $rel_type ?> this <?php print $example->type_id->name;?>: <?php
|
|
|
// the $headers array is an array of fields to use as the colum headers.
|
|
|
// additional documentation can be found here
|
|
|
// https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
|
|
@@ -103,7 +103,7 @@ if (count($object_rels) > 0 or count($subject_rels) > 0) { ?>
|
|
|
$rows = array();
|
|
|
|
|
|
foreach ($subjects as $subject){
|
|
|
- // link the pub to it's node
|
|
|
+ // link the example to it's node
|
|
|
$title = $subject->record->subject_id->title;
|
|
|
if (property_exists($subject->record, 'nid')) {
|
|
|
$title = l($title, "node/" . $subject->record->nid, array('attributes' => array('target' => "_blank")));
|
|
@@ -111,13 +111,13 @@ if (count($object_rels) > 0 or count($subject_rels) > 0) { ?>
|
|
|
|
|
|
// get the citation
|
|
|
$values = array(
|
|
|
- 'pub_id' => $subject->record->subject_id->pub_id,
|
|
|
+ 'example_id' => $subject->record->subject_id->example_id,
|
|
|
'type_id' => array(
|
|
|
'name' => 'Citation',
|
|
|
),
|
|
|
);
|
|
|
- $citation = tripal_core_generate_chado_var('pubprop', $values);
|
|
|
- $citation = tripal_core_expand_chado_vars($citation, 'field', 'pubprop.value');
|
|
|
+ $citation = tripal_core_generate_chado_var('exampleprop', $values);
|
|
|
+ $citation = tripal_core_expand_chado_vars($citation, 'field', 'exampleprop.value');
|
|
|
|
|
|
$rows[] = array(
|
|
|
$title . '<br>' . htmlspecialchars($citation->value),
|
|
@@ -131,7 +131,7 @@ if (count($object_rels) > 0 or count($subject_rels) > 0) { ?>
|
|
|
'header' => $headers,
|
|
|
'rows' => $rows,
|
|
|
'attributes' => array(
|
|
|
- 'id' => 'tripal_pub-table-relationship-subject',
|
|
|
+ 'id' => 'tripal_example-table-relationship-subject',
|
|
|
'class' => 'tripal-data-table'
|
|
|
),
|
|
|
'sticky' => FALSE,
|