ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilObjCategoryGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5require_once "./Services/Container/classes/class.ilContainerGUI.php";
6
22{
23 var $ctrl;
24
25 const CONTAINER_SETTING_TAXBLOCK = "tax_sblock_";
26
31 function ilObjCategoryGUI($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
32 {
33 //global $ilCtrl;
34
35 // CONTROL OPTIONS
36 //$this->ctrl =& $ilCtrl;
37 //$this->ctrl->saveParameter($this,array("ref_id","cmdClass"));
38 $GLOBALS['lng']->loadLanguageModule('cat');
39
40 $this->type = "cat";
41 $this->ilContainerGUI($a_data,(int) $a_id,$a_call_by_reference,false);
42
43 if (is_object($this->object))
44 {
45 include_once("./Services/Container/classes/class.ilContainer.php");
46 include_once("./Services/Object/classes/class.ilObjectServiceSettingsGUI.php");
47 $this->info_screen_enabled = ilContainer::_lookupContainerSetting(
48 $this->object->getId(),
50 true);
51 }
52 }
53
54 function &executeCommand()
55 {
56 global $rbacsystem, $ilNavigationHistory, $ilAccess, $ilCtrl,$ilTabs;
57
58 $next_class = $this->ctrl->getNextClass($this);
59 $cmd = $this->ctrl->getCmd();
60
61 // show repository tree
62 $this->showRepTree();
63
64 switch($next_class)
65 {
66 case "ilobjusergui":
67 include_once('./Services/User/classes/class.ilObjUserGUI.php');
68
69 $this->tabs_gui->setTabActive('administrate_users');
70 if(!$_GET['obj_id'])
71 {
72 $this->gui_obj = new ilObjUserGUI("",$_GET['ref_id'],true, false);
73 $this->gui_obj->setCreationMode($this->creation_mode);
74 $ret =& $this->ctrl->forwardCommand($this->gui_obj);
75 }
76 else
77 {
78 $this->gui_obj = new ilObjUserGUI("", $_GET['obj_id'],false, false);
79 $this->gui_obj->setCreationMode($this->creation_mode);
80 $ret =& $this->ctrl->forwardCommand($this->gui_obj);
81 }
82
83 $ilTabs->clearTargets();
84 $ilTabs->setBackTarget($this->lng->txt('backto_lua'), $this->ctrl->getLinkTarget($this,'listUsers'));
85 global $ilHelp;
86 $ilHelp->setScreenIdComponent("cat");
87 $ilHelp->setScreenId("administrate_user");
88 $ilHelp->setSubScreenId($ilCtrl->getCmd());
89 break;
90
91 case "ilobjuserfoldergui":
92 include_once('./Services/User/classes/class.ilObjUserFolderGUI.php');
93
94 $this->gui_obj = new ilObjUserFolderGUI("",(int) $_GET['ref_id'],true, false);
95 $this->gui_obj->setUserOwnerId((int) $_GET['ref_id']);
96 $this->gui_obj->setCreationMode($this->creation_mode);
97 $ret =& $this->ctrl->forwardCommand($this->gui_obj);
98
99 $ilTabs->clearTargets();
100 $ilTabs->setBackTarget($this->lng->txt('backto_lua'), $this->ctrl->getLinkTarget($this,'listUsers'));
101 global $ilHelp;
102 $ilHelp->setScreenIdComponent("cat");
103 $ilHelp->setScreenId("administrate_user");
104 $ilHelp->setSubScreenId($ilCtrl->getCmd());
105 break;
106
107 case "ilcolumngui":
108 $this->checkPermission("read");
109 $this->prepareOutput();
110 include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
111 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
112 ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId()));
113 $this->renderObject();
114 break;
115
116 case 'ilpermissiongui':
117 $this->prepareOutput();
118 $this->tabs_gui->setTabActive('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 case 'ilinfoscreengui':
125 if ($this->info_screen_enabled)
126 {
127 $this->prepareOutput();
128 $this->infoScreen();
129 }
130 break;
131
132 case 'ilcontainerlinklistgui':
133 include_once("Services/Container/classes/class.ilContainerLinkListGUI.php");
134 $link_list_gui =& new ilContainerLinkListGUI();
135 $ret =& $this->ctrl->forwardCommand($link_list_gui);
136 break;
137
138 // container page editing
139 case "ilcontainerpagegui":
140 $this->prepareOutput(false);
141 $ret = $this->forwardToPageObject();
142 if ($ret != "")
143 {
144 $this->tpl->setContent($ret);
145 }
146 break;
147
148 case 'ilobjectcopygui':
149 $this->prepareOutput();
150
151 include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
152 $cp = new ilObjectCopyGUI($this);
153 $cp->setType('cat');
154 $this->ctrl->forwardCommand($cp);
155 break;
156
157 case "ilobjstylesheetgui":
158 $this->forwardToStyleSheet();
159 break;
160
161 case 'ilusertablegui':
162 include_once './Services/User/classes/class.ilUserTableGUI.php';
163 $u_table = new ilUserTableGUI($this, "listUsers");
164 $u_table->initFilter();
165 $this->ctrl->setReturn($this,'listUsers');
166 $this->ctrl->forwardCommand($u_table);
167 break;
168
169 case "ilcommonactiondispatchergui":
170 $this->prepareOutput();
171 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
173 $this->ctrl->forwardCommand($gui);
174 break;
175
176 case 'ildidactictemplategui':
177 $this->ctrl->setReturn($this,'edit');
178 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateGUI.php';
179 $did = new ilDidacticTemplateGUI($this);
180 $this->ctrl->forwardCommand($did);
181 break;
182
183 case 'ilexportgui':
184 $this->prepareOutput();
185 $this->tabs_gui->setTabActive('export');
186 include_once './Services/Export/classes/class.ilExportGUI.php';
187 $exp = new ilExportGUI($this);
188 $exp->addFormat('xml');
189 $this->ctrl->forwardCommand($exp);
190 break;
191
192 case 'ilobjecttranslationgui':
193 $this->checkPermissionBool("write");
194 $this->prepareOutput();
195 //$this->tabs_gui->setTabActive('export');
196 $this->setEditTabs("settings_trans");
197 include_once("./Services/Object/classes/class.ilObjectTranslationGUI.php");
198 $transgui = new ilObjectTranslationGUI($this);
199 $this->ctrl->forwardCommand($transgui);
200 break;
201
202 case 'ilobjtaxonomygui':
203 $this->checkPermissionBool("write");
204 $this->prepareOutput();
205 $this->initTaxSubTabs();
206 include_once("./Services/Taxonomy/classes/class.ilObjTaxonomyGUI.php");
207 $tax = new ilObjTaxonomyGUI();
208 $tax->setAssignedObject($this->object->getId());
209 $tax->setMultiple(true);
210 $tax->setListInfo($this->lng->txt("cntr_tax_list_info"));
211 $this->ctrl->forwardCommand($tax);
212 break;
213
214 case 'ilobjectmetadatagui';
215 $this->checkPermissionBool("write");
216 $this->prepareOutput();
217 $this->tabs_gui->activateTab('meta_data');
218 include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
219 $md_gui = new ilObjectMetaDataGUI($this->object);
220 $this->ctrl->forwardCommand($md_gui);
221 break;
222
223 default:
224 if ($cmd == "infoScreen")
225 {
226 $this->checkPermission("visible");
227 }
228 else
229 {
230 $this->checkPermission("read");
231 }
232
233 // add entry to navigation history
234 if (!$this->getCreationMode() &&
235 $ilAccess->checkAccess("read", "", $_GET["ref_id"]))
236 {
237 include_once("./Services/Link/classes/class.ilLink.php");
238 $ilNavigationHistory->addItem($_GET["ref_id"],
239 ilLink::_getLink($_GET["ref_id"], "cat"), "cat");
240 }
241
242 $this->prepareOutput();
243 include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
244 if (is_object($this->object))
245 {
246 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
247 ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId()));
248 }
249
250 if(!$cmd)
251 {
252 $cmd = "render";
253 }
254 $cmd .= "Object";
255 $this->$cmd();
256
257 break;
258 }
259
260 $this->addHeaderAction();
261
262 return true;
263 }
264
268 function getTabs(&$tabs_gui)
269 {
270 global $rbacsystem, $lng, $ilHelp, $ilAccess;
271
272 if ($this->ctrl->getCmd() == "editPageContent")
273 {
274 return;
275 }
276 #$this->ctrl->setParameter($this,"ref_id",$this->ref_id);
277
278 $ilHelp->setScreenIdComponent("cat");
279
280 if ($rbacsystem->checkAccess('read',$this->ref_id))
281 {
282 $force_active = ($_GET["cmd"] == "" || $_GET["cmd"] == "render")
283 ? true
284 : false;
285 $tabs_gui->addTab("view_content", $lng->txt("content"),
286 $this->ctrl->getLinkTarget($this, ""));
287
288 //BEGIN ChangeEvent add info tab to category object
289 if ($this->info_screen_enabled)
290 {
291 $force_active = ($this->ctrl->getNextClass() == "ilinfoscreengui"
292 || strtolower($_GET["cmdClass"]) == "ilnotegui")
293 ? true
294 : false;
295 $tabs_gui->addTarget("info_short",
296 $this->ctrl->getLinkTargetByClass(
297 array("ilobjcategorygui", "ilinfoscreengui"), "showSummary"),
298 array("showSummary","", "infoScreen"),
299 "", "", $force_active);
300 }
301 //END ChangeEvent add info tab to category object
302 }
303
304 if ($rbacsystem->checkAccess('write',$this->ref_id))
305 {
306 $force_active = ($_GET["cmd"] == "edit")
307 ? true
308 : false;
309 $tabs_gui->addTarget("settings",
310 $this->ctrl->getLinkTarget($this, "edit"), "edit", get_class($this)
311 , "", $force_active);
312
313 // metadata
314 include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
315 $mdgui = new ilObjectMetaDataGUI($this->object);
316 $mdtab = $mdgui->getTab();
317 if($mdtab)
318 {
319 $tabs_gui->addTab("meta_data",
320 $this->lng->txt("meta_data"),
321 $mdtab);
322 }
323
324 include_once "Services/Object/classes/class.ilObjectServiceSettingsGUI.php";
326 $this->object->getId(),
328 false
329 ))
330 {
331 $tabs_gui->addTarget("obj_tool_setting_taxonomies",
332 $this->ctrl->getLinkTarget($this, "editTaxonomySettings"), "editTaxonomySettings", get_class($this));
333 }
334 }
335
336 include_once './Services/User/classes/class.ilUserAccountSettings.php';
337 if(
338 ilUserAccountSettings::getInstance()->isLocalUserAdministrationEnabled() and
339 $rbacsystem->checkAccess('cat_administrate_users',$this->ref_id))
340 {
341 $tabs_gui->addTarget("administrate_users",
342 $this->ctrl->getLinkTarget($this, "listUsers"), "listUsers", get_class($this));
343 }
344
345 if($ilAccess->checkAccess('write','',$this->object->getRefId()))
346 {
347 $tabs_gui->addTarget(
348 'export',
349 $this->ctrl->getLinkTargetByClass('ilexportgui',''),
350 'export',
351 'ilexportgui'
352 );
353 }
354
355 // parent tabs (all container: edit_permission, clipboard, trash
356 parent::getTabs($tabs_gui);
357
358 }
359
363 function renderObject()
364 {
365 global $ilTabs;
366
367 $ilTabs->activateTab("view_content");
368 $ret = parent::renderObject();
369 return $ret;
370
371 }
372
373 protected function initCreationForms($a_new_type)
374 {
375 $forms = parent::initCreationForms($a_new_type);
376 //unset($forms[self::CFORM_IMPORT]);
377 return $forms;
378 }
379
380 protected function afterSave(ilObject $a_new_object)
381 {
382 global $ilUser, $tree;
383
384 // add default translation
385 $a_new_object->addTranslation($a_new_object->getTitle(),
386 $a_new_object->getDescription(), $ilUser->getPref("language"), true);
387
388 // default: sort by title
389 include_once('Services/Container/classes/class.ilContainerSortingSettings.php');
390 $settings = new ilContainerSortingSettings($a_new_object->getId());
391 $settings->setSortMode(ilContainer::SORT_TITLE);
392 $settings->save();
393
394 // inherit parents content style, if not individual
395 $parent_ref_id = $tree->getParentId($a_new_object->getRefId());
396 $parent_id = ilObject::_lookupObjId($parent_ref_id);
397 include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
398 $style_id = ilObjStyleSheet::lookupObjectStyle($parent_id);
399 if ($style_id > 0)
400 {
402 {
403 ilObjStyleSheet::writeStyleUsage($a_new_object->getId(), $style_id);
404 }
405 }
406
407 // always send a message
408 ilUtil::sendSuccess($this->lng->txt("cat_added"),true);
409 $this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
410 $this->redirectToRefId($a_new_object->getRefId(), "");
411 }
412
419 {
420 $this->ctrl->setCmd("showSummary");
421 $this->ctrl->setCmdClass("ilinfoscreengui");
422 $this->infoScreen();
423 }
424
428 function infoScreen()
429 {
430 global $ilAccess, $ilCtrl;
431
432 if (!$ilAccess->checkAccess("visible", "", $this->ref_id))
433 {
434 $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
435 }
436
437 if (!$this->info_screen_enabled)
438 {
439 return;
440 }
441
442 // #10986
443 $this->tabs_gui->setTabActive('info_short');
444
445 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
446 $info = new ilInfoScreenGUI($this);
447
448 $info->enablePrivateNotes();
449
450 if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
451 {
452 $info->enableNews();
453 }
454
455 // no news editing for files, just notifications
456 $info->enableNewsEditing(false);
457 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
458 {
459 $news_set = new ilSetting("news");
460 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
461
462 if ($enable_internal_rss)
463 {
464 $info->setBlockProperty("news", "settings", true);
465 $info->setBlockProperty("news", "public_notifications_option", true);
466 }
467 }
468
469 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
470 $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_INFO,'cat',$this->object->getId());
471 $record_gui->setInfoObject($info);
472 $record_gui->parse();
473
474
475 // standard meta data
476 $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
477
478 // forward the command
479 if ($ilCtrl->getNextClass() == "ilinfoscreengui")
480 {
481 $ilCtrl->forwardCommand($info);
482 }
483 else
484 {
485 return $ilCtrl->getHTML($info);
486 }
487 }
488
494 protected function editInfoObject()
495 {
496 $this->checkPermission("write");
497 $this->setEditTabs();
498 $this->tabs_gui->activateTab('settings');
499 $this->tabs_gui->setSubTabActive('edit_cat_settings');
500
501 $this->initExtendedSettings();
502 $this->tpl->setContent($this->form->getHTML());
503 }
504
510 protected function updateInfoObject()
511 {
512 $this->checkPermission("write");
513
514 // init form
515 $this->initExtendedSettings();
516
517 // still needed for date conversion and so on
518 $this->form->checkInput();
519
520 if($this->record_gui->importEditFormPostValues())
521 {
522 $this->record_gui->writeEditForm();
523
524 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
525 $this->ctrl->redirect($this, "editInfo");
526 }
527
528 $this->editInfoObject();
529 }
530
531
537 protected function initExtendedSettings()
538 {
539 if(is_object($this->form))
540 {
541 return true;
542 }
543
544 include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
545 $this->form = new ilPropertyFormGUI();
546 $this->form->setFormAction($this->ctrl->getFormAction($this));
547 $this->form->setTitle($this->lng->txt('ext_cat_settings'));
548 $this->form->addCommandButton('updateInfo',$this->lng->txt('save'));
549 $this->form->addCommandButton('editInfo',$this->lng->txt('cancel'));
550
551 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
552 $this->record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_EDITOR,'cat',$this->object->getId());
553 $this->record_gui->setPropertyForm($this->form);
554 $this->record_gui->parse();
555
556 return true;
557 }
558
559 protected function setEditTabs($active_tab = "settings_misc")
560 {
561 global $ilSetting, $ilTabs;
562
563 $this->tabs_gui->addSubTab("settings_misc",
564 $this->lng->txt("settings"),
565 $this->ctrl->getLinkTarget($this, "edit"));
566
567 /*$this->tabs_gui->addSubTab("settings_trans",
568 $this->lng->txt("title_and_translations"),
569 $this->ctrl->getLinkTarget($this, "editTranslations"));*/
570
571 $this->tabs_gui->addSubTab("settings_trans",
572 $this->lng->txt("obj_multilinguality"),
573 $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", ""));
574
575 // custom icon
576 if ($ilSetting->get("custom_icons"))
577 {
578 $this->tabs_gui->addSubTab("icons",
579 $this->lng->txt("icon_settings"),
580 $this->ctrl->getLinkTarget($this,'editIcons'));
581 }
582
583 $this->tabs_gui->activateTab("settings");
584 $this->tabs_gui->activateSubTab($active_tab);
585 }
586
587 function initEditForm()
588 {
589 $this->lng->loadLanguageModule($this->object->getType());
590 $this->setEditTabs();
591
592 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
593 $form = new ilPropertyFormGUI();
594 $form->setFormAction($this->ctrl->getFormAction($this));
595 $form->setTitle($this->lng->txt($this->object->getType()."_edit"));
596
597 // title/description
598
599 $trans = $this->object->getTranslations();
600 $def = $trans["Fobject"][0]; // default
601
602 $title = new ilTextInputGUI($this->lng->txt("title"), "title");
603 $title->setRequired(true);
604 $title->setSize(min(40, ilObject::TITLE_LENGTH));
605 $title->setMaxLength(ilObject::TITLE_LENGTH);
606 $title->setValue($def["title"]);
607 $form->addItem($title);
608
609 if(sizeof($trans["Fobject"]) > 1)
610 {
611 include_once('Services/MetaData/classes/class.ilMDLanguageItem.php');
612 $languages = ilMDLanguageItem::_getLanguages();
613
614 $title->setInfo($this->lng->txt("language").": ".$languages[$def["lang"]].
615 ' <a href="'.$this->ctrl->getLinkTarget($this, "editTranslations").
616 '">&raquo; '.$this->lng->txt("cat_more_translations").'</a>');
617
618 unset($languages);
619 }
620
621 $desc = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
622 $desc->setRows(2);
623 $desc->setCols(40);
624 $desc->setValue($def["desc"]);
625 $form->addItem($desc);
626
627 // Show didactic template type
628 $this->initDidacticTemplate($form);
629
630 // presentation
631 $pres = new ilFormSectionHeaderGUI();
632 $pres->setTitle($this->lng->txt('obj_presentation'));
633 $form->addItem($pres);
634
635
636 $form = $this->initSortingForm(
637 $form,
638 array(
642 )
643 );
644
645 // icon settings
646// $this->showCustomIconsEditing(1, $form, false);
647
648 // Edit ecs export settings
649 include_once 'Modules/Category/classes/class.ilECSCategorySettings.php';
650 $ecs = new ilECSCategorySettings($this->object);
651 $ecs->addSettingsToForm($form, 'cat');
652
653 // services
654 $sh = new ilFormSectionHeaderGUI();
655 $sh->setTitle($this->lng->txt('obj_features'));
656 $form->addItem($sh);
657
658 include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
660 $this->object->getId(),
661 $form,
662 array(
667 )
668 );
669
670 $form->addCommandButton("update", $this->lng->txt("save"));
671// $form->addCommandButton("addTranslation", $this->lng->txt("add_translation"));
672
673 return $form;
674 }
675
677 {
678 // values are set in initEditForm()
679 }
680
686 function updateObject()
687 {
688 if (!$this->checkPermissionBool("write"))
689 {
690 $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
691 }
692 else
693 {
694 $form = $this->initEditForm();
695 if($form->checkInput())
696 {
697 $title = $form->getInput("title");
698 $desc = $form->getInput("desc");
699 $lang = $this->object->getTranslations();
700 $lang = $lang["Fobject"][0]["lang"];
701 $this->object->deleteTranslation($lang);
702 $this->object->addTranslation($title, $desc, $lang, true);
703 $this->object->setTitle($title);
704 $this->object->setDescription($desc);
705 $this->object->update();
706
707 $this->saveSortingSettings($form);
708
709 // save custom icons
710/* if ($this->ilias->getSetting("custom_icons"))
711 {
712 if($form->getItemByPostVar("cont_big_icon")->getDeletionFlag())
713 {
714 $this->object->removeBigIcon();
715 }
716 if($form->getItemByPostVar("cont_small_icon")->getDeletionFlag())
717 {
718 $this->object->removeSmallIcon();
719 }
720 if($form->getItemByPostVar("cont_tiny_icon")->getDeletionFlag())
721 {
722 $this->object->removeTinyIcon();
723 }
724
725 $this->object->saveIcons($_FILES["cont_big_icon"]['tmp_name'],
726 $_FILES["cont_small_icon"]['tmp_name'],
727 $_FILES["cont_tiny_icon"]['tmp_name']);
728 }*/
729
730 // BEGIN ChangeEvent: Record update
731 global $ilUser;
732 require_once('Services/Tracking/classes/class.ilChangeEvent.php');
733 ilChangeEvent::_recordWriteEvent($this->object->getId(), $ilUser->getId(), 'update');
734 ilChangeEvent::_catchupWriteEvents($this->object->getId(), $ilUser->getId());
735 // END ChangeEvent: Record update
736
737 // services
738 include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
740 $this->object->getId(),
741 $form,
742 array(
747 )
748 );
749
750 // Update ecs export settings
751 include_once 'Modules/Category/classes/class.ilECSCategorySettings.php';
752 $ecs = new ilECSCategorySettings($this->object);
753 if($ecs->handleSettingsUpdate())
754 {
755 return $this->afterUpdate();
756 }
757 }
758
759 // display form to correct errors
760 $this->setEditTabs();
761 $form->setValuesByPost();
762 $this->tpl->setContent($form->getHTML());
763 }
764 }
765
769 function editTranslationsObject($a_get_post_values = false, $a_add = false)
770 {
771 global $tpl;
772
773 $this->ctrl->redirectByClass("ilobjecttranslationgui", "");
774
775
776 $this->lng->loadLanguageModule($this->object->getType());
777 $this->setEditTabs("settings_trans");
778
779 include_once("./Services/Object/classes/class.ilObjectTranslationTableGUI.php");
780 $table = new ilObjectTranslationTableGUI($this, "editTranslations", true,
781 "Translation");
782 if ($a_get_post_values)
783 {
784 $vals = array();
785 foreach($_POST["title"] as $k => $v)
786 {
787 $vals[] = array("title" => $v,
788 "desc" => $_POST["desc"][$k],
789 "lang" => $_POST["lang"][$k],
790 "default" => ($_POST["default"] == $k));
791 }
792 $table->setData($vals);
793 }
794 else
795 {
796 $data = $this->object->getTranslations();
797 foreach($data["Fobject"] as $k => $v)
798 {
799 $data["Fobject"][$k]["default"] = ($k == $data["default_language"]);
800 }
801 if($a_add)
802 {
803 $data["Fobject"][++$k]["title"] = "";
804 }
805 $table->setData($data["Fobject"]);
806 }
807 $tpl->setContent($table->getHTML());
808 }
809
814 {
815 if (!$this->checkPermissionBool("write"))
816 {
817 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
818 }
819
820 // default language set?
821 if (!isset($_POST["default"]))
822 {
823 ilUtil::sendFailure($this->lng->txt("msg_no_default_language"));
824 return $this->editTranslationsObject(true);
825 }
826
827 // all languages set?
828 if (array_key_exists("",$_POST["lang"]))
829 {
830 ilUtil::sendFailure($this->lng->txt("msg_no_language_selected"));
831 return $this->editTranslationsObject(true);
832 }
833
834 // no single language is selected more than once?
835 if (count(array_unique($_POST["lang"])) < count($_POST["lang"]))
836 {
837 ilUtil::sendFailure($this->lng->txt("msg_multi_language_selected"));
838 return $this->editTranslationsObject(true);
839 }
840
841 // save the stuff
842 $this->object->removeTranslations();
843 foreach($_POST["title"] as $k => $v)
844 {
845 // update object data if default
846 $is_default = ($_POST["default"] == $k);
847 if($is_default)
848 {
849 $this->object->setTitle(ilUtil::stripSlashes($v));
850 $this->object->setDescription(ilUtil::stripSlashes($_POST["desc"][$k]));
851 $this->object->update();
852 }
853
854 $this->object->addTranslation(
856 ilUtil::stripSlashes($_POST["desc"][$k]),
857 ilUtil::stripSlashes($_POST["lang"][$k]),
858 $is_default);
859 }
860
861 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
862 $this->ctrl->redirect($this, "editTranslations");
863 }
864
869 {
870 if($_POST["title"])
871 {
872 $k = max(array_keys($_POST["title"]));
873 $k++;
874 $_POST["title"][$k] = "";
875 $this->editTranslationsObject(true);
876 }
877 else
878 {
879 $this->editTranslationsObject(false, true);
880 }
881 }
882
887 {
888 foreach($_POST["title"] as $k => $v)
889 {
890 if ($_POST["check"][$k])
891 {
892 // default translation cannot be deleted
893 if($k != $_POST["default"])
894 {
895 unset($_POST["title"][$k]);
896 unset($_POST["desc"][$k]);
897 unset($_POST["lang"][$k]);
898 }
899 else
900 {
901 ilUtil::sendFailure($this->lng->txt("msg_no_default_language"));
902 return $this->editTranslationsObject();
903 }
904 }
905 }
906 $this->saveTranslationsObject();
907 }
908
913 {
914 ilObjCategoryGUI::_importCategoriesForm($this->ref_id, $this->tpl);
915 }
916
920 function _importCategoriesForm ($a_ref_id, &$a_tpl)
921 {
922 global $lng, $rbacreview;
923
924 $a_tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.cat_import_form.html",
925 "Modules/Category");
926
927 $a_tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
928
929 $a_tpl->setVariable("TXT_IMPORT_CATEGORIES", $lng->txt("import_categories"));
930 $a_tpl->setVariable("TXT_HIERARCHY_OPTION", $lng->txt("import_cat_localrol"));
931 $a_tpl->setVariable("TXT_IMPORT_FILE", $lng->txt("import_file"));
932 $a_tpl->setVariable("TXT_IMPORT_TABLE", $lng->txt("import_cat_table"));
933
934 $a_tpl->setVariable("BTN_IMPORT", $lng->txt("import"));
935 $a_tpl->setVariable("BTN_CANCEL", $lng->txt("cancel"));
936
937 // NEED TO FILL ADOPT_PERMISSIONS HTML FORM....
938 $parent_role_ids = $rbacreview->getParentRoleIds($a_ref_id,true);
939
940 // sort output for correct color changing
941 ksort($parent_role_ids);
942
943 foreach ($parent_role_ids as $key => $par)
944 {
945 if ($par["obj_id"] != SYSTEM_ROLE_ID)
946 {
947 $check = ilUtil::formCheckbox(0,"adopt[]",$par["obj_id"],1);
948 $output["adopt"][$key]["css_row_adopt"] = ilUtil::switchColor($key, "tblrow1", "tblrow2");
949 $output["adopt"][$key]["check_adopt"] = $check;
950 $output["adopt"][$key]["role_id"] = $par["obj_id"];
951 $output["adopt"][$key]["type"] = ($par["type"] == 'role' ? 'Role' : 'Template');
952 $output["adopt"][$key]["role_name"] = $par["title"];
953 }
954 }
955
956 //var_dump($output);
957
958 // BEGIN ADOPT PERMISSIONS
959 foreach ($output["adopt"] as $key => $value)
960 {
961 $a_tpl->setCurrentBlock("ADOPT_PERM_ROW");
962 $a_tpl->setVariable("CSS_ROW_ADOPT",$value["css_row_adopt"]);
963 $a_tpl->setVariable("CHECK_ADOPT",$value["check_adopt"]);
964 $a_tpl->setVariable("LABEL_ID",$value["role_id"]);
965 $a_tpl->setVariable("TYPE",$value["type"]);
966 $a_tpl->setVariable("ROLE_NAME",$value["role_name"]);
967 $a_tpl->parseCurrentBlock();
968 }
969 }
970
971
978 {
979 $this->ctrl->redirect($this);
980 }
981
985 function _getImportDir()
986 {
987 return ilUtil::getDataDir()."/cat_import";
988 }
989
994 {
996 // call to importCategories with $withrol = 0
998 }
999
1004 {
1005
1006 //echo "entra aqui";
1007 // call to importCategories with $withrol = 1
1009 }
1010
1015 function _importCategories($a_ref_id, $withrol_tmp)
1016 {
1017 global $lng;
1018
1019 require_once("./Modules/Category/classes/class.ilCategoryImportParser.php");
1020
1021 $import_dir = ilObjCategoryGUI::_getImportDir();
1022
1023 // create user import directory if necessary
1024 if (!@is_dir($import_dir))
1025 {
1026 ilUtil::createDirectory($import_dir);
1027 }
1028
1029 // move uploaded file to user import directory
1030
1031 $file_name = $_FILES["importFile"]["name"];
1032
1033 // added to prevent empty file names
1034 if (!strcmp($file_name,"")) {
1035 ilUtil::sendFailure($lng->txt("no_import_file_found"), true);
1036 $this->ctrl->redirect($this);
1037 }
1038
1039 $parts = pathinfo($file_name);
1040 $full_path = $import_dir."/".$file_name;
1041 ilUtil::moveUploadedFile($_FILES["importFile"]["tmp_name"], $file_name, $full_path);
1042
1043 // unzip file
1044 ilUtil::unzip($full_path);
1045
1046 $subdir = basename($parts["basename"],".".$parts["extension"]);
1047 $xml_file = $import_dir."/".$subdir."/".$subdir.".xml";
1048 // CategoryImportParser
1049 //var_dump($_POST);
1050 $importParser = new ilCategoryImportParser($xml_file, $a_ref_id, $withrol_tmp);
1051 $importParser->startParsing();
1052
1053 ilUtil::sendSuccess($lng->txt("categories_imported"), true);
1054 $this->ctrl->redirect($this);
1055 }
1056
1061 protected function resetFilterObject()
1062 {
1063 include_once("./Services/User/classes/class.ilUserTableGUI.php");
1064 $utab = new ilUserTableGUI($this, "listUsers",ilUserTableGUI::MODE_LOCAL_USER);
1065 $utab->resetOffset();
1066 $utab->resetFilter();
1067
1068 // from "old" implementation
1069 $this->listUsersObject();
1070 }
1071
1076 protected function applyFilterObject()
1077 {
1078 global $ilTabs;
1079
1080 include_once("./Services/User/classes/class.ilUserTableGUI.php");
1081 $utab = new ilUserTableGUI($this, "listUsers", ilUserTableGUI::MODE_LOCAL_USER);
1082 $utab->resetOffset();
1083 $utab->writeFilterToSession();
1084 $this->listUsersObject();
1085 }
1086
1087 // METHODS for local user administration
1088 function listUsersObject($show_delete = false)
1089 {
1090 global $ilUser,$rbacreview, $ilToolbar;
1091
1092 include_once './Services/User/classes/class.ilLocalUser.php';
1093 include_once './Services/User/classes/class.ilObjUserGUI.php';
1094
1095 global $rbacsystem,$rbacreview;
1096
1097 if(!$rbacsystem->checkAccess("cat_administrate_users",$this->object->getRefId()))
1098 {
1099 $this->ilias->raiseError($this->lng->txt("msg_no_perm_admin_users"),$this->ilias->error_obj->MESSAGE);
1100 }
1101 $this->tabs_gui->setTabActive('administrate_users');
1102
1103
1104
1105 $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.cat_admin_users.html',
1106 "Modules/Category");
1107
1108 if(count($rbacreview->getGlobalAssignableRoles()) or in_array(SYSTEM_ROLE_ID,$rbacreview->assignedRoles($ilUser->getId())))
1109 {
1110 $ilToolbar->addButton(
1111 $this->lng->txt('add_user'),
1112 $this->ctrl->getLinkTargetByClass('ilobjusergui','create')
1113 );
1114
1115 $ilToolbar->addButton(
1116 $this->lng->txt('import_users'),
1117 $this->ctrl->getLinkTargetByClass('ilobjuserfoldergui','importUserForm')
1118 );
1119 }
1120 else
1121 {
1122 ilUtil::sendInfo($this->lng->txt('no_roles_user_can_be_assigned_to'));
1123 }
1124
1125 if($show_delete)
1126 {
1127 $this->tpl->setCurrentBlock("confirm_delete");
1128 $this->tpl->setVariable("CONFIRM_FORMACTION",$this->ctrl->getFormAction($this));
1129 $this->tpl->setVariable("TXT_CANCEL",$this->lng->txt('cancel'));
1130 $this->tpl->setVariable("CONFIRM_CMD",'performDeleteUsers');
1131 $this->tpl->setVariable("TXT_CONFIRM",$this->lng->txt('delete'));
1132 $this->tpl->parseCurrentBlock();
1133 }
1134
1135 $this->lng->loadLanguageModule('user');
1136
1137 include_once("./Services/User/classes/class.ilUserTableGUI.php");
1138 $utab = new ilUserTableGUI($this, 'listUsers',ilUserTableGUI::MODE_LOCAL_USER);
1139 $this->tpl->setVariable('USERS_TABLE',$utab->getHTML());
1140
1141 return true;
1142 }
1143
1147 protected function addUserAutoCompleteObject()
1148 {
1149 include_once './Services/User/classes/class.ilUserAutoComplete.php';
1150 $auto = new ilUserAutoComplete();
1151 $auto->setSearchFields(array('login','firstname','lastname','email'));
1152 $auto->enableFieldSearchableCheck(true);
1153 $auto->isMoreLinkAvailable(true);
1154
1155 if(($_REQUEST['fetchall']))
1156 {
1157 $auto->setLimit(ilUserAutoComplete::MAX_ENTRIES);
1158 }
1159
1160 echo $auto->getList($_REQUEST['term']);
1161 exit();
1162 }
1163
1164
1166 {
1167 include_once './Services/User/classes/class.ilLocalUser.php';
1168 $this->checkPermission("cat_administrate_users");
1169
1170 foreach($_POST['user_ids'] as $user_id)
1171 {
1172 if(!in_array($user_id,ilLocalUser::_getAllUserIds($this->object->getRefId())))
1173 {
1174 die('user id not valid');
1175 }
1176 if(!$tmp_obj =& ilObjectFactory::getInstanceByObjId($user_id,false))
1177 {
1178 continue;
1179 }
1180 $tmp_obj->delete();
1181 }
1182 ilUtil::sendSuccess($this->lng->txt('deleted_users'));
1183 $this->listUsersObject();
1184
1185 return true;
1186 }
1187
1189 {
1190 $this->checkPermission("cat_administrate_users");
1191 if(!count($_POST['id']))
1192 {
1193 ilUtil::sendFailure($this->lng->txt('no_users_selected'));
1194 $this->listUsersObject();
1195
1196 return true;
1197 }
1198
1199 include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
1200 $confirm = new ilConfirmationGUI();
1201 $confirm->setFormAction($this->ctrl->getFormAction($this));
1202 $confirm->setHeaderText($this->lng->txt('sure_delete_selected_users'));
1203 $confirm->setConfirm($this->lng->txt('delete'), 'performDeleteUsers');
1204 $confirm->setCancel($this->lng->txt('cancel'), 'listUsers');
1205
1206 foreach($_POST['id'] as $user)
1207 {
1208 $name = ilObjUser::_lookupName($user);
1209
1210 $confirm->addItem(
1211 'user_ids[]',
1212 $user,
1213 $name['lastname'].', '.$name['firstname'].' ['.$name['login'].']'
1214 );
1215 }
1216 $this->tpl->setContent($confirm->getHTML());
1217 }
1218
1220 {
1221 global $rbacreview,$ilTabs;
1222
1223 $this->checkPermission("cat_administrate_users");
1224
1225 include_once './Services/User/classes/class.ilLocalUser.php';
1226
1227 if(!isset($_GET['obj_id']))
1228 {
1229 ilUtil::sendFailure('no_user_selected');
1230 $this->listUsersObject();
1231
1232 return true;
1233 }
1234
1235 $ilTabs->clearTargets();
1236 $ilTabs->setBackTarget($this->lng->txt('backto_lua'), $this->ctrl->getLinkTarget($this,'listUsers'));
1237 global $ilHelp;
1238 $ilHelp->setScreenIdComponent("cat");
1239 $ilHelp->setScreenId("administrate_user");
1240 $ilHelp->setSubScreenId("assign_roles");
1241
1242
1243 $roles = $this->__getAssignableRoles();
1244
1245 if(!count($roles))
1246 {
1247 #ilUtil::sendInfo($this->lng->txt('no_roles_user_can_be_assigned_to'));
1248 #$this->listUsersObject();
1249
1250 #return true;
1251 }
1252
1253 $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.cat_role_assignment.html',
1254 "Modules/Category");
1255
1256 $ass_roles = $rbacreview->assignedRoles($_GET['obj_id']);
1257
1258 $counter = 0;
1259 foreach($roles as $role)
1260 {
1261 $role_obj =& ilObjectFactory::getInstanceByObjId($role['obj_id']);
1262
1263 $disabled = false;
1264 $f_result[$counter][] = ilUtil::formCheckbox(in_array($role['obj_id'],$ass_roles) ? 1 : 0,
1265 'role_ids[]',
1266 $role['obj_id'],
1267 $disabled);
1268 $f_result[$counter][] = $role_obj->getTitle() ? $role_obj->getTitle() : "";
1269 $f_result[$counter][] = $role_obj->getDescription() ? $role_obj->getDescription() : "";
1270 $f_result[$counter][] = $role['role_type'] == 'global' ?
1271 $this->lng->txt('global') :
1272 $this->lng->txt('local');
1273
1274 unset($role_obj);
1275 ++$counter;
1276 }
1277 $this->__showRolesTable($f_result,"assignRolesObject");
1278 }
1279
1281 {
1282 global $rbacreview,$rbacadmin;
1283 $this->checkPermission("cat_administrate_users");
1284
1285 include_once './Services/User/classes/class.ilLocalUser.php';
1286 // check hack
1287 if(!isset($_GET['obj_id']) or !in_array($_REQUEST['obj_id'],ilLocalUser::_getAllUserIds()))
1288 {
1289 ilUtil::sendFailure('no_user_selected');
1290 $this->listUsersObject();
1291
1292 return true;
1293 }
1294 $roles = $this->__getAssignableRoles();
1295
1296 // check minimum one global role
1297 if(!$this->__checkGlobalRoles($_POST['role_ids']))
1298 {
1299 ilUtil::sendFailure($this->lng->txt('no_global_role_left'));
1300 $this->assignRolesObject();
1301
1302 return false;
1303 }
1304
1305 $new_role_ids = $_POST['role_ids'] ? $_POST['role_ids'] : array();
1306 $assigned_roles = $rbacreview->assignedRoles((int) $_REQUEST['obj_id']);
1307 foreach($roles as $role)
1308 {
1309 if(in_array($role['obj_id'],$new_role_ids) and !in_array($role['obj_id'],$assigned_roles))
1310 {
1311 $rbacadmin->assignUser($role['obj_id'],(int) $_REQUEST['obj_id']);
1312 }
1313 if(in_array($role['obj_id'],$assigned_roles) and !in_array($role['obj_id'],$new_role_ids))
1314 {
1315 $rbacadmin->deassignUser($role['obj_id'],(int) $_REQUEST['obj_id']);
1316 }
1317 }
1318 ilUtil::sendSuccess($this->lng->txt('role_assignment_updated'));
1319 $this->assignRolesObject();
1320
1321 return true;
1322 }
1323
1324 // PRIVATE
1326 {
1327 global $rbacreview,$ilUser;
1328
1329 // check local user
1330 $tmp_obj =& ilObjectFactory::getInstanceByObjId($_REQUEST['obj_id']);
1331 // Admin => all roles
1332 if(in_array(SYSTEM_ROLE_ID,$rbacreview->assignedRoles($ilUser->getId())))
1333 {
1334 $global_roles = $rbacreview->getGlobalRolesArray();
1335 }
1336 elseif($tmp_obj->getTimeLimitOwner() == $this->object->getRefId())
1337 {
1338 $global_roles = $rbacreview->getGlobalAssignableRoles();
1339 }
1340 else
1341 {
1342 $global_roles = array();
1343 }
1344 return $roles = array_merge($global_roles,
1345 $rbacreview->getAssignableChildRoles($this->object->getRefId()));
1346 }
1347
1348 function __checkGlobalRoles($new_assigned)
1349 {
1350 global $rbacreview,$ilUser;
1351
1352 $this->checkPermission("cat_administrate_users");
1353
1354 // return true if it's not a local user
1355 $tmp_obj =& ilObjectFactory::getInstanceByObjId($_REQUEST['obj_id']);
1356 if($tmp_obj->getTimeLimitOwner() != $this->object->getRefId() and
1357 !in_array(SYSTEM_ROLE_ID,$rbacreview->assignedRoles($ilUser->getId())))
1358 {
1359 return true;
1360 }
1361
1362 // new assignment by form
1363 $new_assigned = $new_assigned ? $new_assigned : array();
1364 $assigned = $rbacreview->assignedRoles((int) $_GET['obj_id']);
1365
1366 // all assignable globals
1367 if(!in_array(SYSTEM_ROLE_ID,$rbacreview->assignedRoles($ilUser->getId())))
1368 {
1369 $ga = $rbacreview->getGlobalAssignableRoles();
1370 }
1371 else
1372 {
1373 $ga = $rbacreview->getGlobalRolesArray();
1374 }
1375 $global_assignable = array();
1376 foreach($ga as $role)
1377 {
1378 $global_assignable[] = $role['obj_id'];
1379 }
1380
1381 $new_visible_assigned_roles = array_intersect($new_assigned,$global_assignable);
1382 $all_assigned_roles = array_intersect($assigned,$rbacreview->getGlobalRoles());
1383 $main_assigned_roles = array_diff($all_assigned_roles,$global_assignable);
1384
1385 if(!count($new_visible_assigned_roles) and !count($main_assigned_roles))
1386 {
1387 return false;
1388 }
1389 return true;
1390 }
1391
1392
1393 function __showRolesTable($a_result_set,$a_from = "")
1394 {
1395 $this->checkPermission("cat_administrate_users");
1396
1397 $tbl =& $this->__initTableGUI();
1398 $tpl =& $tbl->getTemplateObject();
1399
1400 // SET FORMAACTION
1401 $tpl->setCurrentBlock("tbl_form_header");
1402
1403 $this->ctrl->setParameter($this,'obj_id',$_GET['obj_id']);
1404 $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
1405 $tpl->parseCurrentBlock();
1406
1407 // SET FOOTER BUTTONS
1408 $tpl->setVariable("COLUMN_COUNTS",4);
1409 $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
1410
1411// $tpl->setCurrentBlock("tbl_action_button");
1412 $tpl->setVariable("BTN_NAME","assignSave");
1413 $tpl->setVariable("BTN_VALUE",$this->lng->txt("change_assignment"));
1414 $tpl->parseCurrentBlock();
1415
1416 $tpl->setCurrentBlock("tbl_action_row");
1417 $tpl->setVariable("TPLPATH",$this->tpl->tplPath);
1418 $tpl->parseCurrentBlock();
1419
1420 $tmp_obj =& ilObjectFactory::getInstanceByObjId($_GET['obj_id']);
1421 $title = $this->lng->txt('role_assignment').' ('.$tmp_obj->getFullname().')';
1422
1423 $tbl->setTitle($title,"icon_role.svg",$this->lng->txt("role_assignment"));
1424 $tbl->setHeaderNames(array('',
1425 $this->lng->txt("title"),
1426 $this->lng->txt('description'),
1427 $this->lng->txt("type")));
1428 $tbl->setHeaderVars(array("",
1429 "title",
1430 "description",
1431 "type"),
1432 array("ref_id" => $this->object->getRefId(),
1433 "cmd" => "assignRoles",
1434 "obj_id" => $_GET['obj_id'],
1435 "cmdClass" => "ilobjcategorygui",
1436 "cmdNode" => $_GET["cmdNode"],
1437 "baseClass" => "ilRepositoryGUI")
1438 );
1439 $tbl->setColumnWidth(array("4%","35%","45%","16%"));
1440
1441 $this->set_unlimited = true;
1442 $this->__setTableGUIBasicData($tbl,$a_result_set,$a_from,true);
1443 $tbl->render();
1444
1445 $this->tpl->setVariable("ROLES_TABLE",$tbl->tpl->get());
1446
1447 return true;
1448 }
1449
1450 function __showUsersTable($a_result_set,$a_from = "",$a_footer = true)
1451 {
1452 $this->checkPermission("cat_administrate_users");
1453
1454 $tbl =& $this->__initTableGUI();
1455 $tpl =& $tbl->getTemplateObject();
1456
1457 // SET FORMAACTION
1458 $tpl->setCurrentBlock("tbl_form_header");
1459
1460 $this->ctrl->setParameter($this,'sort_by',$_GET['sort_by']);
1461 $this->ctrl->setParameter($this,'sort_order',$_GET['sort_order']);
1462 $this->ctrl->setParameter($this,'offset',$_GET['offset']);
1463 $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
1464 $tpl->parseCurrentBlock();
1465
1466
1467 if($a_footer)
1468 {
1469 // SET FOOTER BUTTONS
1470 $tpl->setVariable("COLUMN_COUNTS",6);
1471 $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
1472
1473 $tpl->setCurrentBlock("tbl_action_button");
1474 $tpl->setVariable("BTN_NAME","deleteUser");
1475 $tpl->setVariable("BTN_VALUE",$this->lng->txt("delete"));
1476 $tpl->parseCurrentBlock();
1477
1478 $tpl->setCurrentBlock("tbl_action_row");
1479 $tpl->setVariable("TPLPATH",$this->tpl->tplPath);
1480 $tpl->parseCurrentBlock();
1481
1482 $tbl->setFormName('cmd');
1483 $tbl->enable('select_all');
1484 }
1485
1486 $tbl->setTitle($this->lng->txt("users"),"icon_usr.svg",$this->lng->txt("users"));
1487 $tbl->setHeaderNames(array('',
1488 $this->lng->txt("username"),
1489 $this->lng->txt("firstname"),
1490 $this->lng->txt("lastname"),
1491 $this->lng->txt('context'),
1492 $this->lng->txt('role_assignment')));
1493 $tbl->setHeaderVars(array("",
1494 "login",
1495 "firstname",
1496 "lastname",
1497 "context",
1498 "role_assignment"),
1499 array("ref_id" => $this->object->getRefId(),
1500 "cmd" => "listUsers",
1501 "cmdClass" => "ilobjcategorygui",
1502 "cmdNode" => $_GET["cmdNode"]));
1503 $tbl->setColumnWidth(array("1px","20%","20%","20%","20%","20%"));
1504 $tbl->setSelectAllCheckbox('user_ids');
1505
1506 $this->__setTableGUIBasicData($tbl,$a_result_set,$a_from,true);
1507 $tbl->render();
1508
1509 $this->tpl->setVariable("USERS_TABLE",$tbl->tpl->get());
1510
1511 return true;
1512 }
1513
1514 function __setTableGUIBasicData(&$tbl,&$result_set,$a_from = "",$a_footer = true)
1515 {
1516 global $ilUser;
1517
1518 switch ($a_from)
1519 {
1520 case "listUsersObject":
1521 $tbl->setOrderColumn($_GET["sort_by"]);
1522 $tbl->setOrderDirection($_GET["sort_order"]);
1523 $tbl->setOffset($_GET["offset"]);
1524 $tbl->setMaxCount($this->all_users_count);
1525 $tbl->setLimit($ilUser->getPref('hits_per_page'));
1526 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
1527 $tbl->setData($result_set);
1528 $tbl->disable('auto_sort');
1529
1530 return true;
1531
1532
1533 case "assignRolesObject":
1534 $offset = $_GET["offset"];
1535 // init sort_by (unfortunatly sort_by is preset with 'title'
1536 if ($_GET["sort_by"] == "title" or empty($_GET["sort_by"]))
1537 {
1538 $_GET["sort_by"] = "login";
1539 }
1540 $order = $_GET["sort_by"];
1541 $direction = $_GET["sort_order"];
1542 break;
1543
1544 case "clipboardObject":
1545 $offset = $_GET["offset"];
1546 $order = $_GET["sort_by"];
1547 $direction = $_GET["sort_order"];
1548 $tbl->disable("footer");
1549 break;
1550
1551 default:
1552 $offset = $_GET["offset"];
1553 $order = $_GET["sort_by"];
1554 $direction = $_GET["sort_order"];
1555 break;
1556 }
1557
1558 $tbl->setOrderColumn($order);
1559 $tbl->setOrderDirection($direction);
1560 $tbl->setOffset($offset);
1561 if($this->set_unlimited)
1562 {
1563 $tbl->setLimit($_GET["limit"]*100);
1564 }
1565 else
1566 {
1567 $tbl->setLimit($_GET['limit']);
1568 }
1569 $tbl->setMaxCount(count($result_set));
1570
1571 if($a_footer)
1572 {
1573 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
1574 }
1575 else
1576 {
1577 $tbl->disable('footer');
1578 }
1579 $tbl->setData($result_set);
1580 }
1581
1582 function &__initTableGUI()
1583 {
1584 include_once "./Services/Table/classes/class.ilTableGUI.php";
1585
1586 return new ilTableGUI(0,false);
1587 }
1588
1589 function __buildFilterSelect($a_parent_ids)
1590 {
1591 $action[0] = $this->lng->txt('all_users');
1592 $action[$this->object->getRefId()] = $this->lng->txt('users').
1593 ' ('.ilObject::_lookupTitle(ilObject::_lookupObjId($this->object->getRefId())).')';
1594
1595 foreach($a_parent_ids as $parent)
1596 {
1597 if($parent == $this->object->getRefId())
1598 {
1599 continue;
1600 }
1601 switch($parent)
1602 {
1604 $action[ilLocalUser::_getUserFolderId()] = $this->lng->txt('global_user');
1605
1606 break;
1607
1608 default:
1609 $action[$parent] = $this->lng->txt('users').' ('.ilObject::_lookupTitle(ilObject::_lookupObjId($parent)).')';
1610
1611 break;
1612 }
1613 }
1614 return ilUtil::formSelect($_SESSION['filtered_users'][$this->object->getRefId()],"filter",$action,false,true);
1615 }
1616
1617 public static function _goto($a_target)
1618 {
1619 global $ilAccess, $ilErr, $lng;
1620
1621 if ($ilAccess->checkAccess("read", "", $a_target))
1622 {
1624 }
1625 else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
1626 {
1627 ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
1630 }
1631
1632 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1633
1634 }
1635
1636
1640
1644 function editIconsObject($a_form = null)
1645 {
1646 global $tpl;
1647
1648 $this->checkPermission('write');
1649
1650 $this->tabs_gui->setTabActive('settings');
1651
1652 if(!$a_form)
1653 {
1654 $a_form = $this->initIconsForm();
1655 }
1656
1657 $tpl->setContent($a_form->getHTML());
1658 }
1659
1660 function initIconsForm()
1661 {
1662 $this->setEditTabs("icons");
1663
1664 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
1665 $form = new ilPropertyFormGUI();
1666 $form->setFormAction($this->ctrl->getFormAction($this));
1667
1668 $this->showCustomIconsEditing(1, $form);
1669
1670 // $form->setTitle($this->lng->txt('edit_grouping'));
1671 $form->addCommandButton('updateIcons', $this->lng->txt('save'));
1672
1673 return $form;
1674 }
1675
1680 {
1681 global $ilSetting;
1682
1683 $this->checkPermission('write');
1684
1685 $form = $this->initIconsForm();
1686 if($form->checkInput())
1687 {
1688 //save custom icons
1689 if ($ilSetting->get("custom_icons"))
1690 {
1691 if($_POST["cont_icon_delete"])
1692 {
1693 $this->object->removeCustomIcon();
1694 }
1695 $this->object->saveIcons($_FILES["cont_icon"]['tmp_name']);
1696 }
1697 if ($_FILES["cont_icon"]['tmp_name'] || $_POST["cont_icon_delete"])
1698 {
1699 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
1700 }
1701 $this->ctrl->redirect($this,"editIcons");
1702 }
1703
1704 $form->setValuesByPost();
1705 $this->editIconsObject($form);
1706 }
1707
1708
1709 //
1710 // taxonomy
1711 //
1712
1713 protected function initTaxSubTabs($a_active = "tax_list")
1714 {
1715 $this->tabs_gui->setTabActive("obj_tool_setting_taxonomies");
1716 $this->tabs_gui->addSubTab("tax_settings", $this->lng->txt("cntr_taxonomy_sideblock_settings"),
1717 $this->ctrl->getLinkTarget($this, "editTaxonomySettings"));
1718 $this->tabs_gui->addSubTab("tax_list", $this->lng->txt("cntr_taxonomy_definitions"),
1719 $this->ctrl->getLinkTargetByClass("ilobjtaxonomygui", ""));
1720 $this->tabs_gui->activateSubTab($a_active);
1721 }
1722
1723 protected function getTaxonomiesForRefId()
1724 {
1725 global $tree;
1726
1727 include_once "Services/Object/classes/class.ilObjectServiceSettingsGUI.php";
1728 include_once "Services/Taxonomy/classes/class.ilObjTaxonomy.php";
1729
1730 // see ilTaxMDGUI::getSelectableTaxonomies()
1731
1732 $res = array();
1733 foreach($tree->getPathFull($this->object->getRefId()) as $node)
1734 {
1735 // find all defined taxes for parent node, activation is not relevant
1736 $node_taxes = ilObjTaxonomy::getUsageOfObject($node["obj_id"], true);
1737 if(sizeof($node_taxes))
1738 {
1739 foreach($node_taxes as $node_tax)
1740 {
1741 $res[$node_tax["tax_id"]] = array(
1742 "title" => $node_tax["title"]
1743 ,"source" => $node["child"]
1744 );
1745 }
1746 }
1747 }
1748
1749 asort($res);
1750 return $res;
1751 }
1752
1753 protected function initTaxonomyForm(array $tax)
1754 {
1755 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1756 $form = new ilPropertyFormGUI();
1757 $form->setFormAction($this->ctrl->getFormAction($this), "editTaxonomySettings");
1758 $form->setTitle($this->lng->txt("cntr_taxonomy_sideblock_settings"));
1759
1760 $block = new ilCheckboxGroupInputGUI($this->lng->txt("cntr_taxonomy_show_sideblock"), "sblock");
1761 $form->addItem($block);
1762
1763 $current = $this->getActiveBlocks();
1764
1765 foreach($tax as $tax_id => $tax_item)
1766 {
1767 $option = new ilCheckboxOption($tax_item["title"], $tax_id,
1769
1770 if($tax_item["source"] != $this->object->getRefId())
1771 {
1772 $loc = new ilLocatorGUI();
1773 $loc->setTextOnly(true);
1774 $loc->addRepositoryItems($tax_item["source"]);
1775 $option->setInfo($loc->getHTML());
1776 }
1777
1778 $block->addOption($option);
1779
1780 if(in_array($tax_id, $current))
1781 {
1782 $value[] = $tax_id;
1783 }
1784 }
1785
1786 $block->setValue($value);
1787
1788 $form->addCommandButton("updateTaxonomySettings", $this->lng->txt("save"));
1789
1790 return $form;
1791 }
1792
1793 protected function editTaxonomySettingsObject()
1794 {
1795 $this->initTaxSubTabs("tax_settings");
1796
1797 $taxonomies = $this->getTaxonomiesForRefId();
1798 if(!sizeof($taxonomies))
1799 {
1800 ilUtil::sendFailure($this->lng->txt("cntr_tax_none_available"));
1801 return;
1802 }
1803
1804 $form = $this->initTaxonomyForm($taxonomies);
1805 $this->tpl->setContent($form->getHTML());
1806 }
1807
1808 protected function getActiveBlocks()
1809 {
1810 $res = array();
1811
1813
1814 foreach(ilContainer::_getContainerSettings($this->object->getId()) as $keyword => $value)
1815 {
1816 if(substr($keyword, 0, strlen($prefix)) == $prefix && (bool)$value)
1817 {
1818 $res[] = substr($keyword, strlen($prefix));
1819 }
1820 }
1821
1822 return $res;
1823 }
1824
1825 protected function updateTaxonomySettingsObject()
1826 {
1827 $taxonomies = $this->getTaxonomiesForRefId();
1828 if(sizeof($taxonomies))
1829 {
1830 $form = $this->initTaxonomyForm($taxonomies);
1831 if($form->checkInput())
1832 {
1833 $sblock = $form->getInput("sblock");
1834
1836
1837 ilContainer::_deleteContainerSettings($this->object->getId(),
1838 $prefix."%", true);
1839
1840 if(is_array($sblock))
1841 {
1842 foreach($sblock as $tax_id)
1843 {
1844 ilContainer::_writeContainerSetting($this->object->getId(),
1845 $prefix.$tax_id, 1);
1846 }
1847 }
1848
1849 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
1850 }
1851 }
1852 $this->ctrl->redirect($this, "editTaxonomySettings");
1853 }
1854
1855} // END class.ilObjCategoryGUI
1856?>
$_GET["client_id"]
$_SESSION["AccountId"]
_recordWriteEvent($obj_id, $usr_id, $action, $parent_obj_id=null)
Records a write event.
_catchupWriteEvents($obj_id, $usr_id, $timestamp=null)
Catches up with all write events which occured before the specified timestamp.
This class represents a property in a property form.
This class represents an option in a checkbox group.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Confirmation screen class.
Class ilContainerGUI.
afterUpdate()
Post (successful) object update hook.
& forwardToPageObject()
forward command to page object
initSortingForm(ilPropertyFormGUI $form, array $a_sorting_settings)
Append sorting settings to property form.
ilContainerGUI($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Constructor @access public.
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 ilContainerLinkListGUI.
static _deleteContainerSettings($a_id, $a_keyword=null, $a_keyword_like=false)
static _getContainerSettings($a_id)
_lookupContainerSetting($a_id, $a_keyword, $a_default_value=NULL)
Lookup a container setting.
_writeContainerSetting($a_id, $a_keyword, $a_value)
GUI class for didactic template settings inside repository objects.
Class ilECSCategorySettings.
Export User Interface Class.
This class represents a section header in a property form.
Class ilInfoScreenGUI.
_getAllUserIds($a_filter=0)
locator handling class
Class ilObjCategoryGUI.
__setTableGUIBasicData(&$tbl, &$result_set, $a_from="", $a_footer=true)
initExtendedSettings()
build property form for extended category settings
initEditForm()
Init object edit form.
updateObject()
updates object entry in object_data
__showRolesTable($a_result_set, $a_from="")
importCategoriesWithRolObject()
import categories with local rol
importCategoriesFormObject()
display form for category import
addUserAutoCompleteObject()
Show auto complete results.
ilObjCategoryGUI($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Constructor @access public.
getEditFormValues()
Get values for edit form.
initTaxSubTabs($a_active="tax_list")
_getImportDir()
get user import directory name
deleteTranslationsObject()
Remove translation.
editInfoObject()
Edit extended category settings.
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
infoScreen()
show information screen
addTranslationObject()
Add a translation.
listUsersObject($show_delete=false)
editIconsObject($a_form=null)
Edit folder icons.
applyFilterObject()
Apply filter.
initCreationForms($a_new_type)
Init creation froms.
updateIconsObject()
update container icons
getTabs(&$tabs_gui)
Get tabs.
importCategoriesObject()
import categories
__checkGlobalRoles($new_assigned)
_importCategoriesForm($a_ref_id, &$a_tpl)
display form for category import (static, also called by RootFolderGUI)
__showUsersTable($a_result_set, $a_from="", $a_footer=true)
__buildFilterSelect($a_parent_ids)
afterSave(ilObject $a_new_object)
Post (successful) object creation hook.
setEditTabs($active_tab="settings_misc")
renderObject()
Render category.
saveTranslationsObject()
Save title and translations.
resetFilterObject()
Reset filter (note: this function existed before data table filter has been introduced.
_importCategories($a_ref_id, $withrol_tmp)
import categories (static, also called by RootFolderGUI)
editTranslationsObject($a_get_post_values=false, $a_add=false)
Edit title and translations.
& executeCommand()
execute command note: this method is overwritten in all container objects
updateInfoObject()
Update info (extended meta data)
importCancelledObject()
import cancelled
getContentStylePath($a_style_id)
get content style path
static lookupObjectStyle($a_obj_id)
Lookup object style.
static writeStyleUsage($a_obj_id, $a_style_id)
Write style usage.
_lookupStandard($a_id)
Lookup standard flag.
Taxonomy GUI class.
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
Class ilObjUserFolderGUI.
Class ilObjUserGUI.
static _lookupName($a_user_id)
lookup user name
GUI class for the workflow of copying objects.
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
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
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
getCreationMode()
get creation mode
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.
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 ilObjectMetaDataGUI.
static initServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Init service settings form.
static updateServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Update service settings.
GUI class for object translation handling.
TableGUI class for title/description translations.
Class ilObject Basic functions for all objects.
static _lookupObjId($a_id)
const TITLE_LENGTH
max length of object title
static _lookupTitle($a_id)
lookup object title
static _lookupDescription($a_id)
lookup object description
getRefId()
get reference id @access public
getDescription()
get object description
getId()
get object id @access public
getTitle()
get object title @access public
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a property form user interface.
ILIAS Setting Class.
Class ilTableGUI.
This class represents a text area property in a property form.
This class represents a text property in a property form.
static getInstance()
Singelton get instance.
Auto completion class for user lists.
TableGUI class for user administration.
static getDataDir()
get data directory (outside webspace)
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static formCheckbox($checked, $varname, $value, $disabled=false)
??? @access public
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows)
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static formSelect($selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static createDirectory($a_dir, $a_mod=0755)
create directory
$_POST['username']
Definition: cron.php:12
$tbl
Definition: example_048.php:81
$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
exit
Definition: login.php:54
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
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
global $ilUser
Definition: imgupload.php:15