ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
5 require_once "./Services/Container/classes/class.ilContainerGUI.php";
6 
22 {
23  var $ctrl;
24 
25  const CONTAINER_SETTING_TAXBLOCK = "tax_sblock_";
26 
31  function __construct($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  parent::__construct($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/Content/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/Content/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->tabs_gui->activateTab("view_content"); // see #19868
256  $this->$cmd();
257 
258  break;
259  }
260 
261  $this->addHeaderAction();
262 
263  return true;
264  }
265 
269  function getTabs()
270  {
271  global $rbacsystem, $lng, $ilHelp, $ilAccess;
272 
273  if ($this->ctrl->getCmd() == "editPageContent")
274  {
275  return;
276  }
277  #$this->ctrl->setParameter($this,"ref_id",$this->ref_id);
278 
279  $ilHelp->setScreenIdComponent("cat");
280 
281  if ($rbacsystem->checkAccess('read',$this->ref_id))
282  {
283  $force_active = ($_GET["cmd"] == "" || $_GET["cmd"] == "render")
284  ? true
285  : false;
286  $this->tabs_gui->addTab("view_content", $lng->txt("content"),
287  $this->ctrl->getLinkTarget($this, ""));
288 
289  //BEGIN ChangeEvent add info tab to category object
290  if ($this->info_screen_enabled)
291  {
292  $force_active = ($this->ctrl->getNextClass() == "ilinfoscreengui"
293  || strtolower($_GET["cmdClass"]) == "ilnotegui")
294  ? true
295  : false;
296  $this->tabs_gui->addTarget("info_short",
297  $this->ctrl->getLinkTargetByClass(
298  array("ilobjcategorygui", "ilinfoscreengui"), "showSummary"),
299  array("showSummary","", "infoScreen"),
300  "", "", $force_active);
301  }
302  //END ChangeEvent add info tab to category object
303  }
304 
305  if ($rbacsystem->checkAccess('write',$this->ref_id))
306  {
307  $force_active = ($_GET["cmd"] == "edit")
308  ? true
309  : false;
310  $this->tabs_gui->addTarget("settings",
311  $this->ctrl->getLinkTarget($this, "edit"), "edit", get_class($this)
312  , "", $force_active);
313 
314  // metadata
315  include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
316  $mdgui = new ilObjectMetaDataGUI($this->object);
317  $mdtab = $mdgui->getTab();
318  if($mdtab)
319  {
320  $this->tabs_gui->addTab("meta_data",
321  $this->lng->txt("meta_data"),
322  $mdtab);
323  }
324 
325  include_once "Services/Object/classes/class.ilObjectServiceSettingsGUI.php";
327  $this->object->getId(),
329  false
330  ))
331  {
332  $this->tabs_gui->addTarget("obj_tool_setting_taxonomies",
333  $this->ctrl->getLinkTarget($this, "editTaxonomySettings"), "editTaxonomySettings", get_class($this));
334  }
335  }
336 
337  include_once './Services/User/classes/class.ilUserAccountSettings.php';
338  if(
339  ilUserAccountSettings::getInstance()->isLocalUserAdministrationEnabled() and
340  $rbacsystem->checkAccess('cat_administrate_users',$this->ref_id))
341  {
342  $this->tabs_gui->addTarget("administrate_users",
343  $this->ctrl->getLinkTarget($this, "listUsers"), "listUsers", get_class($this));
344  }
345 
346  if($ilAccess->checkAccess('write','',$this->object->getRefId()))
347  {
348  $this->tabs_gui->addTarget(
349  'export',
350  $this->ctrl->getLinkTargetByClass('ilexportgui',''),
351  'export',
352  'ilexportgui'
353  );
354  }
355 
356  // parent tabs (all container: edit_permission, clipboard, trash
357  parent::getTabs();
358 
359  }
360 
364  function renderObject()
365  {
366  global $ilTabs;
367 
368  $ilTabs->activateTab("view_content");
369  $ret = parent::renderObject();
370  return $ret;
371 
372  }
373 
374  function viewObject()
375  {
376  if (strtolower($_GET["baseClass"]) == "iladministrationgui")
377  {
378  parent::viewObject();
379  return true;
380  }
381  return $this->renderObject();
382  }
383 
384  protected function initCreationForms($a_new_type)
385  {
386  $forms = parent::initCreationForms($a_new_type);
387  //unset($forms[self::CFORM_IMPORT]);
388  return $forms;
389  }
390 
391  protected function afterSave(ilObject $a_new_object)
392  {
393  global $ilUser, $tree;
394 
395  // add default translation
396  $a_new_object->addTranslation($a_new_object->getTitle(),
397  $a_new_object->getDescription(), $ilUser->getPref("language"), true);
398 
399  // default: sort by title
400  include_once('Services/Container/classes/class.ilContainerSortingSettings.php');
401  $settings = new ilContainerSortingSettings($a_new_object->getId());
403  $settings->save();
404 
405  // inherit parents content style, if not individual
406  $parent_ref_id = $tree->getParentId($a_new_object->getRefId());
407  $parent_id = ilObject::_lookupObjId($parent_ref_id);
408  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
409  $style_id = ilObjStyleSheet::lookupObjectStyle($parent_id);
410  if ($style_id > 0)
411  {
412  if (ilObjStyleSheet::_lookupStandard($style_id))
413  {
414  ilObjStyleSheet::writeStyleUsage($a_new_object->getId(), $style_id);
415  }
416  }
417 
418  // always send a message
419  ilUtil::sendSuccess($this->lng->txt("cat_added"),true);
420  $this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
421  $this->redirectToRefId($a_new_object->getRefId(), "");
422  }
423 
429  function infoScreenObject()
430  {
431  $this->ctrl->setCmd("showSummary");
432  $this->ctrl->setCmdClass("ilinfoscreengui");
433  $this->infoScreen();
434  }
435 
439  function infoScreen()
440  {
441  global $ilAccess, $ilCtrl;
442 
443  if (!$ilAccess->checkAccess("visible", "", $this->ref_id))
444  {
445  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
446  }
447 
448  if (!$this->info_screen_enabled)
449  {
450  return;
451  }
452 
453  // #10986
454  $this->tabs_gui->setTabActive('info_short');
455 
456  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
457  $info = new ilInfoScreenGUI($this);
458 
459  $info->enablePrivateNotes();
460 
461  if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
462  {
463  $info->enableNews();
464  }
465 
466  // no news editing for files, just notifications
467  $info->enableNewsEditing(false);
468  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
469  {
470  $news_set = new ilSetting("news");
471  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
472 
473  if ($enable_internal_rss)
474  {
475  $info->setBlockProperty("news", "settings", true);
476  $info->setBlockProperty("news", "public_notifications_option", true);
477  }
478  }
479 
480  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
481  $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_INFO,'cat',$this->object->getId());
482  $record_gui->setInfoObject($info);
483  $record_gui->parse();
484 
485 
486  // standard meta data
487  $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
488 
489  // forward the command
490  if ($ilCtrl->getNextClass() == "ilinfoscreengui")
491  {
492  $ilCtrl->forwardCommand($info);
493  }
494  else
495  {
496  return $ilCtrl->getHTML($info);
497  }
498  }
499 
505  protected function editInfoObject()
506  {
507  $this->checkPermission("write");
508  $this->setEditTabs();
509  $this->tabs_gui->activateTab('settings');
510  $this->tabs_gui->setSubTabActive('edit_cat_settings');
511 
512  $this->initExtendedSettings();
513  $this->tpl->setContent($this->form->getHTML());
514  }
515 
521  protected function updateInfoObject()
522  {
523  $this->checkPermission("write");
524 
525  // init form
526  $this->initExtendedSettings();
527 
528  // still needed for date conversion and so on
529  $this->form->checkInput();
530 
531  if($this->record_gui->importEditFormPostValues())
532  {
533  $this->record_gui->writeEditForm();
534 
535  ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
536  $this->ctrl->redirect($this, "editInfo");
537  }
538 
539  $this->editInfoObject();
540  }
541 
542 
548  protected function initExtendedSettings()
549  {
550  if(is_object($this->form))
551  {
552  return true;
553  }
554 
555  include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
556  $this->form = new ilPropertyFormGUI();
557  $this->form->setFormAction($this->ctrl->getFormAction($this));
558  $this->form->setTitle($this->lng->txt('ext_cat_settings'));
559  $this->form->addCommandButton('updateInfo',$this->lng->txt('save'));
560  $this->form->addCommandButton('editInfo',$this->lng->txt('cancel'));
561 
562  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
563  $this->record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_EDITOR,'cat',$this->object->getId());
564  $this->record_gui->setPropertyForm($this->form);
565  $this->record_gui->parse();
566 
567  return true;
568  }
569 
570  protected function setEditTabs($active_tab = "settings_misc")
571  {
572  global $ilSetting, $ilTabs;
573 
574  $this->tabs_gui->addSubTab("settings_misc",
575  $this->lng->txt("settings"),
576  $this->ctrl->getLinkTarget($this, "edit"));
577 
578  /*$this->tabs_gui->addSubTab("settings_trans",
579  $this->lng->txt("title_and_translations"),
580  $this->ctrl->getLinkTarget($this, "editTranslations"));*/
581 
582  $this->tabs_gui->addSubTab("settings_trans",
583  $this->lng->txt("obj_multilinguality"),
584  $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", ""));
585 
586  // custom icon
587  if ($ilSetting->get("custom_icons"))
588  {
589  $this->tabs_gui->addSubTab("icons",
590  $this->lng->txt("icon_settings"),
591  $this->ctrl->getLinkTarget($this,'editIcons'));
592  }
593 
594  $this->tabs_gui->activateTab("settings");
595  $this->tabs_gui->activateSubTab($active_tab);
596  }
597 
598  function initEditForm()
599  {
600  $this->lng->loadLanguageModule($this->object->getType());
601  $this->setEditTabs();
602 
603  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
604  $form = new ilPropertyFormGUI();
605  $form->setFormAction($this->ctrl->getFormAction($this));
606  $form->setTitle($this->lng->txt($this->object->getType()."_edit"));
607 
608  // title/description
609 
610  $trans = $this->object->getTranslations();
611  $def = $trans["Fobject"][0]; // default
612 
613  $title = new ilTextInputGUI($this->lng->txt("title"), "title");
614  $title->setRequired(true);
615  $title->setSize(min(40, ilObject::TITLE_LENGTH));
616  $title->setMaxLength(ilObject::TITLE_LENGTH);
617  $title->setValue($def["title"]);
618  $form->addItem($title);
619 
620  if(sizeof($trans["Fobject"]) > 1)
621  {
622  include_once('Services/MetaData/classes/class.ilMDLanguageItem.php');
624 
625  $title->setInfo($this->lng->txt("language").": ".$languages[$def["lang"]].
626  ' <a href="'.$this->ctrl->getLinkTarget($this, "editTranslations").
627  '">&raquo; '.$this->lng->txt("cat_more_translations").'</a>');
628 
629  unset($languages);
630  }
631 
632  $desc = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
633  $desc->setRows(2);
634  $desc->setCols(40);
635  $desc->setValue($def["desc"]);
636  $form->addItem($desc);
637 
638  // Show didactic template type
639  $this->initDidacticTemplate($form);
640 
641  // presentation
642  $pres = new ilFormSectionHeaderGUI();
643  $pres->setTitle($this->lng->txt('obj_presentation'));
644  $form->addItem($pres);
645 
646 
647  $form = $this->initSortingForm(
648  $form,
649  array(
653  )
654  );
655 
656  // icon settings
657 // $this->showCustomIconsEditing(1, $form, false);
658 
659  // Edit ecs export settings
660  include_once 'Modules/Category/classes/class.ilECSCategorySettings.php';
661  $ecs = new ilECSCategorySettings($this->object);
662  $ecs->addSettingsToForm($form, 'cat');
663 
664  // services
665  $sh = new ilFormSectionHeaderGUI();
666  $sh->setTitle($this->lng->txt('obj_features'));
667  $form->addItem($sh);
668 
669  include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
671  $this->object->getId(),
672  $form,
673  array(
678  )
679  );
680 
681  $form->addCommandButton("update", $this->lng->txt("save"));
682 // $form->addCommandButton("addTranslation", $this->lng->txt("add_translation"));
683 
684  return $form;
685  }
686 
687  function getEditFormValues()
688  {
689  // values are set in initEditForm()
690  }
691 
697  function updateObject()
698  {
699  if (!$this->checkPermissionBool("write"))
700  {
701  $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
702  }
703  else
704  {
705  $form = $this->initEditForm();
706  if($form->checkInput())
707  {
708  $title = $form->getInput("title");
709  $desc = $form->getInput("desc");
710  $lang = $this->object->getTranslations();
711  $lang = $lang["Fobject"][0]["lang"];
712  $this->object->deleteTranslation($lang);
713  $this->object->addTranslation($title, $desc, $lang, true);
714  $this->object->setTitle($title);
715  $this->object->setDescription($desc);
716  $this->object->update();
717 
718  $this->saveSortingSettings($form);
719 
720  // save custom icons
721 /* if ($this->ilias->getSetting("custom_icons"))
722  {
723  if($form->getItemByPostVar("cont_big_icon")->getDeletionFlag())
724  {
725  $this->object->removeBigIcon();
726  }
727  if($form->getItemByPostVar("cont_small_icon")->getDeletionFlag())
728  {
729  $this->object->removeSmallIcon();
730  }
731  if($form->getItemByPostVar("cont_tiny_icon")->getDeletionFlag())
732  {
733  $this->object->removeTinyIcon();
734  }
735 
736  $this->object->saveIcons($_FILES["cont_big_icon"]['tmp_name'],
737  $_FILES["cont_small_icon"]['tmp_name'],
738  $_FILES["cont_tiny_icon"]['tmp_name']);
739  }*/
740 
741  // BEGIN ChangeEvent: Record update
742  global $ilUser;
743  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
744  ilChangeEvent::_recordWriteEvent($this->object->getId(), $ilUser->getId(), 'update');
745  ilChangeEvent::_catchupWriteEvents($this->object->getId(), $ilUser->getId());
746  // END ChangeEvent: Record update
747 
748  // services
749  include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
751  $this->object->getId(),
752  $form,
753  array(
758  )
759  );
760 
761  // Update ecs export settings
762  include_once 'Modules/Category/classes/class.ilECSCategorySettings.php';
763  $ecs = new ilECSCategorySettings($this->object);
764  if($ecs->handleSettingsUpdate())
765  {
766  return $this->afterUpdate();
767  }
768  }
769 
770  // display form to correct errors
771  $this->setEditTabs();
772  $form->setValuesByPost();
773  $this->tpl->setContent($form->getHTML());
774  }
775  }
776 
780  function editTranslationsObject($a_get_post_values = false, $a_add = false)
781  {
782  global $tpl;
783 
784  $this->ctrl->redirectByClass("ilobjecttranslationgui", "");
785 
786 
787  $this->lng->loadLanguageModule($this->object->getType());
788  $this->setEditTabs("settings_trans");
789 
790  include_once("./Services/Object/classes/class.ilObjectTranslationTableGUI.php");
791  $table = new ilObjectTranslationTableGUI($this, "editTranslations", true,
792  "Translation");
793  if ($a_get_post_values)
794  {
795  $vals = array();
796  foreach($_POST["title"] as $k => $v)
797  {
798  $vals[] = array("title" => $v,
799  "desc" => $_POST["desc"][$k],
800  "lang" => $_POST["lang"][$k],
801  "default" => ($_POST["default"] == $k));
802  }
803  $table->setData($vals);
804  }
805  else
806  {
807  $data = $this->object->getTranslations();
808  foreach($data["Fobject"] as $k => $v)
809  {
810  $data["Fobject"][$k]["default"] = ($k == $data["default_language"]);
811  }
812  if($a_add)
813  {
814  $data["Fobject"][++$k]["title"] = "";
815  }
816  $table->setData($data["Fobject"]);
817  }
818  $tpl->setContent($table->getHTML());
819  }
820 
825  {
826  if (!$this->checkPermissionBool("write"))
827  {
828  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
829  }
830 
831  // default language set?
832  if (!isset($_POST["default"]))
833  {
834  ilUtil::sendFailure($this->lng->txt("msg_no_default_language"));
835  return $this->editTranslationsObject(true);
836  }
837 
838  // all languages set?
839  if (array_key_exists("",$_POST["lang"]))
840  {
841  ilUtil::sendFailure($this->lng->txt("msg_no_language_selected"));
842  return $this->editTranslationsObject(true);
843  }
844 
845  // no single language is selected more than once?
846  if (count(array_unique($_POST["lang"])) < count($_POST["lang"]))
847  {
848  ilUtil::sendFailure($this->lng->txt("msg_multi_language_selected"));
849  return $this->editTranslationsObject(true);
850  }
851 
852  // save the stuff
853  $this->object->removeTranslations();
854  foreach($_POST["title"] as $k => $v)
855  {
856  // update object data if default
857  $is_default = ($_POST["default"] == $k);
858  if($is_default)
859  {
860  $this->object->setTitle(ilUtil::stripSlashes($v));
861  $this->object->setDescription(ilUtil::stripSlashes($_POST["desc"][$k]));
862  $this->object->update();
863  }
864 
865  $this->object->addTranslation(
867  ilUtil::stripSlashes($_POST["desc"][$k]),
868  ilUtil::stripSlashes($_POST["lang"][$k]),
869  $is_default);
870  }
871 
872  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
873  $this->ctrl->redirect($this, "editTranslations");
874  }
875 
880  {
881  if($_POST["title"])
882  {
883  $k = max(array_keys($_POST["title"]));
884  $k++;
885  $_POST["title"][$k] = "";
886  $this->editTranslationsObject(true);
887  }
888  else
889  {
890  $this->editTranslationsObject(false, true);
891  }
892  }
893 
898  {
899  foreach($_POST["title"] as $k => $v)
900  {
901  if ($_POST["check"][$k])
902  {
903  // default translation cannot be deleted
904  if($k != $_POST["default"])
905  {
906  unset($_POST["title"][$k]);
907  unset($_POST["desc"][$k]);
908  unset($_POST["lang"][$k]);
909  }
910  else
911  {
912  ilUtil::sendFailure($this->lng->txt("msg_no_default_language"));
913  return $this->editTranslationsObject();
914  }
915  }
916  }
917  $this->saveTranslationsObject();
918  }
919 
924  {
925  ilObjCategoryGUI::_importCategoriesForm($this->ref_id, $this->tpl);
926  }
927 
931  public static function _importCategoriesForm ($a_ref_id, &$a_tpl)
932  {
933  global $lng, $rbacreview, $ilCtrl;
934 
935  $a_tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.cat_import_form.html",
936  "Modules/Category");
937 
938  $a_tpl->setVariable("FORMACTION", $ilCtrl->getFormActionByClass('ilObjCategoryGUI'));
939 
940  $a_tpl->setVariable("TXT_IMPORT_CATEGORIES", $lng->txt("import_categories"));
941  $a_tpl->setVariable("TXT_HIERARCHY_OPTION", $lng->txt("import_cat_localrol"));
942  $a_tpl->setVariable("TXT_IMPORT_FILE", $lng->txt("import_file"));
943  $a_tpl->setVariable("TXT_IMPORT_TABLE", $lng->txt("import_cat_table"));
944 
945  $a_tpl->setVariable("BTN_IMPORT", $lng->txt("import"));
946  $a_tpl->setVariable("BTN_CANCEL", $lng->txt("cancel"));
947 
948  // NEED TO FILL ADOPT_PERMISSIONS HTML FORM....
949  $parent_role_ids = $rbacreview->getParentRoleIds($a_ref_id,true);
950 
951  // sort output for correct color changing
952  ksort($parent_role_ids);
953 
954  foreach ($parent_role_ids as $key => $par)
955  {
956  if ($par["obj_id"] != SYSTEM_ROLE_ID)
957  {
958  $check = ilUtil::formCheckbox(0,"adopt[]",$par["obj_id"],1);
959  $output["adopt"][$key]["css_row_adopt"] = ilUtil::switchColor($key, "tblrow1", "tblrow2");
960  $output["adopt"][$key]["check_adopt"] = $check;
961  $output["adopt"][$key]["role_id"] = $par["obj_id"];
962  $output["adopt"][$key]["type"] = ($par["type"] == 'role' ? 'Role' : 'Template');
963  $output["adopt"][$key]["role_name"] = $par["title"];
964  }
965  }
966 
967  //var_dump($output);
968 
969  // BEGIN ADOPT PERMISSIONS
970  foreach ($output["adopt"] as $key => $value)
971  {
972  $a_tpl->setCurrentBlock("ADOPT_PERM_ROW");
973  $a_tpl->setVariable("CSS_ROW_ADOPT",$value["css_row_adopt"]);
974  $a_tpl->setVariable("CHECK_ADOPT",$value["check_adopt"]);
975  $a_tpl->setVariable("LABEL_ID",$value["role_id"]);
976  $a_tpl->setVariable("TYPE",$value["type"]);
977  $a_tpl->setVariable("ROLE_NAME",$value["role_name"]);
978  $a_tpl->parseCurrentBlock();
979  }
980  }
981 
982 
989  {
990  $this->ctrl->redirect($this);
991  }
992 
996  static function _getImportDir()
997  {
998  return ilUtil::getDataDir()."/cat_import";
999  }
1000 
1005  {
1007  // call to importCategories with $withrol = 0
1009  }
1010 
1015  {
1016 
1017  //echo "entra aqui";
1018  // call to importCategories with $withrol = 1
1020  }
1021 
1026  public static function _importCategories($a_ref_id, $withrol_tmp)
1027  {
1028  global $lng, $ilCtrl;
1029 
1030  require_once("./Modules/Category/classes/class.ilCategoryImportParser.php");
1031 
1032  $import_dir = ilObjCategoryGUI::_getImportDir();
1033 
1034  // create user import directory if necessary
1035  if (!@is_dir($import_dir))
1036  {
1037  ilUtil::createDirectory($import_dir);
1038  }
1039 
1040  // move uploaded file to user import directory
1041 
1042  $file_name = $_FILES["importFile"]["name"];
1043 
1044  // added to prevent empty file names
1045  if (!strcmp($file_name,"")) {
1046  ilUtil::sendFailure($lng->txt("no_import_file_found"), true);
1047  $ilCtrl->redirectByClass('ilObjCategoryGUI');
1048  }
1049 
1050  $parts = pathinfo($file_name);
1051  $full_path = $import_dir."/".$file_name;
1052  ilUtil::moveUploadedFile($_FILES["importFile"]["tmp_name"], $file_name, $full_path);
1053 
1054  // unzip file
1055  ilUtil::unzip($full_path);
1056 
1057  $subdir = basename($parts["basename"],".".$parts["extension"]);
1058  $xml_file = $import_dir."/".$subdir."/".$subdir.".xml";
1059  // CategoryImportParser
1060  //var_dump($_POST);
1061  $importParser = new ilCategoryImportParser($xml_file, $a_ref_id, $withrol_tmp);
1062  $importParser->startParsing();
1063 
1064  ilUtil::sendSuccess($lng->txt("categories_imported"), true);
1065  $ilCtrl->redirectByClass('ilObjCategoryGUI');
1066  }
1067 
1072  protected function resetFilterObject()
1073  {
1074  include_once("./Services/User/classes/class.ilUserTableGUI.php");
1075  $utab = new ilUserTableGUI($this, "listUsers",ilUserTableGUI::MODE_LOCAL_USER);
1076  $utab->resetOffset();
1077  $utab->resetFilter();
1078 
1079  // from "old" implementation
1080  $this->listUsersObject();
1081  }
1082 
1087  protected function applyFilterObject()
1088  {
1089  global $ilTabs;
1090 
1091  include_once("./Services/User/classes/class.ilUserTableGUI.php");
1092  $utab = new ilUserTableGUI($this, "listUsers", ilUserTableGUI::MODE_LOCAL_USER);
1093  $utab->resetOffset();
1094  $utab->writeFilterToSession();
1095  $this->listUsersObject();
1096  }
1097 
1098  // METHODS for local user administration
1099  function listUsersObject($show_delete = false)
1100  {
1101  global $ilUser,$rbacreview, $ilToolbar;
1102 
1103  include_once './Services/User/classes/class.ilLocalUser.php';
1104  include_once './Services/User/classes/class.ilObjUserGUI.php';
1105 
1106  global $rbacsystem,$rbacreview;
1107 
1108  if(!$rbacsystem->checkAccess("cat_administrate_users",$this->object->getRefId()))
1109  {
1110  $this->ilias->raiseError($this->lng->txt("msg_no_perm_admin_users"),$this->ilias->error_obj->MESSAGE);
1111  }
1112  $this->tabs_gui->setTabActive('administrate_users');
1113 
1114 
1115 
1116  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.cat_admin_users.html',
1117  "Modules/Category");
1118 
1119  if(count($rbacreview->getGlobalAssignableRoles()) or in_array(SYSTEM_ROLE_ID,$rbacreview->assignedRoles($ilUser->getId())))
1120  {
1121  $ilToolbar->addButton(
1122  $this->lng->txt('add_user'),
1123  $this->ctrl->getLinkTargetByClass('ilobjusergui','create')
1124  );
1125 
1126  $ilToolbar->addButton(
1127  $this->lng->txt('import_users'),
1128  $this->ctrl->getLinkTargetByClass('ilobjuserfoldergui','importUserForm')
1129  );
1130  }
1131  else
1132  {
1133  ilUtil::sendInfo($this->lng->txt('no_roles_user_can_be_assigned_to'));
1134  }
1135 
1136  if($show_delete)
1137  {
1138  $this->tpl->setCurrentBlock("confirm_delete");
1139  $this->tpl->setVariable("CONFIRM_FORMACTION",$this->ctrl->getFormAction($this));
1140  $this->tpl->setVariable("TXT_CANCEL",$this->lng->txt('cancel'));
1141  $this->tpl->setVariable("CONFIRM_CMD",'performDeleteUsers');
1142  $this->tpl->setVariable("TXT_CONFIRM",$this->lng->txt('delete'));
1143  $this->tpl->parseCurrentBlock();
1144  }
1145 
1146  $this->lng->loadLanguageModule('user');
1147 
1148  include_once("./Services/User/classes/class.ilUserTableGUI.php");
1149  $utab = new ilUserTableGUI($this, 'listUsers',ilUserTableGUI::MODE_LOCAL_USER);
1150  $this->tpl->setVariable('USERS_TABLE',$utab->getHTML());
1151 
1152  return true;
1153  }
1154 
1158  protected function addUserAutoCompleteObject()
1159  {
1160  include_once './Services/User/classes/class.ilUserAutoComplete.php';
1161  $auto = new ilUserAutoComplete();
1162  $auto->setSearchFields(array('login','firstname','lastname','email'));
1163  $auto->enableFieldSearchableCheck(true);
1164  $auto->isMoreLinkAvailable(true);
1165 
1166  if(($_REQUEST['fetchall']))
1167  {
1168  $auto->setLimit(ilUserAutoComplete::MAX_ENTRIES);
1169  }
1170 
1171  echo $auto->getList($_REQUEST['term']);
1172  exit();
1173  }
1174 
1175 
1177  {
1178  include_once './Services/User/classes/class.ilLocalUser.php';
1179  $this->checkPermission("cat_administrate_users");
1180 
1181  foreach($_POST['user_ids'] as $user_id)
1182  {
1183  if(!in_array($user_id,ilLocalUser::_getAllUserIds($this->object->getRefId())))
1184  {
1185  die('user id not valid');
1186  }
1187  if(!$tmp_obj =& ilObjectFactory::getInstanceByObjId($user_id,false))
1188  {
1189  continue;
1190  }
1191  $tmp_obj->delete();
1192  }
1193  ilUtil::sendSuccess($this->lng->txt('deleted_users'));
1194  $this->listUsersObject();
1195 
1196  return true;
1197  }
1198 
1200  {
1201  $this->checkPermission("cat_administrate_users");
1202  if(!count($_POST['id']))
1203  {
1204  ilUtil::sendFailure($this->lng->txt('no_users_selected'));
1205  $this->listUsersObject();
1206 
1207  return true;
1208  }
1209 
1210  include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
1211  $confirm = new ilConfirmationGUI();
1212  $confirm->setFormAction($this->ctrl->getFormAction($this));
1213  $confirm->setHeaderText($this->lng->txt('sure_delete_selected_users'));
1214  $confirm->setConfirm($this->lng->txt('delete'), 'performDeleteUsers');
1215  $confirm->setCancel($this->lng->txt('cancel'), 'listUsers');
1216 
1217  foreach($_POST['id'] as $user)
1218  {
1219  $name = ilObjUser::_lookupName($user);
1220 
1221  $confirm->addItem(
1222  'user_ids[]',
1223  $user,
1224  $name['lastname'].', '.$name['firstname'].' ['.$name['login'].']'
1225  );
1226  }
1227  $this->tpl->setContent($confirm->getHTML());
1228  }
1229 
1231  {
1232  global $rbacreview,$ilTabs;
1233 
1234  $this->checkPermission("cat_administrate_users");
1235 
1236  include_once './Services/User/classes/class.ilLocalUser.php';
1237 
1238  if(!isset($_GET['obj_id']))
1239  {
1240  ilUtil::sendFailure('no_user_selected');
1241  $this->listUsersObject();
1242 
1243  return true;
1244  }
1245 
1246  $ilTabs->clearTargets();
1247  $ilTabs->setBackTarget($this->lng->txt('backto_lua'), $this->ctrl->getLinkTarget($this,'listUsers'));
1248  global $ilHelp;
1249  $ilHelp->setScreenIdComponent("cat");
1250  $ilHelp->setScreenId("administrate_user");
1251  $ilHelp->setSubScreenId("assign_roles");
1252 
1253 
1254  $roles = $this->__getAssignableRoles();
1255 
1256  if(!count($roles))
1257  {
1258  #ilUtil::sendInfo($this->lng->txt('no_roles_user_can_be_assigned_to'));
1259  #$this->listUsersObject();
1260 
1261  #return true;
1262  }
1263 
1264  $ass_roles = $rbacreview->assignedRoles($_GET['obj_id']);
1265 
1266  $counter = 0;
1267  $f_result = array();
1268 
1269  foreach($roles as $role)
1270  {
1271  $role_obj =& ilObjectFactory::getInstanceByObjId($role['obj_id']);
1272 
1273  $disabled = false;
1274  $f_result[$counter]['checkbox'] = ilUtil::formCheckbox(in_array($role['obj_id'],$ass_roles) ? 1 : 0,
1275  'role_ids[]',
1276  $role['obj_id'],
1277  $disabled);
1278  $f_result[$counter]['title'] = $role_obj->getTitle() ? $role_obj->getTitle() : "";
1279  $f_result[$counter]['desc'] = $role_obj->getDescription() ? $role_obj->getDescription() : "";
1280  $f_result[$counter]['type'] = $role['role_type'] == 'global' ?
1281  $this->lng->txt('global') :
1282  $this->lng->txt('local');
1283 
1284  unset($role_obj);
1285  ++$counter;
1286  }
1287 
1288  include_once ('./Modules/Category/classes/class.ilCategoryAssignRoleTableGUI.php');
1289  $table = new ilCategoryAssignRoleTableGUI($this, "assignRoles");
1290  $tmp_obj =& ilObjectFactory::getInstanceByObjId($_GET['obj_id']);
1291  $title = $this->lng->txt('role_assignment').' ('.$tmp_obj->getFullname().')';
1292  $table->setTitle($title,"icon_role.svg",$this->lng->txt("role_assignment"));
1293  $table->setData($f_result);
1294  $this->tpl->setContent($table->getHTML());
1295  }
1296 
1297  function assignSaveObject()
1298  {
1299  global $rbacreview,$rbacadmin;
1300  $this->checkPermission("cat_administrate_users");
1301 
1302  include_once './Services/User/classes/class.ilLocalUser.php';
1303  // check hack
1304  if(!isset($_GET['obj_id']) or !in_array($_REQUEST['obj_id'],ilLocalUser::_getAllUserIds()))
1305  {
1306  ilUtil::sendFailure('no_user_selected');
1307  $this->listUsersObject();
1308 
1309  return true;
1310  }
1311  $roles = $this->__getAssignableRoles();
1312 
1313  // check minimum one global role
1314  if(!$this->__checkGlobalRoles($_POST['role_ids']))
1315  {
1316  ilUtil::sendFailure($this->lng->txt('no_global_role_left'));
1317  $this->assignRolesObject();
1318 
1319  return false;
1320  }
1321 
1322  $new_role_ids = $_POST['role_ids'] ? $_POST['role_ids'] : array();
1323  $assigned_roles = $rbacreview->assignedRoles((int) $_REQUEST['obj_id']);
1324  foreach($roles as $role)
1325  {
1326  if(in_array($role['obj_id'],$new_role_ids) and !in_array($role['obj_id'],$assigned_roles))
1327  {
1328  $rbacadmin->assignUser($role['obj_id'],(int) $_REQUEST['obj_id']);
1329  }
1330  if(in_array($role['obj_id'],$assigned_roles) and !in_array($role['obj_id'],$new_role_ids))
1331  {
1332  $rbacadmin->deassignUser($role['obj_id'],(int) $_REQUEST['obj_id']);
1333  }
1334  }
1335  ilUtil::sendSuccess($this->lng->txt('role_assignment_updated'));
1336  $this->assignRolesObject();
1337 
1338  return true;
1339  }
1340 
1341  // PRIVATE
1343  {
1344  global $rbacreview,$ilUser;
1345 
1346  // check local user
1347  $tmp_obj =& ilObjectFactory::getInstanceByObjId($_REQUEST['obj_id']);
1348  // Admin => all roles
1349  if(in_array(SYSTEM_ROLE_ID,$rbacreview->assignedRoles($ilUser->getId())))
1350  {
1351  $global_roles = $rbacreview->getGlobalRolesArray();
1352  }
1353  elseif($tmp_obj->getTimeLimitOwner() == $this->object->getRefId())
1354  {
1355  $global_roles = $rbacreview->getGlobalAssignableRoles();
1356  }
1357  else
1358  {
1359  $global_roles = array();
1360  }
1361  return $roles = array_merge($global_roles,
1362  $rbacreview->getAssignableChildRoles($this->object->getRefId()));
1363  }
1364 
1365  function __checkGlobalRoles($new_assigned)
1366  {
1367  global $rbacreview,$ilUser;
1368 
1369  $this->checkPermission("cat_administrate_users");
1370 
1371  // return true if it's not a local user
1372  $tmp_obj =& ilObjectFactory::getInstanceByObjId($_REQUEST['obj_id']);
1373  if($tmp_obj->getTimeLimitOwner() != $this->object->getRefId() and
1374  !in_array(SYSTEM_ROLE_ID,$rbacreview->assignedRoles($ilUser->getId())))
1375  {
1376  return true;
1377  }
1378 
1379  // new assignment by form
1380  $new_assigned = $new_assigned ? $new_assigned : array();
1381  $assigned = $rbacreview->assignedRoles((int) $_GET['obj_id']);
1382 
1383  // all assignable globals
1384  if(!in_array(SYSTEM_ROLE_ID,$rbacreview->assignedRoles($ilUser->getId())))
1385  {
1386  $ga = $rbacreview->getGlobalAssignableRoles();
1387  }
1388  else
1389  {
1390  $ga = $rbacreview->getGlobalRolesArray();
1391  }
1392  $global_assignable = array();
1393  foreach($ga as $role)
1394  {
1395  $global_assignable[] = $role['obj_id'];
1396  }
1397 
1398  $new_visible_assigned_roles = array_intersect($new_assigned,$global_assignable);
1399  $all_assigned_roles = array_intersect($assigned,$rbacreview->getGlobalRoles());
1400  $main_assigned_roles = array_diff($all_assigned_roles,$global_assignable);
1401 
1402  if(!count($new_visible_assigned_roles) and !count($main_assigned_roles))
1403  {
1404  return false;
1405  }
1406  return true;
1407  }
1408 
1409  public static function _goto($a_target)
1410  {
1411  global $ilAccess, $ilErr, $lng;
1412 
1413  if ($ilAccess->checkAccess("read", "", $a_target))
1414  {
1416  }
1417  else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
1418  {
1419  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
1420  ilObject::_lookupTitle(ilObject::_lookupObjId($a_target))), true);
1422  }
1423 
1424  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1425 
1426  }
1427 
1428 
1432 
1436  function editIconsObject($a_form = null)
1437  {
1438  global $tpl;
1439 
1440  $this->checkPermission('write');
1441 
1442  $this->tabs_gui->setTabActive('settings');
1443 
1444  if(!$a_form)
1445  {
1446  $a_form = $this->initIconsForm();
1447  }
1448 
1449  $tpl->setContent($a_form->getHTML());
1450  }
1451 
1452  function initIconsForm()
1453  {
1454  $this->setEditTabs("icons");
1455 
1456  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
1457  $form = new ilPropertyFormGUI();
1458  $form->setFormAction($this->ctrl->getFormAction($this));
1459 
1460  $this->showCustomIconsEditing(1, $form);
1461 
1462  // $form->setTitle($this->lng->txt('edit_grouping'));
1463  $form->addCommandButton('updateIcons', $this->lng->txt('save'));
1464 
1465  return $form;
1466  }
1467 
1472  {
1473  global $ilSetting;
1474 
1475  $this->checkPermission('write');
1476 
1477  $form = $this->initIconsForm();
1478  if($form->checkInput())
1479  {
1480  //save custom icons
1481  if ($ilSetting->get("custom_icons"))
1482  {
1483  if($_POST["cont_icon_delete"])
1484  {
1485  $this->object->removeCustomIcon();
1486  }
1487  $this->object->saveIcons($_FILES["cont_icon"]['tmp_name']);
1488  }
1489  if ($_FILES["cont_icon"]['tmp_name'] || $_POST["cont_icon_delete"])
1490  {
1491  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
1492  }
1493  $this->ctrl->redirect($this,"editIcons");
1494  }
1495 
1496  $form->setValuesByPost();
1497  $this->editIconsObject($form);
1498  }
1499 
1500 
1501  //
1502  // taxonomy
1503  //
1504 
1505  protected function initTaxSubTabs($a_active = "tax_list")
1506  {
1507  $this->tabs_gui->setTabActive("obj_tool_setting_taxonomies");
1508  $this->tabs_gui->addSubTab("tax_settings", $this->lng->txt("cntr_taxonomy_sideblock_settings"),
1509  $this->ctrl->getLinkTarget($this, "editTaxonomySettings"));
1510  $this->tabs_gui->addSubTab("tax_list", $this->lng->txt("cntr_taxonomy_definitions"),
1511  $this->ctrl->getLinkTargetByClass("ilobjtaxonomygui", ""));
1512  $this->tabs_gui->activateSubTab($a_active);
1513  }
1514 
1515  protected function getTaxonomiesForRefId()
1516  {
1517  global $tree;
1518 
1519  include_once "Services/Object/classes/class.ilObjectServiceSettingsGUI.php";
1520  include_once "Services/Taxonomy/classes/class.ilObjTaxonomy.php";
1521 
1522  // see ilTaxMDGUI::getSelectableTaxonomies()
1523 
1524  $res = array();
1525  foreach($tree->getPathFull($this->object->getRefId()) as $node)
1526  {
1527  // find all defined taxes for parent node, activation is not relevant
1528  $node_taxes = ilObjTaxonomy::getUsageOfObject($node["obj_id"], true);
1529  if(sizeof($node_taxes))
1530  {
1531  foreach($node_taxes as $node_tax)
1532  {
1533  $res[$node_tax["tax_id"]] = array(
1534  "title" => $node_tax["title"]
1535  ,"source" => $node["child"]
1536  );
1537  }
1538  }
1539  }
1540 
1541  asort($res);
1542  return $res;
1543  }
1544 
1545  protected function initTaxonomyForm(array $tax)
1546  {
1547  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1548  $form = new ilPropertyFormGUI();
1549  $form->setFormAction($this->ctrl->getFormAction($this), "editTaxonomySettings");
1550  $form->setTitle($this->lng->txt("cntr_taxonomy_sideblock_settings"));
1551 
1552  $block = new ilCheckboxGroupInputGUI($this->lng->txt("cntr_taxonomy_show_sideblock"), "sblock");
1553  $form->addItem($block);
1554 
1555  $current = $this->getActiveBlocks();
1556 
1557  foreach($tax as $tax_id => $tax_item)
1558  {
1559  $option = new ilCheckboxOption($tax_item["title"], $tax_id,
1560  ilObject::_lookupDescription($tax_id));
1561 
1562  if($tax_item["source"] != $this->object->getRefId())
1563  {
1564  $loc = new ilLocatorGUI();
1565  $loc->setTextOnly(true);
1566  $loc->addRepositoryItems($tax_item["source"]);
1567  $option->setInfo($loc->getHTML());
1568  }
1569 
1570  $block->addOption($option);
1571 
1572  if(in_array($tax_id, $current))
1573  {
1574  $value[] = $tax_id;
1575  }
1576  }
1577 
1578  $block->setValue($value);
1579 
1580  $form->addCommandButton("updateTaxonomySettings", $this->lng->txt("save"));
1581 
1582  return $form;
1583  }
1584 
1585  protected function editTaxonomySettingsObject()
1586  {
1587  $this->initTaxSubTabs("tax_settings");
1588 
1589  $taxonomies = $this->getTaxonomiesForRefId();
1590  if(!sizeof($taxonomies))
1591  {
1592  ilUtil::sendFailure($this->lng->txt("cntr_tax_none_available"));
1593  return;
1594  }
1595 
1596  $form = $this->initTaxonomyForm($taxonomies);
1597  $this->tpl->setContent($form->getHTML());
1598  }
1599 
1600  protected function getActiveBlocks()
1601  {
1602  $res = array();
1603 
1604  $prefix = self::CONTAINER_SETTING_TAXBLOCK;
1605 
1606  foreach(ilContainer::_getContainerSettings($this->object->getId()) as $keyword => $value)
1607  {
1608  if(substr($keyword, 0, strlen($prefix)) == $prefix && (bool)$value)
1609  {
1610  $res[] = substr($keyword, strlen($prefix));
1611  }
1612  }
1613 
1614  return $res;
1615  }
1616 
1617  protected function updateTaxonomySettingsObject()
1618  {
1619  $taxonomies = $this->getTaxonomiesForRefId();
1620  if(sizeof($taxonomies))
1621  {
1622  $form = $this->initTaxonomyForm($taxonomies);
1623  if($form->checkInput())
1624  {
1625  $sblock = $form->getInput("sblock");
1626 
1627  $prefix = self::CONTAINER_SETTING_TAXBLOCK;
1628 
1630  $prefix."%", true);
1631 
1632  if(is_array($sblock))
1633  {
1634  foreach($sblock as $tax_id)
1635  {
1637  $prefix.$tax_id, 1);
1638  }
1639  }
1640 
1641  ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
1642  }
1643  }
1644  $this->ctrl->redirect($this, "editTaxonomySettings");
1645  }
1646 
1647 } // END class.ilObjCategoryGUI
1648 ?>
Class ilObjCategoryGUI.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _lookupName($a_user_id)
lookup user name
global $ilErr
Definition: raiseError.php:16
importCategoriesObject()
import categories
ILIAS Setting Class.
Class ilContainerLinkListGUI.
Class ilObjectMetaDataGUI.
importCancelledObject()
import cancelled
Class ilInfoScreenGUI.
This class represents an option in a checkbox group.
importCategoriesWithRolObject()
import categories with local rol
infoScreen()
show information screen
saveSortingSettings(ilPropertyFormGUI $form)
Save sorting settings.
__checkGlobalRoles($new_assigned)
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
This class represents a property form user interface.
GUI class for the workflow of copying objects.
setPropertyForm($form)
set property form object
const TITLE_LENGTH
max length of object title
$_GET["client_id"]
This class represents a section header in a property form.
Class ilObject Basic functions for all objects.
static _recordWriteEvent($obj_id, $usr_id, $action, $parent_obj_id=null)
Records a write event.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Constructor public.
$cmd
Definition: sahs_server.php:35
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
editIconsObject($a_form=null)
Edit folder icons.
static _importCategoriesForm($a_ref_id, &$a_tpl)
display form for category import (static, also called by RootFolderGUI)
prepareOutput($a_show_subobjects=true)
prepare output
static _lookupTitle($a_id)
lookup object title
updateIconsObject()
update container icons
addTranslationObject()
Add a translation.
initExtendedSettings()
build property form for extended category settings
editTranslationsObject($a_get_post_values=false, $a_add=false)
Edit title and translations.
static lookupObjectStyle($a_obj_id)
Lookup object style.
Auto completion class for user lists.
static _catchupWriteEvents($obj_id, $usr_id, $timestamp=null)
Catches up with all write events which occured before the specified timestamp.
locator handling class
static _lookupStandard($a_id)
Lookup standard flag.
listUsersObject($show_delete=false)
TableGUI class for role assignments.
global $ilCtrl
Definition: ilias.php:18
deleteTranslationsObject()
Remove translation.
static writeStyleUsage($a_obj_id, $a_style_id)
Write style usage.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$counter
importCategoriesFormObject()
display form for category import
Export User Interface Class.
TableGUI class for user administration.
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
$info
Definition: example_052.php:80
GUI class for didactic template settings inside repository objects.
setInfoObject($info)
get info sections
updateInfoObject()
Update info (extended meta data)
getId()
get object id public
showCustomIconsEditing($a_input_colspan=1, ilPropertyFormGUI $a_form=null, $a_as_section=true)
show edit section of custom icons for container
static _deleteContainerSettings($a_id, $a_keyword=null, $a_keyword_like=false)
static _gotoRepositoryNode($a_ref_id, $a_cmd="frameset")
Goto repository root.
Taxonomy GUI class.
editInfoObject()
Edit extended category settings.
static _lookupDescription($a_id)
lookup object description
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
applyFilterObject()
Apply filter.
initDidacticTemplate(ilPropertyFormGUI $form)
Show didactic template types.
static _lookupObjId($a_id)
static _getContainerSettings($a_id)
initTaxSubTabs($a_active="tax_list")
This class represents a text property in a property form.
getTitle()
get object title public
getDescription()
get object description
resetFilterObject()
Reset filter (note: this function existed before data table filter has been introduced.
forwardToStyleSheet()
Forward to style object.
& forwardToPageObject()
forward command to page object
$ilUser
Definition: imgupload.php:18
redirection script todo: (a better solution should control the processing via a xml file) ...
static createDirectory($a_dir, $a_mod=0755)
create directory
This class represents a property in a property form.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static _getAllUserIds($a_filter=0)
static updateServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Update service settings.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Create styles array
The data for the language used.
afterSave(ilObject $a_new_object)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=NULL)
Lookup a container setting.
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually...
renderObject()
Render category.
static getContentStylePath($a_style_id)
get content style path
setEditTabs($active_tab="settings_misc")
TableGUI class for title/description translations.
static getDataDir()
get data directory (outside webspace)
initSortingForm(ilPropertyFormGUI $form, array $a_sorting_settings)
Append sorting settings to property form.
redirectToRefId($a_ref_id, $a_cmd="")
redirects to (repository) view per ref id usually to a container and usually used at the end of a sav...
Create new PHPExcel object
obj_idprivate
static _getImportDir()
get user import directory name
global $ilSetting
Definition: privfeed.php:17
static getInstance()
Singelton get instance.
This class represents a text area property in a property form.
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows) ...
$ret
Definition: parser.php:6
static initServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Init service settings form.
Class ilObjUserFolderGUI.
static _importCategories($a_ref_id, $withrol_tmp)
import categories (static, also called by RootFolderGUI)
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
getCreationMode()
get creation mode
getRefId()
get reference id public
Class ilContainerGUI.
static _writeContainerSetting($a_id, $a_keyword, $a_value)
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
Class ilECSCategorySettings.
$languages
Definition: cssgen2.php:34
Class ilObjUserGUI.
updateObject()
updates object entry in object_data
addHeaderAction()
Add header action menu.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
saveTranslationsObject()
Save title and translations.
$_POST["username"]
addUserAutoCompleteObject()
Show auto complete results.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
GUI class for object translation handling.
static formCheckbox($checked, $varname, $value, $disabled=false)
??? public
Confirmation screen class.