123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- <?php
- $feature = $variables['node']->feature;
- $all_relationships = $feature->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_feature-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){
-
- switch ($rel_type) {
- case 'integral part of':
- case 'instance of':
- $verb = 'is an';
- break;
- case 'proper part of':
- case 'transformation of':
- case 'genome of':
- case 'part of':
- case 'position of':
- case 'sequence of':
- case 'variant of':
- $verb = 'is a';
- break;
- case 'derives from':
- case 'connects on':
- case 'contains':
- case 'finishes':
- case 'guides':
- case 'has origin':
- case 'has part':
- case 'has quality':
- case 'is consecutive sequence of':
- case 'maximally overlaps':
- case 'overlaps':
- case 'starts':
- $verb = '';
- break;
- default:
- $verb = 'is';
- } ?>
- <p>This <?php print $feature->type_id->name;?> <?php print $verb ?> <?php print $rel_type ?> the following <b><?php print $obj_type ?></b> feature(s): <?php
-
-
-
- $headers = array('Feature Name' ,'Unique Name', 'Species', 'Type');
-
-
-
-
- $rows = array();
- foreach ($objects as $object){
-
- $feature_name = $object->record->object_id->name;
- if (property_exists($object->record, 'nid')) {
- $feature_name = l($feature_name, "node/" . $object->record->nid, array('attributes' => array('target' => "_blank")));
- }
-
- $organism = $object->record->object_id->organism_id;
- $organism_name = $organism->genus ." " . $organism->species;
- if (property_exists($organism, 'nid')) {
- $organism_name = l("<i>" . $organism->genus . " " . $organism->species . "</i>", "node/" . $organism->nid, array('html' => TRUE));
- }
- $rows[] = array(
- array('data' => $feature_name, 'width' => '30%'),
- array('data' => $object->record->object_id->uniquename, 'width' => '30%'),
- array('data' => $organism_name, 'width' => '30%'),
- array('data' => $object->record->object_id->type_id->name, 'width' => '10%'),
- );
- }
-
-
-
-
- $table = array(
- 'header' => $headers,
- 'rows' => $rows,
- 'attributes' => array(
- 'id' => 'tripal_feature-table-relationship-object',
- 'class' => 'tripal-data-table'
- ),
- 'sticky' => FALSE,
- 'caption' => '',
- 'colgroups' => array(),
- 'empty' => '',
- );
-
-
- print theme_table($table); ?>
- </p>
- <br><?php
- }
- }
-
- foreach ($object_rels as $rel_type => $rels){
- foreach ($rels as $subject_type => $subjects){
-
- switch ($rel_type) {
- case 'integral part of':
- case 'instance of':
- $verb = 'are an';
- break;
- case 'proper part of':
- case 'transformation of':
- case 'genome of':
- case 'part of':
- case 'position of':
- case 'sequence of':
- case 'variant of':
- $verb = 'are a';
- break;
- case 'derives from':
- case 'connects on':
- case 'contains':
- case 'finishes':
- case 'guides':
- case 'has origin':
- case 'has part':
- case 'has quality':
- case 'is consecutive sequence of':
- case 'maximally overlaps':
- case 'overlaps':
- case 'starts':
- $verb = '';
- break;
- default:
- $verb = 'are';
- } ?>
- <p>The following <b><?php print $subjects[0]->record->subject_id->type_id->name ?></b> feature(s) <?php print $verb ?> <?php print $rel_type ?> this <?php print $feature->type_id->name;?>: <?php
-
-
-
- $headers = array('Feature Name' ,'Unique Name', 'Species', 'Type');
-
-
-
-
- $rows = array();
- foreach ($subjects as $subject){
-
- $feature_name = $subject->record->subject_id->name;
- if (property_exists($subject->record, 'nid')) {
- $feature_name = l($feature_name, "node/" . $subject->record->nid, array('attributes' => array('target' => "_blank")));
- }
-
- $organism = $subject->record->subject_id->organism_id;
- $organism_name = $organism->genus ." " . $organism->species;
- if (property_exists($organism, 'nid')) {
- $organism_name = l("<i>" . $organism->genus . " " . $organism->species . "</i>", "node/" . $organism->nid, array('html' => TRUE));
- }
- $rows[] = array(
- array('data' => $feature_name, 'width' => '30%'),
- array('data' =>$subject->record->subject_id->uniquename, 'width' => '30%'),
- array('data' =>$organism_name, 'width' => '30%'),
- array('data' =>$subject->record->subject_id->type_id->name, 'width' => '10%'),
- );
- }
-
-
-
-
- $table = array(
- 'header' => $headers,
- 'rows' => $rows,
- 'attributes' => array(
- 'id' => 'tripal_feature-table-relationship-subject',
- 'class' => 'tripal-data-table'
- ),
- 'sticky' => FALSE,
- 'caption' => '',
- 'colgroups' => array(),
- 'empty' => '',
- );
-
-
- print theme_table($table); ?>
- </p>
- <br><?php
- }
- }
- }
|