ILIAS  release_7 Revision v7.30-3-g800a261c036
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 $this->lng->loadLanguageModule("obj");
55 }
56
57
61 public function viewObject()
62 {
64
65 $this->checkPermission('read');
66
67 if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
68 parent::viewObject();
69 return true;
70 }
71
72 // Trac access - see ilObjCourseGUI
73 include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
75 $GLOBALS["ilUser"]->getId(),
76 $this->object->getId(),
77 $this->object->getRefId(),
78 'fold'
79 );
80
81 $this->renderObject();
82 $this->tabs_gui->setTabActive('view_content');
83 return true;
84 }
85
89 public function renderObject()
90 {
91 $ilTabs = $this->tabs;
92
93 $this->checkPermission('read');
94
95 $ilTabs->activateTab("view_content");
96 $ret = parent::renderObject();
97 return $ret;
98 }
99
100 public function executeCommand()
101 {
103 $ilCtrl = $this->ctrl;
104
105 $next_class = $this->ctrl->getNextClass($this);
106 $cmd = $this->ctrl->getCmd();
107
108 $header_action = true;
109 switch ($next_class) {
110 case 'ilreputilgui':
111 $ru = new \ilRepUtilGUI($this);
112 $this->ctrl->setReturn($this, 'trash');
113 $this->ctrl->forwardCommand($ru);
114 break;
115
116 case 'ilpermissiongui':
117 $this->prepareOutput();
118 $this->tabs_gui->activateTab('perm_settings');
119 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
120 $perm_gui = new ilPermissionGUI($this);
121 $ret = &$this->ctrl->forwardCommand($perm_gui);
122 break;
123
124
125 case 'ilcoursecontentgui':
126 $this->prepareOutput();
127 include_once './Modules/Course/classes/class.ilCourseContentGUI.php';
128 $course_content_obj = new ilCourseContentGUI($this);
129 $this->ctrl->forwardCommand($course_content_obj);
130 break;
131
132 case "illearningprogressgui":
133 $this->prepareOutput();
134 include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
135
136 $new_gui = new ilLearningProgressGUI(
138 $this->object->getRefId(),
139 $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId()
140 );
141 $this->ctrl->forwardCommand($new_gui);
142 $this->tabs_gui->setTabActive('learning_progress');
143 break;
144
145 // container page editing
146 case "ilcontainerpagegui":
147 $this->prepareOutput(false);
148 $ret = $this->forwardToPageObject();
149 if ($ret != "") {
150 $this->tpl->setContent($ret);
151 }
152 $header_action = false;
153 break;
154
155 case 'ilinfoscreengui':
156 $this->prepareOutput();
157 $this->infoScreen();
158 break;
159
160 case 'ilobjectcopygui':
161 $this->prepareOutput();
162
163 include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
164 $cp = new ilObjectCopyGUI($this);
165 $cp->setType('fold');
166 $this->ctrl->forwardCommand($cp);
167 break;
168
169 case "ilobjstylesheetgui":
170 $this->forwardToStyleSheet();
171 break;
172
173 case 'ilexportgui':
174 $this->prepareOutput();
175
176 $this->tabs_gui->setTabActive('export');
177 include_once './Services/Export/classes/class.ilExportGUI.php';
178 $exp = new ilExportGUI($this);
179 $exp->addFormat('xml');
180 $this->ctrl->forwardCommand($exp);
181 break;
182
183 case "ilcommonactiondispatchergui":
184 $this->prepareOutput();
186 $this->ctrl->forwardCommand($gui);
187 break;
188
189 case 'ildidactictemplategui':
190 $this->ctrl->setReturn($this, 'edit');
191 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateGUI.php';
192 $did = new ilDidacticTemplateGUI($this);
193 $this->ctrl->forwardCommand($did);
194 break;
195 case 'ilcolumngui':
196 $this->tabs_gui->setTabActive('none');
197 $this->checkPermission("read");
198 $this->viewObject();
199 break;
200
201 case 'ilobjecttranslationgui':
202 $this->checkPermissionBool("write");
203 $this->prepareOutput();
204 $this->setSubTabs("settings_trans");
205 include_once("./Services/Object/classes/class.ilObjectTranslationGUI.php");
206 $transgui = new ilObjectTranslationGUI($this);
207 $this->ctrl->forwardCommand($transgui);
208 break;
209
210 default:
211
212 $this->prepareOutput();
213 // cognos-blu-patch: begin
214 // removed timings forward
215 // cognos-blu-patch: end
216
217 if (empty($cmd)) {
218 $cmd = "view";
219 }
220 $cmd .= "Object";
221 $this->$cmd();
222 break;
223 }
224
225 if ($header_action) {
226 $this->addHeaderAction();
227 }
228 }
229
233 public function setFolderTree($a_tree)
234 {
235 $this->folder_tree = &$a_tree;
236 }
237
244 public function importFileObject($parent_id = null, $a_catch_errors = true)
245 {
247
248 if (parent::importFileObject($parent_id, $a_catch_errors)) {
249 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
250 $this->ctrl->returnToParent($this);
251 }
252 }
253
259 protected function initEditForm()
260 {
262 $ilCtrl = $this->ctrl;
263 $obj_service = $this->getObjectService();
264
265 $lng->loadLanguageModule($this->object->getType());
266
267 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
268 $form = new ilPropertyFormGUI();
269 $form->setFormAction($this->ctrl->getFormAction($this, "update"));
270 $form->setTitle($this->lng->txt($this->object->getType() . "_edit"));
271
272 // title
273 $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
274 $ti->setSize(min(40, ilObject::TITLE_LENGTH));
275 $ti->setMaxLength(ilObject::TITLE_LENGTH);
276 $ti->setRequired(true);
277 $form->addItem($ti);
278
279 // description
280 $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
281 $ta->setCols(40);
282 $ta->setRows(2);
283 $form->addItem($ta);
284
285 // Show didactic template type
286 $this->initDidacticTemplate($form);
287
288 $pres = new ilFormSectionHeaderGUI();
289 $pres->setTitle($this->lng->txt('fold_presentation'));
290 $form->addItem($pres);
291
292 // title and icon visibility
293 $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTitleIconVisibility();
294
295 // top actions visibility
296 $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTopActionsVisibility();
297
298 // custom icon
299 $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addIcon();
300
301 // tile image
302 $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTileImage();
303
304 // list presentation
305 $form = $this->initListPresentationForm($form);
306
307 $this->initSortingForm(
308 $form,
309 array(
314 )
315 );
316
317 $form->addCommandButton("update", $this->lng->txt("save"));
318 //$this->form->addCommandButton("cancelUpdate", $lng->txt("cancel"));
319
320 return $form;
321 }
322
323 protected function getEditFormCustomValues(array &$a_values)
324 {
325 // we cannot use $this->object->getOrderType()
326 // if set to inherit it will be translated to parent setting
327 include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
328 $sort = new ilContainerSortingSettings($this->object->getId());
329 $a_values["sor"] = $sort->getSortMode();
330 }
331
332 protected function updateCustom(ilPropertyFormGUI $a_form)
333 {
334 $obj_service = $this->getObjectService();
335
336 // title icon visibility
337 $obj_service->commonSettings()->legacyForm($a_form, $this->object)->saveTitleIconVisibility();
338
339 // top actions visibility
340 $obj_service->commonSettings()->legacyForm($a_form, $this->object)->saveTopActionsVisibility();
341
342 // custom icon
343 $obj_service->commonSettings()->legacyForm($a_form, $this->object)->saveIcon();
344
345 // tile image
346 $obj_service->commonSettings()->legacyForm($a_form, $this->object)->saveTileImage();
347
348 // list presentation
349 $this->saveListPresentation($a_form);
350
351 $this->saveSortingSettings($a_form);
352 }
353
354 // BEGIN ChangeEvent show info screen on folder object
360 public function showSummaryObject()
361 {
362 $this->ctrl->setCmd("showSummary");
363 $this->ctrl->setCmdClass("ilinfoscreengui");
364 $this->infoScreen();
365 }
366
367 protected function afterSave(ilObject $a_new_object)
368 {
369 include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
370 $sort = new ilContainerSortingSettings($a_new_object->getId());
371 $sort->setSortMode(ilContainer::SORT_INHERIT);
372 $sort->update();
373
374 // always send a message
375 ilUtil::sendSuccess($this->lng->txt("fold_added"), true);
376 $this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
377 $this->redirectToRefId($a_new_object->getRefId(), "");
378 }
379
385 public function infoScreenObject()
386 {
387 $this->ctrl->setCmd("showSummary");
388 $this->ctrl->setCmdClass("ilinfoscreengui");
389 $this->infoScreen();
390 }
391
395 public function infoScreen()
396 {
397 $ilAccess = $this->access;
398
399 if (!$ilAccess->checkAccess("visible", "", $this->ref_id)) {
400 $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"), $this->ilias->error_obj->MESSAGE);
401 }
402
403 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
404 $info = new ilInfoScreenGUI($this);
405
406 $GLOBALS['ilTabs']->activateTab('info_short');
407
408 $info->enablePrivateNotes();
409
410 if ($ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
411 $info->enableNews();
412 }
413
414 // no news editing for files, just notifications
415 $info->enableNewsEditing(false);
416 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
417 $news_set = new ilSetting("news");
418 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
419
420 if ($enable_internal_rss) {
421 $info->setBlockProperty("news", "settings", true);
422 $info->setBlockProperty("news", "public_notifications_option", true);
423 }
424 }
425
426
427 // standard meta data
428 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
429
430 // forward the command
431 $this->ctrl->forwardCommand($info);
432 }
433 // END ChangeEvent show info screen on folder object
434
438 public function getTabs()
439 {
442 $ilCtrl = $this->ctrl;
443 $ilAccess = $this->access;
444 $ilHelp = $this->help;
445
446 $this->ctrl->setParameter($this, "ref_id", $this->ref_id);
447
448 $ilHelp->setScreenIdComponent("fold");
449
450 $this->tabs_gui->setTabActive("");
451 if ($ilAccess->checkAccess('read', '', $this->ref_id)) {
452 $this->tabs_gui->addTab(
453 "view_content",
454 $lng->txt("content"),
455 $this->ctrl->getLinkTarget($this, "")
456 );
457
458 //BEGIN ChangeEvent add info tab to category object
459 $force_active = ($this->ctrl->getNextClass() == "ilinfoscreengui"
460 || strtolower($_GET["cmdClass"]) == "ilnotegui")
461 ? true
462 : false;
463 $this->tabs_gui->addTarget(
464 "info_short",
465 $this->ctrl->getLinkTargetByClass(
466 array("ilobjfoldergui", "ilinfoscreengui"),
467 "showSummary"
468 ),
469 array("showSummary","", "infoScreen"),
470 "",
471 "",
472 $force_active
473 );
474 //END ChangeEvent add info tab to category object
475 }
476
477 if ($rbacsystem->checkAccess('write', $this->ref_id)) {
478 $this->tabs_gui->addTarget(
479 "settings",
480 $this->ctrl->getLinkTarget($this, "edit"),
481 "edit",
482 "",
483 "",
484 ($ilCtrl->getCmd() == "edit")
485 );
486 }
487
488 // learning progress
489 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
490 if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
491 $this->tabs_gui->addTarget(
492 'learning_progress',
493 $this->ctrl->getLinkTargetByClass(array('ilobjfoldergui','illearningprogressgui'), ''),
494 '',
495 array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui')
496 );
497 }
498
499 if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
500 $this->tabs_gui->addTarget(
501 'export',
502 $this->ctrl->getLinkTargetByClass('ilexportgui', ''),
503 'export',
504 'ilexportgui'
505 );
506 }
507
508
509 if ($rbacsystem->checkAccess('edit_permission', $this->ref_id)) {
510 $this->tabs_gui->addTarget(
511 "perm_settings",
512 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
513 array("perm","info","owner"),
514 'ilpermissiongui'
515 );
516 }
517
518 // show clipboard in repository
519 if ($_GET["baseClass"] == "ilRepositoryGUI" and !empty($_SESSION['il_rep_clipboard'])) {
520 $this->tabs_gui->addTarget(
521 "clipboard",
522 $this->ctrl->getLinkTarget($this, "clipboard"),
523 "clipboard",
524 get_class($this)
525 );
526 }
527 }
528
532 public static function _goto($a_target)
533 {
534 global $DIC;
535
536 $ilAccess = $DIC->access();
537 $ilErr = $DIC["ilErr"];
538 $lng = $DIC->language();
539
540 if ($ilAccess->checkAccess("read", "", $a_target)) {
542 }
543 if ($ilAccess->checkAccess("visible", "", $a_target)) {
544 ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
545 }
546 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
547 }
548
556 public function modifyItemGUI($a_item_list_gui, $a_item_data, $a_show_path)
557 {
559
560 // if folder is in a course, modify item list gui according to course requirements
561 if ($course_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs')) {
562 include_once("./Modules/Course/classes/class.ilObjCourse.php");
563 include_once("./Modules/Course/classes/class.ilObjCourseGUI.php");
564 $course_obj_id = ilObject::_lookupObjId($course_ref_id);
566 $a_item_list_gui,
567 'ilcoursecontentgui',
568 $a_item_data,
569 $a_show_path,
570 ilObjCourse::_lookupAboStatus($course_obj_id),
571 $course_ref_id,
572 $course_obj_id,
573 $this->object->getRefId()
574 );
575 }
576 }
577
581 public function showPossibleSubObjects()
582 {
583 $gui = new ilObjectAddNewItemGUI($this->object->getRefId());
584 $gui->render();
585 }
586
587
588 protected function forwardToTimingsView()
589 {
591
592 if (!$crs_ref = $tree->checkForParentType($this->ref_id, 'crs')) {
593 return false;
594 }
595 include_once './Modules/Course/classes/class.ilObjCourse.php';
596 if (!$this->ctrl->getCmd() and ilObjCourse::_lookupViewMode(ilObject::_lookupObjId($crs_ref)) == ilContainer::VIEW_TIMING) {
597 if (!isset($_SESSION['crs_timings'])) {
598 $_SESSION['crs_timings'] = true;
599 }
600
601 if ($_SESSION['crs_timings'] == true) {
602 include_once './Modules/Course/classes/class.ilCourseContentGUI.php';
603 $course_content_obj = new ilCourseContentGUI($this);
604 $this->ctrl->setCmdClass(get_class($course_content_obj));
605 $this->ctrl->setCmd('editUserTimings');
606 $this->ctrl->forwardCommand($course_content_obj);
607 return true;
608 }
609 }
610 $_SESSION['crs_timings'] = false;
611 return false;
612 }
613
620 public function editObject()
621 {
622 $ilTabs = $this->tabs;
624
625 $this->setSubTabs("settings");
626 $ilTabs->activateTab("settings");
627
628 if (!$this->checkPermissionBool("write")) {
629 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $ilErr->MESSAGE);
630 }
631
632 $form = $this->initEditForm();
633 $values = $this->getEditFormValues();
634 if ($values) {
635 $form->setValuesByArray($values, true);
636 }
637 $GLOBALS['tpl']->setContent($form->getHTML());
638 }
639
640
644 public function setSubTabs($a_tab)
645 {
646 $ilTabs = $this->tabs;
648
649 $ilTabs->addSubTab(
650 "settings",
651 $lng->txt("fold_settings"),
652 $this->ctrl->getLinkTarget($this, 'edit')
653 );
654
655 $this->tabs_gui->addSubTab(
656 "settings_trans",
657 $this->lng->txt("obj_multilinguality"),
658 $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", "")
659 );
660
661 $ilTabs->activateSubTab($a_tab);
662 $ilTabs->activateTab("settings");
663 }
664} // END class.ilObjFolderGUI
user()
Definition: user.php:4
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$_GET["client_id"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
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
saveListPresentation(ilPropertyFormGUI $form)
Save list presentation setting.
forwardToStyleSheet()
Forward to style object.
initListPresentationForm(ilPropertyFormGUI $form)
Add list presentation settings to form.
saveSortingSettings(ilPropertyFormGUI $form)
Save sorting settings.
Class ilCourseContentGUI.
GUI class for didactic template settings inside repository objects.
Export User Interface Class.
This class represents a section header in a property form.
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
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.
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.
showPossibleSubObjects()
show possible sub objects selection list
viewObject()
View folder.
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.
initEditForm()
Init object edit form.
infoScreen()
show information screen
Render add new item selector.
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.
getObjectService()
Get object service.
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...
GUI class for object translation handling.
Class ilObject Basic functions for all objects.
static _lookupObjId($a_id)
const TITLE_LENGTH
max length of object title
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.
This class represents a text area property in a property form.
This class represents a text property in a property form.
global $DIC
Definition: goto.php:24
help()
Definition: help.php:2
$ilUser
Definition: imgupload.php:18
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
redirection script todo: (a better solution should control the processing via a xml file)
$ret
Definition: parser.php:6
settings()
Definition: settings.php:2