tripal_project.install
- 2.x tripal_project/tripal_project.install
- 3.x legacy/tripal_project/tripal_project.install
- 1.x tripal_project/tripal_project.install
Install the tripal project
File
legacy/tripal_project/tripal_project.installView source
- <?php
- /**
- * @file
- * Install the tripal project
- */
-
- /**
- * Implements hook_disable().
- * Disable default views when module is disabled
- *
- * @ingroup tripal_legacy_project
- */
- function tripal_project_disable() {
-
- // Disable all default views provided by this module
- require_once("tripal_project.views_default.inc");
- $views = tripal_project_views_default_views();
- foreach (array_keys($views) as $view_name) {
- tripal_disable_view($view_name,FALSE,array('suppress_error' => TRUE));
- }
-
- }
-
- /**
- * Implementation of hook_requirements().
- *
- * @ingroup tripal_legacy_project
- */
- function tripal_project_requirements($phase) {
- $requirements = array();
- if ($phase == 'install') {
- // make sure chado is installed
- if (!$GLOBALS["chado_is_installed"]) {
- $requirements ['tripal_project'] = array(
- 'title' => "tripal_project",
- 'value' => "ERROR: Chado must be installed before this module can be enabled",
- 'severity' => REQUIREMENT_ERROR,
- );
- }
- }
- return $requirements;
- }
-
- /**
- * Implementation of hook_install().
- *
- * @ingroup tripal_legacy_project
- */
- function tripal_project_install() {
-
- tripal_project_add_cvs();
- tripal_project_add_cvterms();
-
- // set the default vocabularies
- tripal_set_default_cv('projectprop', 'type_id', 'project_property');
- tripal_set_default_cv('project_relationship', 'type_id', 'project_relationship');
- }
-
- /**
- * Implementation of hook_uninstall().
- *
- * @ingroup tripal_legacy_project
- */
- function tripal_project_uninstall() {
-
- }
-
- /**
- * Implementation of hook_schema().
- *
- * @ingroup tripal_legacy_project
- */
- function tripal_project_schema() {
- $schema['chado_project'] = array(
- 'fields' => array(
- 'nid' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- ),
- 'vid' => array(
- 'type' => 'int',
- 'not null' => TRUE,
- ),
- 'project_id' => array(
- 'type' => 'int',
- 'unsigned' => TRUE,
- 'not null' => TRUE,
- ),
- ),
- 'primary key' => array('nid', 'vid', 'project_id'),
- );
- return $schema;
- }
-
- /**
- * Add cvs pertaining to projects
- *
- * @ingroup tripal_legacy_project
- */
- function tripal_project_add_cvs() {
- // Add the cv for project properties
- tripal_insert_cv(
- 'project_property',
- 'Contains properties for projects'
- );
-
- // Add cv for relationship types
- tripal_insert_cv(
- 'project_relationship',
- 'Contains Types of relationships between projects.'
- );
- }
-
- /**
- * Add cvterms pertaining to projects
- *
- * @ingroup tripal_legacy_project
- */
- function tripal_project_add_cvterms() {
-
- // Insert cvterm 'Project Description' into cvterm table of chado
- // database. This CV term is used to keep track of the project
- // description in the projectprop table.
- tripal_insert_cvterm(
- array(
- 'name' => 'Project Description',
- 'definition' => 'Description of a project',
- 'cv_name' => 'project_property',
- 'is_relationship' => 0,
- 'db_name' => 'tripal'
- ),
- array('update_existing' => TRUE)
- );
- }