<?php defined("_VALID_ACCESS") || die('Direct access forbidden'); @DB::DropTable('home_page'); @DB::CreateTable('base_home_page', 'id I4 AUTO KEY,' . 'priority I4,' . 'home_page C(64)', array('constraints' => '')); @DB::CreateTable('base_home_page_clearance', 'id I4 AUTO KEY,' . 'home_page_id I,' . 'clearance C(64)', array('constraints' => ', FOREIGN KEY (home_page_id) REFERENCES base_home_page(id)')); Base_HomePageCommon::set_home_page(_M('Dashboard'), array('ACCESS:employee')); Base_HomePageCommon::set_home_page(_M('My Contact'), array());
public function install() { $ret = true; $ret &= DB::CreateTable('base_dashboard_tabs', ' id I4 AUTO KEY, user_login_id I4, name C(64) NOTNULL, pos I2', array('constraints' => ', FOREIGN KEY (user_login_id) REFERENCES user_login(ID)')); if (!$ret) { print 'Unable to create table base_dashboard_tabs.<br>'; return false; } $ret &= DB::CreateTable('base_dashboard_default_tabs', ' id I4 AUTO KEY, name C(64) NOTNULL, pos I2'); if (!$ret) { print 'Unable to create table base_dashboard_default_tabs.<br>'; return false; } DB::Execute('INSERT INTO base_dashboard_default_tabs(name,pos) VALUES(\'Default\',0)'); $ret &= DB::CreateTable('base_dashboard_applets', ' id I4 AUTO KEY, user_login_id I4, module_name C(128), col I2 DEFAULT 0, pos I2 DEFAULT 0, color I2 DEFAULT 0, tab I4', array('constraints' => ', FOREIGN KEY (user_login_id) REFERENCES user_login(ID), FOREIGN KEY (tab) REFERENCES base_dashboard_tabs(ID)')); if (!$ret) { print 'Unable to create table base_dashboard_applets.<br>'; return false; } $ret &= DB::CreateTable('base_dashboard_settings', ' applet_id I4, name C(32) NOTNULL, value X NOTNULL', array('constraints' => ', FOREIGN KEY (applet_id) REFERENCES base_dashboard_applets(ID), PRIMARY KEY(applet_id,name)')); if (!$ret) { print 'Unable to create table base_dashboard_settings.<br>'; return false; } $ret &= DB::CreateTable('base_dashboard_default_applets', ' id I4 AUTO KEY, module_name C(128), col I2 DEFAULT 0, pos I2 DEFAULT 0, color I2 DEFAULT 0, tab I4', array('constraints' => ', FOREIGN KEY (tab) REFERENCES base_dashboard_default_tabs(ID)')); if (!$ret) { print 'Unable to create table base_dashboard_default_applets.<br>'; return false; } $ret &= DB::CreateTable('base_dashboard_default_settings', ' applet_id I4, name C(32) NOTNULL, value X NOTNULL', array('constraints' => ', FOREIGN KEY (applet_id) REFERENCES base_dashboard_default_applets(ID), PRIMARY KEY(applet_id,name)')); if (!$ret) { print 'Unable to create table base_dashboard_default_settings<br>'; return false; } Base_ThemeCommon::install_default_theme($this->get_type()); Base_AclCommon::add_permission(_M('Dashboard'), array('ACCESS:employee')); Base_HomePageCommon::set_home_page(_M('Dashboard'), array('ACCESS:employee')); Base_HomePageCommon::set_home_page(_M('My Contact'), array()); // Not exactly the place to add that, but we need to ensure proper order of home pages return $ret; }