ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 {
104
105 $next_class = $this->ctrl->getNextClass($this);
106 $cmd = $this->ctrl->getCmd();
107
108 switch ($next_class) {
109 case 'ilreputilgui':
110 $ru = new \ilRepUtilGUI($this);
111 $this->ctrl->setReturn($this, 'trash');
112 $this->ctrl->forwardCommand($ru);
113 break;
114
115 case 'ilpermissiongui':
116 $this->prepareOutput();
117 $this->tabs_gui->activateTab('perm_settings');
118 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
119 $perm_gui = new ilPermissionGUI($this);
120 $ret = &$this->ctrl->forwardCommand($perm_gui);
121 break;
122
123
124 case 'ilcoursecontentgui':
125 $this->prepareOutput();
126 include_once './Modules/Course/classes/class.ilCourseContentGUI.php';
127 $course_content_obj = new ilCourseContentGUI($this);
128 $this->ctrl->forwardCommand($course_content_obj);
129 break;
130
131 case "illearningprogressgui":
132 $this->prepareOutput();
133 include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
134
135 $new_gui = new ilLearningProgressGUI(
137 $this->object->getRefId(),
138 $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId()
139 );
140 $this->ctrl->forwardCommand($new_gui);
141 $this->tabs_gui->setTabActive('learning_progress');
142 break;
143
144 // container page editing
145 case "ilcontainerpagegui":
146 $this->prepareOutput(false);
147 $ret = $this->forwardToPageObject();
148 if ($ret != "") {
149 $this->tpl->setContent($ret);
150 }
151 break;
152
153 case 'ilinfoscreengui':
154 $this->prepareOutput();
155 $this->infoScreen();
156 break;
157
158 case 'ilobjectcopygui':
159 $this->prepareOutput();
160
161 include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
162 $cp = new ilObjectCopyGUI($this);
163 $cp->setType('fold');
164 $this->ctrl->forwardCommand($cp);
165 break;
166
167 case "ilobjstylesheetgui":
168 $this->forwardToStyleSheet();
169 break;
170
171 case 'ilexportgui':
172 $this->prepareOutput();
173
174 $this->tabs_gui->setTabActive('export');
175 include_once './Services/Export/classes/class.ilExportGUI.php';
176 $exp = new ilExportGUI($this);
177 $exp->addFormat('xml');
178 $this->ctrl->forwardCommand($exp);
179 break;
180
181 case "ilcommonactiondispatchergui":
182 $this->prepareOutput();
184 $this->ctrl->forwardCommand($gui);
185 break;
186
187 case 'ildidactictemplategui':
188 $this->ctrl->setReturn($this, 'edit');
189 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateGUI.php';
190 $did = new ilDidacticTemplateGUI($this);
191 $this->ctrl->forwardCommand($did);
192 break;
193 case 'ilcolumngui':
194 $this->tabs_gui->setTabActive('none');
195 $this->checkPermission("read");
196 $this->viewObject();
197 break;
198
199 case 'ilobjecttranslationgui':
200 $this->checkPermissionBool("write");
201 $this->prepareOutput();
202 $this->setSubTabs("settings_trans");
203 include_once("./Services/Object/classes/class.ilObjectTranslationGUI.php");
204 $transgui = new ilObjectTranslationGUI($this);
205 $this->ctrl->forwardCommand($transgui);
206 break;
207
208 default:
209
210 $this->prepareOutput();
211 // cognos-blu-patch: begin
212 // removed timings forward
213 // cognos-blu-patch: end
214
215 if (empty($cmd)) {
216 $cmd = "view";
217 }
218 $cmd .= "Object";
219 $this->$cmd();
220 break;
221 }
222
223 $this->addHeaderAction();
224 }
225
229 public function setFolderTree($a_tree)
230 {
231 $this->folder_tree = &$a_tree;
232 }
233
240 public function importFileObject($parent_id = null, $a_catch_errors = true)
241 {
243
244 if (parent::importFileObject($parent_id, $a_catch_errors)) {
245 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
246 $this->ctrl->returnToParent($this);
247 }
248 }
249
255 protected function initEditForm()
256 {
259 $obj_service = $this->getObjectService();
260
261 $lng->loadLanguageModule($this->object->getType());
262
263 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
264 $form = new ilPropertyFormGUI();
265 $form->setFormAction($this->ctrl->getFormAction($this, "update"));
266 $form->setTitle($this->lng->txt($this->object->getType() . "_edit"));
267
268 // title
269 $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
270 $ti->setSize(min(40, ilObject::TITLE_LENGTH));
271 $ti->setMaxLength(ilObject::TITLE_LENGTH);
272 $ti->setRequired(true);
273 $form->addItem($ti);
274
275 // description
276 $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
277 $ta->setCols(40);
278 $ta->setRows(2);
279 $form->addItem($ta);
280
281 // Show didactic template type
282 $this->initDidacticTemplate($form);
283
284 $pres = new ilFormSectionHeaderGUI();
285 $pres->setTitle($this->lng->txt('fold_presentation'));
286 $form->addItem($pres);
287
288 // title and icon visibility
289 $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTitleIconVisibility();
290
291 // top actions visibility
292 $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTopActionsVisibility();
293
294 // custom icon
295 $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addIcon();
296
297 // tile image
298 $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTileImage();
299
300 // list presentation
301 $form = $this->initListPresentationForm($form);
302
303 $this->initSortingForm(
304 $form,
305 array(
310 )
311 );
312
313 $form->addCommandButton("update", $this->lng->txt("save"));
314 //$this->form->addCommandButton("cancelUpdate", $lng->txt("cancel"));
315
316 return $form;
317 }
318
319 protected function getEditFormCustomValues(array &$a_values)
320 {
321 // we cannot use $this->object->getOrderType()
322 // if set to inherit it will be translated to parent setting
323 include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
324 $sort = new ilContainerSortingSettings($this->object->getId());
325 $a_values["sor"] = $sort->getSortMode();
326 }
327
328 protected function updateCustom(ilPropertyFormGUI $a_form)
329 {
330 $obj_service = $this->getObjectService();
331
332 // title icon visibility
333 $obj_service->commonSettings()->legacyForm($a_form, $this->object)->saveTitleIconVisibility();
334
335 // top actions visibility
336 $obj_service->commonSettings()->legacyForm($a_form, $this->object)->saveTopActionsVisibility();
337
338 // custom icon
339 $obj_service->commonSettings()->legacyForm($a_form, $this->object)->saveIcon();
340
341 // tile image
342 $obj_service->commonSettings()->legacyForm($a_form, $this->object)->saveTileImage();
343
344 // list presentation
345 $this->saveListPresentation($a_form);
346
347 $this->saveSortingSettings($a_form);
348 }
349
350 // BEGIN ChangeEvent show info screen on folder object
356 public function showSummaryObject()
357 {
358 $this->ctrl->setCmd("showSummary");
359 $this->ctrl->setCmdClass("ilinfoscreengui");
360 $this->infoScreen();
361 }
362
363 protected function afterSave(ilObject $a_new_object)
364 {
365 include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
366 $sort = new ilContainerSortingSettings($a_new_object->getId());
367 $sort->setSortMode(ilContainer::SORT_INHERIT);
368 $sort->update();
369
370 // always send a message
371 ilUtil::sendSuccess($this->lng->txt("fold_added"), true);
372 $this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
373 $this->redirectToRefId($a_new_object->getRefId(), "");
374 }
375
381 public function infoScreenObject()
382 {
383 $this->ctrl->setCmd("showSummary");
384 $this->ctrl->setCmdClass("ilinfoscreengui");
385 $this->infoScreen();
386 }
387
391 public function infoScreen()
392 {
393 $ilAccess = $this->access;
394
395 if (!$ilAccess->checkAccess("visible", "", $this->ref_id)) {
396 $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"), $this->ilias->error_obj->MESSAGE);
397 }
398
399 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
400 $info = new ilInfoScreenGUI($this);
401
402 $GLOBALS['ilTabs']->activateTab('info_short');
403
404 $info->enablePrivateNotes();
405
406 if ($ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
407 $info->enableNews();
408 }
409
410 // no news editing for files, just notifications
411 $info->enableNewsEditing(false);
412 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
413 $news_set = new ilSetting("news");
414 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
415
416 if ($enable_internal_rss) {
417 $info->setBlockProperty("news", "settings", true);
418 $info->setBlockProperty("news", "public_notifications_option", true);
419 }
420 }
421
422
423 // standard meta data
424 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
425
426 // forward the command
427 $this->ctrl->forwardCommand($info);
428 }
429 // END ChangeEvent show info screen on folder object
430
434 public function getTabs()
435 {
439 $ilAccess = $this->access;
440 $ilHelp = $this->help;
441
442 $this->ctrl->setParameter($this, "ref_id", $this->ref_id);
443
444 $ilHelp->setScreenIdComponent("fold");
445
446 $this->tabs_gui->setTabActive("");
447 if ($rbacsystem->checkAccess('read', $this->ref_id)) {
448 $this->tabs_gui->addTab(
449 "view_content",
450 $lng->txt("content"),
451 $this->ctrl->getLinkTarget($this, "")
452 );
453
454 //BEGIN ChangeEvent add info tab to category object
455 $force_active = ($this->ctrl->getNextClass() == "ilinfoscreengui"
456 || strtolower($_GET["cmdClass"]) == "ilnotegui")
457 ? true
458 : false;
459 $this->tabs_gui->addTarget(
460 "info_short",
461 $this->ctrl->getLinkTargetByClass(
462 array("ilobjfoldergui", "ilinfoscreengui"),
463 "showSummary"
464 ),
465 array("showSummary","", "infoScreen"),
466 "",
467 "",
468 $force_active
469 );
470 //END ChangeEvent add info tab to category object
471 }
472
473 if ($rbacsystem->checkAccess('write', $this->ref_id)) {
474 $this->tabs_gui->addTarget(
475 "settings",
476 $this->ctrl->getLinkTarget($this, "edit"),
477 "edit",
478 "",
479 "",
480 ($ilCtrl->getCmd() == "edit")
481 );
482 }
483
484 // learning progress
485 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
486 if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
487 $this->tabs_gui->addTarget(
488 'learning_progress',
489 $this->ctrl->getLinkTargetByClass(array('ilobjfoldergui','illearningprogressgui'), ''),
490 '',
491 array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui')
492 );
493 }
494
495 if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
496 $this->tabs_gui->addTarget(
497 'export',
498 $this->ctrl->getLinkTargetByClass('ilexportgui', ''),
499 'export',
500 'ilexportgui'
501 );
502 }
503
504
505 if ($rbacsystem->checkAccess('edit_permission', $this->ref_id)) {
506 $this->tabs_gui->addTarget(
507 "perm_settings",
508 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
509 array("perm","info","owner"),
510 'ilpermissiongui'
511 );
512 }
513
514 // show clipboard in repository
515 if ($_GET["baseClass"] == "ilRepositoryGUI" and !empty($_SESSION['il_rep_clipboard'])) {
516 $this->tabs_gui->addTarget(
517 "clipboard",
518 $this->ctrl->getLinkTarget($this, "clipboard"),
519 "clipboard",
520 get_class($this)
521 );
522 }
523 }
524
528 public static function _goto($a_target)
529 {
530 global $DIC;
531
532 $ilAccess = $DIC->access();
533 $ilErr = $DIC["ilErr"];
534 $lng = $DIC->language();
535
536 if ($ilAccess->checkAccess("read", "", $a_target)) {
538 }
539 if ($ilAccess->checkAccess("visible", "", $a_target)) {
540 ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
541 }
542 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
543 }
544
552 public function modifyItemGUI($a_item_list_gui, $a_item_data, $a_show_path)
553 {
555
556 // if folder is in a course, modify item list gui according to course requirements
557 if ($course_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs')) {
558 include_once("./Modules/Course/classes/class.ilObjCourse.php");
559 include_once("./Modules/Course/classes/class.ilObjCourseGUI.php");
560 $course_obj_id = ilObject::_lookupObjId($course_ref_id);
562 $a_item_list_gui,
563 'ilcoursecontentgui',
564 $a_item_data,
565 $a_show_path,
566 ilObjCourse::_lookupAboStatus($course_obj_id),
567 $course_ref_id,
568 $course_obj_id,
569 $this->object->getRefId()
570 );
571 }
572 }
573
574 protected function forwardToTimingsView()
575 {
577
578 if (!$crs_ref = $tree->checkForParentType($this->ref_id, 'crs')) {
579 return false;
580 }
581 include_once './Modules/Course/classes/class.ilObjCourse.php';
582 if (!$this->ctrl->getCmd() and ilObjCourse::_lookupViewMode(ilObject::_lookupObjId($crs_ref)) == ilContainer::VIEW_TIMING) {
583 if (!isset($_SESSION['crs_timings'])) {
584 $_SESSION['crs_timings'] = true;
585 }
586
587 if ($_SESSION['crs_timings'] == true) {
588 include_once './Modules/Course/classes/class.ilCourseContentGUI.php';
589 $course_content_obj = new ilCourseContentGUI($this);
590 $this->ctrl->setCmdClass(get_class($course_content_obj));
591 $this->ctrl->setCmd('editUserTimings');
592 $this->ctrl->forwardCommand($course_content_obj);
593 return true;
594 }
595 }
596 $_SESSION['crs_timings'] = false;
597 return false;
598 }
599
606 public function editObject()
607 {
608 $ilTabs = $this->tabs;
610
611 $this->setSubTabs("settings");
612 $ilTabs->activateTab("settings");
613
614 if (!$this->checkPermissionBool("write")) {
615 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $ilErr->MESSAGE);
616 }
617
618 $form = $this->initEditForm();
619 $values = $this->getEditFormValues();
620 if ($values) {
621 $form->setValuesByArray($values, true);
622 }
623 $GLOBALS['tpl']->setContent($form->getHTML());
624 }
625
626
630 public function setSubTabs($a_tab)
631 {
632 $ilTabs = $this->tabs;
634
635 $ilTabs->addSubTab(
636 "settings",
637 $lng->txt("fold_settings"),
638 $this->ctrl->getLinkTarget($this, 'edit')
639 );
640
641 $this->tabs_gui->addSubTab(
642 "settings_trans",
643 $this->lng->txt("obj_multilinguality"),
644 $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", "")
645 );
646
647 $ilTabs->activateSubTab($a_tab);
648 $ilTabs->activateTab("settings");
649 }
650} // 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.
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
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.
help()
Definition: help.php:2
global $ilCtrl
Definition: ilias.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
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46