123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
- <?php
- require_once "api/tripal_entities.api.inc";
- require_once "includes/tripal_entities.admin.inc";
- require_once "includes/tripal_entities.field_storage.inc";
- require_once "includes/tripal_entities.fields.inc";
- require_once "includes/TripalData.inc";
- require_once "includes/TripalDataController.inc";
- require_once "includes/TripalDataUIController.inc";
- require_once "includes/TripalDataType.inc";
- require_once "includes/TripalDataTypeController.inc";
- require_once "includes/TripalDataTypeUIController.inc";
- function tripal_entities_views_api() {
- return array(
- 'api' => 3,
- );
- }
- function tripal_entities_permission() {
-
-
- $permissions = array(
- 'administer tripal data types' => array(
- 'title' => t('Administer Tripal data types'),
- 'description' => t('Create and delete fields for Tripal data types, and set their permissions.'),
- ),
- 'administer tripal data' => array(
- 'title' => t('Administer Tripal data'),
- 'description' => t('Edit and delete all tripal data'),
- ),
- );
-
- foreach (tripal_data_get_types() as $type) {
- $type_name = check_plain($type->type);
- $permissions += array(
- "edit any $type_name data" => array(
- 'title' => t('%type_name: Edit any', array('%type_name' => $type->label)),
- ),
- "view any $type_name data" => array(
- 'title' => t('%type_name: View any', array('%type_name' => $type->label)),
- ),
- );
- }
- return $permissions;
- }
- function tripal_entities_theme($existing, $type, $theme, $path) {
- return array(
- 'tripal_data' => array(
- 'render element' => 'elements',
- 'template' => 'tripal_data',
- 'path' => "$path/theme/templates"
- ),
- );
- }
- function tripal_entities_rdf_mapping() {
- return array();
- }
- function tripal_entities_entity_info() {
- $entities = array();
- $entities['tripal_data'] = array(
-
- 'label' => t('Tripal Data'),
- 'plural label' => t('Tripal Data'),
-
-
- 'entity class' => 'TripalData',
- 'controller class' => 'TripalDataController',
-
- 'base table' => 'tripal_data',
-
- 'uri callback' => 'tripal_entities_vocbulary_term_uri',
-
- 'fieldable' => TRUE,
-
-
-
- 'entity keys' => array(
- 'id' => 'entity_id',
- 'bundle' => 'type',
- ),
- 'bundle keys' => array(
- 'bundle' => 'type',
- ),
-
- 'access callback' => 'tripal_data_access',
-
- 'static cache' => FALSE,
-
- 'bundles' => array(),
- 'label callback' => 'entity_class_label',
- 'creation callback' => 'tripal_data_create',
-
-
-
-
- 'admin ui' => array(
- 'path' => 'admin/content/data',
- 'controller class' => 'TripalDataUIController',
- 'menu wildcard' => '%tripal_data',
- 'file' => 'includes/TripalDataUIController.inc',
- ),
- 'view modes' => array(
- 'full' => array(
- 'label' => t('Full content'),
- 'custom settings' => FALSE,
- ),
- 'teaser' => array(
- 'label' => t('Teaser'),
- 'custom settings' => TRUE,
- ),
- ),
- );
-
- $entities['tripal_data_type'] = array(
- 'label' => t('Tripal Data Type'),
- 'entity class' => 'TripalDataType',
- 'controller class' => 'TripalDataTypeController',
- 'base table' => 'tripal_data_type',
- 'fieldable' => FALSE,
-
-
- 'bundle of' => 'tripal_data',
- 'exportable' => TRUE,
- 'entity keys' => array(
- 'id' => 'id',
- 'name' => 'type',
- 'label' => 'label',
- ),
- 'access callback' => 'tripal_data_type_access',
- 'module' => 'tripal_entities',
-
- 'admin ui' => array(
- 'path' => 'admin/structure/data_types',
- 'controller class' => 'TripalDataTypeUIController',
- 'file' => 'includes/TripalDataTypeUIController.inc',
- ),
- );
- return $entities;
- }
- function tripal_entities_entity_info_alter(&$entity_info) {
-
-
-
- $values = array(
- 'cv_id' => array(
- 'name' => 'sequence'
- ),
- 'name' => 'gene',
- );
- $cvterm = chado_generate_var('cvterm', $values);
- $label = preg_replace('/_/', ' ', ucwords($cvterm->name));
- $type = $cvterm->dbxref_id->db_id->name . '_' . $cvterm->dbxref_id->accession;
- $entity_info['tripal_data']['bundles'][$type] = array(
- 'label' => $label,
- 'admin' => array(
- 'path' => 'admin/structure/data_types/manage/%tripal_data_type',
- 'real path' => 'admin/structure/data_types/manage/' . $type,
- 'bundle argument' => 4,
- 'access arguments' => array('administer tripal data types'),
- ),
- );
- }
|