ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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{
26 protected $nav_history;
27
31 protected $help;
32
33 public $ctrl;
34
35 const CONTAINER_SETTING_TAXBLOCK = "tax_sblock_";
36
41 public function __construct($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
42 {
43 global $DIC;
44
45 $this->rbacsystem = $DIC->rbac()->system();
46 $this->nav_history = $DIC["ilNavigationHistory"];
47 $this->access = $DIC->access();
48 $this->ctrl = $DIC->ctrl();
49 $this->tabs = $DIC->tabs();
50 $this->help = $DIC["ilHelp"];
51 $this->lng = $DIC->language();
52 $this->user = $DIC->user();
53 $this->tree = $DIC->repositoryTree();
54 $this->error = $DIC["ilErr"];
55 $this->settings = $DIC->settings();
56 $this->tpl = $DIC["tpl"];
57 $this->toolbar = $DIC->toolbar();
58 $this->rbacreview = $DIC->rbac()->review();
59 $this->rbacadmin = $DIC->rbac()->admin();
60 //global $ilCtrl;
61
62 // CONTROL OPTIONS
63 //$this->ctrl =& $ilCtrl;
64 //$this->ctrl->saveParameter($this,array("ref_id","cmdClass"));
65 $GLOBALS['lng']->loadLanguageModule('cat');
66
67 $this->type = "cat";
68 parent::__construct($a_data, (int) $a_id, $a_call_by_reference, false);
69
70 if (is_object($this->object)) {
71 include_once("./Services/Container/classes/class.ilContainer.php");
72 include_once("./Services/Object/classes/class.ilObjectServiceSettingsGUI.php");
73 $this->info_screen_enabled = ilContainer::_lookupContainerSetting(
74 $this->object->getId(),
76 true
77 );
78 }
79 }
80
81 public function executeCommand()
82 {
84 $ilNavigationHistory = $this->nav_history;
85 $ilAccess = $this->access;
87 $ilTabs = $this->tabs;
88
89 $next_class = $this->ctrl->getNextClass($this);
90 $cmd = $this->ctrl->getCmd();
91
92 // show repository tree
93 $this->showRepTree();
94
95 switch ($next_class) {
96 case "ilobjusergui":
97 include_once('./Services/User/classes/class.ilObjUserGUI.php');
98
99 $this->tabs_gui->setTabActive('administrate_users');
100 if (!$_GET['obj_id']) {
101 $this->gui_obj = new ilObjUserGUI("", $_GET['ref_id'], true, false);
102 $this->gui_obj->setCreationMode($this->creation_mode);
103 $ret =&$this->ctrl->forwardCommand($this->gui_obj);
104 } else {
105 $this->gui_obj = new ilObjUserGUI("", $_GET['obj_id'], false, false);
106 $this->gui_obj->setCreationMode($this->creation_mode);
107 $ret =&$this->ctrl->forwardCommand($this->gui_obj);
108 }
109
110 $ilTabs->clearTargets();
111 $ilTabs->setBackTarget($this->lng->txt('backto_lua'), $this->ctrl->getLinkTarget($this, 'listUsers'));
112 $ilHelp = $this->help;
113 $ilHelp->setScreenIdComponent("cat");
114 $ilHelp->setScreenId("administrate_user");
115 $ilHelp->setSubScreenId($ilCtrl->getCmd());
116 break;
117
118 case "ilobjuserfoldergui":
119 include_once('./Services/User/classes/class.ilObjUserFolderGUI.php');
120
121 $this->gui_obj = new ilObjUserFolderGUI("", (int) $_GET['ref_id'], true, false);
122 $this->gui_obj->setUserOwnerId((int) $_GET['ref_id']);
123 $this->gui_obj->setCreationMode($this->creation_mode);
124 $ret =&$this->ctrl->forwardCommand($this->gui_obj);
125
126 $ilTabs->clearTargets();
127 $ilTabs->setBackTarget($this->lng->txt('backto_lua'), $this->ctrl->getLinkTarget($this, 'listUsers'));
128 $ilHelp = $this->help;
129 $ilHelp->setScreenIdComponent("cat");
130 $ilHelp->setScreenId("administrate_user");
131 $ilHelp->setSubScreenId($ilCtrl->getCmd());
132 break;
133
134 case "ilcolumngui":
135 $this->checkPermission("read");
136 $this->prepareOutput();
137 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
138 $this->tpl->setVariable(
139 "LOCATION_CONTENT_STYLESHEET",
140 ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId())
141 );
142 $this->renderObject();
143 break;
144
145 case 'ilpermissiongui':
146 $this->prepareOutput();
147 $this->tabs_gui->setTabActive('perm_settings');
148 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
149 $perm_gui = new ilPermissionGUI($this);
150 $ret =&$this->ctrl->forwardCommand($perm_gui);
151 break;
152
153 case 'ilinfoscreengui':
154 if ($this->info_screen_enabled) {
155 $this->prepareOutput();
156 $this->infoScreen();
157 }
158 break;
159
160 case 'ilcontainerlinklistgui':
161 include_once("Services/Container/classes/class.ilContainerLinkListGUI.php");
162 $link_list_gui = new ilContainerLinkListGUI();
163 $ret =&$this->ctrl->forwardCommand($link_list_gui);
164 break;
165
166 // container page editing
167 case "ilcontainerpagegui":
168 $this->prepareOutput(false);
169 $ret = $this->forwardToPageObject();
170 if ($ret != "") {
171 $this->tpl->setContent($ret);
172 }
173 break;
174
175 case 'ilobjectcopygui':
176 $this->prepareOutput();
177
178 include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
179 $cp = new ilObjectCopyGUI($this);
180 $cp->setType('cat');
181 $this->ctrl->forwardCommand($cp);
182 break;
183
184 case "ilobjstylesheetgui":
185 $this->forwardToStyleSheet();
186 break;
187
188 case 'ilusertablegui':
189 include_once './Services/User/classes/class.ilUserTableGUI.php';
190 $u_table = new ilUserTableGUI($this, "listUsers");
191 $u_table->initFilter();
192 $this->ctrl->setReturn($this, 'listUsers');
193 $this->ctrl->forwardCommand($u_table);
194 break;
195
196 case "ilcommonactiondispatchergui":
197 $this->prepareOutput();
198 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
200 $this->ctrl->forwardCommand($gui);
201 break;
202
203 case 'ildidactictemplategui':
204 $this->ctrl->setReturn($this, 'edit');
205 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateGUI.php';
206 $did = new ilDidacticTemplateGUI($this);
207 $this->ctrl->forwardCommand($did);
208 break;
209
210 case 'ilexportgui':
211 $this->prepareOutput();
212 $this->tabs_gui->setTabActive('export');
213 include_once './Services/Export/classes/class.ilExportGUI.php';
214 $exp = new ilExportGUI($this);
215 $exp->addFormat('xml');
216 $this->ctrl->forwardCommand($exp);
217 break;
218
219 case 'ilobjecttranslationgui':
220 $this->checkPermissionBool("write");
221 $this->prepareOutput();
222 //$this->tabs_gui->setTabActive('export');
223 $this->setEditTabs("settings_trans");
224 include_once("./Services/Object/classes/class.ilObjectTranslationGUI.php");
225 $transgui = new ilObjectTranslationGUI($this);
226 $this->ctrl->forwardCommand($transgui);
227 break;
228
229 case 'ilobjtaxonomygui':
230 $this->checkPermissionBool("write");
231 $this->prepareOutput();
232 $this->initTaxSubTabs();
233 include_once("./Services/Taxonomy/classes/class.ilObjTaxonomyGUI.php");
234 $tax = new ilObjTaxonomyGUI();
235 $tax->setAssignedObject($this->object->getId());
236 $tax->setMultiple(true);
237 $tax->setListInfo($this->lng->txt("cntr_tax_list_info"));
238 $this->ctrl->forwardCommand($tax);
239 break;
240
241 case 'ilobjectmetadatagui':
242 $this->checkPermissionBool("write");
243 $this->prepareOutput();
244 $this->tabs_gui->activateTab('meta_data');
245 $this->ctrl->forwardCommand($this->getObjectMetadataGUI());
246 break;
247
248 default:
249 if ($cmd == "infoScreen") {
250 $this->checkPermission("visible");
251 } else {
252 $this->checkPermission("read");
253 }
254
255 // add entry to navigation history
256 if (!$this->getCreationMode() &&
257 $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
258 include_once("./Services/Link/classes/class.ilLink.php");
259 $ilNavigationHistory->addItem(
260 $_GET["ref_id"],
261 ilLink::_getLink($_GET["ref_id"], "cat"),
262 "cat"
263 );
264 }
265
266 $this->prepareOutput();
267 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
268 if (is_object($this->object)) {
269 $this->tpl->setVariable(
270 "LOCATION_CONTENT_STYLESHEET",
271 ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId())
272 );
273 }
274
275 if (!$cmd) {
276 $cmd = "render";
277 }
278 $cmd .= "Object";
279 $this->tabs_gui->activateTab("view_content"); // see #19868
280 $this->$cmd();
281
282 break;
283 }
284
285 $this->addHeaderAction();
286
287 return true;
288 }
289
290
294 protected function addHeaderAction()
295 {
297 parent::addHeaderAction();
298 }
299
300
307 public function getObjectMetadataGUI()
308 {
309 include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
310 $md_gui = new ilObjectMetaDataGUI($this->object);
311 include_once "Services/Object/classes/class.ilObjectServiceSettingsGUI.php";
313 $this->object->getId(),
315 false
316 )) {
317 $md_gui->enableTaxonomyDefinition(true);
318 $tax = $md_gui->getTaxonomyObjGUI();
319 $tax->setMultiple(true);
320 $tax->setListInfo($this->lng->txt("cntr_tax_list_info"));
321 $taxonomies = $this->getTaxonomiesForRefId();
322 if (sizeof($taxonomies)) {
323 $md_gui->setTaxonomySettings(function ($form) {
324 $tax = $this->getTaxonomiesForRefId();
325 $block = new ilCheckboxGroupInputGUI($this->lng->txt("cntr_taxonomy_show_sideblock"), "sblock");
326 $form->addItem($block);
327
328 $current = $this->getActiveBlocks();
329
330 foreach ($tax as $tax_id => $tax_item) {
331 $option = new ilCheckboxOption(
332 $tax_item["title"],
333 $tax_id,
335 );
336
337 if ($tax_item["source"] != $this->object->getRefId()) {
338 $loc = new ilLocatorGUI();
339 $loc->setTextOnly(true);
340 $loc->addRepositoryItems($tax_item["source"]);
341 $option->setInfo($loc->getHTML());
342 }
343
344 $block->addOption($option);
345
346 if (in_array($tax_id, $current)) {
347 $value[] = $tax_id;
348 }
349 }
350
351 $block->setValue($value);
352 }, function ($form) {
353 $taxonomies = $this->getTaxonomiesForRefId();
354 if (sizeof($taxonomies)) {
355 $sblock = $form->getInput("sblock");
356
358
360 $this->object->getId(),
361 $prefix . "%",
362 true
363 );
364
365 if (is_array($sblock)) {
366 foreach ($sblock as $tax_id) {
368 $this->object->getId(),
369 $prefix . $tax_id,
370 1
371 );
372 }
373 }
374 }
375 });
376 }
377 }
378 return $md_gui;
379 }
380
381
385 public function getTabs()
386 {
389 $ilHelp = $this->help;
390 $ilAccess = $this->access;
391
392 if ($this->ctrl->getCmd() == "editPageContent") {
393 return;
394 }
395 #$this->ctrl->setParameter($this,"ref_id",$this->ref_id);
396
397 $ilHelp->setScreenIdComponent("cat");
398
399 if ($rbacsystem->checkAccess('read', $this->ref_id)) {
400 $force_active = ($_GET["cmd"] == "" || $_GET["cmd"] == "render")
401 ? true
402 : false;
403 $this->tabs_gui->addTab(
404 "view_content",
405 $lng->txt("content"),
406 $this->ctrl->getLinkTarget($this, "")
407 );
408
409 //BEGIN ChangeEvent add info tab to category object
410 if ($this->info_screen_enabled) {
411 $force_active = ($this->ctrl->getNextClass() == "ilinfoscreengui"
412 || strtolower($_GET["cmdClass"]) == "ilnotegui")
413 ? true
414 : false;
415 $this->tabs_gui->addTarget(
416 "info_short",
417 $this->ctrl->getLinkTargetByClass(
418 array("ilobjcategorygui", "ilinfoscreengui"),
419 "showSummary"
420 ),
421 array("showSummary","", "infoScreen"),
422 "",
423 "",
424 $force_active
425 );
426 }
427 //END ChangeEvent add info tab to category object
428 }
429
430 if ($rbacsystem->checkAccess('write', $this->ref_id)) {
431 $force_active = ($_GET["cmd"] == "edit")
432 ? true
433 : false;
434 $this->tabs_gui->addTarget(
435 "settings",
436 $this->ctrl->getLinkTarget($this, "edit"),
437 "edit",
438 get_class($this),
439 "",
440 $force_active
441 );
442
443
444
445 // metadata / taxonomies
446 include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
447 $mdgui = new ilObjectMetaDataGUI($this->object);
449 $this->object->getId(),
451 false
452 )) {
453 $mdgui->enableTaxonomyDefinition(true);
454 }
455 $mdtab = $mdgui->getTab();
456 if ($mdtab) {
457 $this->tabs_gui->addTab(
458 "meta_data",
459 $this->lng->txt("meta_data"),
460 $mdtab
461 );
462 }
463 }
464
465 include_once './Services/User/classes/class.ilUserAccountSettings.php';
466 if (
467 ilUserAccountSettings::getInstance()->isLocalUserAdministrationEnabled() and
468 $rbacsystem->checkAccess('cat_administrate_users', $this->ref_id)) {
469 $this->tabs_gui->addTarget(
470 "administrate_users",
471 $this->ctrl->getLinkTarget($this, "listUsers"),
472 "listUsers",
473 get_class($this)
474 );
475 }
476
477 if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
478 $this->tabs_gui->addTarget(
479 'export',
480 $this->ctrl->getLinkTargetByClass('ilexportgui', ''),
481 'export',
482 'ilexportgui'
483 );
484 }
485
486 // parent tabs (all container: edit_permission, clipboard, trash
487 parent::getTabs();
488 }
489
493 public function renderObject()
494 {
495 $ilTabs = $this->tabs;
496
497 $ilTabs->activateTab("view_content");
498 $ret = parent::renderObject();
499 return $ret;
500 }
501
502 public function viewObject()
503 {
504 if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
505 parent::viewObject();
506 return true;
507 }
508 return $this->renderObject();
509 }
510
511 protected function initCreationForms($a_new_type)
512 {
513 $forms = parent::initCreationForms($a_new_type);
514 //unset($forms[self::CFORM_IMPORT]);
515 return $forms;
516 }
517
518 protected function afterSave(ilObject $a_new_object)
519 {
522
523 // add default translation
524 $a_new_object->addTranslation(
525 $a_new_object->getTitle(),
526 $a_new_object->getDescription(),
527 $ilUser->getPref("language"),
528 true
529 );
530
531 // default: sort by title
532 include_once('Services/Container/classes/class.ilContainerSortingSettings.php');
533 $settings = new ilContainerSortingSettings($a_new_object->getId());
535 $settings->save();
536
537 // inherit parents content style, if not individual
538 $parent_ref_id = $tree->getParentId($a_new_object->getRefId());
539 $parent_id = ilObject::_lookupObjId($parent_ref_id);
540 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
541 $style_id = ilObjStyleSheet::lookupObjectStyle($parent_id);
542 if ($style_id > 0) {
543 if (ilObjStyleSheet::_lookupStandard($style_id)) {
544 ilObjStyleSheet::writeStyleUsage($a_new_object->getId(), $style_id);
545 }
546 }
547
548 // always send a message
549 ilUtil::sendSuccess($this->lng->txt("cat_added"), true);
550 $this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
551 $this->redirectToRefId($a_new_object->getRefId(), "");
552 }
553
559 public function infoScreenObject()
560 {
561 $this->ctrl->setCmd("showSummary");
562 $this->ctrl->setCmdClass("ilinfoscreengui");
563 $this->infoScreen();
564 }
565
569 public function infoScreen()
570 {
571 $ilAccess = $this->access;
574
575 if (!$ilAccess->checkAccess("visible", "", $this->ref_id)) {
576 $ilErr->raiseError($this->lng->txt("msg_no_perm_read"), $ilErr->MESSAGE);
577 }
578
579 if (!$this->info_screen_enabled) {
580 return;
581 }
582
583 // #10986
584 $this->tabs_gui->setTabActive('info_short');
585
586 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
587 $info = new ilInfoScreenGUI($this);
588
589 $info->enablePrivateNotes();
590
591 if ($ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
592 $info->enableNews();
593 }
594
595 // no news editing for files, just notifications
596 $info->enableNewsEditing(false);
597 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
598 $news_set = new ilSetting("news");
599 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
600
601 if ($enable_internal_rss) {
602 $info->setBlockProperty("news", "settings", true);
603 $info->setBlockProperty("news", "public_notifications_option", true);
604 }
605 }
606
607 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
608 $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_INFO, 'cat', $this->object->getId());
609 $record_gui->setInfoObject($info);
610 $record_gui->parse();
611
612
613 // standard meta data
614 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
615
616 // forward the command
617 if ($ilCtrl->getNextClass() == "ilinfoscreengui") {
618 $ilCtrl->forwardCommand($info);
619 } else {
620 return $ilCtrl->getHTML($info);
621 }
622 }
623
629 protected function editInfoObject()
630 {
631 $this->checkPermission("write");
632 $this->setEditTabs();
633 $this->tabs_gui->activateTab('settings');
634 $this->tabs_gui->setSubTabActive('edit_cat_settings');
635
636 $this->initExtendedSettings();
637 $this->tpl->setContent($this->form->getHTML());
638 }
639
645 protected function updateInfoObject()
646 {
647 $this->checkPermission("write");
648
649 // init form
650 $this->initExtendedSettings();
651
652 // still needed for date conversion and so on
653 $this->form->checkInput();
654
655 if ($this->record_gui->importEditFormPostValues()) {
656 $this->record_gui->writeEditForm();
657
658 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
659 $this->ctrl->redirect($this, "editInfo");
660 }
661
662 $this->editInfoObject();
663 }
664
665
671 protected function initExtendedSettings()
672 {
673 if (is_object($this->form)) {
674 return true;
675 }
676
677 include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
678 $this->form = new ilPropertyFormGUI();
679 $this->form->setFormAction($this->ctrl->getFormAction($this));
680 $this->form->setTitle($this->lng->txt('ext_cat_settings'));
681 $this->form->addCommandButton('updateInfo', $this->lng->txt('save'));
682 $this->form->addCommandButton('editInfo', $this->lng->txt('cancel'));
683
684 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
685 $this->record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_EDITOR, 'cat', $this->object->getId());
686 $this->record_gui->setPropertyForm($this->form);
687 $this->record_gui->parse();
688
689 return true;
690 }
691
692 protected function setEditTabs($active_tab = "settings_misc")
693 {
695 $ilTabs = $this->tabs;
696
697 $this->tabs_gui->addSubTab(
698 "settings_misc",
699 $this->lng->txt("settings"),
700 $this->ctrl->getLinkTarget($this, "edit")
701 );
702
703 /*$this->tabs_gui->addSubTab("settings_trans",
704 $this->lng->txt("title_and_translations"),
705 $this->ctrl->getLinkTarget($this, "editTranslations"));*/
706
707 $this->tabs_gui->addSubTab(
708 "settings_trans",
709 $this->lng->txt("obj_multilinguality"),
710 $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", "")
711 );
712
713 // custom icon
714 if ($ilSetting->get("custom_icons")) {
715 $this->tabs_gui->addSubTab(
716 "icons",
717 $this->lng->txt("icon_settings"),
718 $this->ctrl->getLinkTarget($this, 'editIcons')
719 );
720 }
721
722 $this->tabs_gui->activateTab("settings");
723 $this->tabs_gui->activateSubTab($active_tab);
724 }
725
726 public function initEditForm()
727 {
728 $this->lng->loadLanguageModule($this->object->getType());
729 $this->setEditTabs();
730
731 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
732 $form = new ilPropertyFormGUI();
733 $form->setFormAction($this->ctrl->getFormAction($this));
734 $form->setTitle($this->lng->txt($this->object->getType() . "_edit"));
735
736 // title/description
737
738 $trans = $this->object->getTranslations();
739 $def = $trans["Fobject"][0]; // default
740
741 $title = new ilTextInputGUI($this->lng->txt("title"), "title");
742 $title->setRequired(true);
743 $title->setSize(min(40, ilObject::TITLE_LENGTH));
744 $title->setMaxLength(ilObject::TITLE_LENGTH);
745 $title->setValue($def["title"]);
746 $form->addItem($title);
747
748 if (sizeof($trans["Fobject"]) > 1) {
749 include_once('Services/MetaData/classes/class.ilMDLanguageItem.php');
750 $languages = ilMDLanguageItem::_getLanguages();
751
752 $title->setInfo($this->lng->txt("language") . ": " . $languages[$def["lang"]] .
753 ' <a href="' . $this->ctrl->getLinkTarget($this, "editTranslations") .
754 '">&raquo; ' . $this->lng->txt("cat_more_translations") . '</a>');
755
756 unset($languages);
757 }
758
759 $desc = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
760 $desc->setRows(2);
761 $desc->setCols(40);
762 $desc->setValue($def["desc"]);
763 $form->addItem($desc);
764
765 // Show didactic template type
767
768 // presentation
769 $pres = new ilFormSectionHeaderGUI();
770 $pres->setTitle($this->lng->txt('obj_presentation'));
771 $form->addItem($pres);
772
773
774 $form = $this->initSortingForm(
775 $form,
776 array(
780 )
781 );
782
783 // icon settings
784 // $this->showCustomIconsEditing(1, $form, false);
785
786 // Edit ecs export settings
787 include_once 'Modules/Category/classes/class.ilECSCategorySettings.php';
788 $ecs = new ilECSCategorySettings($this->object);
789 $ecs->addSettingsToForm($form, 'cat');
790
791 // services
792 $sh = new ilFormSectionHeaderGUI();
793 $sh->setTitle($this->lng->txt('obj_features'));
794 $form->addItem($sh);
795
796 include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
798 $this->object->getId(),
799 $form,
800 array(
805 )
806 );
807
808 $form->addCommandButton("update", $this->lng->txt("save"));
809 // $form->addCommandButton("addTranslation", $this->lng->txt("add_translation"));
810
811 return $form;
812 }
813
814 public function getEditFormValues()
815 {
816 // values are set in initEditForm()
817 }
818
824 public function updateObject()
825 {
828
829 if (!$this->checkPermissionBool("write")) {
830 $ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $ilErr->MESSAGE);
831 } else {
832 $form = $this->initEditForm();
833 if ($form->checkInput()) {
834 $title = $form->getInput("title");
835 $desc = $form->getInput("desc");
836 $lang = $this->object->getTranslations();
837 $lang = $lang["Fobject"][0]["lang"];
838 $this->object->deleteTranslation($lang);
839 $this->object->addTranslation($title, $desc, $lang, true);
840 $this->object->setTitle($title);
841 $this->object->setDescription($desc);
842 $this->object->update();
843
845
846 // save custom icons
847
848 // BEGIN ChangeEvent: Record update
849 require_once('Services/Tracking/classes/class.ilChangeEvent.php');
850 ilChangeEvent::_recordWriteEvent($this->object->getId(), $ilUser->getId(), 'update');
851 ilChangeEvent::_catchupWriteEvents($this->object->getId(), $ilUser->getId());
852 // END ChangeEvent: Record update
853
854 // services
855 include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
857 $this->object->getId(),
858 $form,
859 array(
864 )
865 );
866
867 // Update ecs export settings
868 include_once 'Modules/Category/classes/class.ilECSCategorySettings.php';
869 $ecs = new ilECSCategorySettings($this->object);
870 if ($ecs->handleSettingsUpdate()) {
871 return $this->afterUpdate();
872 }
873 }
874
875 // display form to correct errors
876 $this->setEditTabs();
877 $form->setValuesByPost();
878 $this->tpl->setContent($form->getHTML());
879 }
880 }
881
885 public function editTranslationsObject($a_get_post_values = false, $a_add = false)
886 {
888
889 $this->ctrl->redirectByClass("ilobjecttranslationgui", "");
890
891
892 $this->lng->loadLanguageModule($this->object->getType());
893 $this->setEditTabs("settings_trans");
894
895 include_once("./Services/Object/classes/class.ilObjectTranslationTableGUI.php");
897 $this,
898 "editTranslations",
899 true,
900 "Translation"
901 );
902 if ($a_get_post_values) {
903 $vals = array();
904 foreach ($_POST["title"] as $k => $v) {
905 $vals[] = array("title" => $v,
906 "desc" => $_POST["desc"][$k],
907 "lang" => $_POST["lang"][$k],
908 "default" => ($_POST["default"] == $k));
909 }
910 $table->setData($vals);
911 } else {
912 $data = $this->object->getTranslations();
913 foreach ($data["Fobject"] as $k => $v) {
914 $data["Fobject"][$k]["default"] = ($k == $data["default_language"]);
915 }
916 if ($a_add) {
917 $data["Fobject"][++$k]["title"] = "";
918 }
919 $table->setData($data["Fobject"]);
920 }
921 $tpl->setContent($table->getHTML());
922 }
923
927 public function saveTranslationsObject()
928 {
930
931 if (!$this->checkPermissionBool("write")) {
932 $ilErr->raiseError($this->lng->txt("permission_denied"), $ilErr->MESSAGE);
933 }
934
935 // default language set?
936 if (!isset($_POST["default"])) {
937 ilUtil::sendFailure($this->lng->txt("msg_no_default_language"));
938 return $this->editTranslationsObject(true);
939 }
940
941 // all languages set?
942 if (array_key_exists("", $_POST["lang"])) {
943 ilUtil::sendFailure($this->lng->txt("msg_no_language_selected"));
944 return $this->editTranslationsObject(true);
945 }
946
947 // no single language is selected more than once?
948 if (count(array_unique($_POST["lang"])) < count($_POST["lang"])) {
949 ilUtil::sendFailure($this->lng->txt("msg_multi_language_selected"));
950 return $this->editTranslationsObject(true);
951 }
952
953 // save the stuff
954 $this->object->removeTranslations();
955 foreach ($_POST["title"] as $k => $v) {
956 // update object data if default
957 $is_default = ($_POST["default"] == $k);
958 if ($is_default) {
959 $this->object->setTitle(ilUtil::stripSlashes($v));
960 $this->object->setDescription(ilUtil::stripSlashes($_POST["desc"][$k]));
961 $this->object->update();
962 }
963
964 $this->object->addTranslation(
966 ilUtil::stripSlashes($_POST["desc"][$k]),
967 ilUtil::stripSlashes($_POST["lang"][$k]),
968 $is_default
969 );
970 }
971
972 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
973 $this->ctrl->redirect($this, "editTranslations");
974 }
975
979 public function addTranslationObject()
980 {
981 if ($_POST["title"]) {
982 $k = max(array_keys($_POST["title"]));
983 $k++;
984 $_POST["title"][$k] = "";
985 $this->editTranslationsObject(true);
986 } else {
987 $this->editTranslationsObject(false, true);
988 }
989 }
990
994 public function deleteTranslationsObject()
995 {
996 foreach ($_POST["title"] as $k => $v) {
997 if ($_POST["check"][$k]) {
998 // default translation cannot be deleted
999 if ($k != $_POST["default"]) {
1000 unset($_POST["title"][$k]);
1001 unset($_POST["desc"][$k]);
1002 unset($_POST["lang"][$k]);
1003 } else {
1004 ilUtil::sendFailure($this->lng->txt("msg_no_default_language"));
1005 return $this->editTranslationsObject();
1006 }
1007 }
1008 }
1009 $this->saveTranslationsObject();
1010 }
1011
1016 {
1017 ilObjCategoryGUI::_importCategoriesForm($this->ref_id, $this->tpl);
1018 }
1019
1023 public static function _importCategoriesForm($a_ref_id, &$a_tpl)
1024 {
1025 global $DIC;
1026
1027 $lng = $DIC->language();
1028 $rbacreview = $DIC->rbac()->review();
1029 $ilCtrl = $DIC->ctrl();
1030
1031 $a_tpl->addBlockfile(
1032 "ADM_CONTENT",
1033 "adm_content",
1034 "tpl.cat_import_form.html",
1035 "Modules/Category"
1036 );
1037
1038 $a_tpl->setVariable("FORMACTION", $ilCtrl->getFormActionByClass('ilObjCategoryGUI'));
1039
1040 $a_tpl->setVariable("TXT_IMPORT_CATEGORIES", $lng->txt("import_categories"));
1041 $a_tpl->setVariable("TXT_HIERARCHY_OPTION", $lng->txt("import_cat_localrol"));
1042 $a_tpl->setVariable("TXT_IMPORT_FILE", $lng->txt("import_file"));
1043 $a_tpl->setVariable("TXT_IMPORT_TABLE", $lng->txt("import_cat_table"));
1044
1045 $a_tpl->setVariable("BTN_IMPORT", $lng->txt("import"));
1046 $a_tpl->setVariable("BTN_CANCEL", $lng->txt("cancel"));
1047
1048 // NEED TO FILL ADOPT_PERMISSIONS HTML FORM....
1049 $parent_role_ids = $rbacreview->getParentRoleIds($a_ref_id, true);
1050
1051 // sort output for correct color changing
1052 ksort($parent_role_ids);
1053
1054 foreach ($parent_role_ids as $key => $par) {
1055 if ($par["obj_id"] != SYSTEM_ROLE_ID) {
1056 $check = ilUtil::formCheckbox(0, "adopt[]", $par["obj_id"], 1);
1057 $output["adopt"][$key]["css_row_adopt"] = ilUtil::switchColor($key, "tblrow1", "tblrow2");
1058 $output["adopt"][$key]["check_adopt"] = $check;
1059 $output["adopt"][$key]["role_id"] = $par["obj_id"];
1060 $output["adopt"][$key]["type"] = ($par["type"] == 'role' ? 'Role' : 'Template');
1061 $output["adopt"][$key]["role_name"] = $par["title"];
1062 }
1063 }
1064
1065 //var_dump($output);
1066
1067 // BEGIN ADOPT PERMISSIONS
1068 foreach ($output["adopt"] as $key => $value) {
1069 $a_tpl->setCurrentBlock("ADOPT_PERM_ROW");
1070 $a_tpl->setVariable("CSS_ROW_ADOPT", $value["css_row_adopt"]);
1071 $a_tpl->setVariable("CHECK_ADOPT", $value["check_adopt"]);
1072 $a_tpl->setVariable("LABEL_ID", $value["role_id"]);
1073 $a_tpl->setVariable("TYPE", $value["type"]);
1074 $a_tpl->setVariable("ROLE_NAME", $value["role_name"]);
1075 $a_tpl->parseCurrentBlock();
1076 }
1077 }
1078
1079
1085 public function importCancelledObject()
1086 {
1087 $this->ctrl->redirect($this);
1088 }
1089
1093 public static function _getImportDir()
1094 {
1095 return ilUtil::getDataDir() . "/cat_import";
1096 }
1097
1101 public function importCategoriesObject()
1102 {
1104 // call to importCategories with $withrol = 0
1106 }
1107
1112 {
1113
1114 //echo "entra aqui";
1115 // call to importCategories with $withrol = 1
1117 }
1118
1123 public static function _importCategories($a_ref_id, $withrol_tmp)
1124 {
1125 global $DIC;
1126
1127 $lng = $DIC->language();
1128 $ilCtrl = $DIC->ctrl();
1129
1130 require_once("./Modules/Category/classes/class.ilCategoryImportParser.php");
1131
1132 $import_dir = ilObjCategoryGUI::_getImportDir();
1133
1134 // create user import directory if necessary
1135 if (!@is_dir($import_dir)) {
1136 ilUtil::createDirectory($import_dir);
1137 }
1138
1139 // move uploaded file to user import directory
1140
1141 $file_name = $_FILES["importFile"]["name"];
1142
1143 // added to prevent empty file names
1144 if (!strcmp($file_name, "")) {
1145 ilUtil::sendFailure($lng->txt("no_import_file_found"), true);
1146 $ilCtrl->redirectByClass('ilObjCategoryGUI');
1147 }
1148
1149 $parts = pathinfo($file_name);
1150 $full_path = $import_dir . "/" . $file_name;
1151 ilUtil::moveUploadedFile($_FILES["importFile"]["tmp_name"], $file_name, $full_path);
1152
1153 // unzip file
1154 ilUtil::unzip($full_path);
1155
1156 $subdir = basename($parts["basename"], "." . $parts["extension"]);
1157 $xml_file = $import_dir . "/" . $subdir . "/" . $subdir . ".xml";
1158 // CategoryImportParser
1159 //var_dump($_POST);
1160 $importParser = new ilCategoryImportParser($xml_file, $a_ref_id, $withrol_tmp);
1161 $importParser->startParsing();
1162
1163 ilUtil::sendSuccess($lng->txt("categories_imported"), true);
1164 $ilCtrl->redirectByClass('ilObjCategoryGUI');
1165 }
1166
1171 protected function resetFilterObject()
1172 {
1173 include_once("./Services/User/classes/class.ilUserTableGUI.php");
1174 $utab = new ilUserTableGUI($this, "listUsers", ilUserTableGUI::MODE_LOCAL_USER);
1175 $utab->resetOffset();
1176 $utab->resetFilter();
1177
1178 // from "old" implementation
1179 $this->listUsersObject();
1180 }
1181
1186 protected function applyFilterObject()
1187 {
1188 $ilTabs = $this->tabs;
1189
1190 include_once("./Services/User/classes/class.ilUserTableGUI.php");
1191 $utab = new ilUserTableGUI($this, "listUsers", ilUserTableGUI::MODE_LOCAL_USER);
1192 $utab->resetOffset();
1193 $utab->writeFilterToSession();
1194 $this->listUsersObject();
1195 }
1196
1197 // METHODS for local user administration
1198 public function listUsersObject($show_delete = false)
1199 {
1202 $ilToolbar = $this->toolbar;
1203
1204 include_once './Services/User/classes/class.ilLocalUser.php';
1205 include_once './Services/User/classes/class.ilObjUserGUI.php';
1206
1209
1210 if (!$rbacsystem->checkAccess("cat_administrate_users", $this->object->getRefId())) {
1211 $ilErr->raiseError($this->lng->txt("msg_no_perm_admin_users"), $ilErr->MESSAGE);
1212 }
1213 $this->tabs_gui->setTabActive('administrate_users');
1214
1215
1216
1217 $this->tpl->addBlockfile(
1218 'ADM_CONTENT',
1219 'adm_content',
1220 'tpl.cat_admin_users.html',
1221 "Modules/Category"
1222 );
1223
1224 if (count($rbacreview->getGlobalAssignableRoles()) or in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))) {
1225 $ilToolbar->addButton(
1226 $this->lng->txt('add_user'),
1227 $this->ctrl->getLinkTargetByClass('ilobjusergui', 'create')
1228 );
1229
1230 $ilToolbar->addButton(
1231 $this->lng->txt('import_users'),
1232 $this->ctrl->getLinkTargetByClass('ilobjuserfoldergui', 'importUserForm')
1233 );
1234 } else {
1235 ilUtil::sendInfo($this->lng->txt('no_roles_user_can_be_assigned_to'));
1236 }
1237
1238 if ($show_delete) {
1239 $this->tpl->setCurrentBlock("confirm_delete");
1240 $this->tpl->setVariable("CONFIRM_FORMACTION", $this->ctrl->getFormAction($this));
1241 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt('cancel'));
1242 $this->tpl->setVariable("CONFIRM_CMD", 'performDeleteUsers');
1243 $this->tpl->setVariable("TXT_CONFIRM", $this->lng->txt('delete'));
1244 $this->tpl->parseCurrentBlock();
1245 }
1246
1247 $this->lng->loadLanguageModule('user');
1248
1249 include_once("./Services/User/classes/class.ilUserTableGUI.php");
1250 $utab = new ilUserTableGUI($this, 'listUsers', ilUserTableGUI::MODE_LOCAL_USER);
1251 $this->tpl->setVariable('USERS_TABLE', $utab->getHTML());
1252
1253 return true;
1254 }
1255
1259 protected function addUserAutoCompleteObject()
1260 {
1261 include_once './Services/User/classes/class.ilUserAutoComplete.php';
1262 $auto = new ilUserAutoComplete();
1263 $auto->setSearchFields(array('login','firstname','lastname','email'));
1264 $auto->enableFieldSearchableCheck(true);
1265 $auto->isMoreLinkAvailable(true);
1266
1267 if (($_REQUEST['fetchall'])) {
1268 $auto->setLimit(ilUserAutoComplete::MAX_ENTRIES);
1269 }
1270
1271 echo $auto->getList($_REQUEST['term']);
1272 exit();
1273 }
1274
1275
1277 {
1278 include_once './Services/User/classes/class.ilLocalUser.php';
1279 $this->checkPermission("cat_administrate_users");
1280
1281 foreach ($_POST['user_ids'] as $user_id) {
1282 if (!in_array($user_id, ilLocalUser::_getAllUserIds($this->object->getRefId()))) {
1283 die('user id not valid');
1284 }
1285 if (!$tmp_obj =&ilObjectFactory::getInstanceByObjId($user_id, false)) {
1286 continue;
1287 }
1288 $tmp_obj->delete();
1289 }
1290 ilUtil::sendSuccess($this->lng->txt('deleted_users'));
1291 $this->listUsersObject();
1292
1293 return true;
1294 }
1295
1296 public function deleteUsersObject()
1297 {
1298 $this->checkPermission("cat_administrate_users");
1299 if (!count($_POST['id'])) {
1300 ilUtil::sendFailure($this->lng->txt('no_users_selected'));
1301 $this->listUsersObject();
1302
1303 return true;
1304 }
1305
1306 include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
1307 $confirm = new ilConfirmationGUI();
1308 $confirm->setFormAction($this->ctrl->getFormAction($this));
1309 $confirm->setHeaderText($this->lng->txt('sure_delete_selected_users'));
1310 $confirm->setConfirm($this->lng->txt('delete'), 'performDeleteUsers');
1311 $confirm->setCancel($this->lng->txt('cancel'), 'listUsers');
1312
1313 foreach ($_POST['id'] as $user) {
1315
1316 $confirm->addItem(
1317 'user_ids[]',
1318 $user,
1319 $name['lastname'] . ', ' . $name['firstname'] . ' [' . $name['login'] . ']'
1320 );
1321 }
1322 $this->tpl->setContent($confirm->getHTML());
1323 }
1324
1325 public function assignRolesObject()
1326 {
1328 $ilTabs = $this->tabs;
1329
1330 $this->checkPermission("cat_administrate_users");
1331
1332 include_once './Services/User/classes/class.ilLocalUser.php';
1333
1334 if (!isset($_GET['obj_id'])) {
1335 ilUtil::sendFailure('no_user_selected');
1336 $this->listUsersObject();
1337
1338 return true;
1339 }
1340
1341 $ilTabs->clearTargets();
1342 $ilTabs->setBackTarget($this->lng->txt('backto_lua'), $this->ctrl->getLinkTarget($this, 'listUsers'));
1343 $ilHelp = $this->help;
1344 $ilHelp->setScreenIdComponent("cat");
1345 $ilHelp->setScreenId("administrate_user");
1346 $ilHelp->setSubScreenId("assign_roles");
1347
1348
1349 $roles = $this->__getAssignableRoles();
1350
1351 if (!count($roles)) {
1352 #ilUtil::sendInfo($this->lng->txt('no_roles_user_can_be_assigned_to'));
1353 #$this->listUsersObject();
1354
1355 #return true;
1356 }
1357
1358 $ass_roles = $rbacreview->assignedRoles($_GET['obj_id']);
1359
1360 $counter = 0;
1361 $f_result = array();
1362
1363 foreach ($roles as $role) {
1364 $role_obj =&ilObjectFactory::getInstanceByObjId($role['obj_id']);
1365
1366 $disabled = false;
1367 $f_result[$counter]['checkbox'] = ilUtil::formCheckbox(
1368 in_array($role['obj_id'], $ass_roles) ? 1 : 0,
1369 'role_ids[]',
1370 $role['obj_id'],
1371 $disabled
1372 );
1373 $f_result[$counter]['title'] = $role_obj->getTitle() ? $role_obj->getTitle() : "";
1374 $f_result[$counter]['desc'] = $role_obj->getDescription() ? $role_obj->getDescription() : "";
1375 $f_result[$counter]['type'] = $role['role_type'] == 'global' ?
1376 $this->lng->txt('global') :
1377 $this->lng->txt('local');
1378
1379 unset($role_obj);
1380 ++$counter;
1381 }
1382
1383 include_once('./Modules/Category/classes/class.ilCategoryAssignRoleTableGUI.php');
1384 $table = new ilCategoryAssignRoleTableGUI($this, "assignRoles");
1385 $tmp_obj =&ilObjectFactory::getInstanceByObjId($_GET['obj_id']);
1386 $title = $this->lng->txt('role_assignment') . ' (' . $tmp_obj->getFullname() . ')';
1387 $table->setTitle($title, "icon_role.svg", $this->lng->txt("role_assignment"));
1388 $table->setData($f_result);
1389 $this->tpl->setContent($table->getHTML());
1390 }
1391
1392 public function assignSaveObject()
1393 {
1396 $this->checkPermission("cat_administrate_users");
1397
1398 include_once './Services/User/classes/class.ilLocalUser.php';
1399 // check hack
1400 if (!isset($_GET['obj_id']) or !in_array($_REQUEST['obj_id'], ilLocalUser::_getAllUserIds())) {
1401 ilUtil::sendFailure('no_user_selected');
1402 $this->listUsersObject();
1403
1404 return true;
1405 }
1406 $roles = $this->__getAssignableRoles();
1407
1408 // check minimum one global role
1409 if (!$this->__checkGlobalRoles($_POST['role_ids'])) {
1410 ilUtil::sendFailure($this->lng->txt('no_global_role_left'));
1411 $this->assignRolesObject();
1412
1413 return false;
1414 }
1415
1416 $new_role_ids = $_POST['role_ids'] ? $_POST['role_ids'] : array();
1417 $assigned_roles = $rbacreview->assignedRoles((int) $_REQUEST['obj_id']);
1418 foreach ($roles as $role) {
1419 if (in_array($role['obj_id'], $new_role_ids) and !in_array($role['obj_id'], $assigned_roles)) {
1420 $rbacadmin->assignUser($role['obj_id'], (int) $_REQUEST['obj_id']);
1421 }
1422 if (in_array($role['obj_id'], $assigned_roles) and !in_array($role['obj_id'], $new_role_ids)) {
1423 $rbacadmin->deassignUser($role['obj_id'], (int) $_REQUEST['obj_id']);
1424 }
1425 }
1426 ilUtil::sendSuccess($this->lng->txt('role_assignment_updated'));
1427 $this->assignRolesObject();
1428
1429 return true;
1430 }
1431
1432 // PRIVATE
1433 public function __getAssignableRoles()
1434 {
1437
1438 // check local user
1439 $tmp_obj =&ilObjectFactory::getInstanceByObjId($_REQUEST['obj_id']);
1440 // Admin => all roles
1441 if (in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))) {
1442 $global_roles = $rbacreview->getGlobalRolesArray();
1443 } elseif ($tmp_obj->getTimeLimitOwner() == $this->object->getRefId()) {
1444 $global_roles = $rbacreview->getGlobalAssignableRoles();
1445 } else {
1446 $global_roles = array();
1447 }
1448 return $roles = array_merge(
1449 $global_roles,
1450 $rbacreview->getAssignableChildRoles($this->object->getRefId())
1451 );
1452 }
1453
1454 public function __checkGlobalRoles($new_assigned)
1455 {
1458
1459 $this->checkPermission("cat_administrate_users");
1460
1461 // return true if it's not a local user
1462 $tmp_obj =&ilObjectFactory::getInstanceByObjId($_REQUEST['obj_id']);
1463 if ($tmp_obj->getTimeLimitOwner() != $this->object->getRefId() and
1464 !in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))) {
1465 return true;
1466 }
1467
1468 // new assignment by form
1469 $new_assigned = $new_assigned ? $new_assigned : array();
1470 $assigned = $rbacreview->assignedRoles((int) $_GET['obj_id']);
1471
1472 // all assignable globals
1473 if (!in_array(SYSTEM_ROLE_ID, $rbacreview->assignedRoles($ilUser->getId()))) {
1474 $ga = $rbacreview->getGlobalAssignableRoles();
1475 } else {
1476 $ga = $rbacreview->getGlobalRolesArray();
1477 }
1478 $global_assignable = array();
1479 foreach ($ga as $role) {
1480 $global_assignable[] = $role['obj_id'];
1481 }
1482
1483 $new_visible_assigned_roles = array_intersect($new_assigned, $global_assignable);
1484 $all_assigned_roles = array_intersect($assigned, $rbacreview->getGlobalRoles());
1485 $main_assigned_roles = array_diff($all_assigned_roles, $global_assignable);
1486
1487 if (!count($new_visible_assigned_roles) and !count($main_assigned_roles)) {
1488 return false;
1489 }
1490 return true;
1491 }
1492
1493 public static function _goto($a_target)
1494 {
1495 global $DIC;
1496
1497 $ilAccess = $DIC->access();
1498 $ilErr = $DIC["ilErr"];
1499 $lng = $DIC->language();
1500
1501 if ($ilAccess->checkAccess("read", "", $a_target)) {
1503 } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1505 $lng->txt("msg_no_perm_read_item"),
1507 ), true);
1509 }
1510
1511 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1512 }
1513
1514
1518
1522 public function editIconsObject($a_form = null)
1523 {
1524 $tpl = $this->tpl;
1525
1526 $this->checkPermission('write');
1527
1528 $this->tabs_gui->setTabActive('settings');
1529
1530 if (!$a_form) {
1531 $a_form = $this->initIconsForm();
1532 }
1533
1534 $tpl->setContent($a_form->getHTML());
1535 }
1536
1537 public function initIconsForm()
1538 {
1539 $this->setEditTabs("icons");
1540
1541 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
1542 $form = new ilPropertyFormGUI();
1543 $form->setFormAction($this->ctrl->getFormAction($this));
1544
1545 $this->showCustomIconsEditing(1, $form);
1546
1547 // $form->setTitle($this->lng->txt('edit_grouping'));
1548 $form->addCommandButton('updateIcons', $this->lng->txt('save'));
1549
1550 return $form;
1551 }
1552
1556 public function updateIconsObject()
1557 {
1559
1560 $this->checkPermission('write');
1561
1562 $form = $this->initIconsForm();
1563 if ($form->checkInput()) {
1564 //save custom icons
1565 if ($ilSetting->get("custom_icons")) {
1566 if ($_POST["cont_icon_delete"]) {
1567 $this->object->removeCustomIcon();
1568 }
1569 $this->object->saveIcons($_FILES["cont_icon"]['tmp_name']);
1570 }
1571 if ($_FILES["cont_icon"]['tmp_name'] || $_POST["cont_icon_delete"]) {
1572 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1573 }
1574 $this->ctrl->redirect($this, "editIcons");
1575 }
1576
1577 $form->setValuesByPost();
1578 $this->editIconsObject($form);
1579 }
1580
1581
1582 //
1583 // taxonomy
1584 //
1585
1586 protected function initTaxSubTabs($a_active = "tax_list")
1587 {
1588 $this->tabs_gui->setTabActive("obj_tool_setting_taxonomies");
1589 $this->tabs_gui->addSubTab(
1590 "tax_settings",
1591 $this->lng->txt("cntr_taxonomy_sideblock_settings"),
1592 $this->ctrl->getLinkTarget($this, "editTaxonomySettings")
1593 );
1594 $this->tabs_gui->addSubTab(
1595 "tax_list",
1596 $this->lng->txt("cntr_taxonomy_definitions"),
1597 $this->ctrl->getLinkTargetByClass("ilobjtaxonomygui", "")
1598 );
1599 $this->tabs_gui->activateSubTab($a_active);
1600 }
1601
1602 protected function getTaxonomiesForRefId()
1603 {
1605
1606 include_once "Services/Object/classes/class.ilObjectServiceSettingsGUI.php";
1607 include_once "Services/Taxonomy/classes/class.ilObjTaxonomy.php";
1608
1609 // see ilTaxMDGUI::getSelectableTaxonomies()
1610
1611 $res = array();
1612 foreach ($tree->getPathFull($this->object->getRefId()) as $node) {
1613 //if ($node["ref_id"] != $this->object->getRefId())
1614 {
1615 // find all defined taxes for parent node, activation is not relevant
1616 $node_taxes = ilObjTaxonomy::getUsageOfObject($node["obj_id"], true);
1617 if (sizeof($node_taxes)) {
1618 foreach ($node_taxes as $node_tax) {
1619 $res[$node_tax["tax_id"]] = array(
1620 "title" => $node_tax["title"]
1621 , "source" => $node["child"]
1622 );
1623 }
1624 }
1625 }
1626 }
1627
1628 asort($res);
1629 return $res;
1630 }
1631
1632
1633 protected function getActiveBlocks()
1634 {
1635 $res = array();
1636
1638
1639 foreach (ilContainer::_getContainerSettings($this->object->getId()) as $keyword => $value) {
1640 if (substr($keyword, 0, strlen($prefix)) == $prefix && (bool) $value) {
1641 $res[] = substr($keyword, strlen($prefix));
1642 }
1643 }
1644
1645 return $res;
1646 }
1647} // END class.ilObjCategoryGUI
sprintf('%.4f', $callTime)
user()
Definition: user.php:4
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
TableGUI class for role assignments.
static _catchupWriteEvents($obj_id, $usr_id, $timestamp=null)
Catches up with all write events which occured before the specified timestamp.
static _recordWriteEvent($obj_id, $usr_id, $action, $parent_obj_id=null)
Records a write event.
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.
prepareOutput($a_show_subobjects=true)
prepare output
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 _lookupContainerSetting($a_id, $a_keyword, $a_default_value=null)
Lookup a container setting.
static _deleteContainerSettings($a_id, $a_keyword=null, $a_keyword_like=false)
static _getContainerSettings($a_id)
static _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.
static _getAllUserIds($a_filter=0)
locator handling class
Class ilObjCategoryGUI.
initExtendedSettings()
build property form for extended category settings
initEditForm()
Init object edit form.
updateObject()
updates object entry in object_data
importCategoriesWithRolObject()
import categories with local rol
importCategoriesFormObject()
display form for category import
addUserAutoCompleteObject()
Show auto complete results.
getObjectMetadataGUI()
Get object metadata gui.
getEditFormValues()
Get values for edit form.
initTaxSubTabs($a_active="tax_list")
deleteTranslationsObject()
Remove translation.
static _importCategories($a_ref_id, $withrol_tmp)
import categories (static, also called by RootFolderGUI)
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.
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Constructor @access public.
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
viewObject()
list childs of current object
executeCommand()
execute command note: this method is overwritten in all container objects
importCategoriesObject()
import categories
static _getImportDir()
get user import directory name
__checkGlobalRoles($new_assigned)
static _importCategoriesForm($a_ref_id, &$a_tpl)
display form for category import (static, also called by RootFolderGUI)
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.
editTranslationsObject($a_get_post_values=false, $a_add=false)
Edit title and translations.
updateInfoObject()
Update info (extended meta data)
importCancelledObject()
import cancelled
static _lookupStandard($a_id)
Lookup standard flag.
static lookupObjectStyle($a_obj_id)
Lookup object style.
static getContentStylePath($a_style_id, $add_random=true)
get content style path
static writeStyleUsage($a_obj_id, $a_style_id)
Write style usage.
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.
static 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.
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.
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.
static initPreview()
Initializes the preview and loads the needed javascripts and styles.
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 getInstance()
Singelton get instance.
Auto completion class for user lists.
TableGUI class for user administration.
static getDataDir()
get data directory (outside webspace)
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 createDirectory($a_dir, $a_mod=0755)
create directory
$counter
$lang
Definition: consent.php:3
$def
Definition: croninfo.php:21
$key
Definition: croninfo.php:18
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $ilCtrl
Definition: ilias.php:18
if($format !==null) $name
Definition: metadata.php:146
$info
Definition: index.php:5
$ret
Definition: parser.php:6
global $ilSetting
Definition: privfeed.php:17
if(empty($password)) $table
Definition: pwgen.php:24
if(isset($_POST['submit'])) $form
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
settings()
Definition: settings.php:2
$ilUser
Definition: imgupload.php:18