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