public function install() { global $AppUI; // Create holiday table $q = new w2p_Database_Query(); $q->createTable('holiday'); $q->createDefinition('( `holiday_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `holiday_user` int(10) NOT NULL DEFAULT \'0\', `holiday_type` int(10) NOT NULL DEFAULT \'0\', `holiday_annual` int(10) NOT NULL DEFAULT \'0\', `holiday_start_date` datetime NOT NULL DEFAULT \'0000-00-00 00:00:00\', `holiday_end_date` datetime NOT NULL DEFAULT \'0000-00-00 00:00:00\', `holiday_description` text, PRIMARY KEY (`holiday_id`), KEY `holiday_start_end_date` (`holiday_start_date`,`holiday_end_date`), KEY `holiday_type` (`holiday_type`), KEY `holiday_user` (`holiday_user`) ) ENGINE=MyISAM CHARACTER SET=utf8 COLLATE=utf8_general_ci '); $q->exec(); $q->clear(); // Create settings table $q->createTable('holiday_settings'); $q->createDefinition('( `holiday_manual` int(10) NOT NULL default \'0\', `holiday_auto` int(10) NOT NULL default \'0\', `holiday_driver` int(10) NOT NULL default \'-1\', `holiday_filter` int(10) NOT NULL default \'-1\', UNIQUE KEY `holiday_manual` (holiday_manual), UNIQUE KEY `holiday_auto` (holiday_auto), UNIQUE KEY `holiday_driver` (holiday_driver), UNIQUE KEY `holiday_filter` (holiday_filter) ) ENGINE=MyISAM CHARACTER SET=utf8 COLLATE=utf8_general_ci '); $q->exec(); $q->clear(); // Set default settings $q->addTable('holiday_settings'); $q->addInsert('holiday_manual', 0); $q->addInsert('holiday_auto', 0); $q->addInsert('holiday_driver', -1); $q->addInsert('holiday_filter', -1); $q->exec(); $i = 0; $user_holiday_types = array('holidays', 'sick stoppage', 'formation', 'seminar', 'mission', 'strike', 'other holiday'); foreach ($user_holiday_types as $user_holiday_type) { $q->clear(); $q->addTable('sysvals'); $q->addInsert('sysval_key_id', 1); // select list $q->addInsert('sysval_title', 'UserHolidayType'); $q->addInsert('sysval_value', $user_holiday_type); $q->addInsert('sysval_value_id', $i++); $q->exec(); } $perms = $AppUI->acl(); return $perms->registerModule('Holiday', 'holiday'); }
public function install() { $ok = true; $q = new w2p_Database_Query(); $sql = '( resource_id integer not null auto_increment, resource_name varchar(255) not null default "", resource_key varchar(64) not null default "", resource_type integer not null default 0, resource_note text not null default "", resource_max_allocation integer not null default 100, primary key (resource_id), key (resource_name), key (resource_type) )'; $q->createTable('resources', $sql); $ok = $ok && $q->exec(); $q->clear(); $sql = '( resource_type_id integer not null auto_increment, resource_type_name varchar(255) not null default "", resource_type_note text, primary key (resource_type_id) )'; $q->createTable('resource_types', $sql); $ok = $ok && $q->exec(); $q->clear(); $sql = '( resource_id integer not null default 0, task_id integer not null default 0, percent_allocated integer not null default 100, key (resource_id), key (task_id, resource_id) )'; $q->createTable('resource_tasks', $sql); $ok = $ok && $q->exec(); $q->clear(); $q->addTable('resource_types'); $q->addInsert('resource_type_name', 'Equipment'); $q->exec(); $q->addInsert('resource_type_name', 'Tool'); $q->exec(); $q->addInsert('resource_type_name', 'Venue'); $ok = $ok && $q->exec(); if (!$ok) { return false; } return null; }
public function install(CAppUI $AppUI = null) { global $AppUI; $q = new w2p_Database_Query(); $q->createTable('history'); $sql = ' ( history_id int(10) unsigned NOT NULL auto_increment, history_date datetime NOT NULL default \'0000-00-00 00:00:00\', history_user int(10) NOT NULL default \'0\', history_action varchar(20) NOT NULL default \'modify\', history_item int(10) NOT NULL, history_table varchar(20) NOT NULL default \'\', history_project int(10) NOT NULL default \'0\', history_name varchar(255), history_changes text, history_description text, PRIMARY KEY (history_id), INDEX index_history_module (history_table, history_item), INDEX index_history_item (history_item) ) TYPE=MyISAM'; $q->createDefinition($sql); $q->exec(); $perms = $AppUI->acl(); return $perms->registerModule('History', 'history'); }
public function install() { global $AppUI; $q = new w2p_Database_Query(); $q->createTable('planner'); $sql = '( planner_id int(10) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (planner_id)) ENGINE = MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci'; $q->createDefinition($sql); $q->exec(); /* $q->clear(); $q->addTable('planner','dw'); $q->addInsert('dokuwiki_URL_use','dokuwiki_base_URL'); $q->addInsert('dokuwiki_URL','http://localhost/dokuwiki/'); $q->exec(); $q->clear(); $q->addTable('dokuwiki','dw'); $q->addInsert('dokuwiki_URL','http://localhost/dwiki/doku.php?id=projects'); $q->addInsert('dokuwiki_URL_use','dokuwiki_projects_namespace'); $q->exec(); $q->clear(); $q->addTable('dokuwiki','dw'); $q->addInsert('dokuwiki_URL',''); $q->addInsert('dokuwiki_URL_use','dokuwiki_tasks_sub_namespace'); $q->exec(); $q->clear(); $q->addTable('dokuwiki','dw'); $q->addInsert('dokuwiki_URL','http://localhost/dwiki/doku.php?id=contacts'); $q->addInsert('dokuwiki_URL_use','dokuwiki_contacs_namespace'); $q->exec(); $f['dokuwiki_URL']=''; // $f['dw.dokuwiki_id']=1; $f['dokuwiki_URL_use']='dokuwiki_base_URL'; $q->clear(); $q->addTable('dokuwiki','dw'); // $f['dw.dokuwiki_id']=2; $f['dw.dokuwiki_URL_use']='dokuwiki_projects_namespace'; $q->addInsert($f); $q->exec(); $q->clear(); $q->addTable('dokuwiki','dw'); // $f['dw.dokuwiki_id']=3; $f['dw.dokuwiki_URL_use']='dokuwiki_tasks_namespace'; $q->addInsert($f); $q->exec(); */ $perms = $AppUI->acl(); return $perms->registerModule('Planner', 'planner'); }
public function install() { global $AppUI; $q = new w2p_Database_Query(); $q->createTable('links'); $q->createDefinition('( link_id int( 11 ) NOT NULL AUTO_INCREMENT , link_url varchar( 255 ) NOT NULL default "", link_project int( 11 ) NOT NULL default "0", link_task int( 11 ) NOT NULL default "0", link_name varchar( 255 ) NOT NULL default "", link_parent int( 11 ) default "0", link_description text, link_owner int( 11 ) default "0", link_date datetime default NULL , link_icon varchar( 20 ) default "obj/", link_category int( 11 ) NOT NULL default "0", PRIMARY KEY ( link_id ) , KEY idx_link_task ( link_task ) , KEY idx_link_project ( link_project ) , KEY idx_link_parent ( link_parent ) ) ENGINE = MYISAM DEFAULT CHARSET=utf8 '); $q->exec($sql); $i = 0; $linkTypes = array('Unknown', 'Document', 'Application'); foreach ($linkTypes as $linkType) { $q->clear(); $q->addTable('sysvals'); $q->addInsert('sysval_key_id', 1); $q->addInsert('sysval_title', 'LinkType'); $q->addInsert('sysval_value', $linkType); $q->addInsert('sysval_value_id', $i); $q->exec(); $i++; } $perms = $AppUI->acl(); return $perms->registerModule('Links', 'links'); }