ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilObjSystemCheckGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once 'Services/Object/classes/class.ilObjectGUI.php';
5include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
6include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
7include_once './Services/SystemCheck/classes/class.ilSystemCheckTrash.php';
8
9
17{
18 const SECTION_MAIN = 'main';
19 const SECTION_GROUP = 'group';
20
21
25 public $ctrl;
26
33 public function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output = true)
34 {
35 $this->type = 'sysc';
36 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
37 $this->lng->loadLanguageModule('sysc');
38 }
39
44 public function getLang()
45 {
46 return $this->lng;
47 }
48
52 public function executeCommand()
53 {
54 $next_class = $this->ctrl->getNextClass($this);
55 $cmd = $this->ctrl->getCmd();
56 $this->prepareOutput();
57
58 switch ($next_class) {
59 case "ilobjectownershipmanagementgui":
60 $this->setSubTabs(self::SECTION_MAIN, 'no_owner');
61 include_once 'Services/Object/classes/class.ilObjectOwnershipManagementGUI.php';
63 $this->ctrl->forwardCommand($gui);
64 break;
65
66 case 'ilobjsystemfoldergui':
67 include_once './Modules/SystemFolder/classes/class.ilObjSystemFolderGUI.php';
68 $sys_folder = new ilObjSystemFolderGUI('', SYSTEM_FOLDER_ID, true);
69 $this->ctrl->forwardCommand($sys_folder);
70
71 $GLOBALS['ilTabs']->clearTargets();
72
73 $this->setSubTabs(self::SECTION_MAIN, 'sc');
74 break;
75
76 case 'ilpermissiongui':
77 $this->tabs_gui->setTabActive('perm_settings');
78 require_once 'Services/AccessControl/classes/class.ilPermissionGUI.php';
79 $perm_gui = new ilPermissionGUI($this);
80 $this->ctrl->forwardCommand($perm_gui);
81 break;
82
83 case '':
84 case 'ilobjsystemcheckgui':
85 if ($cmd == '' || $cmd == 'view') {
86 $cmd = 'overview';
87 }
88 $this->$cmd();
89 break;
90
91 default:
92 // Forward to task handler
93 include_once './Services/SystemCheck/classes/class.ilSCComponentTaskFactory.php';
94 $this->ctrl->saveParameter($this, 'grp_id');
95 $this->ctrl->saveParameter($this, 'task_id');
96 $this->ctrl->setReturn($this, 'showGroup');
97 $GLOBALS['ilTabs']->clearTargets();
98 $GLOBALS['ilTabs']->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'showGroup'));
99 $handler = ilSCComponentTaskFactory::getComponentTask((int) $_REQUEST['task_id']);
100 $this->ctrl->forwardCommand($handler);
101 break;
102
103
104 }
105 }
106
111 public function getAdminTabs()
112 {
116 global $rbacsystem;
117
118 if ($rbacsystem->checkAccess('read', $this->object->getRefId())) {
119 $this->tabs_gui->addTarget('overview', $this->ctrl->getLinkTarget($this, 'overview'));
120 }
121 if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
122 $this->tabs_gui->addTarget('perm_settings', $this->ctrl->getLinkTargetByClass(array(get_class($this), 'ilpermissiongui'), 'perm'), array('perm', 'info', 'owner'), 'ilpermissiongui');
123 }
124 }
125
129 protected function overview()
130 {
131 $this->getLang()->loadLanguageModule('sysc');
132
133
134 $this->setSubTabs(self::SECTION_MAIN, 'overview');
135
136
137 include_once 'Services/SystemCheck/classes/class.ilSCGroupTableGUI.php';
138
139 $table = new ilSCGroupTableGUI($this, 'overview');
140 $table->init();
141 $table->parse();
142
143 $GLOBALS['tpl']->setContent($table->getHTML());
144 return true;
145 }
146
150 protected function showGroup()
151 {
152 $this->setSubTabs(self::SECTION_GROUP, '');
153
154 $grp_id = (int) $_REQUEST['grp_id'];
155 $this->ctrl->saveParameter($this, 'grp_id');
156
157 include_once 'Services/SystemCheck/classes/class.ilSCTaskTableGUI.php';
158 $table = new ilSCTaskTableGUI($grp_id, $this, 'showGroup');
159 $table->init();
160 $table->parse();
161
162 $GLOBALS['tpl']->setContent($table->getHTML());
163 return true;
164 }
165
166
167
168
173 protected function trash(ilPropertyFormGUI $form = null)
174 {
175 $this->setSubTabs(self::SECTION_MAIN, 'trash');
176 if (!$form instanceof ilPropertyFormGUI) {
177 $form = $this->initFormTrash();
178 }
179 $GLOBALS['tpl']->setContent($form->getHTML());
180 }
181
186 protected function initFormTrash()
187 {
188 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
189 $form = new ilPropertyFormGUI();
190 $form->setFormAction($this->ctrl->getFormAction($this));
191
192 $form->setTitle($this->lng->txt('sysc_administrate_deleted'));
193
194 $action = new ilRadioGroupInputGUI($this->lng->txt('sysc_trash_action'), 'type');
195 $action->setRequired(true);
196
197 // Restore
198 $restore = new ilRadioOption($this->lng->txt('sysc_trash_restore'), ilSystemCheckTrash::MODE_TRASH_RESTORE);
199 $restore->setInfo($this->lng->txt('sysc_trash_restore_info'));
200 $action->addOption($restore);
201
202 // Remove
203 $remove = new ilRadioOption($this->lng->txt('sysc_trash_remove'), ilSystemCheckTrash::MODE_TRASH_REMOVE);
204 $remove->setInfo($this->lng->txt('sysc_trash_remove_info'));
205 $action->addOption($remove);
206
207 // limit number
208 $num = new ilNumberInputGUI($this->lng->txt('sysc_trash_limit_num'), 'number');
209 $num->setInfo($this->lng->txt('purge_count_limit_desc'));
210 $num->setSize(10);
211 $num->setMinValue(1);
212 $remove->addSubItem($num);
213
214 $age = new ilDateTimeInputGUI($this->lng->txt('sysc_trash_limit_age'), 'age');
215 $age->setInfo($this->lng->txt('purge_age_limit_desc'));
216 $age->setMinuteStepSize(15);
217 #$earlier = new ilDateTime(time(),IL_CAL_UNIX);
218 #$earlier->increment(IL_CAL_MONTH,-6);
219 #$age->setDate($earlier);
220 $remove->addSubItem($age);
221
222 // limit types
223 $types = new ilSelectInputGUI($this->lng->txt('sysc_trash_limit_type'), 'types');
224 /*
225 * @var ilObjDefinition
226 */
227 $sub_objects = $GLOBALS['tree']->lookupTrashedObjectTypes();
228
229 $options = array();
230 $options[0] = '';
231 foreach ($sub_objects as $obj_type) {
232 if (!$GLOBALS['objDefinition']->isRBACObject($obj_type) or !$GLOBALS['objDefinition']->isAllowedInRepository($obj_type)) {
233 continue;
234 }
235 $options[$obj_type] = $this->lng->txt('obj_' . $obj_type);
236 }
237
238 asort($options);
239
240 $types->setOptions($options);
241 $remove->addSubItem($types);
242
243 $form->addItem($action);
244
245
246 $form->addCommandButton('handleTrashAction', $this->lng->txt('start_scan'));
247 $form->addCommandButton('', $this->lng->txt('cancel'));
248
249 return $form;
250 }
251
255 protected function handleTrashAction()
256 {
257 $form = $this->initFormTrash();
258 if ($form->checkInput()) {
259 $trash = new ilSystemCheckTrash();
261 $dt = $form->getItemByPostVar('age')->getDate();
262 if ($dt) {
263 $trash->setAgeLimit($dt);
264 }
265 $trash->setNumberLimit($form->getInput('number'));
266
267 if ($form->getInput('types')) {
268 $trash->setTypesLimit((array) $form->getInput('types'));
269 }
270 $trash->setMode($form->getInput('type'));
271 $trash->start();
272
273 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
274 $form->setValuesByPost();
275 $this->trash($form);
276 return true;
277 }
278
279 ilUtil::sendFailure($this->lng->txt('err_check_input'));
280 $form->setValuesByPost();
281 $this->trash($form);
282 return false;
283 }
284
285
290 protected function setSubTabs($a_section, $a_active)
291 {
292 switch ($a_section) {
294 $GLOBALS['ilTabs']->addSubTab(
295 '',
296 $this->getLang()->txt('sysc_groups'),
297 $this->ctrl->getLinkTarget($this, 'overview')
298 );
299 $GLOBALS['ilTabs']->addSubTab(
300 'trash',
301 $this->getLang()->txt('sysc_tab_trash'),
302 $this->ctrl->getLinkTarget($this, 'trash')
303 );
304 $GLOBALS['ilTabs']->addSubTab(
305 'no_owner',
306 $this->getLang()->txt('system_check_no_owner'),
307 $this->ctrl->getLinkTargetByClass('ilobjectownershipmanagementgui')
308 );
309 break;
310
312 $GLOBALS['ilTabs']->clearTargets();
313 $GLOBALS['ilTabs']->setBackTarget(
314 $this->lng->txt('back'),
315 $this->ctrl->getLinkTarget($this, 'overview')
316 );
317 }
318 $GLOBALS['ilTabs']->activateSubTab($a_active);
319 }
320}
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
An exception for terminatinating execution or to throw for unit testing.
This class represents a date/time property in a property form.
This class represents a number property in a property form.
__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
overview()
Show overview table.
trash(ilPropertyFormGUI $form=null)
Show trash form.
setSubTabs($a_section, $a_active)
Set subtabs.
handleTrashAction()
Handle Trash action.
initFormTrash()
Show trash restore form.
executeCommand()
ilCtrl execute command
Class ilObjSystemFolderGUI.
Class ilObjectGUI Basic methods of all Output classes.
prepareOutput($a_show_subobjects=true)
prepare output
getAdminTabs()
administration tabs show only permissions and trash folder
Class ilObjectOwnershipManagementGUI.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
Table GUI for system check groups overview.
Table GUI for system check task overview.
This class represents a selection list property in a property form.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$action
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
if(empty($password)) $table
Definition: pwgen.php:24
if(isset($_POST['submit'])) $form
$handler