array( 'title' => t('Administer Natural Diversity Module'), 'description' => t('Allow users to administer the natural diversity module.'), ), ); } /** * Menu items are automatically added for the new node types created * by this module to the 'Create Content' Navigation menu item. This function * adds more menu items needed for this module. * * @ingroup tripal_natural_diversity */ function tripal_natural_diversity_menu() { $items = array(); // the administative settings menu $items['admin/tripal/chado/tripal_natdiv'] = array( 'title' => 'Natural Diversity Experiments', 'description' => 'Experiments relating to natural diversity such as genotype and phenotype experiments.', 'page callback' => 'tripal_natural_diversity_admin_natdiv_view', 'access arguments' => array('adminster tripal nd'), 'type' => MENU_NORMAL_ITEM, ); $items['admin/tripal/chado/tripal_natdiv/help'] = array( 'title' => 'Help', 'description' => ('Help for the Tripal natural diversity module.'), 'page callback' => 'theme', 'page arguments' => array('tripal_natural_diversity_help'), 'access arguments' => array('administer tripal nd'), 'type' => MENU_LOCAL_TASK, 'weight' => 10 ); $items['admin/tripal/chado/tripal_natdiv/views/natdiv_exp/enable'] = array( 'title' => 'Enable Natural Diversity Administrative View', 'page callback' => 'tripal_views_admin_enable_view', 'page arguments' => array('tripal_natural_diversity_admin_natdiv_exp', 'admin/tripal/chado/tripal_natdiv'), 'access arguments' => array('administer tripal nd'), 'type' => MENU_CALLBACK, ); return $items; } /** * Implements hook_views_api() * Purpose: Essentially this hook tells drupal that there is views support for * for this module which then includes tripal_natural_diversity.views.inc where all the * views integration code is * * @ingroup tripal_natural_diversity */ function tripal_natural_diversity_views_api() { return array( 'api' => 3.0, ); } /** * Implements hook_theme * * @ingroup tripal_natural_diversity */ function tripal_natural_diversity_theme($existing, $type, $theme, $path) { $core_path = drupal_get_path('module', 'tripal_core'); $items = array( // tripal_feature templates 'tripal_feature_nd_genotypes' => array( 'variables' => array('node' => NULL), 'template' => 'tripal_feature.nd_genotypes', 'path' => "$path/theme/tripal_feature", ), // tripal_stock templates 'tripal_stock_nd_genotypes' => array( 'variables' => array('node' => NULL), 'template' => 'tripal_stock.nd_genotypes', 'path' => "$path/theme/tripal_stock", ), 'tripal_stock_nd_phenotypes' => array( 'variables' => array('node' => NULL), 'template' => 'tripal_stock.nd_phenotypes', 'path' => "$path/theme/tripal_stock", ), 'tripal_natural_diversity_help' => array( 'template' => 'tripal_natural_diversity.help', 'variables' => array(NULL), 'path' => "$path/theme", ), ); return $items; } /** * @ingroup tripal_library */ function tripal_natural_diversity_block_info() { $blocks['ndfgenotype']['info'] = t('Tripal Natural Diversity Feature Genotypes'); $blocks['ndfgenotype']['cache'] = 'BLOCK_NO_CACHE'; $blocks['ndsgenotype']['info'] = t('Tripal Natural Diversity Library Genotypes'); $blocks['ndsgenotype']['cache'] = 'BLOCK_NO_CACHE'; $blocks['ndsphenotype']['info'] = t('Tripal Natural Diversity Stock Phenotypes'); $blocks['ndsphenotype']['cache'] = 'BLOCK_NO_CACHE'; return $blocks; } /** * @ingroup tripal_library */ function tripal_natural_diversity_block_view($delta = '') { 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 'ndfgenotype': $block['subject'] = t('Genotypes'); $block['content'] = theme('tripal_feature_nd_genotypes', $node); break; case 'ndsgenotype': $block['subject'] = t('Stock Genotypes'); $block['content'] = theme('tripal_stock_nd_genotypes', $node); break; case 'ndsphenotype': $block['subject'] = t('Phenotypes'); $block['content'] = theme('tripal_stock_nd_phenotypes', $node); break; default : } return $block; } } /** * * @ingroup tripal_natural_diversity */ function tripal_natural_diversity_node_view($node, $view_mode, $langcode) { switch ($node->type) { case 'chado_feature': if ($view_mode == 'full') { // the tripal_genetic module provides a tripal_feature_genotype // template. if the tripal_genetic content is present get rid of it as this // module superceeds it. if (array_key_exists('tripal_feature_genotypes', $node->content)) { unset($node->content['tripal_feature_genotypes']); } $node->content['tripal_feature_nd_genotypes'] = array( '#value' => theme('tripal_feature_nd_genotypes', array('node' => $node)), ); } break; case 'chado_stock': if ($view_mode == 'full') { // the tripal_genetic module provides a tripal_stock_genotype // template. if the tripal_genetic content is present get rid of it as this // module superceeds it. if (array_key_exists('tripal_stock_genotypes', $node->content)) { unset($node->content['tripal_stock_genotypes']); } $node->content['tripal_stock_nd_genotypes'] = array( '#value' => theme('tripal_stock_nd_genotypes', array('node' => $node)), ); $node->content['tripal_stock_nd_phenotypes'] = array( '#value' => theme('tripal_stock_nd_phenotypes', array('node' => $node)), ); } break; } }