|
@@ -1,6 +1,7 @@
|
|
|
<?php
|
|
|
|
|
|
require_once('api/tripal_natural_diversity.api.inc');
|
|
|
+require_once('theme/tripal_natural_diversity.theme.inc');
|
|
|
require_once('includes/tripal_natural_diversity.schema.inc');
|
|
|
require_once('includes/tripal_natural_diversity.admin.inc');
|
|
|
/**
|
|
@@ -35,13 +36,13 @@ function tripal_natural_diversity_menu() {
|
|
|
);
|
|
|
|
|
|
$items['admin/tripal/chado/tripal_natdiv/help'] = array(
|
|
|
- 'title' => 'Help',
|
|
|
- 'description' => "A description of the Tripal natural_diversity module including a short description of it's usage.",
|
|
|
- 'page callback' => 'theme',
|
|
|
- 'page arguments' => array('tripal_natdiv_help'),
|
|
|
- 'access arguments' => array('adminster tripal natural_diversity'),
|
|
|
- 'type' => MENU_LOCAL_TASK,
|
|
|
- 'weight' => 10
|
|
|
+ '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 natual_diversity'),
|
|
|
+ 'type' => MENU_LOCAL_TASK,
|
|
|
+ 'weight' => 10
|
|
|
);
|
|
|
|
|
|
$items['admin/tripal/chado/tripal_natdiv/views/natdiv_exp/enable'] = array(
|
|
@@ -74,30 +75,31 @@ function tripal_natural_diversity_views_api() {
|
|
|
*
|
|
|
* @ingroup tripal_natural_diversity
|
|
|
*/
|
|
|
-function tripal_natural_diversity_theme() {
|
|
|
- $theme_path = drupal_get_path('module', 'tripal_natural_diversity') . '/theme';
|
|
|
+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(
|
|
|
- 'arguments' => array('node' => NULL),
|
|
|
- 'template' => 'tripal_feature_nd_genotypes',
|
|
|
- 'path' => "$theme_path/tripal_feature",
|
|
|
+ 'variables' => array('node' => NULL),
|
|
|
+ 'template' => 'tripal_feature.nd_genotypes',
|
|
|
+ 'path' => "$path/theme/tripal_feature",
|
|
|
),
|
|
|
// tripal_stock templates
|
|
|
'tripal_stock_nd_genotypes' => array(
|
|
|
- 'arguments' => array('node' => NULL),
|
|
|
- 'template' => 'tripal_stock_nd_genotypes',
|
|
|
- 'path' => "$theme_path/tripal_stock",
|
|
|
+ 'variables' => array('node' => NULL),
|
|
|
+ 'template' => 'tripal_stock.nd_genotypes',
|
|
|
+ 'path' => "$path/theme/tripal_stock",
|
|
|
),
|
|
|
'tripal_stock_nd_phenotypes' => array(
|
|
|
- 'arguments' => array('node' => NULL),
|
|
|
- 'template' => 'tripal_stock_nd_phenotypes',
|
|
|
- 'path' => "$theme_path/tripal_stock",
|
|
|
+ 'variables' => array('node' => NULL),
|
|
|
+ 'template' => 'tripal_stock.nd_phenotypes',
|
|
|
+ 'path' => "$path/theme/tripal_stock",
|
|
|
),
|
|
|
- 'tripal_natdiv_help' => array(
|
|
|
- 'template' => 'tripal_natdiv_help',
|
|
|
+ 'tripal_natural_diversity_help' => array(
|
|
|
+ 'template' => 'tripal_natural_diversity.help',
|
|
|
'variables' => array(NULL),
|
|
|
- 'path' => "$theme_path",
|
|
|
+ 'path' => "$path/theme",
|
|
|
),
|
|
|
);
|
|
|
return $items;
|
|
@@ -130,19 +132,19 @@ function tripal_natural_diversity_block_view($delta = '') {
|
|
|
|
|
|
$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 :
|
|
|
+ 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;
|
|
|
}
|
|
@@ -151,31 +153,36 @@ function tripal_natural_diversity_block_view($delta = '') {
|
|
|
*
|
|
|
* @ingroup tripal_natural_diversity
|
|
|
*/
|
|
|
-function tripal_natural_diversity_node_view(&$node, $view_mode, $langcode) {
|
|
|
- if ($node->type == 'chado_feature') {
|
|
|
- // the tripal_genetic module provides a tripal_feature_genotype
|
|
|
- // template. The only difference between them is the addition of
|
|
|
- // project information by this module's template. Therefore,
|
|
|
- // if the tripal_genetic content is present get rid of as this
|
|
|
- // module superceeds it.
|
|
|
+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', $node),
|
|
|
+ '#value' => theme('tripal_feature_nd_genotypes', array('node' => $node)),
|
|
|
);
|
|
|
}
|
|
|
- }
|
|
|
- if ($node->type == 'chado_stock') {
|
|
|
+ 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', $node),
|
|
|
+ '#value' => theme('tripal_stock_nd_genotypes', array('node' => $node)),
|
|
|
);
|
|
|
$node->content['tripal_stock_nd_phenotypes'] = array(
|
|
|
- '#value' => theme('tripal_stock_nd_phenotypes', $node),
|
|
|
+ '#value' => theme('tripal_stock_nd_phenotypes', array('node' => $node)),
|
|
|
);
|
|
|
}
|
|
|
- }
|
|
|
- break;
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|