function tripal_project_block

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

Display block with projects

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_project/tripal_project.module, line 431
This file contains the basic functions needed for this drupal module. The drupal tripal_project module maps directly to the chado general module.

Code

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

      $blocks['projectbase']['info'] = t('Tripal Project Details');
      $blocks['projectbase']['cache'] = BLOCK_NO_CACHE;

      $blocks['projectprops']['info'] = t('Tripal Project Properties');
      $blocks['projectprops']['cache'] = BLOCK_NO_CACHE;

      $blocks['projectpubs']['info'] = t('Tripal Project Publications');
      $blocks['projectpubs']['cache'] = BLOCK_NO_CACHE;

      $blocks['projectcont']['info'] = t('Tripal Project Contact');
      $blocks['projectcont']['cache'] = BLOCK_NO_CACHE;

      $blocks['projectrels']['info'] = t('Tripal Project Relationships');
      $blocks['projectrels']['cache'] = BLOCK_NO_CACHE;

      return $blocks;

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

        $block = array();
        switch ($delta) {
          case 'projectbase':
            $block['subject'] = t('Project Details');
            $block['content'] = theme('tripal_project_base', $node);
            break;
          case 'projectprops':
            $block['subject'] = t('Properties');
            $block['content'] = theme('tripal_project_properties', $node);
            break;
          case 'projectpubs':
            $block['subject'] = t('Publications');
            $block['content'] = theme('tripal_project_publications', $node);
            break;
          case 'projectcont':
            $block['subject'] = t('Contact');
            $block['content'] = theme('tripal_project_contact', $node);
            break;
          case 'projectrels':
            $block['subject'] = t('Relationships');
            $block['content'] = theme('tripal_project_relationships', $node);
            break;
          default :
        }
        return $block;
      }
  }
}