ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
20require_once "./Services/Container/classes/class.ilContainerGUI.php";
21
23{
24 var $folder_tree; // folder tree
25
30 function ilObjFolderGUI($a_data, $a_id = 0, $a_call_by_reference = true, $a_prepare_output = false)
31 {
32 $this->type = "fold";
33 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output, false);
34 }
35
36
40 function viewObject()
41 {
42 global $tree;
43
44 $this->checkPermission('read');
45
46 if (strtolower($_GET["baseClass"]) == "iladministrationgui")
47 {
48 parent::viewObject();
49 return true;
50 }
51
52 // Trac access - see ilObjCourseGUI
53 include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
54 ilLearningProgress::_tracProgress($GLOBALS["ilUser"]->getId(),$this->object->getId(),
55 $this->object->getRefId(),'fold');
56
57 $this->renderObject();
58 $this->tabs_gui->setTabActive('view_content');
59 return true;
60 }
61
65 function renderObject()
66 {
67 global $ilTabs;
68
69 $this->checkPermission('read');
70
71 $ilTabs->activateTab("view_content");
72 $ret = parent::renderObject();
73 return $ret;
74 }
75
76 function &executeCommand()
77 {
78 global $ilUser,$ilCtrl;
79
80 $next_class = $this->ctrl->getNextClass($this);
81 $cmd = $this->ctrl->getCmd();
82
83 // show repository tree
84 $this->showRepTree();
85
86 switch ($next_class)
87 {
88 case 'ilpermissiongui':
89 $this->prepareOutput();
90 $this->tabs_gui->setTabActive('perm_settings');
91 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
92 $perm_gui =& new ilPermissionGUI($this);
93 $ret =& $this->ctrl->forwardCommand($perm_gui);
94 break;
95
96 case 'ilcoursecontentgui':
97 $this->prepareOutput();
98 include_once './Modules/Course/classes/class.ilCourseContentGUI.php';
99 $course_content_obj = new ilCourseContentGUI($this);
100 $this->ctrl->forwardCommand($course_content_obj);
101 break;
102
103 case "illearningprogressgui":
104 $this->prepareOutput();
105 include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
106
108 $this->object->getRefId(),
109 $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId());
110 $this->ctrl->forwardCommand($new_gui);
111 $this->tabs_gui->setTabActive('learning_progress');
112 break;
113
114 // container page editing
115 case "ilcontainerpagegui":
116 $this->prepareOutput(false);
117 $ret = $this->forwardToPageObject();
118 if ($ret != "")
119 {
120 $this->tpl->setContent($ret);
121 }
122 break;
123
124 case 'ilinfoscreengui':
125 $this->prepareOutput();
126 $this->infoScreen();
127 break;
128
129 case 'ilobjectcopygui':
130 $this->prepareOutput();
131
132 include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
133 $cp = new ilObjectCopyGUI($this);
134 $cp->setType('fold');
135 $this->ctrl->forwardCommand($cp);
136 break;
137
138 case "ilobjstylesheetgui":
139 $this->forwardToStyleSheet();
140 break;
141
142 case 'ilexportgui':
143 $this->prepareOutput();
144
145 $this->tabs_gui->setTabActive('export');
146 include_once './Services/Export/classes/class.ilExportGUI.php';
147 $exp = new ilExportGUI($this);
148 $exp->addFormat('xml');
149 $this->ctrl->forwardCommand($exp);
150 break;
151
152 case "ilcommonactiondispatchergui":
153 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
155 $this->ctrl->forwardCommand($gui);
156 break;
157
158 case 'ildidactictemplategui':
159 $this->ctrl->setReturn($this,'edit');
160 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateGUI.php';
161 $did = new ilDidacticTemplateGUI($this);
162 $this->ctrl->forwardCommand($did);
163 break;
164 case 'ilcolumngui':
165 $this->tabs_gui->setTabActive('none');
166 $this->checkPermission("read");
167 $this->viewObject();
168 break;
169
170 default:
171
172 $this->prepareOutput();
173 // Dirty hack for course timings view
174 if($this->forwardToTimingsView())
175 {
176 break;
177 }
178
179 if (empty($cmd))
180 {
181 $cmd = "view";
182 }
183 $cmd .= "Object";
184 $this->$cmd();
185 break;
186 }
187
188 $this->addHeaderAction();
189 }
190
194 function setFolderTree($a_tree)
195 {
196 $this->folder_tree =& $a_tree;
197 }
198
203 public function importFileObject()
204 {
205 global $lng;
206
207 if(parent::importFileObject())
208 {
209 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
210 $this->ctrl->returnToParent($this);
211 }
212 }
213
214
215
216 protected function initEditCustomForm(ilPropertyFormGUI $a_form)
217 {
218 // Show didactic template type
219 $this->initDidacticTemplate($a_form);
220
221 $this->initSortingForm(
222 $a_form,
223 array(
228 )
229 );
230 }
231
232 protected function getEditFormCustomValues(array &$a_values)
233 {
234 // we cannot use $this->object->getOrderType()
235 // if set to inherit it will be translated to parent setting
236 include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
237 $sort = new ilContainerSortingSettings($this->object->getId());
238 $a_values["sor"] = $sort->getSortMode();
239 }
240
241 protected function updateCustom(ilPropertyFormGUI $a_form)
242 {
243 $this->saveSortingSettings($a_form);
244 }
245
246 // BEGIN ChangeEvent show info screen on folder object
253 {
254 $this->ctrl->setCmd("showSummary");
255 $this->ctrl->setCmdClass("ilinfoscreengui");
256 $this->infoScreen();
257 }
258
259 protected function afterSave(ilObject $a_new_object)
260 {
261 include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
262 $sort = new ilContainerSortingSettings($a_new_object->getId());
263 $sort->setSortMode(ilContainer::SORT_INHERIT);
264 $sort->update();
265
266 // always send a message
267 ilUtil::sendSuccess($this->lng->txt("fold_added"),true);
268 $this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
269 $this->redirectToRefId($a_new_object->getRefId(), "");
270 }
271
278 {
279 $this->ctrl->setCmd("showSummary");
280 $this->ctrl->setCmdClass("ilinfoscreengui");
281 $this->infoScreen();
282 }
283
287 function infoScreen()
288 {
289 global $ilAccess;
290
291 if (!$ilAccess->checkAccess("visible", "", $this->ref_id))
292 {
293 $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
294 }
295
296 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
297 $info = new ilInfoScreenGUI($this);
298
299 $info->enablePrivateNotes();
300
301 if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
302 {
303 $info->enableNews();
304 }
305
306 // no news editing for files, just notifications
307 $info->enableNewsEditing(false);
308 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
309 {
310 $news_set = new ilSetting("news");
311 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
312
313 if ($enable_internal_rss)
314 {
315 $info->setBlockProperty("news", "settings", true);
316 $info->setBlockProperty("news", "public_notifications_option", true);
317 }
318 }
319
320
321 // standard meta data
322 $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
323
324 // forward the command
325 $this->ctrl->forwardCommand($info);
326 }
327 // END ChangeEvent show info screen on folder object
328
332 function getTabs(&$tabs_gui)
333 {
334 global $rbacsystem, $ilUser, $lng, $ilCtrl,$ilAccess, $ilHelp;
335
336 $this->ctrl->setParameter($this,"ref_id",$this->ref_id);
337
338 $ilHelp->setScreenIdComponent("fold");
339
340 $tabs_gui->setTabActive("");
341 if ($rbacsystem->checkAccess('read',$this->ref_id))
342 {
343 $tabs_gui->addTab("view_content", $lng->txt("content"),
344 $this->ctrl->getLinkTarget($this, ""));
345
346 //BEGIN ChangeEvent add info tab to category object
347 $force_active = ($this->ctrl->getNextClass() == "ilinfoscreengui"
348 || strtolower($_GET["cmdClass"]) == "ilnotegui")
349 ? true
350 : false;
351 $tabs_gui->addTarget("info_short",
352 $this->ctrl->getLinkTargetByClass(
353 array("ilobjfoldergui", "ilinfoscreengui"), "showSummary"),
354 array("showSummary","", "infoScreen"),
355 "", "", $force_active);
356 //END ChangeEvent add info tab to category object
357 }
358
359 if ($rbacsystem->checkAccess('write',$this->ref_id))
360 {
361 $tabs_gui->addTarget("settings",
362 $this->ctrl->getLinkTarget($this, "edit"), "edit", "", "", ($ilCtrl->getCmd() == "edit"));
363 }
364
365 // learning progress
366 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
367 if(ilLearningProgressAccess::checkAccess($this->object->getRefId()))
368 {
369 $tabs_gui->addTarget('learning_progress',
370 $this->ctrl->getLinkTargetByClass(array('ilobjfoldergui','illearningprogressgui'),''),
371 '',
372 array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui'));
373 }
374
375 if($ilAccess->checkAccess('write','',$this->object->getRefId()))
376 {
377 $tabs_gui->addTarget(
378 'export',
379 $this->ctrl->getLinkTargetByClass('ilexportgui',''),
380 'export',
381 'ilexportgui'
382 );
383 }
384
385
386 if ($rbacsystem->checkAccess('edit_permission',$this->ref_id))
387 {
388 $tabs_gui->addTarget("perm_settings",
389 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
390 }
391
392 // show clipboard in repository
393 if ($_GET["baseClass"] == "ilRepositoryGUI" and !empty($_SESSION['il_rep_clipboard']))
394 {
395 $tabs_gui->addTarget("clipboard",
396 $this->ctrl->getLinkTarget($this, "clipboard"), "clipboard", get_class($this));
397 }
398
399 }
400
404 public static function _goto($a_target)
405 {
406 global $ilAccess, $ilErr, $lng;
407
408 if ($ilAccess->checkAccess("read", "", $a_target))
409 {
411 }
412 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
413 }
414
415
416 public function downloadFolderObject () {
417 global $ilAccess, $ilErr, $lng;
418
419 if (!$ilAccess->checkAccess("read", "", $this->ref_id))
420 {
421 $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
422 }
423 $filename = $this->object->downloadFolder();
424 ilUtil::deliverFile($filename, ilUtil::getASCIIFilename($this->object->getTitle().".zip"));
425 }
426
430 function modifyItemGUI($a_item_list_gui, $a_item_data, $a_show_path)
431 {
432 global $tree;
433
434 // if folder is in a course, modify item list gui according to course requirements
435 if ($course_ref_id = $tree->checkForParentType($this->object->getRefId(),'crs'))
436 {
437 include_once("./Modules/Course/classes/class.ilObjCourse.php");
438 include_once("./Modules/Course/classes/class.ilObjCourseGUI.php");
439 $course_obj_id = ilObject::_lookupObjId($course_ref_id);
440 ilObjCourseGUI::_modifyItemGUI($a_item_list_gui, 'ilcoursecontentgui', $a_item_data, $a_show_path,
441 ilObjCourse::_lookupAboStatus($course_obj_id), $course_ref_id, $course_obj_id,
442 $this->object->getRefId());
443 }
444 }
445
446 protected function forwardToTimingsView()
447 {
448 global $tree;
449
450 if(!$crs_ref = $tree->checkForParentType($this->ref_id, 'crs'))
451 {
452 return false;
453 }
454 include_once './Modules/Course/classes/class.ilObjCourse.php';
455 if(!$this->ctrl->getCmd() and ilObjCourse::_lookupViewMode(ilObject::_lookupObjId($crs_ref)) == ilContainer::VIEW_TIMING)
456 {
457 if(!isset($_SESSION['crs_timings'])) {
458 $_SESSION['crs_timings'] = true;
459 }
460
461 if($_SESSION['crs_timings'] == true) {
462 include_once './Modules/Course/classes/class.ilCourseContentGUI.php';
463 $course_content_obj = new ilCourseContentGUI($this);
464 $this->ctrl->setCmdClass(get_class($course_content_obj));
465 $this->ctrl->setCmd('editUserTimings');
466 $this->ctrl->forwardCommand($course_content_obj);
467 return true;
468 }
469 }
470 $_SESSION['crs_timings'] = false;
471 return false;
472 }
473
480 public function editObject()
481 {
482 global $ilTabs, $ilErr;
483
484 $this->setSubTabs("settings");
485 $ilTabs->activateTab("settings");
486
487 if (!$this->checkPermissionBool("write"))
488 {
489 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"),$ilErr->MESSAGE);
490 }
491
492 $form = $this->initEditForm();
493 $values = $this->getEditFormValues();
494 if($values)
495 {
496 $form->setValuesByArray($values,TRUE);
497 }
498 $GLOBALS['tpl']->setContent($form->getHTML());
499 }
500
501
505 function setSubTabs($a_tab)
506 {
507 global $ilTabs, $lng;
508
509 $ilTabs->addSubTab("settings",
510 $lng->txt("fold_settings"),
511 $this->ctrl->getLinkTarget($this,'edit'));
512
513 // custom icon
514 if ($this->ilias->getSetting("custom_icons"))
515 {
516 $ilTabs->addSubTab("icons",
517 $lng->txt("icon_settings"),
518 $this->ctrl->getLinkTarget($this,'editIcons'));
519 }
520
521 $ilTabs->activateSubTab($a_tab);
522 $ilTabs->activateTab("settings");
523 }
524
525
529
533 function editIconsObject($a_form = null)
534 {
535 global $tpl;
536
537 $this->checkPermission('write');
538
539 $this->tabs_gui->setTabActive('settings');
540
541 if(!$a_form)
542 {
543 $a_form = $this->initIconsForm();
544 }
545
546 $tpl->setContent($a_form->getHTML());
547 }
548
549 function initIconsForm()
550 {
551 $this->setSubTabs("icons");
552
553 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
554 $form = new ilPropertyFormGUI();
555 $form->setFormAction($this->ctrl->getFormAction($this));
556
557 $this->showCustomIconsEditing(1, $form);
558
559 // $form->setTitle($this->lng->txt('edit_grouping'));
560 $form->addCommandButton('updateIcons', $this->lng->txt('save'));
561
562 return $form;
563 }
564
569 {
570 global $ilSetting;
571
572 $this->checkPermission('write');
573
574 $form = $this->initIconsForm();
575 if($form->checkInput())
576 {
577 //save custom icons
578 if ($ilSetting->get("custom_icons"))
579 {
580 if($_POST["cont_icon_delete"])
581 {
582 $this->object->removeCustomIcon();
583 }
584 $this->object->saveIcons($_FILES["cont_icon"]['tmp_name']);
585 }
586 if ($_FILES["cont_icon"]['tmp_name'] || $_POST["cont_icon_delete"])
587 {
588 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
589 }
590 $this->ctrl->redirect($this,"editIcons");
591 }
592
593 $form->setValuesByPost();
594 $this->editIconsObject($form);
595 }
596
597
598
599} // END class.ilObjFolderGUI
600?>
$filename
Definition: buildRTE.php:89
$_GET["client_id"]
$_SESSION["AccountId"]
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.
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.
Class ilObjFolderGUI.
setFolderTree($a_tree)
set tree
initEditCustomForm(ilPropertyFormGUI $a_form)
Add custom fields to update form.
modifyItemGUI($a_item_list_gui, $a_item_data, $a_show_path)
Modify Item ListGUI for presentation in container.
editIconsObject($a_form=null)
Edit folder icons.
renderObject()
Render folder.
getEditFormCustomValues(array &$a_values)
Add values to custom edit fields.
afterSave(ilObject $a_new_object)
Post (successful) object creation hook.
ilObjFolderGUI($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=false)
Constructor @access public.
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
getTabs(&$tabs_gui)
Get tabs.
importFileObject()
Import object.
& executeCommand()
execute command note: this method is overwritten in all container objects
showSummaryObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
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.
prepareOutput()
prepare output
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.
$_POST['username']
Definition: cron.php:12
$info
Definition: example_052.php:80
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
global $ilCtrl
Definition: ilias.php:18
redirection script todo: (a better solution should control the processing via a xml file)
global $ilSetting
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35
global $ilUser
Definition: imgupload.php:15