|
@@ -38,13 +38,13 @@ function tripal_entities_menu() {
|
|
|
);
|
|
|
|
|
|
// The default tab.
|
|
|
- $items['admin/tripal/bio_data/default'] = array(
|
|
|
+ $items['admin/tripal/BioData/default'] = array(
|
|
|
'title' => 'Biological Data',
|
|
|
'type' => MENU_DEFAULT_LOCAL_TASK,
|
|
|
'weight' => 1,
|
|
|
);
|
|
|
|
|
|
- $items['admin/tripal/bio_data/publish'] = array(
|
|
|
+ $items['admin/tripal/BioData/publish'] = array(
|
|
|
'title' => 'Publish',
|
|
|
'description' => 'Publish Data',
|
|
|
'page callback' => 'tripal_entities_publish',
|
|
@@ -53,7 +53,7 @@ function tripal_entities_menu() {
|
|
|
'type' => MENU_LOCAL_TASK,
|
|
|
'weight' => 2
|
|
|
);
|
|
|
- $items['admin/tripal/bio_data/publish/%'] = array(
|
|
|
+ $items['admin/tripal/BioData/publish/%'] = array(
|
|
|
'title' => 'Publish',
|
|
|
'description' => 'Publish Data',
|
|
|
'page callback' => 'tripal_entities_publish',
|
|
@@ -63,7 +63,7 @@ function tripal_entities_menu() {
|
|
|
'type' => MENU_CALLBACK,
|
|
|
);
|
|
|
|
|
|
- $items['admin/tripal/bio_data/access'] = array(
|
|
|
+ $items['admin/tripal/BioData/access'] = array(
|
|
|
'title' => 'Access',
|
|
|
'description' => 'Set default access permissions for collections of data.',
|
|
|
'page callback' => 'drupal_get_form',
|
|
@@ -153,13 +153,13 @@ function tripal_entities_entity_info() {
|
|
|
$entities = array();
|
|
|
|
|
|
// Get a list of published vocabularies from 'tripal_vocabulary
|
|
|
- $published_vocs = chado_generate_var('tripal_vocabulary', array('publish' => 1), array('return_array' => 1));
|
|
|
+// $published_vocs = chado_generate_var('tripal_vocabulary', array('publish' => 1), array('return_array' => 1));
|
|
|
|
|
|
- foreach ($published_vocs as $voc) {
|
|
|
- $entities[$voc->db_id->name] = array (
|
|
|
+// foreach ($published_vocs as $voc) {
|
|
|
+ $entities['BioData'] = array (
|
|
|
// A human readable label to identify our entity.
|
|
|
- 'label' => $voc->db_id->name . ' (' . $voc->cv_id->name . ')',
|
|
|
- 'plural label' => $voc->db_id->name . ' (' . $voc->cv_id->name . ')',
|
|
|
+ 'label' => 'Biological Data',
|
|
|
+ 'plural label' => 'Biological Data',
|
|
|
|
|
|
// The entity class and controller class extend the classes provided by the
|
|
|
// Entity API.
|
|
@@ -202,7 +202,7 @@ function tripal_entities_entity_info() {
|
|
|
// key here is mean to appear on the 'Find Content' page of the
|
|
|
// administrative menu.
|
|
|
'admin ui' => array (
|
|
|
- 'path' => 'admin/content/bio_data',
|
|
|
+ 'path' => 'admin/content/BioData',
|
|
|
'controller class' => 'TripalEntityUIController',
|
|
|
'menu wildcard' => '%tripal_entity',
|
|
|
'file' => 'includes/TripalEntityUIController.inc'
|
|
@@ -219,8 +219,8 @@ function tripal_entities_entity_info() {
|
|
|
)
|
|
|
);
|
|
|
// The entity that holds information about the entity types.
|
|
|
- $entities [$voc->db_id->name . '_bundle'] = array (
|
|
|
- 'label' => $voc->db_id->name . ' (' . $voc->cv_id->name . ') Data Type',
|
|
|
+ $entities ['BioData_bundles'] = array (
|
|
|
+ 'label' => 'Biological Data Type', //$voc->db_id->name . ' (' . $voc->cv_id->name . ') Data Type',
|
|
|
'entity class' => 'TripalBundle',
|
|
|
'controller class' => 'TripalBundleController',
|
|
|
'base table' => 'tripal_bundle',
|
|
@@ -235,13 +235,13 @@ function tripal_entities_entity_info() {
|
|
|
'module' => 'tripal_entities',
|
|
|
// Enable the entity API's admin UI.
|
|
|
'admin ui' => array (
|
|
|
- 'path' => 'admin/structure/bio_data/' . $voc->db_id->name,
|
|
|
+ 'path' => 'admin/structure/BioData', // . $voc->db_id->name,
|
|
|
'controller class' => 'TripalBundleUIController',
|
|
|
'file' => 'includes/TripalBundleUIController.inc',
|
|
|
'menu wildcard' => '%tripal_bundle',
|
|
|
)
|
|
|
);
|
|
|
- }
|
|
|
+// }
|
|
|
return $entities;
|
|
|
}
|
|
|
/**
|
|
@@ -261,16 +261,16 @@ function tripal_entities_entity_info_alter(&$entity_info) {
|
|
|
// associated with a base entity type.
|
|
|
// We want to dynamically add the bundles (or term types) to the entity.
|
|
|
$cvterm = $term->cvterm_id;
|
|
|
- $entity_type = $cvterm->dbxref_id->db_id->name;
|
|
|
+ $entity_type = 'BioData'; // $cvterm->dbxref_id->db_id->name;
|
|
|
$accession = $cvterm->dbxref_id->accession;
|
|
|
- $bundle_id = $entity_type . '_' . $accession;
|
|
|
+ $bundle_id = $cvterm->dbxref_id->db_id->name . '_' . $accession;
|
|
|
|
|
|
$label = preg_replace('/_/', ' ', ucwords($cvterm->name));
|
|
|
$entity_info[$entity_type]['bundles'][$bundle_id] = array (
|
|
|
'label' => $label,
|
|
|
'admin' => array (
|
|
|
- 'path' => 'admin/structure/bio_data/' . $entity_type . '/manage/%tripal_bundle',
|
|
|
- 'real path' => 'admin/structure/bio_data/' . $entity_type . '/manage/' . $bundle_id,
|
|
|
+ 'path' => 'admin/structure/BioData/manage/%tripal_bundle',
|
|
|
+ 'real path' => 'admin/structure/BioData/manage/' . $bundle_id,
|
|
|
'bundle argument' => 5,
|
|
|
'access arguments' => array (
|
|
|
'administer tripal data types'
|
|
@@ -317,7 +317,8 @@ function tripal_entities_get_published_terms_as_select_options($cv_id = NULL) {
|
|
|
foreach ($published_terms as $term) {
|
|
|
if (!$cv_id) {
|
|
|
$options [$term->cvterm_id->name] = $term->cvterm_id->name;
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
if ($term->cvterm_id->cv_id->cv_id == $cv_id) {
|
|
|
$options [$term->cvterm_id->name] = $term->cvterm_id->name;
|
|
|
}
|
|
@@ -345,7 +346,8 @@ function tripal_bundle_load($bundle_type, $reset = FALSE) {
|
|
|
|
|
|
// Load the tripal_bundle entity. These entities are always the same
|
|
|
// as an Tripal entity type but with a '_bundle' extension.
|
|
|
- $entity = entity_load($bundle_types->type . '_bundle', array($bundle_types->id), array(), $reset);
|
|
|
+ $entity = entity_load('BioData_bundles', array($bundle_types->id), array(), $reset);
|
|
|
+
|
|
|
return reset($entity);
|
|
|
}
|
|
|
|
|
@@ -365,19 +367,7 @@ function tripal_bundle_load($bundle_type, $reset = FALSE) {
|
|
|
* @see tripal_entity_load_multiple()
|
|
|
*/
|
|
|
function tripal_entity_load($id, $reset = FALSE) {
|
|
|
-
|
|
|
- // Get the type of entity by the ID.
|
|
|
- $entity_type = db_select('tripal_entity', 'td')
|
|
|
- ->fields('td', array('type'))
|
|
|
- ->condition('id', $id)
|
|
|
- ->execute()
|
|
|
- ->fetchField();
|
|
|
-
|
|
|
- // Load the entity.
|
|
|
- if ($entity_type) {
|
|
|
- $entity = entity_load($entity_type, array($id), array(), $reset);
|
|
|
+ $entity = entity_load('BioData', array($id), array(), $reset);
|
|
|
return reset($entity);
|
|
|
- }
|
|
|
- return FALSE;
|
|
|
}
|
|
|
|