• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Services/PersonalDesktop/classes/class.ilObjPersonalDesktopSettingsGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2006 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 include_once("./classes/class.ilObjectGUI.php");
00024 
00025 
00036 class ilObjPersonalDesktopSettingsGUI extends ilObjectGUI
00037 {
00038     private static $ERROR_MESSAGE;
00044         public function __construct($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
00045         {
00046                 global $lng;
00047                 
00048                 $this->type = 'pdts';
00049                 parent::ilObjectGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
00050 
00051                 $lng->loadLanguageModule("pd");
00052         }
00053 
00060         public function executeCommand()
00061         {
00062                 global $rbacsystem,$ilErr,$ilAccess;
00063 
00064                 $next_class = $this->ctrl->getNextClass($this);
00065                 $cmd = $this->ctrl->getCmd();
00066 
00067                 $this->prepareOutput();
00068 
00069                 if(!$ilAccess->checkAccess('read','',$this->object->getRefId()))
00070                 {
00071                         $ilErr->raiseError($this->lng->txt('no_permission'),$ilErr->WARNING);
00072                 }
00073 
00074                 switch($next_class)
00075                 {
00076                         case 'ilpermissiongui':
00077                                 $this->tabs_gui->setTabActive('perm_settings');
00078                                 include_once("./classes/class.ilPermissionGUI.php");
00079                                 $perm_gui =& new ilPermissionGUI($this);
00080                                 $ret =& $this->ctrl->forwardCommand($perm_gui);
00081                                 break;
00082 
00083                         default:
00084                                 if(!$cmd || $cmd == 'view')
00085                                 {
00086                                         $cmd = "editSettings";
00087                                 }
00088 
00089                                 $this->$cmd();
00090                                 break;
00091                 }
00092                 return true;
00093         }
00094 
00101         public function getAdminTabs()
00102         {
00103                 global $rbacsystem, $ilAccess;
00104 
00105                 if ($rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
00106                 {
00107                         $this->tabs_gui->addTarget("pd_settings",
00108                                 $this->ctrl->getLinkTarget($this, "editSettings"),
00109                                 array("editSettings", "view"));
00110                 }
00111 
00112                 if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
00113                 {
00114                         $this->tabs_gui->addTarget("perm_settings",
00115                                 $this->ctrl->getLinkTargetByClass('ilpermissiongui',"perm"),
00116                                 array(),'ilpermissiongui');
00117                 }
00118         }
00119 
00123         public function editSettings()
00124         {
00125                 global $ilCtrl, $lng, $ilSetting;
00126                 
00127                 $pd_set = new ilSetting("pd");
00128                 
00129                 $enable_calendar = $ilSetting->get("enable_calendar");          
00130                 $enable_block_moving = $pd_set->get("enable_block_moving");
00131                 $enable_active_users = $ilSetting->get("block_activated_pdusers");              
00132                 
00133                 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
00134                 $form = new ilPropertyFormGUI();
00135                 $form->setFormAction($ilCtrl->getFormAction($this));
00136                 $form->setTitle($lng->txt("pd_settings"));
00137                 
00138                 // Enable calendar
00139                 $cb_prop = new ilCheckboxInputGUI($lng->txt("enable_calendar"), "enable_calendar");
00140                 $cb_prop->setValue("1");
00141                 //$cb_prop->setInfo($lng->txt("pd_enable_block_moving_info"));
00142                 $cb_prop->setChecked($enable_calendar);
00143                 $form->addItem($cb_prop);
00144 
00145                 // Enable bookmarks
00146                 $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_bookmarks"), "enable_bookmarks");
00147                 $cb_prop->setValue("1");
00148                 $cb_prop->setChecked(($ilSetting->get("disable_bookmarks") ? "0" : "1"));
00149                 $form->addItem($cb_prop);
00150                 
00151                 // Enable notes
00152                 $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_notes"), "enable_notes");
00153                 $cb_prop->setValue("1");
00154                 $cb_prop->setChecked(($ilSetting->get("disable_notes") ? "0" : "1"));
00155                 $form->addItem($cb_prop);
00156                 
00157                 // Enable block moving
00158                 $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_block_moving"),
00159                         "enable_block_moving");
00160                 $cb_prop->setValue("1");
00161                 $cb_prop->setInfo($lng->txt("pd_enable_block_moving_info"));
00162                 $cb_prop->setChecked($enable_block_moving);
00163                 $form->addItem($cb_prop);               
00164                 
00165                 // Enable active users block
00166                 $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_active_users"),
00167                         "block_activated_pdusers");
00168                 $cb_prop->setValue("1");
00169                 $cb_prop->setChecked($enable_active_users);
00170                 
00171                         // maximum inactivity time
00172                         $ti_prop = new ilTextInputGUI($lng->txt("pd_time_before_removal"),
00173                                 "time_removal");
00174                         $ti_prop->setValue($pd_set->get("user_activity_time"));
00175                         $ti_prop->setInfo($lng->txt("pd_time_before_removal_info"));
00176                         $ti_prop->setMaxLength(3);
00177                         $ti_prop->setSize(3);
00178                         $cb_prop->addSubItem($ti_prop);
00179                         
00180                         // osi host
00181                         // see http://www.onlinestatus.org
00182                         $ti_prop = new ilTextInputGUI($lng->txt("pd_osi_host"),
00183                                 "osi_host");
00184                         $ti_prop->setValue($pd_set->get("osi_host"));
00185                         $ti_prop->setInfo($lng->txt("pd_osi_host_info").
00186                                 ' <a href="http://www.onlinestatus.org" target="_blank">http://www.onlinestatus.org</a>');
00187                         $cb_prop->addSubItem($ti_prop);
00188                         
00189                 $form->addItem($cb_prop);               
00190                 
00191                 // command buttons
00192                 $form->addCommandButton("saveSettings", $lng->txt("save"));
00193                 $form->addCommandButton("view", $lng->txt("cancel"));
00194 
00195                 $this->tpl->setContent($form->getHTML());
00196         }
00197 
00201         public function saveSettings()
00202         {
00203                 global $ilCtrl, $ilSetting;
00204                 
00205                 $pd_set = new ilSetting("pd");          
00206                 $ilSetting->set("enable_calendar", $_POST["enable_calendar"]);
00207                 $ilSetting->set("disable_bookmarks", (int) ($_POST["enable_bookmarks"] ? 0 : 1));
00208                 $ilSetting->set("disable_notes", (int) ($_POST["enable_notes"] ? 0 : 1));
00209                 
00210                 $ilSetting->set("block_activated_pdusers", $_POST["block_activated_pdusers"]);
00211                 $pd_set->set("enable_block_moving", $_POST["enable_block_moving"]);
00212                 $pd_set->set("user_activity_time", (int) $_POST["time_removal"]);
00213                 $pd_set->set("osi_host", $_POST["osi_host"]);   
00214                 
00215                 ilUtil::sendInfo($this->lng->txt("settings_saved"),true);
00216                 
00217                 $ilCtrl->redirect($this, "view");
00218         }
00219 }
00220 ?>

Generated on Fri Dec 13 2013 17:57:00 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1