ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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
36 $this->type = 'sysc';
37 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
38 $this->lng->loadLanguageModule('sysc');
39 }
40
45 public function getLang()
46 {
47 return $this->lng;
48 }
49
53 public function executeCommand()
54 {
55 $next_class = $this->ctrl->getNextClass($this);
56 $cmd = $this->ctrl->getCmd();
57 $this->prepareOutput();
58
59 switch($next_class)
60 {
61 case "ilobjectownershipmanagementgui":
62 $this->setSubTabs(self::SECTION_MAIN,'no_owner');
63 include_once 'Services/Object/classes/class.ilObjectOwnershipManagementGUI.php';
65 $this->ctrl->forwardCommand($gui);
66 break;
67
68 case 'ilobjsystemfoldergui':
69 include_once './Modules/SystemFolder/classes/class.ilObjSystemFolderGUI.php';
70 $sys_folder = new ilObjSystemFolderGUI('',SYSTEM_FOLDER_ID,TRUE);
71 $this->ctrl->forwardCommand($sys_folder);
72
73 $GLOBALS['ilTabs']->clearTargets();
74
75 $this->setSubTabs(self::SECTION_MAIN,'sc');
76 break;
77
78 case 'ilpermissiongui':
79 $this->tabs_gui->setTabActive('perm_settings');
80 require_once 'Services/AccessControl/classes/class.ilPermissionGUI.php';
81 $perm_gui = new ilPermissionGUI($this);
82 $this->ctrl->forwardCommand($perm_gui);
83 break;
84
85 case '':
86 case 'ilobjsystemcheckgui':
87 if($cmd == '' || $cmd == 'view')
88 {
89 $cmd = 'overview';
90 }
91 $this->$cmd();
92 break;
93
94 default:
95 // Forward to task handler
96 include_once './Services/SystemCheck/classes/class.ilSCComponentTaskFactory.php';
97 $this->ctrl->saveParameter($this,'grp_id');
98 $this->ctrl->saveParameter($this, 'task_id');
99 $this->ctrl->setReturn($this,'showGroup');
100 $GLOBALS['ilTabs']->clearTargets();
101 $GLOBALS['ilTabs']->setBackTarget($this->lng->txt('back'),$this->ctrl->getLinkTarget($this,'showGroup'));
102 $handler = ilSCComponentTaskFactory::getComponentTask((int) $_REQUEST['task_id']);
103 $this->ctrl->forwardCommand($handler);
104 break;
105
106
107 }
108 }
109
114 public function getAdminTabs()
115 {
119 global $rbacsystem;
120
121 if($rbacsystem->checkAccess('read', $this->object->getRefId()))
122 {
123 $this->tabs_gui->addTarget('overview', $this->ctrl->getLinkTarget($this, 'overview'));
124 }
125 if($rbacsystem->checkAccess('edit_permission', $this->object->getRefId()))
126 {
127 $this->tabs_gui->addTarget('perm_settings', $this->ctrl->getLinkTargetByClass(array(get_class($this), 'ilpermissiongui'), 'perm'), array('perm', 'info', 'owner'), 'ilpermissiongui');
128 }
129 }
130
134 protected function overview()
135 {
136 $this->getLang()->loadLanguageModule('sysc');
137
138
139 $this->setSubTabs(self::SECTION_MAIN, 'overview');
140
141
142 include_once 'Services/SystemCheck/classes/class.ilSCGroupTableGUI.php';
143
144 $table = new ilSCGroupTableGUI($this,'overview');
145 $table->init();
146 $table->parse();
147
148 $GLOBALS['tpl']->setContent($table->getHTML());
149 return true;
150 }
151
155 protected function showGroup()
156 {
157 $this->setSubTabs(self::SECTION_GROUP, '');
158
159 $grp_id = (int) $_REQUEST['grp_id'];
160 $this->ctrl->saveParameter($this, 'grp_id');
161
162 include_once 'Services/SystemCheck/classes/class.ilSCTaskTableGUI.php';
163 $table = new ilSCTaskTableGUI($grp_id,$this,'showGroup');
164 $table->init();
165 $table->parse();
166
167 $GLOBALS['tpl']->setContent($table->getHTML());
168 return true;
169 }
170
171
172
173
178 protected function trash(ilPropertyFormGUI $form = null)
179 {
180 $this->setSubTabs(self::SECTION_MAIN,'trash');
181 if(!$form instanceof ilPropertyFormGUI)
182 {
183 $form = $this->initFormTrash();
184 }
185 $GLOBALS['tpl']->setContent($form->getHTML());
186 }
187
192 protected function initFormTrash()
193 {
194 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
195 $form = new ilPropertyFormGUI();
196 $form->setFormAction($this->ctrl->getFormAction($this));
197
198 $form->setTitle($this->lng->txt('sysc_administrate_deleted'));
199
200 $action = new ilRadioGroupInputGUI($this->lng->txt('sysc_trash_action'), 'type');
201 $action->setRequired(TRUE);
202
203 // Restore
204 $restore = new ilRadioOption($this->lng->txt('sysc_trash_restore'), ilSystemCheckTrash::MODE_TRASH_RESTORE);
205 $restore->setInfo($this->lng->txt('sysc_trash_restore_info'));
206 $action->addOption($restore);
207
208 // Remove
209 $remove = new ilRadioOption($this->lng->txt('sysc_trash_remove'), ilSystemCheckTrash::MODE_TRASH_REMOVE);
210 $remove->setInfo($this->lng->txt('sysc_trash_remove_info'));
211 $action->addOption($remove);
212
213 // limit number
214 $num = new ilNumberInputGUI($this->lng->txt('sysc_trash_limit_num'), 'number');
215 $num->setInfo($this->lng->txt('purge_count_limit_desc'));
216 $num->setSize(10);
217 $num->setMinValue(1);
218 $remove->addSubItem($num);
219
220 $age = new ilDateTimeInputGUI($this->lng->txt('sysc_trash_limit_age'), 'age');
221 $age->setInfo($this->lng->txt('purge_age_limit_desc'));
222 $age->setMinuteStepSize(15);
223 #$earlier = new ilDateTime(time(),IL_CAL_UNIX);
224 #$earlier->increment(IL_CAL_MONTH,-6);
225 #$age->setDate($earlier);
226 $remove->addSubItem($age);
227
228 // limit types
229 $types = new ilSelectInputGUI($this->lng->txt('sysc_trash_limit_type'), 'types');
230 /*
231 * @var ilObjDefinition
232 */
233 $sub_objects = $GLOBALS['tree']->lookupTrashedObjectTypes();
234
235 $options = array();
236 $options[0] = '';
237 foreach($sub_objects as $obj_type)
238 {
239 if(!$GLOBALS['objDefinition']->isRBACObject($obj_type) or !$GLOBALS['objDefinition']->isAllowedInRepository($obj_type))
240 {
241 continue;
242 }
243 $options[$obj_type] = $this->lng->txt('obj_'.$obj_type);
244 }
245
246 asort($options);
247
248 $types->setOptions($options);
249 $remove->addSubItem($types);
250
251 $form->addItem($action);
252
253
254 $form->addCommandButton('handleTrashAction', $this->lng->txt('start_scan'));
255 $form->addCommandButton('',$this->lng->txt('cancel'));
256
257 return $form;
258 }
259
263 protected function handleTrashAction()
264 {
265 $form = $this->initFormTrash();
266 if($form->checkInput())
267 {
268 $trash = new ilSystemCheckTrash();
270 $dt = $form->getItemByPostVar('age')->getDate();
271 if($dt)
272 {
273 $trash->setAgeLimit($dt);
274 }
275 $trash->setNumberLimit($form->getInput('number'));
276
277 if($form->getInput('types'))
278 {
279 $trash->setTypesLimit((array) $form->getInput('types'));
280 }
281 $trash->setMode($form->getInput('type'));
282 $trash->start();
283
284 ilUtil::sendSuccess($this->lng->txt('settings_saved'),TRUE);
285 $form->setValuesByPost();
286 $this->trash($form);
287 return TRUE;
288 }
289
290 ilUtil::sendFailure($this->lng->txt('err_check_input'));
291 $form->setValuesByPost();
292 $this->trash($form);
293 return FALSE;
294 }
295
296
301 protected function setSubTabs($a_section, $a_active)
302 {
303 switch($a_section)
304 {
306 $GLOBALS['ilTabs']->addSubTab(
307 '',
308 $this->getLang()->txt('sysc_groups'),
309 $this->ctrl->getLinkTarget($this,'overview')
310 );
311 $GLOBALS['ilTabs']->addSubTab(
312 'trash',
313 $this->getLang()->txt('sysc_tab_trash'),
314 $this->ctrl->getLinkTarget($this,'trash')
315 );
316 $GLOBALS['ilTabs']->addSubTab(
317 'no_owner',
318 $this->getLang()->txt('system_check_no_owner'),
319 $this->ctrl->getLinkTargetByClass('ilobjectownershipmanagementgui')
320 );
321 break;
322
324 $GLOBALS['ilTabs']->clearTargets();
325 $GLOBALS['ilTabs']->setBackTarget(
326 $this->lng->txt('back'),
327 $this->ctrl->getLinkTarget($this,'overview')
328 );
329 }
330 $GLOBALS['ilTabs']->activateSubTab($a_active);
331 }
332
333}
334?>
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.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$cmd
Definition: sahs_server.php:35
if(!is_array($argv)) $options