ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 // show repository tree
109 $this->showRepTree();
110
111 switch ($next_class) {
112 case 'ilpermissiongui':
113 $this->prepareOutput();
114 $this->tabs_gui->setTabActive('perm_settings');
115 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
116 $perm_gui = new ilPermissionGUI($this);
117 $ret = &$this->ctrl->forwardCommand($perm_gui);
118 break;
119
120
121 case 'ilcoursecontentgui':
122 $this->prepareOutput();
123 include_once './Modules/Course/classes/class.ilCourseContentGUI.php';
124 $course_content_obj = new ilCourseContentGUI($this);
125 $this->ctrl->forwardCommand($course_content_obj);
126 break;
127
128 case "illearningprogressgui":
129 $this->prepareOutput();
130 include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
131
132 $new_gui = new ilLearningProgressGUI(
134 $this->object->getRefId(),
135 $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId()
136 );
137 $this->ctrl->forwardCommand($new_gui);
138 $this->tabs_gui->setTabActive('learning_progress');
139 break;
140
141 // container page editing
142 case "ilcontainerpagegui":
143 $this->prepareOutput(false);
144 $ret = $this->forwardToPageObject();
145 if ($ret != "") {
146 $this->tpl->setContent($ret);
147 }
148 break;
149
150 case 'ilinfoscreengui':
151 $this->prepareOutput();
152 $this->infoScreen();
153 break;
154
155 case 'ilobjectcopygui':
156 $this->prepareOutput();
157
158 include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
159 $cp = new ilObjectCopyGUI($this);
160 $cp->setType('fold');
161 $this->ctrl->forwardCommand($cp);
162 break;
163
164 case "ilobjstylesheetgui":
165 $this->forwardToStyleSheet();
166 break;
167
168 case 'ilexportgui':
169 $this->prepareOutput();
170
171 $this->tabs_gui->setTabActive('export');
172 include_once './Services/Export/classes/class.ilExportGUI.php';
173 $exp = new ilExportGUI($this);
174 $exp->addFormat('xml');
175 $this->ctrl->forwardCommand($exp);
176 break;
177
178 case "ilcommonactiondispatchergui":
179 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
181 $this->ctrl->forwardCommand($gui);
182 break;
183
184 case 'ildidactictemplategui':
185 $this->ctrl->setReturn($this, 'edit');
186 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateGUI.php';
187 $did = new ilDidacticTemplateGUI($this);
188 $this->ctrl->forwardCommand($did);
189 break;
190 case 'ilcolumngui':
191 $this->tabs_gui->setTabActive('none');
192 $this->checkPermission("read");
193 $this->viewObject();
194 break;
195
196 case 'ilbackgroundtaskhub':
197 include_once './Services/BackgroundTask/classes/class.ilBackgroundTaskHub.php';
198 $bggui = new ilBackgroundTaskHub();
199 $this->ctrl->forwardCommand($bggui);
200 break;
201
202 case 'ilobjecttranslationgui':
203 $this->checkPermissionBool("write");
204 $this->prepareOutput();
205 $this->setSubTabs("settings_trans");
206 include_once("./Services/Object/classes/class.ilObjectTranslationGUI.php");
207 $transgui = new ilObjectTranslationGUI($this);
208 $this->ctrl->forwardCommand($transgui);
209 break;
210
211 default:
212
213 $this->prepareOutput();
214 // cognos-blu-patch: begin
215 // removed timings forward
216 // cognos-blu-patch: end
217
218 if (empty($cmd)) {
219 $cmd = "view";
220 }
221 $cmd .= "Object";
222 $this->$cmd();
223 break;
224 }
225
226 $this->addHeaderAction();
227 }
228
232 public function setFolderTree($a_tree)
233 {
234 $this->folder_tree = &$a_tree;
235 }
236
243 public function importFileObject($parent_id = null, $a_catch_errors = true)
244 {
246
247 if (parent::importFileObject($parent_id, $a_catch_errors)) {
248 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
249 $this->ctrl->returnToParent($this);
250 }
251 }
252
258 protected function initEditForm()
259 {
262 $obj_service = $this->getObjectService();
263
264 $lng->loadLanguageModule($this->object->getType());
265
266 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
267 $form = new ilPropertyFormGUI();
268 $form->setFormAction($this->ctrl->getFormAction($this, "update"));
269 $form->setTitle($this->lng->txt($this->object->getType() . "_edit"));
270
271 // title
272 $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
273 $ti->setSize(min(40, ilObject::TITLE_LENGTH));
274 $ti->setMaxLength(ilObject::TITLE_LENGTH);
275 $ti->setRequired(true);
276 $form->addItem($ti);
277
278 // description
279 $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
280 $ta->setCols(40);
281 $ta->setRows(2);
282 $form->addItem($ta);
283
284 // Show didactic template type
286
287 $pres = new ilFormSectionHeaderGUI();
288 $pres->setTitle($this->lng->txt('fold_presentation'));
289 $form->addItem($pres);
290
291 // title and icon visibility
292 $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTitleIconVisibility();
293
294 // top actions visibility
295 $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTopActionsVisibility();
296
297 // custom icon
298 $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addIcon();
299
300 // tile image
301 $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTileImage();
302
303 // list presentation
305
306 $this->initSortingForm(
307 $form,
308 array(
313 )
314 );
315
316 $form->addCommandButton("update", $this->lng->txt("save"));
317 //$this->form->addCommandButton("cancelUpdate", $lng->txt("cancel"));
318
319 return $form;
320 }
321
322 protected function getEditFormCustomValues(array &$a_values)
323 {
324 // we cannot use $this->object->getOrderType()
325 // if set to inherit it will be translated to parent setting
326 include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
327 $sort = new ilContainerSortingSettings($this->object->getId());
328 $a_values["sor"] = $sort->getSortMode();
329 }
330
331 protected function updateCustom(ilPropertyFormGUI $a_form)
332 {
333 $obj_service = $this->getObjectService();
334
335 // title icon visibility
336 $obj_service->commonSettings()->legacyForm($a_form, $this->object)->saveTitleIconVisibility();
337
338 // top actions visibility
339 $obj_service->commonSettings()->legacyForm($a_form, $this->object)->saveTopActionsVisibility();
340
341 // custom icon
342 $obj_service->commonSettings()->legacyForm($a_form, $this->object)->saveIcon();
343
344 // tile image
345 $obj_service->commonSettings()->legacyForm($a_form, $this->object)->saveTileImage();
346
347 // list presentation
348 $this->saveListPresentation($a_form);
349
350 $this->saveSortingSettings($a_form);
351 }
352
353 // BEGIN ChangeEvent show info screen on folder object
359 public function showSummaryObject()
360 {
361 $this->ctrl->setCmd("showSummary");
362 $this->ctrl->setCmdClass("ilinfoscreengui");
363 $this->infoScreen();
364 }
365
366 protected function afterSave(ilObject $a_new_object)
367 {
368 include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
369 $sort = new ilContainerSortingSettings($a_new_object->getId());
370 $sort->setSortMode(ilContainer::SORT_INHERIT);
371 $sort->update();
372
373 // always send a message
374 ilUtil::sendSuccess($this->lng->txt("fold_added"), true);
375 $this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
376 $this->redirectToRefId($a_new_object->getRefId(), "");
377 }
378
384 public function infoScreenObject()
385 {
386 $this->ctrl->setCmd("showSummary");
387 $this->ctrl->setCmdClass("ilinfoscreengui");
388 $this->infoScreen();
389 }
390
394 public function infoScreen()
395 {
396 $ilAccess = $this->access;
397
398 if (!$ilAccess->checkAccess("visible", "", $this->ref_id)) {
399 $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"), $this->ilias->error_obj->MESSAGE);
400 }
401
402 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
403 $info = new ilInfoScreenGUI($this);
404
405 $GLOBALS['ilTabs']->activateTab('info_short');
406
407 $info->enablePrivateNotes();
408
409 if ($ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
410 $info->enableNews();
411 }
412
413 // no news editing for files, just notifications
414 $info->enableNewsEditing(false);
415 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
416 $news_set = new ilSetting("news");
417 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
418
419 if ($enable_internal_rss) {
420 $info->setBlockProperty("news", "settings", true);
421 $info->setBlockProperty("news", "public_notifications_option", true);
422 }
423 }
424
425
426 // standard meta data
427 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
428
429 // forward the command
430 $this->ctrl->forwardCommand($info);
431 }
432 // END ChangeEvent show info screen on folder object
433
437 public function getTabs()
438 {
442 $ilAccess = $this->access;
443 $ilHelp = $this->help;
444
445 $this->ctrl->setParameter($this, "ref_id", $this->ref_id);
446
447 $ilHelp->setScreenIdComponent("fold");
448
449 $this->tabs_gui->setTabActive("");
450 if ($rbacsystem->checkAccess('read', $this->ref_id)) {
451 $this->tabs_gui->addTab(
452 "view_content",
453 $lng->txt("content"),
454 $this->ctrl->getLinkTarget($this, "")
455 );
456
457 //BEGIN ChangeEvent add info tab to category object
458 $force_active = ($this->ctrl->getNextClass() == "ilinfoscreengui"
459 || strtolower($_GET["cmdClass"]) == "ilnotegui")
460 ? true
461 : false;
462 $this->tabs_gui->addTarget(
463 "info_short",
464 $this->ctrl->getLinkTargetByClass(
465 array("ilobjfoldergui", "ilinfoscreengui"),
466 "showSummary"
467 ),
468 array("showSummary","", "infoScreen"),
469 "",
470 "",
471 $force_active
472 );
473 //END ChangeEvent add info tab to category object
474 }
475
476 if ($rbacsystem->checkAccess('write', $this->ref_id)) {
477 $this->tabs_gui->addTarget(
478 "settings",
479 $this->ctrl->getLinkTarget($this, "edit"),
480 "edit",
481 "",
482 "",
483 ($ilCtrl->getCmd() == "edit")
484 );
485 }
486
487 // learning progress
488 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
489 if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
490 $this->tabs_gui->addTarget(
491 'learning_progress',
492 $this->ctrl->getLinkTargetByClass(array('ilobjfoldergui','illearningprogressgui'), ''),
493 '',
494 array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui')
495 );
496 }
497
498 if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
499 $this->tabs_gui->addTarget(
500 'export',
501 $this->ctrl->getLinkTargetByClass('ilexportgui', ''),
502 'export',
503 'ilexportgui'
504 );
505 }
506
507
508 if ($rbacsystem->checkAccess('edit_permission', $this->ref_id)) {
509 $this->tabs_gui->addTarget(
510 "perm_settings",
511 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
512 array("perm","info","owner"),
513 'ilpermissiongui'
514 );
515 }
516
517 // show clipboard in repository
518 if ($_GET["baseClass"] == "ilRepositoryGUI" and !empty($_SESSION['il_rep_clipboard'])) {
519 $this->tabs_gui->addTarget(
520 "clipboard",
521 $this->ctrl->getLinkTarget($this, "clipboard"),
522 "clipboard",
523 get_class($this)
524 );
525 }
526 }
527
531 public static function _goto($a_target)
532 {
533 global $DIC;
534
535 $ilAccess = $DIC->access();
536 $ilErr = $DIC["ilErr"];
537 $lng = $DIC->language();
538
539 if ($ilAccess->checkAccess("read", "", $a_target)) {
541 }
542 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
543 }
544
545
546 public function downloadFolderObject()
547 {
548 $ilAccess = $this->access;
551
552 if (!$ilAccess->checkAccess("read", "", $this->ref_id)) {
553 $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"), $this->ilias->error_obj->MESSAGE);
554 }
555 $filename = $this->object->downloadFolder();
556 ilUtil::deliverFile($filename, ilUtil::getASCIIFilename($this->object->getTitle() . ".zip"));
557 }
558
566 public function modifyItemGUI($a_item_list_gui, $a_item_data, $a_show_path)
567 {
569
570 // if folder is in a course, modify item list gui according to course requirements
571 if ($course_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs')) {
572 include_once("./Modules/Course/classes/class.ilObjCourse.php");
573 include_once("./Modules/Course/classes/class.ilObjCourseGUI.php");
574 $course_obj_id = ilObject::_lookupObjId($course_ref_id);
576 $a_item_list_gui,
577 'ilcoursecontentgui',
578 $a_item_data,
579 $a_show_path,
580 ilObjCourse::_lookupAboStatus($course_obj_id),
581 $course_ref_id,
582 $course_obj_id,
583 $this->object->getRefId()
584 );
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
$filename
Definition: buildRTE.php:89
$_GET["client_id"]
$_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
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.
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
global $ilCtrl
Definition: ilias.php:18
$info
Definition: index.php:5
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
redirection script todo: (a better solution should control the processing via a xml file)
$ret
Definition: parser.php:6
if(isset($_POST['submit'])) $form
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2
$values
$ilUser
Definition: imgupload.php:18