ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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{
28 protected $help;
29
30 public $folder_tree; // folder tree
31
36 public function __construct($a_data, $a_id = 0, $a_call_by_reference = true, $a_prepare_output = false)
37 {
38 global $DIC;
39
40 $this->tree = $DIC->repositoryTree();
41 $this->tabs = $DIC->tabs();
42 $this->user = $DIC->user();
43 $this->ctrl = $DIC->ctrl();
44 $this->lng = $DIC->language();
45 $this->access = $DIC->access();
46 $this->rbacsystem = $DIC->rbac()->system();
47 $this->help = $DIC["ilHelp"];
48 $this->error = $DIC["ilErr"];
49 $this->tpl = $DIC["tpl"];
50 $this->settings = $DIC->settings();
51 $this->type = "fold";
52 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output, false);
53 }
54
55
59 public function viewObject()
60 {
62
63 $this->checkPermission('read');
64
65 if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
66 parent::viewObject();
67 return true;
68 }
69
70 // Trac access - see ilObjCourseGUI
71 include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
73 $GLOBALS["ilUser"]->getId(),
74 $this->object->getId(),
75 $this->object->getRefId(),
76 'fold'
77 );
78
79 $this->renderObject();
80 $this->tabs_gui->setTabActive('view_content');
81 return true;
82 }
83
87 public function renderObject()
88 {
89 $ilTabs = $this->tabs;
90
91 $this->checkPermission('read');
92
93 $ilTabs->activateTab("view_content");
94 $ret = parent::renderObject();
95 return $ret;
96 }
97
98 public function executeCommand()
99 {
102
103 $next_class = $this->ctrl->getNextClass($this);
104 $cmd = $this->ctrl->getCmd();
105
106 // show repository tree
107 $this->showRepTree();
108
109 switch ($next_class) {
110 case 'ilpermissiongui':
111 $this->prepareOutput();
112 $this->tabs_gui->setTabActive('perm_settings');
113 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
114 $perm_gui = new ilPermissionGUI($this);
115 $ret =&$this->ctrl->forwardCommand($perm_gui);
116 break;
117
118 case 'ilcoursecontentgui':
119 $this->prepareOutput();
120 include_once './Modules/Course/classes/class.ilCourseContentGUI.php';
121 $course_content_obj = new ilCourseContentGUI($this);
122 $this->ctrl->forwardCommand($course_content_obj);
123 break;
124
125 case "illearningprogressgui":
126 $this->prepareOutput();
127 include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
128
129 $new_gui = new ilLearningProgressGUI(
131 $this->object->getRefId(),
132 $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId()
133 );
134 $this->ctrl->forwardCommand($new_gui);
135 $this->tabs_gui->setTabActive('learning_progress');
136 break;
137
138 // container page editing
139 case "ilcontainerpagegui":
140 $this->prepareOutput(false);
141 $ret = $this->forwardToPageObject();
142 if ($ret != "") {
143 $this->tpl->setContent($ret);
144 }
145 break;
146
147 case 'ilinfoscreengui':
148 $this->prepareOutput();
149 $this->infoScreen();
150 break;
151
152 case 'ilobjectcopygui':
153 $this->prepareOutput();
154
155 include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
156 $cp = new ilObjectCopyGUI($this);
157 $cp->setType('fold');
158 $this->ctrl->forwardCommand($cp);
159 break;
160
161 case "ilobjstylesheetgui":
162 $this->forwardToStyleSheet();
163 break;
164
165 case 'ilexportgui':
166 $this->prepareOutput();
167
168 $this->tabs_gui->setTabActive('export');
169 include_once './Services/Export/classes/class.ilExportGUI.php';
170 $exp = new ilExportGUI($this);
171 $exp->addFormat('xml');
172 $this->ctrl->forwardCommand($exp);
173 break;
174
175 case "ilcommonactiondispatchergui":
176 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
178 $this->ctrl->forwardCommand($gui);
179 break;
180
181 case 'ildidactictemplategui':
182 $this->ctrl->setReturn($this, 'edit');
183 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateGUI.php';
184 $did = new ilDidacticTemplateGUI($this);
185 $this->ctrl->forwardCommand($did);
186 break;
187 case 'ilcolumngui':
188 $this->tabs_gui->setTabActive('none');
189 $this->checkPermission("read");
190 $this->viewObject();
191 break;
192
193 case 'ilbackgroundtaskhub':
194 include_once './Services/BackgroundTask/classes/class.ilBackgroundTaskHub.php';
195 $bggui = new ilBackgroundTaskHub();
196 $this->ctrl->forwardCommand($bggui);
197 break;
198
199 default:
200
201 $this->prepareOutput();
202 // Dirty hack for course timings view
203 if ($this->forwardToTimingsView()) {
204 break;
205 }
206
207 if (empty($cmd)) {
208 $cmd = "view";
209 }
210 $cmd .= "Object";
211 $this->$cmd();
212 break;
213 }
214
215 $this->addHeaderAction();
216 }
217
221 public function setFolderTree($a_tree)
222 {
223 $this->folder_tree =&$a_tree;
224 }
225
232 public function importFileObject($parent_id = null, $a_catch_errors = true)
233 {
235
236 if (parent::importFileObject($parent_id, $a_catch_errors)) {
237 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
238 $this->ctrl->returnToParent($this);
239 }
240 }
241
242
243
244 protected function initEditCustomForm(ilPropertyFormGUI $a_form)
245 {
246 // Show didactic template type
247 $this->initDidacticTemplate($a_form);
248
249 $this->initSortingForm(
250 $a_form,
251 array(
256 )
257 );
258 }
259
260 protected function getEditFormCustomValues(array &$a_values)
261 {
262 // we cannot use $this->object->getOrderType()
263 // if set to inherit it will be translated to parent setting
264 include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
265 $sort = new ilContainerSortingSettings($this->object->getId());
266 $a_values["sor"] = $sort->getSortMode();
267 }
268
269 protected function updateCustom(ilPropertyFormGUI $a_form)
270 {
271 $this->saveSortingSettings($a_form);
272 }
273
274 // BEGIN ChangeEvent show info screen on folder object
280 public function showSummaryObject()
281 {
282 $this->ctrl->setCmd("showSummary");
283 $this->ctrl->setCmdClass("ilinfoscreengui");
284 $this->infoScreen();
285 }
286
287 protected function afterSave(ilObject $a_new_object)
288 {
289 include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
290 $sort = new ilContainerSortingSettings($a_new_object->getId());
291 $sort->setSortMode(ilContainer::SORT_INHERIT);
292 $sort->update();
293
294 // always send a message
295 ilUtil::sendSuccess($this->lng->txt("fold_added"), true);
296 $this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
297 $this->redirectToRefId($a_new_object->getRefId(), "");
298 }
299
305 public function infoScreenObject()
306 {
307 $this->ctrl->setCmd("showSummary");
308 $this->ctrl->setCmdClass("ilinfoscreengui");
309 $this->infoScreen();
310 }
311
315 public function infoScreen()
316 {
317 $ilAccess = $this->access;
318
319 if (!$ilAccess->checkAccess("visible", "", $this->ref_id)) {
320 $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"), $this->ilias->error_obj->MESSAGE);
321 }
322
323 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
324 $info = new ilInfoScreenGUI($this);
325
326 $GLOBALS['ilTabs']->activateTab('info_short');
327
328 $info->enablePrivateNotes();
329
330 if ($ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
331 $info->enableNews();
332 }
333
334 // no news editing for files, just notifications
335 $info->enableNewsEditing(false);
336 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
337 $news_set = new ilSetting("news");
338 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
339
340 if ($enable_internal_rss) {
341 $info->setBlockProperty("news", "settings", true);
342 $info->setBlockProperty("news", "public_notifications_option", true);
343 }
344 }
345
346
347 // standard meta data
348 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
349
350 // forward the command
351 $this->ctrl->forwardCommand($info);
352 }
353 // END ChangeEvent show info screen on folder object
354
358 public function getTabs()
359 {
363 $ilAccess = $this->access;
364 $ilHelp = $this->help;
365
366 $this->ctrl->setParameter($this, "ref_id", $this->ref_id);
367
368 $ilHelp->setScreenIdComponent("fold");
369
370 $this->tabs_gui->setTabActive("");
371 if ($rbacsystem->checkAccess('read', $this->ref_id)) {
372 $this->tabs_gui->addTab(
373 "view_content",
374 $lng->txt("content"),
375 $this->ctrl->getLinkTarget($this, "")
376 );
377
378 //BEGIN ChangeEvent add info tab to category object
379 $force_active = ($this->ctrl->getNextClass() == "ilinfoscreengui"
380 || strtolower($_GET["cmdClass"]) == "ilnotegui")
381 ? true
382 : false;
383 $this->tabs_gui->addTarget(
384 "info_short",
385 $this->ctrl->getLinkTargetByClass(
386 array("ilobjfoldergui", "ilinfoscreengui"),
387 "showSummary"
388 ),
389 array("showSummary","", "infoScreen"),
390 "",
391 "",
392 $force_active
393 );
394 //END ChangeEvent add info tab to category object
395 }
396
397 if ($rbacsystem->checkAccess('write', $this->ref_id)) {
398 $this->tabs_gui->addTarget(
399 "settings",
400 $this->ctrl->getLinkTarget($this, "edit"),
401 "edit",
402 "",
403 "",
404 ($ilCtrl->getCmd() == "edit")
405 );
406 }
407
408 // learning progress
409 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
410 if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
411 $this->tabs_gui->addTarget(
412 'learning_progress',
413 $this->ctrl->getLinkTargetByClass(array('ilobjfoldergui','illearningprogressgui'), ''),
414 '',
415 array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui')
416 );
417 }
418
419 if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
420 $this->tabs_gui->addTarget(
421 'export',
422 $this->ctrl->getLinkTargetByClass('ilexportgui', ''),
423 'export',
424 'ilexportgui'
425 );
426 }
427
428
429 if ($rbacsystem->checkAccess('edit_permission', $this->ref_id)) {
430 $this->tabs_gui->addTarget(
431 "perm_settings",
432 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
433 array("perm","info","owner"),
434 'ilpermissiongui'
435 );
436 }
437
438 // show clipboard in repository
439 if ($_GET["baseClass"] == "ilRepositoryGUI" and !empty($_SESSION['il_rep_clipboard'])) {
440 $this->tabs_gui->addTarget(
441 "clipboard",
442 $this->ctrl->getLinkTarget($this, "clipboard"),
443 "clipboard",
444 get_class($this)
445 );
446 }
447 }
448
452 public static function _goto($a_target)
453 {
454 global $DIC;
455
456 $ilAccess = $DIC->access();
457 $ilErr = $DIC["ilErr"];
458 $lng = $DIC->language();
459
460 if ($ilAccess->checkAccess("read", "", $a_target)) {
462 }
463 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
464 }
465
466
467 public function downloadFolderObject()
468 {
469 $ilAccess = $this->access;
472
473 if (!$ilAccess->checkAccess("read", "", $this->ref_id)) {
474 $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"), $this->ilias->error_obj->MESSAGE);
475 }
476 $filename = $this->object->downloadFolder();
477 ilUtil::deliverFile($filename, ilUtil::getASCIIFilename($this->object->getTitle() . ".zip"));
478 }
479
487 public function modifyItemGUI($a_item_list_gui, $a_item_data, $a_show_path)
488 {
490
491 // if folder is in a course, modify item list gui according to course requirements
492 if ($course_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs')) {
493 include_once("./Modules/Course/classes/class.ilObjCourse.php");
494 include_once("./Modules/Course/classes/class.ilObjCourseGUI.php");
495 $course_obj_id = ilObject::_lookupObjId($course_ref_id);
497 $a_item_list_gui,
498 'ilcoursecontentgui',
499 $a_item_data,
500 $a_show_path,
501 ilObjCourse::_lookupAboStatus($course_obj_id),
502 $course_ref_id,
503 $course_obj_id,
504 $this->object->getRefId()
505 );
506 }
507 }
508
509 protected function forwardToTimingsView()
510 {
512
513 if (!$crs_ref = $tree->checkForParentType($this->ref_id, 'crs')) {
514 return false;
515 }
516 include_once './Modules/Course/classes/class.ilObjCourse.php';
517 if (!$this->ctrl->getCmd() and ilObjCourse::_lookupViewMode(ilObject::_lookupObjId($crs_ref)) == ilContainer::VIEW_TIMING) {
518 if (!isset($_SESSION['crs_timings'])) {
519 $_SESSION['crs_timings'] = true;
520 }
521
522 if ($_SESSION['crs_timings'] == true) {
523 include_once './Modules/Course/classes/class.ilCourseContentGUI.php';
524 $course_content_obj = new ilCourseContentGUI($this);
525 $this->ctrl->setCmdClass(get_class($course_content_obj));
526 $this->ctrl->setCmd('editUserTimings');
527 $this->ctrl->forwardCommand($course_content_obj);
528 return true;
529 }
530 }
531 $_SESSION['crs_timings'] = false;
532 return false;
533 }
534
541 public function editObject()
542 {
543 $ilTabs = $this->tabs;
545
546 $this->setSubTabs("settings");
547 $ilTabs->activateTab("settings");
548
549 if (!$this->checkPermissionBool("write")) {
550 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $ilErr->MESSAGE);
551 }
552
553 $form = $this->initEditForm();
554 $values = $this->getEditFormValues();
555 if ($values) {
556 $form->setValuesByArray($values, true);
557 }
558 $GLOBALS['tpl']->setContent($form->getHTML());
559 }
560
561
565 public function setSubTabs($a_tab)
566 {
567 $ilTabs = $this->tabs;
569
570 $ilTabs->addSubTab(
571 "settings",
572 $lng->txt("fold_settings"),
573 $this->ctrl->getLinkTarget($this, 'edit')
574 );
575
576 // custom icon
577 if ($this->ilias->getSetting("custom_icons")) {
578 $ilTabs->addSubTab(
579 "icons",
580 $lng->txt("icon_settings"),
581 $this->ctrl->getLinkTarget($this, 'editIcons')
582 );
583 }
584
585 $ilTabs->activateSubTab($a_tab);
586 $ilTabs->activateTab("settings");
587 }
588
589
593
597 public function editIconsObject($a_form = null)
598 {
600
601 $this->checkPermission('write');
602
603 $this->tabs_gui->setTabActive('settings');
604
605 if (!$a_form) {
606 $a_form = $this->initIconsForm();
607 }
608
609 $tpl->setContent($a_form->getHTML());
610 }
611
612 public function initIconsForm()
613 {
614 $this->setSubTabs("icons");
615
616 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
617 $form = new ilPropertyFormGUI();
618 $form->setFormAction($this->ctrl->getFormAction($this));
619
620 $this->showCustomIconsEditing(1, $form);
621
622 // $form->setTitle($this->lng->txt('edit_grouping'));
623 $form->addCommandButton('updateIcons', $this->lng->txt('save'));
624
625 return $form;
626 }
627
631 public function updateIconsObject()
632 {
634
635 $this->checkPermission('write');
636
637 $form = $this->initIconsForm();
638 if ($form->checkInput()) {
639 //save custom icons
640 if ($ilSetting->get("custom_icons")) {
641 if ($_POST["cont_icon_delete"]) {
642 $this->object->removeCustomIcon();
643 }
644 $this->object->saveIcons($_FILES["cont_icon"]['tmp_name']);
645 }
646 if ($_FILES["cont_icon"]['tmp_name'] || $_POST["cont_icon_delete"]) {
647 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
648 }
649 $this->ctrl->redirect($this, "editIcons");
650 }
651
652 $form->setValuesByPost();
653 $this->editIconsObject($form);
654 }
655} // END class.ilObjFolderGUI
user()
Definition: user.php:4
$_GET["client_id"]
$_POST["username"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
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 deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $ilCtrl
Definition: ilias.php:18
$info
Definition: index.php:5
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
if(isset($_POST['submit'])) $form
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2
$ilUser
Definition: imgupload.php:18