This repository has been archived on 2024-11-28. You can view files and clone it, but cannot push or open issues or pull requests.
Incam_SGD/plugins/WemagDashboardManagement/admin/configure.php

68 lines
2.2 KiB
PHP

<?php
/**
* This file is part of Wemag Dashboard Management.
*
* Wemag Dashboard Management is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Wemag Dashboard Management is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Wemag Dashboard Management. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2008 Aart-Jan Boor <aart-jan@wemag.nl>
* Wemag Advisering <http://www.wemag.nl>
*/
require_once(KT_LIB_DIR . '/dispatcher.inc.php');
/**
* Dispatches the the configuration page
*/
class ConfigureDashboardDispatcher extends KTAdminDispatcher {
/**
* Show the configuration page
*
* @return the template data
*/
function do_main(){
//set breadcrumbs
$this->oPage->setBreadcrumbDetails(_kt('Dashboard settings'));
if($_POST['saveSettings']){ //form submitted
$this->form_submit();
}
//load auto add new dashlets setting
$autoAddNewDashlets=KTUtil::getSystemSetting("wemag-dashboard-management-plugin-auto-add-new-dashlets");
//render template
$oTemplating =& KTTemplating::getSingleton();
$oTemplate = $oTemplating->loadTemplate("configureDashboard");
$aTemplateData = array();
if($autoAddNewDashlets == "true"){
$aTemplateData['autoAddNewDashlets']='checked="checked"';
}
return $oTemplate->render($aTemplateData);
}
/**
* Handle the form submit, and update settings
*
*/
function form_submit(){
if($_POST['autoAddNewDashlets'] == "true"){
KTUtil::setSystemSetting("wemag-dashboard-management-plugin-auto-add-new-dashlets","true");
}else{
KTUtil::setSystemSetting("wemag-dashboard-management-plugin-auto-add-new-dashlets","false");
}
$this->addInfoMessage(_kt("Settings saved"));
}
}
?>