function tripal_stock_block

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

Purpose: Implement Blocks relating to stock content

Parameters

$op: What kind of information to retrieve about the block or blocks. Possible values include list, configure, save, view.

$delta: Which block to return (not applicable if $op is 'list').

$edit: If $op is 'save', the submitted form data from the configuration form.

Return value

One of the following depending on $op: An array of block descriptions (list), the configuration form (configure), nothing (save), an array defining subject and content for the block indexed by $delta (view)

Related topics

File

tripal_stock/tripal_stock.module, line 917
Implements Tripal Stock Module hooks

Code

function tripal_stock_block($op = 'list', $delta = 0, $edit = array()) {
  switch ($op) {
    case 'list':
      $blocks['base']['info'] = t('Tripal Stock Details');
      $blocks['base']['cache'] = BLOCK_NO_CACHE;

      $blocks['properties']['info'] = t('Tripal Stock Properties');
      $blocks['properties']['cache'] = BLOCK_NO_CACHE;

      $blocks['references']['info'] = t('Tripal Stock References');
      $blocks['references']['cache'] = BLOCK_NO_CACHE;

      $blocks['relationships_as_object']['info'] = t('Tripal Stock Relationships');
      $blocks['relationships_as_object']['cache'] = BLOCK_NO_CACHE;

      $blocks['synonyms']['info'] = t('Tripal Stock Synonyms');
      $blocks['synonyms']['cache'] = BLOCK_NO_CACHE;

      $blocks['collections']['info'] = t('Tripal Stock Collections');
      $blocks['collections']['cache'] = BLOCK_NO_CACHE;

      $blocks['phenotypes']['info'] = t('Tripal Stock Phenotypes');
      $blocks['phenotypes']['cache'] = BLOCK_NO_CACHE;

      $blocks['genotypes']['info'] = t('Tripal Stock Genotypes');
      $blocks['genotypes']['cache'] = BLOCK_NO_CACHE;

      $blocks['locations']['info'] = t('Tripal Stock Locations');
      $blocks['locations']['cache'] = BLOCK_NO_CACHE;

      $blocks['orgstocks']['info'] = t('Tripal Organism Stocks');
      $blocks['orgstocks']['cache'] = BLOCK_NO_CACHE;



      return $blocks;

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

        $block = array();
        switch ($delta) {
          case 'base':
            $block['subject'] = t('Stock Details');
            $block['content'] = theme('tripal_stock_base', $node);
            break;

          case 'properties':
            $block['subject'] = t('Properties');
            $block['content'] = theme('tripal_stock_properties', $node);
            break;

          case 'references':
            $block['subject'] = t('References');
            $block['content'] = theme('tripal_stock_references', $node);
            break;

          case 'relationships':
            $block['subject'] = t('Relationships');
            $block['content'] = theme('tripal_stock_relationships', $node);
            break;

          case 'synonyms':
            $block['subject'] = t('Synonyms');
            $block['content'] = theme('tripal_stock_synonyms', $node);
            break;

          case 'collections':
            $block['subject'] = t('Stock Collections');
            $block['content'] = theme('tripal_stock_collections', $node);
            break;

          case 'phenotypes':
            $block['subject'] = t('Stock Phenotypes');
            $block['content'] = theme('tripal_stock_phenotypes', $node);
            break;

          case 'genotypes':
            $block['subject'] = t('Stock Genotypes');
            $block['content'] = theme('tripal_stock_genotypes', $node);
            break;

          case 'locations':
            $block['subject'] = t('Stock Locations');
            $block['content'] = theme('tripal_stock_locations', $node);
            break;

          case 'orgstocks':
            $block['subject'] = t('Organism Stocks');
            $block['content'] = theme('tripal_organism_stocks', $node);
            break;

        }
        return $block;
      }
  }
}