> ------------------------------------------------------------------------------ See main.inc.php for release information HGram_AIP : classe to manage plugin admin pages --------------------------------------------------------------------------- */ if(!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); include_once('hgram_root.class.inc.php'); include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTables.class.inc.php'); include_once(PHPWG_PLUGINS_PATH.'GrumPluginClasses/classes/GPCTabSheet.class.inc.php'); include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); class HGram_AIP extends HGram_root { protected $tabsheet; public function __construct($prefixeTable, $filelocation) { parent::__construct($prefixeTable, $filelocation); $this->checkRequest(); $this->loadConfig(); $this->initEvents(); $this->tabsheet = new tabsheet(); /* $this->tabsheet->add('database', l10n('hgram_database'), $this->getAdminLink()."&f_tabsheet=database");*/ $this->tabsheet->add('config', l10n('hgram_config'), $this->getAdminLink()."-config"); } public function __destruct() { unset($this->tabsheet); parent::__destruct(); } /* initialize events call for the plugin */ public function initEvents() { parent::initEvents(); if($_GET['tab']=='search') { // load request builder JS only on the search page GPCRequestBuilder::loadJSandCSS(); } } public function loadCSS() { parent::loadCSS(); GPCCore::addUI('gpcCSS'); } /* display administration page */ public function manage() { global $template; $template->set_filename('plugin_admin_content', dirname(__FILE__)."/admin/hgram_admin.tpl"); switch($_GET['tab']) { case 'config': $this->displayConfigPage(); break; } $this->tabsheet->select($_GET['tab']); $this->tabsheet->assign(); $selected_tab=$this->tabsheet->get_selected(); $template->assign($this->tabsheet->get_titlename(), "[".$selected_tab['caption']."]"); $template_plugin["HGRAM_VERSION"] = "".$this->getPluginName()." ".l10n('hgram_release').HGRAM_VERSION; $template->assign('plugin', $template_plugin); $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); } /** * check the $_REQUEST values and set default values * */ protected function checkRequest() { if(!isset($_GET['tab'])) $_GET['tab']='config'; if(!($_GET['tab']=='config')) $_GET['tab']='config'; } /** * manage display of config page & save config */ protected function displayConfigPage() { $cfg=$this->config; if(isset($_POST['submit_save_config'])) { foreach($cfg as $key => $val) { if(isset($_REQUEST['f_'.$key])) { $cfg[$key] = $_REQUEST['f_'.$key]; } } if($cfg['color_r']=='') { $cfg['mode_r']='none'; } else { $cfg['mode_r']='line'; } if($cfg['color_g']=='') { $cfg['mode_g']='none'; } else { $cfg['mode_g']='line'; } if($cfg['color_b']=='') { $cfg['mode_b']='none'; } else { $cfg['mode_b']='line'; } $cfg['color_bg'] = Histogram::RGBToInt(Histogram::StringToRGB($cfg['color_bg'])); $cfg['color_v'] = Histogram::RGBToInt(Histogram::StringToRGB($cfg['color_v'])); $cfg['color_r'] = Histogram::RGBToInt(Histogram::StringToRGB($cfg['color_r'])); $cfg['color_g'] = Histogram::RGBToInt(Histogram::StringToRGB($cfg['color_g'])); $cfg['color_b'] = Histogram::RGBToInt(Histogram::StringToRGB($cfg['color_b'])); $this->config=$cfg; $this->purgeHistoCache(); $this->displayResult(l10n('hgram_save_config'), $this->saveConfig()); } $this->displayConfig(); } /** * display config page */ protected function displayConfig() { global $template, $lang; $template->set_filename('body_page', dirname($this->getFileLocation()).'/admin/hgram_config.tpl'); $cfg=$this->config; $cfg['color_bg'] = Histogram::RGBToString(Histogram::IntToRGB($cfg['color_bg'])); $cfg['color_v'] = Histogram::RGBToString(Histogram::IntToRGB($cfg['color_v'])); $cfg['color_r'] = Histogram::RGBToString(Histogram::IntToRGB($cfg['color_r'])); $cfg['color_g'] = Histogram::RGBToString(Histogram::IntToRGB($cfg['color_g'])); $cfg['color_b'] = Histogram::RGBToString(Histogram::IntToRGB($cfg['color_b'])); if($cfg['mode_r']=='none') $cfg['color_r']=''; if($cfg['mode_g']=='none') $cfg['color_g']=''; if($cfg['mode_b']=='none') $cfg['color_b']=''; $template->assign('hgramConfig', $cfg); $template->assign_var_from_handle('HGRAM_BODY_PAGE', 'body_page'); } //displayConfig } //class ?>