123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- <?php
- /**
- *
- * @param $form
- * @param string $form_state
- */
- function tripal_vocabulary_lookup_form($form, &$form_state = NULL) {
- }
- /**
- *
- * @param $form
- * @param $form_state
- */
- function tripal_vocabulary_lookup_form_validate($form, $form_state) {
- }
- /**
- *
- * @param $form
- * @param $form_state
- */
- function tripal_vocabulary_lookup_form_submit($form, $form_state) {
- }
- function tripal_vocabulary_lookup_page($vocabulary) {
- $vocab = tripal_get_vocabulary_details($vocabulary);
- // If we can't find the term then just return a message.
- if (!$vocab) {
- drupal_set_message('The vocabulary cannot be found on this site', 'error');
- return '';
- }
- $headers = array();
- $rows = array();
- $vocab_name = $vocab['name'];
- if ($vocab['url']) {
- $vocab_name = l($vocab['name'], $vocab['url'], array('attributes' => array('target' => '_blank')));
- }
- $short_name = $vocab['short_name'];
- $vocab_desc = $vocab['description'];
- $rows[] = array(
- array(
- 'data' => 'Name',
- 'header' => TRUE,
- 'width' => '20%',
- ),
- $vocab_name,
- );
- $rows[] = array(
- array(
- 'data' => 'Short Name',
- 'header' => TRUE,
- 'width' => '20%',
- ),
- $short_name,
- );
- $rows[] = array(
- array(
- 'data' => 'Description',
- 'header' => TRUE,
- 'width' => '20%',
- ),
- $vocab_desc,
- );
- $table = array(
- 'header' => $headers,
- 'rows' => $rows,
- 'attributes' => array(),
- 'sticky' => FALSE,
- 'caption' => 'Vocabulary details',
- 'colgroups' => array(),
- 'empty' => '',
- );
- $content = theme_table($table);
- return $content;
- }
- /**
- *
- * @param $vocabulary
- * @param $accession
- *
- * @return
- */
- function tripal_vocabulary_lookup_term_page($vocabulary, $accession) {
- $term = tripal_get_term_details($vocabulary, $accession);
- // If we can't find the term then just return a message.
- if (!$term) {
- drupal_set_message('The term cannot be found on this site', 'error');
- return '';
- }
- // Build the Term table.
- $headers = array();
- $rows = array();
- $term_name = $term['name'];
- $accession = $term['vocabulary']['short_name'] . ':' . $term['accession'];
- if ($term['url']) {
- $term_name = l($term['name'], $term['url'], array('attributes' => array('target' => '_blank')));
- }
- $rows[] = array(
- array(
- 'data' => 'Term',
- 'header' => TRUE,
- 'width' => '20%',
- ),
- $accession,
- );
- $rows[] = array(
- array(
- 'data' => 'Name',
- 'header' => TRUE,
- 'width' => '20%',
- ),
- $term_name,
- );
- $rows[] = array(
- array(
- 'data' => 'Definition',
- 'header' => TRUE,
- 'width' => '20%',
- ),
- $term['definition'],
- );
- $table = array(
- 'header' => $headers,
- 'rows' => $rows,
- 'attributes' => array(),
- 'sticky' => FALSE,
- 'caption' => 'Term Details',
- 'colgroups' => array(),
- 'empty' => '',
- );
- $content = theme_table($table);
- $rows = array();
- $vocab_name = $term['vocabulary']['name'];
- if ($term['vocabulary']['url']) {
- $vocab_name = l($term['vocabulary']['name'], $term['vocabulary']['url'], array('attributes' => array('target' => '_blank')));
- }
- $short_name = $term['vocabulary']['short_name'];
- $vocab_desc = $term['vocabulary']['description'];
- $rows[] = array(
- array(
- 'data' => 'Name',
- 'header' => TRUE,
- 'width' => '20%',
- ),
- $vocab_name,
- );
- $rows[] = array(
- array(
- 'data' => 'Short Name',
- 'header' => TRUE,
- 'width' => '20%',
- ),
- $short_name,
- );
- $rows[] = array(
- array(
- 'data' => 'Description',
- 'header' => TRUE,
- 'width' => '20%',
- ),
- $vocab_desc,
- );
- $table = array(
- 'header' => $headers,
- 'rows' => $rows,
- 'attributes' => array(),
- 'sticky' => FALSE,
- 'caption' => 'Term Vocabulary details',
- 'colgroups' => array(),
- 'empty' => '',
- );
- $content .= theme_table($table);
- return $content;
- }
|