node-chado_feature.tpl.php 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <?php if ($picture) {
  2. print $picture;
  3. $feature = $node->feature;
  4. $accession = $node->accession;
  5. }?>
  6. <div class="node<?php if ($sticky) { print " sticky"; } ?><?php if (!$status) { print " node-unpublished"; } ?>">
  7. <?php if ($page == 0) { ?><h2 class="nodeTitle"><a href="<?php print $node_url?>"><?php print $title?></a>
  8. <?php global $base_url;
  9. if ($sticky) { print '<img src="'.base_path(). drupal_get_path('theme','sanqreal').'/img/sticky.gif" alt="sticky icon" class="sticky" />'; } ?>
  10. </h2><?php }; ?>
  11. <?php if (!$teaser): ?>
  12. <?php if ($submitted): ?>
  13. <div class="metanode"><p><?php print t('') .'<span class="author">'. theme('username', $node).'</span>' . t(' - Posted on ') . '<span class="date">'.format_date($node->created, 'custom', "d F Y").'</span>'; ?></p></div>
  14. <?php endif; ?>
  15. <!-- theme_tripal_feature_feature_id -->
  16. <!--<div id="feature_notice"><img src="sites/all/modules/tripal_analysis_blast/images/info-128x128.png"><br><i>Feature information and annotations have moved. See below</i></div>-->
  17. <div id="feature-view">
  18. <?php
  19. if($feature->is_obsolete == 't'){
  20. drupal_set_message(t('This feature is obsolete and no longer used in analysis, but is here for reference.'));
  21. }?>
  22. <table class="tripal_table_vert">
  23. <tr><th>Name</th><td><?php print $feature->featurename; ?></td></tr>
  24. <tr><th nowrap>Unique Name</th><td><?php print $feature->uniquename; ?></td></tr>
  25. <tr><th>Internal ID</th><td><?php print $accession; ?></td></tr>
  26. <tr><th>Length</th><td><?php print $feature->seqlen ?></td></tr>
  27. <tr><th>Type</th><td><?php print $feature->cvname; ?></td>
  28. </tr>
  29. <?php $org_url = url("node/$org_nid")?>
  30. <tr>
  31. <th>Organism</th>
  32. <td>
  33. <?php if ($org_nid) {?>
  34. <a href="<?php print $org_url?>"><?php print $feature->common_name?></a>
  35. <?php
  36. } else {
  37. if ($feature->common_name) {
  38. print $feature->common_name;
  39. } else {
  40. // This sql is for the preview to show organism common_name
  41. $sql = "SELECT common_name FROM organism WHERE organism_id = $node->organism_id";
  42. $previous_db = db_set_active('chado');
  43. $org_commonname = db_result(db_query($sql));
  44. print $org_commonname;
  45. db_set_active($previous_db);
  46. }
  47. }
  48. ?>
  49. </td>
  50. </tr>
  51. <!-- Add library information which this feature belongs to-->
  52. <?php if ($node->lib_additions) { ?>
  53. <tr><th>Library</th><td>
  54. <?php
  55. $libraries = $node->lib_additions;
  56. foreach ($libraries as $lib_url => $lib_name) {
  57. // Check if library exists as a node in drupal
  58. if ($lib_url) {
  59. ?>
  60. <a href="<?php print $lib_url?>"><?php print $lib_name?></a><BR>
  61. <?php
  62. } else {
  63. print $lib_name;
  64. }
  65. }
  66. ?>
  67. </td></tr>
  68. <?php } ?>
  69. <!-- End of library addition -->
  70. <!-- theme_tripal_feature_feature_synonyms -->
  71. <?php
  72. $synonyms = $node->synonyms;
  73. if(count($synonyms) > 0){
  74. ?>
  75. <tr><th>Synonyms</th><td>
  76. <?php
  77. // iterate through each synonym
  78. if (is_array($synonyms)) {
  79. foreach ($synonyms as $result){
  80. print $result->name."<br>";
  81. }
  82. } else {
  83. print $synonyms;
  84. }
  85. ?>
  86. </td></tr>
  87. <?php } ?>
  88. <!-- End of theme_tripal_feature_feature_synonyms -->
  89. </table>
  90. </div>
  91. <!-- End of theme_tripal_feature_feature_id -->
  92. <?php endif; ?>
  93. <div class="content">
  94. <?php if (!$teaser): ?>
  95. <!-- Control link for the expandableBoxes -->
  96. <br><a id="tripal_expandableBox_toggle_button" onClick="toggleExpandableBoxes()">[-] Collapse All</a><br><br>
  97. <!-- End of Control link for the expandableBoxes -->
  98. <!-- Start of sequences -->
  99. <div id="feature-sequence" class="tripal_feature-info-box">
  100. <div class="tripal_expandableBox"><h3>Sequence</h3></div>
  101. <div class="tripal_expandableBoxContent">
  102. <?php print ucfirst($feature->cvname); ?> sequence
  103. <pre><?php print ereg_replace("(.{100})","\\1<br>",$feature->residues); ?></pre>
  104. <?php
  105. if(count($orelationships) > 0){
  106. foreach ($orelationships as $result){
  107. print "<br>" . ucfirst($result->subject_type) . " sequence";
  108. print "<pre>" . ereg_replace("(.{100})","\\1<br>",$result->subject_residues) . "</pre>";
  109. }
  110. }
  111. ?>
  112. </div></div>
  113. <!-- End of sequences -->
  114. <!-- Start of theme_tripal_feature_feature_references -->
  115. <?php
  116. $references = $node->references;
  117. if(count($references) > 0){
  118. ?>
  119. <div id="feature-references" class="tripal_feature-info-box">
  120. <div class="tripal_expandableBox"><h3>References</h3></div>
  121. <div class="tripal_expandableBoxContent">
  122. <table>
  123. <tr>
  124. <th>Dababase</th>
  125. <th>Accession</th>
  126. </tr>
  127. <?php
  128. foreach ($references as $result){
  129. ?>
  130. <tr>
  131. <td><?php print $result->db_name?></td>
  132. <td><?php if($result->urlprefix){ ?><a href="<?php print $result->urlprefix.$result->accession?>"><?php print $result->accession?></a><?php } else { print $result->accession; } ?></td>
  133. </tr>
  134. <?php } ?>
  135. </table></div></div>
  136. <?php } ?>
  137. <!-- End of theme_tripal_feature_feature_references -->
  138. <!-- Start of theme_tripal_feature_feature_relationships -->
  139. <?php
  140. $orelationships = $node->orelationships;
  141. if(count($orelationships) > 0 or count($srelationships) > 0){
  142. print "<div id=\"feature-relationships\" class=\"tripal_feature-info-box\">";
  143. print "<div class=\"tripal_expandableBox\"><h3>Relationships</h3></div>";
  144. print "<div class=\"tripal_expandableBoxContent\">";
  145. if(count($orelationships) > 0){
  146. foreach ($orelationships as $result){
  147. if(isset($result->subject_nid)){
  148. print "<a href=\"" . url("node/$result->subject_nid") . "\">$result->subject_name ($result->subject_type)</a> ";
  149. } else {
  150. print "$result->subject_name ($result->subject_type) ";
  151. }
  152. print "<b>$result->rel_type</b> ";
  153. if(isset($result->object_nid)){
  154. print "<a href=\"" . url("node/$result->object_nid") . "\">$result->object_name ($result->object_type)</a> ";
  155. } else {
  156. print "$result->object_name ($result->object_type) ";
  157. }
  158. print"<br>";
  159. }
  160. }
  161. if(count($srelationships) > 0){
  162. foreach ($srelationships as $result){
  163. if(isset($result->subject_nid)){
  164. print "<a href=\"" . url("node/$result->subject_nid") . "\">$result->subject_name ($result->subject_type)</a> ";
  165. } else {
  166. print "$result->subject_name ($result->subject_type) ";
  167. }
  168. print "<b>$result->rel_type</b> ";
  169. if(isset($result->object_nid)){
  170. print "<a href=\"" . url("node/$result->object_nid") . "\">$result->object_name ($result->object_type)</a> ";
  171. } else {
  172. print "$result->object_name ($result->object_type) ";
  173. }
  174. print"<br>";
  175. }
  176. }
  177. print "</div></div>";
  178. }
  179. ?>
  180. <!-- End of theme_tripal_feature_feature_relationships -->
  181. <?php endif; ?>
  182. <?php print $content?>
  183. </div>
  184. <?php if (!$teaser): ?>
  185. <?php if ($links) { ?><div class="links"><?php print $links?></div><?php }; ?>
  186. <?php endif; ?>
  187. <?php if ($teaser): ?>
  188. <?php if ($links) { ?><div class="linksteaser"><div class="links"><?php print $links?></div></div><?php }; ?>
  189. <?php endif; ?>
  190. <?php if (!$teaser): ?>
  191. <?php if ($terms) { ?><div class="taxonomy"><span><?php print t('tags') ?></span> <?php print $terms?></div><?php } ?>
  192. <?php endif; ?>
  193. </div>