123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- <?php
- $feature = $variables['node']->feature;
- $alignments = $feature->all_featurelocs;
- if(count($alignments) > 0){ ?>
- <div class="tripal_feature-data-block-desc tripal-data-block-desc">The following features are aligned</div><?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
- $headers = array('Aligned Feature' ,'Feature Type', 'Alignment Location');
-
- // the $rows array contains an array of rows where each row is an array
- // of values for each column of the table in that row. Additional documentation
- // can be found here:
- // https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_table/7
- $rows = array();
-
- foreach ($alignments as $alignment){
- $feature_name = $alignment->name;
- if (property_exists($alignment, 'nid')) {
- $feature_name = l($feature_name, "node/" . $alignment->nid);
- }
- $feature_loc = '';
- $strand = '.';
- if ($alignment->strand == -1) {
- $strand = '-';
- }
- elseif ($alignment->strand == 1) {
- $strand = '+';
- }
-
- if(property_exists($alignment, 'right_feature')){
- $rstrand = '.';
- if ($alignment->right_strand == -1) {
- $rstrand = '-';
- }
- elseif ($alignment->right_strand == 1) {
- $rstrand = '+';
- }
- $feature_loc = $feature->name .":". ($alignment->fmin + 1) . ".." . $alignment->fmax . " " . $strand;
- $feature_loc .= "<br>" . $alignment->name .":". ($alignment->right_fmin + 1) . ".." . $alignment->right_fmax . " " . $rstrand;
- }
- else {
- $feature_loc = $alignment->name .":". ($alignment->fmin + 1) . ".." . $alignment->fmax . " " . $strand;
- }
-
- $rows[] = array(
- $feature_name,
- $alignment->type,
- $feature_loc
- );
- }
-
-
-
-
-
- $table = array(
- 'header' => $headers,
- 'rows' => $rows,
- 'attributes' => array(
- 'id' => 'tripal_feature-table-alignments',
- 'class' => 'tripal-data-table'
- ),
- 'sticky' => FALSE,
- 'caption' => '',
- 'colgroups' => array(),
- 'empty' => '',
- );
-
-
-
- print theme_table($table);
- }
|