|
@@ -27,12 +27,28 @@
|
|
?>
|
|
?>
|
|
|
|
|
|
<?php
|
|
<?php
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// expand the stock object to include the stock relationships.
|
|
|
|
+// since there two foreign keys (object_id and subject_id) in the
|
|
|
|
+// stock_relationship table, we will access each one separately
|
|
|
|
+$node = tripal_core_expand_chado_vars($node,
|
|
|
|
+ 'table','stock_relationship', array('order_by'=>array('rank' => 'ASC')));
|
|
|
|
+
|
|
//uncomment this line to see a full listing of the fields avail. to $node
|
|
//uncomment this line to see a full listing of the fields avail. to $node
|
|
//print '<pre>'.print_r($node,TRUE).'</pre>';
|
|
//print '<pre>'.print_r($node,TRUE).'</pre>';
|
|
|
|
+
|
|
?>
|
|
?>
|
|
|
|
|
|
|
|
+<div id="tripal_stock-relationships-box" class="tripal_stock-info-box tripal-info-box">
|
|
|
|
+<div class="tripal_stock-info-box-title tripal-info-box-title">Relationships</div>
|
|
|
|
+
|
|
<?php
|
|
<?php
|
|
- $relationships = $node->stock->stock_object_relationships;
|
|
|
|
|
|
+ /////////////////////////////////////////////////
|
|
|
|
+ // Subject Relationships
|
|
|
|
+ /////////////////////////////////////////////////
|
|
|
|
+
|
|
|
|
+ $relationships = $node->stock->stock_relationship->subject_id;
|
|
if (!$relationships) {
|
|
if (!$relationships) {
|
|
$relationships = array();
|
|
$relationships = array();
|
|
} elseif (!is_array($relationships)) {
|
|
} elseif (!is_array($relationships)) {
|
|
@@ -40,9 +56,8 @@
|
|
}
|
|
}
|
|
?>
|
|
?>
|
|
|
|
|
|
-<div id="tripal_stock-object_relationships-box" class="tripal_stock-info-box tripal-info-box">
|
|
|
|
- <div class="tripal_stock-info-box-title tripal-info-box-title">Object Relationships</div>
|
|
|
|
- <div class="tripal_stock-info-box-desc tripal-info-box-desc">The stock '<?php print $node->stock->name ?>' is the subject in the following relationships:</div>
|
|
|
|
|
|
+ <div class="tripal_stock-info-box-desc tripal-info-box-desc">Subject relationships</div>
|
|
|
|
+
|
|
<?php if(count($relationships) > 0){ ?>
|
|
<?php if(count($relationships) > 0){ ?>
|
|
<table class="tripal_stock-table tripal-table tripal-table-horz">
|
|
<table class="tripal_stock-table tripal-table tripal-table-horz">
|
|
<tr>
|
|
<tr>
|
|
@@ -70,6 +85,52 @@
|
|
<?php } //end of foreach?>
|
|
<?php } //end of foreach?>
|
|
</table>
|
|
</table>
|
|
<?php } else {
|
|
<?php } else {
|
|
- print '<b>There are no relationships where the current stock is the subject</b>';
|
|
|
|
|
|
+ print '<div class="tripal-no-results">There are no relationships where the current stock is the subject</div>';
|
|
} //end of if there are object relationships ?>
|
|
} //end of if there are object relationships ?>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+<?php
|
|
|
|
+ /////////////////////////////////////////////////
|
|
|
|
+ // Object Relationships
|
|
|
|
+ /////////////////////////////////////////////////
|
|
|
|
+
|
|
|
|
+ $relationships = $node->stock->stock_relationship->object_id;
|
|
|
|
+ if (!$relationships) {
|
|
|
|
+ $relationships = array();
|
|
|
|
+ } elseif (!is_array($relationships)) {
|
|
|
|
+ $relationships = array($relationships);
|
|
|
|
+ }
|
|
|
|
+?>
|
|
|
|
+
|
|
|
|
+ <br><br><div class="tripal_stock-info-box-desc tripal-info-box-desc">Object relationships</div>
|
|
|
|
+
|
|
|
|
+ <?php if(count($relationships) > 0){ ?>
|
|
|
|
+ <table class="tripal_stock-table tripal-table tripal-table-horz">
|
|
|
|
+ <tr>
|
|
|
|
+ <th>Subject</th>
|
|
|
|
+ <th>Type</th>
|
|
|
|
+ <th>Current Stock (Object)</th>
|
|
|
|
+ </tr>
|
|
|
|
+ <?php
|
|
|
|
+ $i = 0;
|
|
|
|
+ foreach ($relationships as $result){
|
|
|
|
+ $class = 'tripal_stock-table-odd-row tripal-table-odd-row';
|
|
|
|
+ if($i % 2 == 0 ){
|
|
|
|
+ $class = 'tripal_stock-table-odd-row tripal-table-even-row';
|
|
|
|
+ } ?>
|
|
|
|
+ <tr class="<?php print $class ?>">
|
|
|
|
+ <?php $subject = $result->subject_id;
|
|
|
|
+ if ($subject->nid) {?>
|
|
|
|
+ <td><?php print l($subject->name.' ('.$subject->uniquename.')', 'node/'.$subject->nid); ?></td>
|
|
|
|
+ <?php } else { ?>
|
|
|
|
+ <td><?php print $subject->name.' ('.$subject->uniquename.')'; ?></td>
|
|
|
|
+ <?php } ?>
|
|
|
|
+ <td><?php print $result->type_id->name; ?></td>
|
|
|
|
+ <td><?php print $node->stock->name; ?></td>
|
|
|
|
+ </tr>
|
|
|
|
+ <?php } //end of foreach?>
|
|
|
|
+ </table>
|
|
|
|
+ <?php } else {
|
|
|
|
+ print '<div class="tripal-no-results">There are no relationships where the current stock is the object.</div>';
|
|
|
|
+ } //end of if there are subject relationships ?>
|
|
</div>
|
|
</div>
|