ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilObjFolderGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
4
21require_once "./Services/Container/classes/class.ilContainerGUI.php";
22
24{
25 var $folder_tree; // folder tree
26
31 public function __construct($a_data, $a_id = 0, $a_call_by_reference = true, $a_prepare_output = false)
32 {
33 $this->type = "fold";
34 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output, false);
35 }
36
37
41 function viewObject()
42 {
43 global $tree;
44
45 $this->checkPermission('read');
46
47 if (strtolower($_GET["baseClass"]) == "iladministrationgui")
48 {
49 parent::viewObject();
50 return true;
51 }
52
53 // Trac access - see ilObjCourseGUI
54 include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
55 ilLearningProgress::_tracProgress($GLOBALS["ilUser"]->getId(),$this->object->getId(),
56 $this->object->getRefId(),'fold');
57
58 $this->renderObject();
59 $this->tabs_gui->setTabActive('view_content');
60 return true;
61 }
62
66 function renderObject()
67 {
68 global $ilTabs;
69
70 $this->checkPermission('read');
71
72 $ilTabs->activateTab("view_content");
73 $ret = parent::renderObject();
74 return $ret;
75 }
76
77 function executeCommand()
78 {
79 global $ilUser,$ilCtrl;
80
81 $next_class = $this->ctrl->getNextClass($this);
82 $cmd = $this->ctrl->getCmd();
83
84 // show repository tree
85 $this->showRepTree();
86
87 switch ($next_class)
88 {
89 case 'ilpermissiongui':
90 $this->prepareOutput();
91 $this->tabs_gui->setTabActive('perm_settings');
92 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
93 $perm_gui = new ilPermissionGUI($this);
94 $ret =& $this->ctrl->forwardCommand($perm_gui);
95 break;
96
97 case 'ilcoursecontentgui':
98 $this->prepareOutput();
99 include_once './Modules/Course/classes/class.ilCourseContentGUI.php';
100 $course_content_obj = new ilCourseContentGUI($this);
101 $this->ctrl->forwardCommand($course_content_obj);
102 break;
103
104 case "illearningprogressgui":
105 $this->prepareOutput();
106 include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
107
109 $this->object->getRefId(),
110 $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId());
111 $this->ctrl->forwardCommand($new_gui);
112 $this->tabs_gui->setTabActive('learning_progress');
113 break;
114
115 // container page editing
116 case "ilcontainerpagegui":
117 $this->prepareOutput(false);
118 $ret = $this->forwardToPageObject();
119 if ($ret != "")
120 {
121 $this->tpl->setContent($ret);
122 }
123 break;
124
125 case 'ilinfoscreengui':
126 $this->prepareOutput();
127 $this->infoScreen();
128 break;
129
130 case 'ilobjectcopygui':
131 $this->prepareOutput();
132
133 include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
134 $cp = new ilObjectCopyGUI($this);
135 $cp->setType('fold');
136 $this->ctrl->forwardCommand($cp);
137 break;
138
139 case "ilobjstylesheetgui":
140 $this->forwardToStyleSheet();
141 break;
142
143 case 'ilexportgui':
144 $this->prepareOutput();
145
146 $this->tabs_gui->setTabActive('export');
147 include_once './Services/Export/classes/class.ilExportGUI.php';
148 $exp = new ilExportGUI($this);
149 $exp->addFormat('xml');
150 $this->ctrl->forwardCommand($exp);
151 break;
152
153 case "ilcommonactiondispatchergui":
154 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
156 $this->ctrl->forwardCommand($gui);
157 break;
158
159 case 'ildidactictemplategui':
160 $this->ctrl->setReturn($this,'edit');
161 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateGUI.php';
162 $did = new ilDidacticTemplateGUI($this);
163 $this->ctrl->forwardCommand($did);
164 break;
165 case 'ilcolumngui':
166 $this->tabs_gui->setTabActive('none');
167 $this->checkPermission("read");
168 $this->viewObject();
169 break;
170
171 case 'ilbackgroundtaskhub':
172 include_once './Services/BackgroundTask/classes/class.ilBackgroundTaskHub.php';
173 $bggui = new ilBackgroundTaskHub();
174 $this->ctrl->forwardCommand($bggui);
175 break;
176
177 default:
178
179 $this->prepareOutput();
180 // Dirty hack for course timings view
181 if($this->forwardToTimingsView())
182 {
183 break;
184 }
185
186 if (empty($cmd))
187 {
188 $cmd = "view";
189 }
190 $cmd .= "Object";
191 $this->$cmd();
192 break;
193 }
194
195 $this->addHeaderAction();
196 }
197
201 function setFolderTree($a_tree)
202 {
203 $this->folder_tree =& $a_tree;
204 }
205
212 public function importFileObject($parent_id = null, $a_catch_errors = true)
213 {
214 global $lng;
215
216 if(parent::importFileObject($parent_id, $a_catch_errors))
217 {
218 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
219 $this->ctrl->returnToParent($this);
220 }
221 }
222
223
224
225 protected function initEditCustomForm(ilPropertyFormGUI $a_form)
226 {
227 // Show didactic template type
228 $this->initDidacticTemplate($a_form);
229
230 $this->initSortingForm(
231 $a_form,
232 array(
237 )
238 );
239 }
240
241 protected function getEditFormCustomValues(array &$a_values)
242 {
243 // we cannot use $this->object->getOrderType()
244 // if set to inherit it will be translated to parent setting
245 include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
246 $sort = new ilContainerSortingSettings($this->object->getId());
247 $a_values["sor"] = $sort->getSortMode();
248 }
249
250 protected function updateCustom(ilPropertyFormGUI $a_form)
251 {
252 $this->saveSortingSettings($a_form);
253 }
254
255 // BEGIN ChangeEvent show info screen on folder object
262 {
263 $this->ctrl->setCmd("showSummary");
264 $this->ctrl->setCmdClass("ilinfoscreengui");
265 $this->infoScreen();
266 }
267
268 protected function afterSave(ilObject $a_new_object)
269 {
270 include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
271 $sort = new ilContainerSortingSettings($a_new_object->getId());
272 $sort->setSortMode(ilContainer::SORT_INHERIT);
273 $sort->update();
274
275 // always send a message
276 ilUtil::sendSuccess($this->lng->txt("fold_added"),true);
277 $this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
278 $this->redirectToRefId($a_new_object->getRefId(), "");
279 }
280
287 {
288 $this->ctrl->setCmd("showSummary");
289 $this->ctrl->setCmdClass("ilinfoscreengui");
290 $this->infoScreen();
291 }
292
296 function infoScreen()
297 {
298 global $ilAccess;
299
300 if (!$ilAccess->checkAccess("visible", "", $this->ref_id))
301 {
302 $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
303 }
304
305 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
306 $info = new ilInfoScreenGUI($this);
307
308 $GLOBALS['ilTabs']->activateTab('info_short');
309
310 $info->enablePrivateNotes();
311
312 if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
313 {
314 $info->enableNews();
315 }
316
317 // no news editing for files, just notifications
318 $info->enableNewsEditing(false);
319 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
320 {
321 $news_set = new ilSetting("news");
322 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
323
324 if ($enable_internal_rss)
325 {
326 $info->setBlockProperty("news", "settings", true);
327 $info->setBlockProperty("news", "public_notifications_option", true);
328 }
329 }
330
331
332 // standard meta data
333 $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
334
335 // forward the command
336 $this->ctrl->forwardCommand($info);
337 }
338 // END ChangeEvent show info screen on folder object
339
343 function getTabs()
344 {
345 global $rbacsystem, $lng, $ilCtrl,$ilAccess, $ilHelp;
346
347 $this->ctrl->setParameter($this,"ref_id",$this->ref_id);
348
349 $ilHelp->setScreenIdComponent("fold");
350
351 $this->tabs_gui->setTabActive("");
352 if ($rbacsystem->checkAccess('read',$this->ref_id))
353 {
354 $this->tabs_gui->addTab("view_content", $lng->txt("content"),
355 $this->ctrl->getLinkTarget($this, ""));
356
357 //BEGIN ChangeEvent add info tab to category object
358 $force_active = ($this->ctrl->getNextClass() == "ilinfoscreengui"
359 || strtolower($_GET["cmdClass"]) == "ilnotegui")
360 ? true
361 : false;
362 $this->tabs_gui->addTarget("info_short",
363 $this->ctrl->getLinkTargetByClass(
364 array("ilobjfoldergui", "ilinfoscreengui"), "showSummary"),
365 array("showSummary","", "infoScreen"),
366 "", "", $force_active);
367 //END ChangeEvent add info tab to category object
368 }
369
370 if ($rbacsystem->checkAccess('write',$this->ref_id))
371 {
372 $this->tabs_gui->addTarget("settings",
373 $this->ctrl->getLinkTarget($this, "edit"), "edit", "", "", ($ilCtrl->getCmd() == "edit"));
374 }
375
376 // learning progress
377 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
378 if(ilLearningProgressAccess::checkAccess($this->object->getRefId()))
379 {
380 $this->tabs_gui->addTarget('learning_progress',
381 $this->ctrl->getLinkTargetByClass(array('ilobjfoldergui','illearningprogressgui'),''),
382 '',
383 array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui'));
384 }
385
386 if($ilAccess->checkAccess('write','',$this->object->getRefId()))
387 {
388 $this->tabs_gui->addTarget(
389 'export',
390 $this->ctrl->getLinkTargetByClass('ilexportgui',''),
391 'export',
392 'ilexportgui'
393 );
394 }
395
396
397 if ($rbacsystem->checkAccess('edit_permission',$this->ref_id))
398 {
399 $this->tabs_gui->addTarget("perm_settings",
400 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
401 }
402
403 // show clipboard in repository
404 if ($_GET["baseClass"] == "ilRepositoryGUI" and !empty($_SESSION['il_rep_clipboard']))
405 {
406 $this->tabs_gui->addTarget("clipboard",
407 $this->ctrl->getLinkTarget($this, "clipboard"), "clipboard", get_class($this));
408 }
409
410 }
411
415 public static function _goto($a_target)
416 {
417 global $ilAccess, $ilErr, $lng;
418
419 if ($ilAccess->checkAccess("read", "", $a_target))
420 {
422 }
423 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
424 }
425
426
427 public function downloadFolderObject () {
428 global $ilAccess, $ilErr, $lng;
429
430 if (!$ilAccess->checkAccess("read", "", $this->ref_id))
431 {
432 $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
433 }
434 $filename = $this->object->downloadFolder();
435 ilUtil::deliverFile($filename, ilUtil::getASCIIFilename($this->object->getTitle().".zip"));
436 }
437
445 public function modifyItemGUI($a_item_list_gui, $a_item_data, $a_show_path)
446 {
447 global $tree;
448
449 // if folder is in a course, modify item list gui according to course requirements
450 if ($course_ref_id = $tree->checkForParentType($this->object->getRefId(),'crs'))
451 {
452 include_once("./Modules/Course/classes/class.ilObjCourse.php");
453 include_once("./Modules/Course/classes/class.ilObjCourseGUI.php");
454 $course_obj_id = ilObject::_lookupObjId($course_ref_id);
456 $a_item_list_gui,
457 'ilcoursecontentgui',
458 $a_item_data,
459 $a_show_path,
460 ilObjCourse::_lookupAboStatus($course_obj_id),
461 $course_ref_id,
462 $course_obj_id,
463 $this->object->getRefId()
464 );
465 }
466 }
467
468 protected function forwardToTimingsView()
469 {
470 global $tree;
471
472 if(!$crs_ref = $tree->checkForParentType($this->ref_id, 'crs'))
473 {
474 return false;
475 }
476 include_once './Modules/Course/classes/class.ilObjCourse.php';
477 if(!$this->ctrl->getCmd() and ilObjCourse::_lookupViewMode(ilObject::_lookupObjId($crs_ref)) == ilContainer::VIEW_TIMING)
478 {
479 if(!isset($_SESSION['crs_timings'])) {
480 $_SESSION['crs_timings'] = true;
481 }
482
483 if($_SESSION['crs_timings'] == true) {
484 include_once './Modules/Course/classes/class.ilCourseContentGUI.php';
485 $course_content_obj = new ilCourseContentGUI($this);
486 $this->ctrl->setCmdClass(get_class($course_content_obj));
487 $this->ctrl->setCmd('editUserTimings');
488 $this->ctrl->forwardCommand($course_content_obj);
489 return true;
490 }
491 }
492 $_SESSION['crs_timings'] = false;
493 return false;
494 }
495
502 public function editObject()
503 {
504 global $ilTabs, $ilErr;
505
506 $this->setSubTabs("settings");
507 $ilTabs->activateTab("settings");
508
509 if (!$this->checkPermissionBool("write"))
510 {
511 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"),$ilErr->MESSAGE);
512 }
513
514 $form = $this->initEditForm();
515 $values = $this->getEditFormValues();
516 if($values)
517 {
518 $form->setValuesByArray($values,TRUE);
519 }
520 $GLOBALS['tpl']->setContent($form->getHTML());
521 }
522
523
527 function setSubTabs($a_tab)
528 {
529 global $ilTabs, $lng;
530
531 $ilTabs->addSubTab("settings",
532 $lng->txt("fold_settings"),
533 $this->ctrl->getLinkTarget($this,'edit'));
534
535 // custom icon
536 if ($this->ilias->getSetting("custom_icons"))
537 {
538 $ilTabs->addSubTab("icons",
539 $lng->txt("icon_settings"),
540 $this->ctrl->getLinkTarget($this,'editIcons'));
541 }
542
543 $ilTabs->activateSubTab($a_tab);
544 $ilTabs->activateTab("settings");
545 }
546
547
551
555 function editIconsObject($a_form = null)
556 {
557 global $tpl;
558
559 $this->checkPermission('write');
560
561 $this->tabs_gui->setTabActive('settings');
562
563 if(!$a_form)
564 {
565 $a_form = $this->initIconsForm();
566 }
567
568 $tpl->setContent($a_form->getHTML());
569 }
570
571 function initIconsForm()
572 {
573 $this->setSubTabs("icons");
574
575 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
576 $form = new ilPropertyFormGUI();
577 $form->setFormAction($this->ctrl->getFormAction($this));
578
579 $this->showCustomIconsEditing(1, $form);
580
581 // $form->setTitle($this->lng->txt('edit_grouping'));
582 $form->addCommandButton('updateIcons', $this->lng->txt('save'));
583
584 return $form;
585 }
586
591 {
592 global $ilSetting;
593
594 $this->checkPermission('write');
595
596 $form = $this->initIconsForm();
597 if($form->checkInput())
598 {
599 //save custom icons
600 if ($ilSetting->get("custom_icons"))
601 {
602 if($_POST["cont_icon_delete"])
603 {
604 $this->object->removeCustomIcon();
605 }
606 $this->object->saveIcons($_FILES["cont_icon"]['tmp_name']);
607 }
608 if ($_FILES["cont_icon"]['tmp_name'] || $_POST["cont_icon_delete"])
609 {
610 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
611 }
612 $this->ctrl->redirect($this,"editIcons");
613 }
614
615 $form->setValuesByPost();
616 $this->editIconsObject($form);
617 }
618
619
620
621} // END class.ilObjFolderGUI
622?>
$_GET["client_id"]
$_POST["username"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
background task hub (aka ajax handler, GUI)
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Class ilContainerGUI.
& forwardToPageObject()
forward command to page object
getEditFormValues()
Get values for edit form.
initSortingForm(ilPropertyFormGUI $form, array $a_sorting_settings)
Append sorting settings to property form.
prepareOutput($a_show_subobjects=true)
prepare output
forwardToStyleSheet()
Forward to style object.
showCustomIconsEditing($a_input_colspan=1, ilPropertyFormGUI $a_form=null, $a_as_section=true)
show edit section of custom icons for container
saveSortingSettings(ilPropertyFormGUI $form)
Save sorting settings.
Class ilCourseContentGUI.
GUI class for didactic template settings inside repository objects.
Export User Interface Class.
Class ilInfoScreenGUI.
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress
Class ilObjUserTrackingGUI.
static _tracProgress($a_user_id, $a_obj_id, $a_ref_id, $a_obj_type='')
static _modifyItemGUI($a_item_list_gui, $a_cmd_class, $a_item_data, $a_show_path, $a_abo_status, $a_course_ref_id, $a_course_obj_id, $a_parent_ref_id=0)
We need a static version of this, e.g.
static _lookupViewMode($a_id)
lookup view mode of container
static _lookupAboStatus($a_id)
Class ilObjFolderGUI.
setFolderTree($a_tree)
set tree
initEditCustomForm(ilPropertyFormGUI $a_form)
Add custom fields to update form.
importFileObject($parent_id=null, $a_catch_errors=true)
Import file object @global type $lng.
modifyItemGUI($a_item_list_gui, $a_item_data, $a_show_path)
Modify Item ListGUI for presentation in container @global type $tree.
editIconsObject($a_form=null)
Edit folder icons.
renderObject()
Render folder.
getEditFormCustomValues(array &$a_values)
Add values to custom edit fields.
executeCommand()
execute command note: this method is overwritten in all container objects
afterSave(ilObject $a_new_object)
Post (successful) object creation hook.
viewObject()
View folder.
updateIconsObject()
update container icons
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
updateCustom(ilPropertyFormGUI $a_form)
Insert custom update form values into object.
setSubTabs($a_tab)
Set sub tabs.
static _goto($a_target)
goto target group
showSummaryObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
__construct($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=false)
Constructor @access public.
infoScreen()
show information screen
GUI class for the workflow of copying objects.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
static _gotoRepositoryNode($a_ref_id, $a_cmd="frameset")
Goto repository root.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
initDidacticTemplate(ilPropertyFormGUI $form)
Show didactic template types.
addHeaderAction()
Add header action menu.
initEditForm()
Init object edit form.
redirectToRefId($a_ref_id, $a_cmd="")
redirects to (repository) view per ref id usually to a container and usually used at the end of a sav...
Class ilObject Basic functions for all objects.
static _lookupObjId($a_id)
getRefId()
get reference id @access public
getId()
get object id @access public
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a property form user interface.
ILIAS Setting Class.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
$info
Definition: example_052.php:80
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $ilCtrl
Definition: ilias.php:18
redirection script todo: (a better solution should control the processing via a xml file)
$ret
Definition: parser.php:6
global $ilSetting
Definition: privfeed.php:17
global $ilErr
Definition: raiseError.php:16
$cmd
Definition: sahs_server.php:35
$ilUser
Definition: imgupload.php:18