ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 private $parent_obj = null;
17
21 public function __construct($a_parent_gui)
22 {
23 $this->parent_obj = $a_parent_gui;
24 }
25
30 public function executeCommand()
31 {
32 global $DIC;
33
34 $ilCtrl = $DIC['ilCtrl'];
35
36 $next_class = $ilCtrl->getNextClass();
37 $cmd = $ilCtrl->getCmd();
38 switch ($next_class) {
39 default:
40 if (!$cmd) {
41 $cmd = 'settings';
42 }
43 $this->$cmd();
44 break;
45
46 }
47 }
48
53 public function getParentObject()
54 {
55 return $this->parent_obj;
56 }
57
61 protected function settings()
62 {
63 $form = $this->initSettingsForm();
64
65 $GLOBALS['DIC']['tpl']->setContent($form->getHTML());
66 }
67
71 protected function update()
72 {
73 include_once './Services/WebServices/FileManager/classes/class.ilFMSettings.php';
74 $settings = ilFMSettings::getInstance();
75
76 $form = $this->initSettingsForm();
77 if ($form->checkInput()) {
78 $settings->enable($form->getInput('active'));
79 $settings->enableLocalFS($form->getInput('local'));
80 $settings->setMaxFileSize($form->getInput('filesize'));
81 $settings->update();
82
83 ilUtil::sendSuccess($GLOBALS['DIC']['lng']->txt('settings_saved'), true);
84 $GLOBALS['DIC']['ilCtrl']->redirect($this, 'settings');
85 }
86 }
87
91 protected function initSettingsForm()
92 {
93 global $DIC;
94
95 $ilCtrl = $DIC['ilCtrl'];
96
97 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
98 $form = new ilPropertyFormGUI();
99 $form->setFormAction($ilCtrl->getFormAction($this));
100 $form->setTitle($GLOBALS['DIC']['lng']->txt('settings'));
101 $form->addCommandButton('update', $GLOBALS['DIC']['lng']->txt('save'));
102 $form->addCommandButton('settings', $GLOBALS['DIC']['lng']->txt('cancel'));
103
104 // activation
105 $active = new ilCheckboxInputGUI($GLOBALS['DIC']['lng']->txt('fm_settings_active'), 'active');
106 $active->setInfo($GLOBALS['DIC']['lng']->txt('fm_settings_active_info'));
107 $active->setValue(1);
108 $active->setChecked(ilFMSettings::getInstance()->isEnabled());
109 $form->addItem($active);
110
111 // one frame
112 $local = new ilCheckboxInputGUI($GLOBALS['DIC']['lng']->txt('fm_settings_local'), 'local');
113 $local->setInfo($GLOBALS['DIC']['lng']->txt('fm_settings_local_info'));
114 $local->setValue(1);
115 $local->setChecked(ilFMSettings::getInstance()->IsLocalFSEnabled());
116 $form->addItem($local);
117
118 $fs = new ilNumberInputGUI($GLOBALS['DIC']['lng']->txt('fm_settings_filesize'), 'filesize');
119 $fs->setSuffix('MiB');
120 $fs->setSize(3);
121 $fs->setMaxLength(3);
122 $fs->setMinValue(1);
123 $fs->setMaxValue(999);
124 $fs->setInfo($GLOBALS['DIC']['lng']->txt('fm_settings_filesize_info'));
125 $fs->setValue(ilFMSettings::getInstance()->getMaxFileSize());
126 $form->addItem($fs);
127
128 return $form;
129 }
130}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
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.
global $ilCtrl
Definition: ilias.php:18
$DIC
Definition: xapitoken.php:46