ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilFMSettingsGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once './Services/WebServices/FileManager/classes/class.ilFMSettings.php';
5
15{
16
20 private $dic;
24 private $ctrl;
28 private $rbacsystem;
29 private $parent_obj = null;
30
34 public function __construct($a_parent_gui)
35 {
36 global $DIC;
37 $this->dic = $DIC;
38 $this->ctrl = $this->dic->ctrl();
39 $this->rbacsystem = $this->dic->rbac()->system();
40 $this->parent_obj = $a_parent_gui;
41 }
42
47 public function executeCommand()
48 {
49 global $ilCtrl;
50
51 $next_class = $ilCtrl->getNextClass();
52 $cmd = $ilCtrl->getCmd();
53 switch ($next_class) {
54 default:
55 if (!$cmd) {
56 $cmd = 'settings';
57 }
58 $this->$cmd();
59 break;
60
61 }
62 }
63
68 public function getParentObject()
69 {
70 return $this->parent_obj;
71 }
72
76 protected function settings()
77 {
78 $form = $this->initSettingsForm();
79
80 $GLOBALS['tpl']->setContent($form->getHTML());
81 }
82
86 protected function update()
87 {
88 include_once './Services/WebServices/FileManager/classes/class.ilFMSettings.php';
89 $settings = ilFMSettings::getInstance();
90
91 $form = $this->initSettingsForm();
92 if ($form->checkInput()) {
93 $settings->enable($form->getInput('active'));
94 $settings->enableLocalFS($form->getInput('local'));
95 $settings->setMaxFileSize($form->getInput('filesize'));
96 $settings->update();
97
98 ilUtil::sendSuccess($GLOBALS['lng']->txt('settings_saved'), true);
99 $GLOBALS['ilCtrl']->redirect($this, 'settings');
100 }
101 }
102
106 protected function initSettingsForm()
107 {
108 global $ilCtrl;
109
110 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
111 $form = new ilPropertyFormGUI();
112 $form->setFormAction($ilCtrl->getFormAction($this));
113 $form->setTitle($GLOBALS['lng']->txt('settings'));
114
115 if ($this->rbacsystem->checkAccess('write', $_GET['ref_id'])) {
116 $form->addCommandButton('update', $GLOBALS['lng']->txt('save'));
117 $form->addCommandButton('settings', $GLOBALS['lng']->txt('cancel'));
118 }
119
120 // activation
121 $active = new ilCheckboxInputGUI($GLOBALS['lng']->txt('fm_settings_active'), 'active');
122 $active->setInfo($GLOBALS['lng']->txt('fm_settings_active_info'));
123 $active->setValue(1);
124 $active->setChecked(ilFMSettings::getInstance()->isEnabled());
125 $form->addItem($active);
126
127 // one frame
128 $local = new ilCheckboxInputGUI($GLOBALS['lng']->txt('fm_settings_local'), 'local');
129 $local->setInfo($GLOBALS['lng']->txt('fm_settings_local_info'));
130 $local->setValue(1);
131 $local->setChecked(ilFMSettings::getInstance()->IsLocalFSEnabled());
132 $form->addItem($local);
133
134 $fs = new ilNumberInputGUI($GLOBALS['lng']->txt('fm_settings_filesize'), 'filesize');
135 $fs->setSuffix('MiB');
136 $fs->setSize(3);
137 $fs->setMaxLength(3);
138 $fs->setMinValue(1);
139 $fs->setMaxValue(999);
140 $fs->setInfo($GLOBALS['lng']->txt('fm_settings_filesize_info'));
141 $fs->setValue(ilFMSettings::getInstance()->getMaxFileSize());
142 $form->addItem($fs);
143
144 return $form;
145 }
146}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
This class represents a checkbox property in a property form.
File manager settings.
getParentObject()
Get parent gui.
executeCommand()
Execute command @global ilCtrl $ilCtrl.
initSettingsForm()
Init settings form.
__construct($a_parent_gui)
Constructor.
settings()
Show settings.
static getInstance()
Get singleton instance.
This class represents a number property in a property form.
This class represents a property form user interface.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $ilCtrl
Definition: ilias.php:18
if(isset($_POST['submit'])) $form
global $DIC
Definition: saml.php:7