function tripal_library_block

1.x tripal_library.module tripal_library_block($op = 'list', $delta = '0', $edit = array())

Display block with libraries

Parameters

op - parameter to define the phase being called for the block:

delta - id of the block to return (ignored when op is list):

edit - when op is save, contains the submitted form data:

Related topics

File

tripal_library/tripal_library.module, line 718

Code

function tripal_library_block($op = 'list', $delta = '0', $edit = array()) {
  switch ($op) {
    case 'list':

      $blocks['libreferences']['info'] = t('Tripal Library Cross References');
      $blocks['libreferences']['cache'] = BLOCK_NO_CACHE;

      $blocks['libbase']['info'] = t('Tripal Library Details');
      $blocks['libbase']['cache'] = BLOCK_NO_CACHE;

      $blocks['libterms']['info'] = t('Tripal Library Terms');
      $blocks['libterms']['cache'] = BLOCK_NO_CACHE;

      $blocks['libsynonyms']['info'] = t('Tripal Library Synonyms');
      $blocks['libsynonyms']['cache'] = BLOCK_NO_CACHE;

      $blocks['libproperties']['info'] = t('Tripal Library Properties');
      $blocks['libproperties']['cache'] = BLOCK_NO_CACHE;

      $blocks['featurelibs']['info'] = t('Tripal Feature Libraries');
      $blocks['featurelibs']['cache'] = BLOCK_NO_CACHE;

      $blocks['orglibs']['info'] = t('Tripal Organism Libraries');
      $blocks['orglibs']['cache'] = BLOCK_NO_CACHE;

      return $blocks;

    case 'view':
      if (user_access('access chado_library content') and arg(0) == 'node' and is_numeric(arg(1))) {
        $nid = arg(1);
        $node = node_load($nid);

        $block = array();
        switch ($delta) {
          case 'libreferences':
            $block['subject'] = t('Cross References');
            $block['content'] = theme('tripal_library_references', $node);
            break;
          case 'libbase':
            $block['subject'] = t('Library Details');
            $block['content'] = theme('tripal_library_base', $node);
            break;
          case 'libsynonyms':
            $block['subject'] = t('Synonyms');
            $block['content'] = theme('tripal_library_synonyms', $node);
            break;
          case 'libproperties':
            $block['subject'] = t('Properties');
            $block['content'] = theme('tripal_library_properties', $node);
            break;
          case 'libterms':
            $block['subject'] = t('Library Terms');
            $block['content'] = theme('tripal_library_terms', $node);
            break;
          case 'featurelibs':
            $block['subject'] = t('Libraries');
            $block['content'] = theme('tripal_feature_libraries', $node);
            break;
          case 'orglibs':
            $block['subject'] = t('Libraries');
            $block['content'] = theme('tripal_organism_libraries', $node);
            break;
          default :
        }
        return $block;
      }
  }
}