This repository has been archived on 2025-06-21. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
suitedesk/modules/storm/stormevent/stormevent.install

78 lines
2.5 KiB
Text

<?php
/**
* @file
*/
function stormevent_install() {
drupal_install_schema('stormevent');
variable_set('node_options_stormevent', array('status'));
$attributes = array();
$attributes['Event type'] = array(
'event' => 'event',
'diary' => 'diary',
'plan' => 'plan',
'meeting' => 'meeting',
'call' => 'call',
'email' => 'email',
);
$attributes['Event type search'] = array(
'-' => 'all',
'event' => 'event',
'diary' => 'diary',
'plan' => 'plan',
'meeting' => 'meeting',
'call' => 'call',
'email' => 'email',
);
$s = "INSERT INTO {stormattribute} (domain, akey, avalue, weight) VALUES ('%s', '%s', '%s', %d)";
$prevdomain = '';
$weight = 0;
foreach ($attributes as $domain => $attribute) {
if ($domain != $prevdomain) $weight=0;
foreach ($attribute as $key => $value) {
db_query($s, $domain, $key, $value, $weight);
$weight++;
}
$prevdomain = $domain;
}
}
function stormevent_disable() {
drupal_set_message(t('Nodes of type "event" have not been deleted on disabling SuiteDesk event. Please note that they will now have reduced functionality, and will not be protected by SuiteDesk event access controls.'), 'warning');
}
function stormevent_uninstall() {
drupal_uninstall_schema('stormevent');
}
function stormevent_schema() {
$schema['stormevent'] = array(
'fields' => array(
'vid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
'nid' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
'organization_nid' => array('type' => 'int'),
'organization_title' => array('type' => 'varchar', 'length' => 128),
'project_nid' => array('type' => 'int'),
'project_title' => array('type' => 'varchar', 'length' => 128),
'task_nid' => array('type' => 'int'),
'task_title' => array('type' => 'varchar', 'length' => 128),
'eventtype' => array('type' => 'varchar', 'length' => 100),
'version' => array('type' => 'varchar', 'length' => 12),
'event_access' => array('type' => 'int', 'default' => 0),
),
'primary key' => array('vid'),
'indexes' => array(
'nid' => array('nid'),
'organization_nid' => array('organization_nid'),
'project_nid' => array('project_nid'),
'task_nid' => array('task_nid'),
),
);
return $schema;
}