ILIAS  release_4-4 Revision
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 
21 {
22  var $ctrl;
23 
28  function ilObjCategoryGUI($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
29  {
30  //global $ilCtrl;
31 
32  // CONTROL OPTIONS
33  //$this->ctrl =& $ilCtrl;
34  //$this->ctrl->saveParameter($this,array("ref_id","cmdClass"));
35  $GLOBALS['lng']->loadLanguageModule('cat');
36 
37  $this->type = "cat";
38  $this->ilContainerGUI($a_data,(int) $a_id,$a_call_by_reference,false);
39 
40  if (is_object($this->object))
41  {
42  include_once("./Services/Container/classes/class.ilContainer.php");
43  include_once("./Services/Object/classes/class.ilObjectServiceSettingsGUI.php");
44  $this->info_screen_enabled = ilContainer::_lookupContainerSetting(
45  $this->object->getId(),
47  true);
48  }
49  }
50 
51  function &executeCommand()
52  {
53  global $rbacsystem, $ilNavigationHistory, $ilAccess, $ilCtrl,$ilTabs;
54 
55  $next_class = $this->ctrl->getNextClass($this);
56  $cmd = $this->ctrl->getCmd();
57 
58  // show repository tree
59  $this->showRepTree(true);
60 
61  switch($next_class)
62  {
63  case "ilobjusergui":
64  include_once('./Services/User/classes/class.ilObjUserGUI.php');
65 
66  $this->tabs_gui->setTabActive('administrate_users');
67  if(!$_GET['obj_id'])
68  {
69  $this->gui_obj = new ilObjUserGUI("",$_GET['ref_id'],true, false);
70  $this->gui_obj->setCreationMode($this->creation_mode);
71  $ret =& $this->ctrl->forwardCommand($this->gui_obj);
72  }
73  else
74  {
75  $this->gui_obj = new ilObjUserGUI("", $_GET['obj_id'],false, false);
76  $this->gui_obj->setCreationMode($this->creation_mode);
77  $ret =& $this->ctrl->forwardCommand($this->gui_obj);
78  }
79 
80  $ilTabs->clearTargets();
81  $ilTabs->setBackTarget($this->lng->txt('backto_lua'), $this->ctrl->getLinkTarget($this,'listUsers'));
82  global $ilHelp;
83  $ilHelp->setScreenIdComponent("cat");
84  $ilHelp->setScreenId("administrate_user");
85  $ilHelp->setSubScreenId($ilCtrl->getCmd());
86  break;
87 
88  case "ilobjuserfoldergui":
89  include_once('./Services/User/classes/class.ilObjUserFolderGUI.php');
90 
91  $this->gui_obj = new ilObjUserFolderGUI("",(int) $_GET['ref_id'],true, false);
92  $this->gui_obj->setUserOwnerId((int) $_GET['ref_id']);
93  $this->gui_obj->setCreationMode($this->creation_mode);
94  $ret =& $this->ctrl->forwardCommand($this->gui_obj);
95 
96  $ilTabs->clearTargets();
97  $ilTabs->setBackTarget($this->lng->txt('backto_lua'), $this->ctrl->getLinkTarget($this,'listUsers'));
98  global $ilHelp;
99  $ilHelp->setScreenIdComponent("cat");
100  $ilHelp->setScreenId("administrate_user");
101  $ilHelp->setSubScreenId($ilCtrl->getCmd());
102  break;
103 
104  case "ilcolumngui":
105  $this->checkPermission("read");
106  $this->prepareOutput();
107  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
108  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
109  ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId()));
110  $this->renderObject();
111  break;
112 
113  case 'ilpermissiongui':
114  $this->prepareOutput();
115  $this->tabs_gui->setTabActive('perm_settings');
116  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
117  $perm_gui =& new ilPermissionGUI($this);
118  $ret =& $this->ctrl->forwardCommand($perm_gui);
119  break;
120 
121  case 'ilinfoscreengui':
122  if ($this->info_screen_enabled)
123  {
124  $this->prepareOutput();
125  $this->infoScreen();
126  }
127  break;
128 
129  case 'ilcontainerlinklistgui':
130  include_once("Services/Container/classes/class.ilContainerLinkListGUI.php");
131  $link_list_gui =& new ilContainerLinkListGUI();
132  $ret =& $this->ctrl->forwardCommand($link_list_gui);
133  break;
134 
135  // container page editing
136  case "ilcontainerpagegui":
137  $this->prepareOutput(false);
138  $ret = $this->forwardToPageObject();
139  if ($ret != "")
140  {
141  $this->tpl->setContent($ret);
142  }
143  break;
144 
145  case 'ilobjectcopygui':
146  $this->prepareOutput();
147 
148  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
149  $cp = new ilObjectCopyGUI($this);
150  $cp->setType('cat');
151  $this->ctrl->forwardCommand($cp);
152  break;
153 
154  case "ilobjstylesheetgui":
155  $this->forwardToStyleSheet();
156  break;
157 
158  case 'ilusertablegui':
159  include_once './Services/User/classes/class.ilUserTableGUI.php';
160  $u_table = new ilUserTableGUI($this, "listUsers");
161  $u_table->initFilter();
162  $this->ctrl->setReturn($this,'listUsers');
163  $this->ctrl->forwardCommand($u_table);
164  break;
165 
166  case "ilcommonactiondispatchergui":
167  $this->prepareOutput();
168  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
170  $this->ctrl->forwardCommand($gui);
171  break;
172 
173  case 'ildidactictemplategui':
174  $this->ctrl->setReturn($this,'edit');
175  include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateGUI.php';
176  $did = new ilDidacticTemplateGUI($this);
177  $this->ctrl->forwardCommand($did);
178  break;
179 
180  case 'ilexportgui':
181  $this->prepareOutput();
182  $this->tabs_gui->setTabActive('export');
183  include_once './Services/Export/classes/class.ilExportGUI.php';
184  $exp = new ilExportGUI($this);
185  $exp->addFormat('xml');
186  $this->ctrl->forwardCommand($exp);
187  break;
188 
189  case 'ilobjecttranslationgui':
190  $this->checkPermissionBool("write");
191  $this->prepareOutput();
192  //$this->tabs_gui->setTabActive('export');
193  $this->setEditTabs("settings_trans");
194  include_once("./Services/Object/classes/class.ilObjectTranslationGUI.php");
195  $transgui = new ilObjectTranslationGUI($this);
196  $this->ctrl->forwardCommand($transgui);
197  break;
198 
199  default:
200  if ($cmd == "infoScreen")
201  {
202  $this->checkPermission("visible");
203  }
204  else
205  {
206  $this->checkPermission("read");
207  }
208 
209  // add entry to navigation history
210  if (!$this->getCreationMode() &&
211  $ilAccess->checkAccess("read", "", $_GET["ref_id"]))
212  {
213  $ilNavigationHistory->addItem($_GET["ref_id"],
214  $ilCtrl->getLinkTargetByClass("ilrepositorygui", "frameset"), "cat");
215  }
216 
217  $this->prepareOutput();
218  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
219  if (is_object($this->object))
220  {
221  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
222  ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId()));
223  }
224 
225  if(!$cmd)
226  {
227  $cmd = "render";
228  }
229  $cmd .= "Object";
230  $this->$cmd();
231 
232  break;
233  }
234 
235  $this->addHeaderAction();
236 
237  return true;
238  }
239 
243  function getTabs(&$tabs_gui)
244  {
245  global $rbacsystem, $lng, $ilHelp, $ilAccess;
246 
247  if ($this->ctrl->getCmd() == "editPageContent")
248  {
249  return;
250  }
251  #$this->ctrl->setParameter($this,"ref_id",$this->ref_id);
252 
253  $ilHelp->setScreenIdComponent("cat");
254 
255  if ($rbacsystem->checkAccess('read',$this->ref_id))
256  {
257  $force_active = ($_GET["cmd"] == "" || $_GET["cmd"] == "render")
258  ? true
259  : false;
260  $tabs_gui->addTab("view_content", $lng->txt("content"),
261  $this->ctrl->getLinkTarget($this, ""));
262 
263  //BEGIN ChangeEvent add info tab to category object
264  if ($this->info_screen_enabled)
265  {
266  $force_active = ($this->ctrl->getNextClass() == "ilinfoscreengui"
267  || strtolower($_GET["cmdClass"]) == "ilnotegui")
268  ? true
269  : false;
270  $tabs_gui->addTarget("info_short",
271  $this->ctrl->getLinkTargetByClass(
272  array("ilobjcategorygui", "ilinfoscreengui"), "showSummary"),
273  array("showSummary","", "infoScreen"),
274  "", "", $force_active);
275  }
276  //END ChangeEvent add info tab to category object
277  }
278 
279  if ($rbacsystem->checkAccess('write',$this->ref_id))
280  {
281  $force_active = ($_GET["cmd"] == "edit")
282  ? true
283  : false;
284  $tabs_gui->addTarget("settings",
285  $this->ctrl->getLinkTarget($this, "edit"), "edit", get_class($this)
286  , "", $force_active);
287  }
288 
289  include_once './Services/User/classes/class.ilUserAccountSettings.php';
290  if(
291  ilUserAccountSettings::getInstance()->isLocalUserAdministrationEnabled() and
292  $rbacsystem->checkAccess('cat_administrate_users',$this->ref_id))
293  {
294  $tabs_gui->addTarget("administrate_users",
295  $this->ctrl->getLinkTarget($this, "listUsers"), "listUsers", get_class($this));
296  }
297 
298  if($ilAccess->checkAccess('write','',$this->object->getRefId()))
299  {
300  $tabs_gui->addTarget(
301  'export',
302  $this->ctrl->getLinkTargetByClass('ilexportgui',''),
303  'export',
304  'ilexportgui'
305  );
306  }
307 
308  // parent tabs (all container: edit_permission, clipboard, trash
309  parent::getTabs($tabs_gui);
310 
311  }
312 
316  function renderObject()
317  {
318  global $ilTabs;
319 
320  $ilTabs->activateTab("view_content");
321  $ret = parent::renderObject();
322  return $ret;
323 
324  }
325 
326  protected function initCreationForms($a_new_type)
327  {
328  $forms = parent::initCreationForms($a_new_type);
329  //unset($forms[self::CFORM_IMPORT]);
330  return $forms;
331  }
332 
333  protected function afterSave(ilObject $a_new_object)
334  {
335  global $ilUser, $tree;
336 
337  // add default translation
338  $a_new_object->addTranslation($a_new_object->getTitle(),
339  $a_new_object->getDescription(), $ilUser->getPref("language"), true);
340 
341  // default: sort by title
342  include_once('Services/Container/classes/class.ilContainerSortingSettings.php');
343  $settings = new ilContainerSortingSettings($a_new_object->getId());
345  $settings->save();
346 
347  // inherit parents content style, if not individual
348  $parent_ref_id = $tree->getParentId($a_new_object->getRefId());
349  $parent_id = ilObject::_lookupObjId($parent_ref_id);
350  include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
351  $style_id = ilObjStyleSheet::lookupObjectStyle($parent_id);
352  if ($style_id > 0)
353  {
354  if (ilObjStyleSheet::_lookupStandard($style_id))
355  {
356  ilObjStyleSheet::writeStyleUsage($a_new_object->getId(), $style_id);
357  }
358  }
359 
360  // always send a message
361  ilUtil::sendSuccess($this->lng->txt("cat_added"),true);
362  $this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
363  $this->redirectToRefId($a_new_object->getRefId(), "");
364  }
365 
371  function infoScreenObject()
372  {
373  $this->ctrl->setCmd("showSummary");
374  $this->ctrl->setCmdClass("ilinfoscreengui");
375  $this->infoScreen();
376  }
377 
381  function infoScreen()
382  {
383  global $ilAccess, $ilCtrl;
384 
385  if (!$ilAccess->checkAccess("visible", "", $this->ref_id))
386  {
387  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
388  }
389 
390  if (!$this->info_screen_enabled)
391  {
392  return;
393  }
394 
395  // #10986
396  $this->tabs_gui->setTabActive('info_short');
397 
398  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
399  $info = new ilInfoScreenGUI($this);
400 
401  $info->enablePrivateNotes();
402 
403  if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
404  {
405  $info->enableNews();
406  }
407 
408  // no news editing for files, just notifications
409  $info->enableNewsEditing(false);
410  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
411  {
412  $news_set = new ilSetting("news");
413  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
414 
415  if ($enable_internal_rss)
416  {
417  $info->setBlockProperty("news", "settings", true);
418  $info->setBlockProperty("news", "public_notifications_option", true);
419  }
420  }
421 
422  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
423  $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_INFO,'cat',$this->object->getId());
424  $record_gui->setInfoObject($info);
425  $record_gui->parse();
426 
427 
428  // standard meta data
429  $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
430 
431  // forward the command
432  if ($ilCtrl->getNextClass() == "ilinfoscreengui")
433  {
434  $ilCtrl->forwardCommand($info);
435  }
436  else
437  {
438  return $ilCtrl->getHTML($info);
439  }
440  }
441 
447  protected function editInfoObject()
448  {
449  $this->checkPermission("write");
450  $this->setEditTabs();
451  $this->tabs_gui->activateTab('settings');
452  $this->tabs_gui->setSubTabActive('edit_cat_settings');
453 
454  $this->initExtendedSettings();
455  $this->tpl->setContent($this->form->getHTML());
456  }
457 
463  protected function updateInfoObject()
464  {
465  $this->checkPermission("write");
466  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
468  'cat',$this->object->getId());
469  $record_gui->loadFromPost();
470  $record_gui->saveValues();
471 
472  ilUtil::sendSuccess($this->lng->txt("settings_saved"));
473  $this->editInfoObject();
474  return true;
475  }
476 
477 
483  protected function initExtendedSettings()
484  {
485  if(is_object($this->form))
486  {
487  return true;
488  }
489 
490  include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
491  $this->form = new ilPropertyFormGUI();
492  $this->form->setFormAction($this->ctrl->getFormAction($this));
493  $this->form->setTitle($this->lng->txt('ext_cat_settings'));
494  $this->form->addCommandButton('updateInfo',$this->lng->txt('save'));
495  $this->form->addCommandButton('editInfo',$this->lng->txt('cancel'));
496 
497  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
498  $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_EDITOR,'cat',$this->object->getId());
499  $record_gui->setPropertyForm($this->form);
500  $record_gui->parse();
501 
502  return true;
503  }
504 
505  protected function setEditTabs($active_tab = "settings_misc")
506  {
507  global $ilSetting, $ilTabs;
508 
509  $this->tabs_gui->addSubTab("settings_misc",
510  $this->lng->txt("settings"),
511  $this->ctrl->getLinkTarget($this, "edit"));
512 
513  /*$this->tabs_gui->addSubTab("settings_trans",
514  $this->lng->txt("title_and_translations"),
515  $this->ctrl->getLinkTarget($this, "editTranslations"));*/
516 
517  $this->tabs_gui->addSubTab("settings_trans",
518  $this->lng->txt("obj_multilinguality"),
519  $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", ""));
520 
521  // custom icon
522  if ($ilSetting->get("custom_icons"))
523  {
524  $this->tabs_gui->addSubTab("icons",
525  $this->lng->txt("icon_settings"),
526  $this->ctrl->getLinkTarget($this,'editIcons'));
527  }
528 
529  $this->tabs_gui->activateTab("settings");
530  $this->tabs_gui->activateSubTab($active_tab);
531 
532  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
533  if(in_array('cat',ilAdvancedMDRecord::_getActivatedObjTypes()))
534  {
535  $this->tabs_gui->addSubTabTarget("edit_cat_settings",
536  $this->ctrl->getLinkTarget($this,'editInfo'),
537  "editInfo", get_class($this));
538  }
539  }
540 
541  function initEditForm()
542  {
543  $this->lng->loadLanguageModule($this->object->getType());
544  $this->setEditTabs();
545 
546  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
547  $form = new ilPropertyFormGUI();
548  $form->setFormAction($this->ctrl->getFormAction($this));
549  $form->setTitle($this->lng->txt($this->object->getType()."_edit"));
550 
551  // title/description
552 
553  $trans = $this->object->getTranslations();
554  $def = $trans["Fobject"][0]; // default
555 
556  $title = new ilTextInputGUI($this->lng->txt("title"), "title");
557  $title->setRequired(true);
558  $title->setSize(min(40, ilObject::TITLE_LENGTH));
559  $title->setMaxLength(ilObject::TITLE_LENGTH);
560  $title->setValue($def["title"]);
561  $form->addItem($title);
562 
563  if(sizeof($trans["Fobject"]) > 1)
564  {
565  include_once('Services/MetaData/classes/class.ilMDLanguageItem.php');
566  $languages = ilMDLanguageItem::_getLanguages();
567 
568  $title->setInfo($this->lng->txt("language").": ".$languages[$def["lang"]].
569  ' <a href="'.$this->ctrl->getLinkTarget($this, "editTranslations").
570  '">&raquo; '.$this->lng->txt("cat_more_translations").'</a>');
571 
572  unset($languages);
573  }
574 
575  $desc = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
576  $desc->setRows(2);
577  $desc->setCols(40);
578  $desc->setValue($def["desc"]);
579  $form->addItem($desc);
580 
581  // Show didactic template type
582  $this->initDidacticTemplate($form);
583 
584  // presentation
585  $pres = new ilFormSectionHeaderGUI();
586  $pres->setTitle($this->lng->txt('obj_presentation'));
587  $form->addItem($pres);
588 
589  // sorting
590  include_once('Services/Container/classes/class.ilContainerSortingSettings.php');
591  $settings = new ilContainerSortingSettings($this->object->getId());
592 
593  $sort = new ilRadioGroupInputGUI($this->lng->txt('sorting_header'), "sorting");
594  $sort_title = new ilRadioOption($this->lng->txt('sorting_title_header'),
596  $sort_title->setInfo($this->lng->txt('sorting_info_title'));
597  $sort->addOption($sort_title);
598 
599  $sort_manual = new ilRadioOption($this->lng->txt('sorting_manual_header'),
601  $sort_manual->setInfo($this->lng->txt('sorting_info_manual'));
602  $sort->addOption($sort_manual);
603 
604  $sort->setValue($settings->getSortMode());
605  $form->addItem($sort);
606 
607  // icon settings
608 // $this->showCustomIconsEditing(1, $form, false);
609 
610  // Edit ecs export settings
611  include_once 'Modules/Category/classes/class.ilECSCategorySettings.php';
612  $ecs = new ilECSCategorySettings($this->object);
613  $ecs->addSettingsToForm($form, 'cat');
614 
615  // services
616  $sh = new ilFormSectionHeaderGUI();
617  $sh->setTitle($this->lng->txt('obj_features'));
618  $form->addItem($sh);
619 
620  include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
622  $this->object->getId(),
623  $form,
624  array(
627  )
628  );
629 
630  $form->addCommandButton("update", $this->lng->txt("save"));
631 // $form->addCommandButton("addTranslation", $this->lng->txt("add_translation"));
632 
633  return $form;
634  }
635 
636  function getEditFormValues()
637  {
638  // values are set in initEditForm()
639  }
640 
646  function updateObject()
647  {
648  if (!$this->checkPermissionBool("write"))
649  {
650  $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
651  }
652  else
653  {
654  $form = $this->initEditForm();
655  if($form->checkInput())
656  {
657  $title = $form->getInput("title");
658  $desc = $form->getInput("desc");
659  $lang = $this->object->getTranslations();
660  $lang = $lang["Fobject"][0]["lang"];
661  $this->object->deleteTranslation($lang);
662  $this->object->addTranslation($title, $desc, $lang, true);
663  $this->object->setTitle($title);
664  $this->object->setDescription($desc);
665  $this->object->update();
666 
667  include_once('Services/Container/classes/class.ilContainerSortingSettings.php');
668  $settings = new ilContainerSortingSettings($this->object->getId());
669  $settings->setSortMode($form->getInput("sorting"));
670  $settings->update();
671 
672  // save custom icons
673 /* if ($this->ilias->getSetting("custom_icons"))
674  {
675  if($form->getItemByPostVar("cont_big_icon")->getDeletionFlag())
676  {
677  $this->object->removeBigIcon();
678  }
679  if($form->getItemByPostVar("cont_small_icon")->getDeletionFlag())
680  {
681  $this->object->removeSmallIcon();
682  }
683  if($form->getItemByPostVar("cont_tiny_icon")->getDeletionFlag())
684  {
685  $this->object->removeTinyIcon();
686  }
687 
688  $this->object->saveIcons($_FILES["cont_big_icon"]['tmp_name'],
689  $_FILES["cont_small_icon"]['tmp_name'],
690  $_FILES["cont_tiny_icon"]['tmp_name']);
691  }*/
692 
693  // BEGIN ChangeEvent: Record update
694  global $ilUser;
695  require_once('Services/Tracking/classes/class.ilChangeEvent.php');
696  ilChangeEvent::_recordWriteEvent($this->object->getId(), $ilUser->getId(), 'update');
697  ilChangeEvent::_catchupWriteEvents($this->object->getId(), $ilUser->getId());
698  // END ChangeEvent: Record update
699 
700  // services
701  include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
703  $this->object->getId(),
704  $form,
705  array(
708  )
709  );
710 
711  // Update ecs export settings
712  include_once 'Modules/Category/classes/class.ilECSCategorySettings.php';
713  $ecs = new ilECSCategorySettings($this->object);
714  if($ecs->handleSettingsUpdate())
715  {
716  return $this->afterUpdate();
717  }
718  }
719 
720  // display form to correct errors
721  $this->setEditTabs();
722  $form->setValuesByPost();
723  $this->tpl->setContent($form->getHTML());
724  }
725  }
726 
730  function editTranslationsObject($a_get_post_values = false, $a_add = false)
731  {
732  global $tpl;
733 
734  $this->ctrl->redirectByClass("ilobjecttranslationgui", "");
735 
736 
737  $this->lng->loadLanguageModule($this->object->getType());
738  $this->setEditTabs("settings_trans");
739 
740  include_once("./Services/Object/classes/class.ilObjectTranslationTableGUI.php");
741  $table = new ilObjectTranslationTableGUI($this, "editTranslations", true,
742  "Translation");
743  if ($a_get_post_values)
744  {
745  $vals = array();
746  foreach($_POST["title"] as $k => $v)
747  {
748  $vals[] = array("title" => $v,
749  "desc" => $_POST["desc"][$k],
750  "lang" => $_POST["lang"][$k],
751  "default" => ($_POST["default"] == $k));
752  }
753  $table->setData($vals);
754  }
755  else
756  {
757  $data = $this->object->getTranslations();
758  foreach($data["Fobject"] as $k => $v)
759  {
760  $data["Fobject"][$k]["default"] = ($k == $data["default_language"]);
761  }
762  if($a_add)
763  {
764  $data["Fobject"][++$k]["title"] = "";
765  }
766  $table->setData($data["Fobject"]);
767  }
768  $tpl->setContent($table->getHTML());
769  }
770 
775  {
776  if (!$this->checkPermissionBool("write"))
777  {
778  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
779  }
780 
781  // default language set?
782  if (!isset($_POST["default"]))
783  {
784  ilUtil::sendFailure($this->lng->txt("msg_no_default_language"));
785  return $this->editTranslationsObject(true);
786  }
787 
788  // all languages set?
789  if (array_key_exists("",$_POST["lang"]))
790  {
791  ilUtil::sendFailure($this->lng->txt("msg_no_language_selected"));
792  return $this->editTranslationsObject(true);
793  }
794 
795  // no single language is selected more than once?
796  if (count(array_unique($_POST["lang"])) < count($_POST["lang"]))
797  {
798  ilUtil::sendFailure($this->lng->txt("msg_multi_language_selected"));
799  return $this->editTranslationsObject(true);
800  }
801 
802  // save the stuff
803  $this->object->removeTranslations();
804  foreach($_POST["title"] as $k => $v)
805  {
806  // update object data if default
807  $is_default = ($_POST["default"] == $k);
808  if($is_default)
809  {
810  $this->object->setTitle(ilUtil::stripSlashes($v));
811  $this->object->setDescription(ilUtil::stripSlashes($_POST["desc"][$k]));
812  $this->object->update();
813  }
814 
815  $this->object->addTranslation(
817  ilUtil::stripSlashes($_POST["desc"][$k]),
818  ilUtil::stripSlashes($_POST["lang"][$k]),
819  $is_default);
820  }
821 
822  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
823  $this->ctrl->redirect($this, "editTranslations");
824  }
825 
830  {
831  if($_POST["title"])
832  {
833  $k = max(array_keys($_POST["title"]));
834  $k++;
835  $_POST["title"][$k] = "";
836  $this->editTranslationsObject(true);
837  }
838  else
839  {
840  $this->editTranslationsObject(false, true);
841  }
842  }
843 
848  {
849  foreach($_POST["title"] as $k => $v)
850  {
851  if ($_POST["check"][$k])
852  {
853  // default translation cannot be deleted
854  if($k != $_POST["default"])
855  {
856  unset($_POST["title"][$k]);
857  unset($_POST["desc"][$k]);
858  unset($_POST["lang"][$k]);
859  }
860  else
861  {
862  ilUtil::sendFailure($this->lng->txt("msg_no_default_language"));
863  return $this->editTranslationsObject();
864  }
865  }
866  }
867  $this->saveTranslationsObject();
868  }
869 
874  {
875  ilObjCategoryGUI::_importCategoriesForm($this->ref_id, $this->tpl);
876  }
877 
881  function _importCategoriesForm ($a_ref_id, &$a_tpl)
882  {
883  global $lng, $rbacreview;
884 
885  $a_tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.cat_import_form.html",
886  "Modules/Category");
887 
888  $a_tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
889 
890  $a_tpl->setVariable("TXT_IMPORT_CATEGORIES", $lng->txt("import_categories"));
891  $a_tpl->setVariable("TXT_HIERARCHY_OPTION", $lng->txt("import_cat_localrol"));
892  $a_tpl->setVariable("TXT_IMPORT_FILE", $lng->txt("import_file"));
893  $a_tpl->setVariable("TXT_IMPORT_TABLE", $lng->txt("import_cat_table"));
894 
895  $a_tpl->setVariable("BTN_IMPORT", $lng->txt("import"));
896  $a_tpl->setVariable("BTN_CANCEL", $lng->txt("cancel"));
897 
898  // NEED TO FILL ADOPT_PERMISSIONS HTML FORM....
899  $parent_role_ids = $rbacreview->getParentRoleIds($a_ref_id,true);
900 
901  // sort output for correct color changing
902  ksort($parent_role_ids);
903 
904  foreach ($parent_role_ids as $key => $par)
905  {
906  if ($par["obj_id"] != SYSTEM_ROLE_ID)
907  {
908  $check = ilUtil::formCheckbox(0,"adopt[]",$par["obj_id"],1);
909  $output["adopt"][$key]["css_row_adopt"] = ilUtil::switchColor($key, "tblrow1", "tblrow2");
910  $output["adopt"][$key]["check_adopt"] = $check;
911  $output["adopt"][$key]["role_id"] = $par["obj_id"];
912  $output["adopt"][$key]["type"] = ($par["type"] == 'role' ? 'Role' : 'Template');
913  $output["adopt"][$key]["role_name"] = $par["title"];
914  }
915  }
916 
917  //var_dump($output);
918 
919  // BEGIN ADOPT PERMISSIONS
920  foreach ($output["adopt"] as $key => $value)
921  {
922  $a_tpl->setCurrentBlock("ADOPT_PERM_ROW");
923  $a_tpl->setVariable("CSS_ROW_ADOPT",$value["css_row_adopt"]);
924  $a_tpl->setVariable("CHECK_ADOPT",$value["check_adopt"]);
925  $a_tpl->setVariable("LABEL_ID",$value["role_id"]);
926  $a_tpl->setVariable("TYPE",$value["type"]);
927  $a_tpl->setVariable("ROLE_NAME",$value["role_name"]);
928  $a_tpl->parseCurrentBlock();
929  }
930  }
931 
932 
939  {
940  $this->ctrl->redirect($this);
941  }
942 
946  function _getImportDir()
947  {
948  return ilUtil::getDataDir()."/cat_import";
949  }
950 
955  {
957  // call to importCategories with $withrol = 0
959  }
960 
965  {
966 
967  //echo "entra aqui";
968  // call to importCategories with $withrol = 1
970  }
971 
976  function _importCategories($a_ref_id, $withrol_tmp)
977  {
978  global $lng;
979 
980  require_once("./Modules/Category/classes/class.ilCategoryImportParser.php");
981 
982  $import_dir = ilObjCategoryGUI::_getImportDir();
983 
984  // create user import directory if necessary
985  if (!@is_dir($import_dir))
986  {
987  ilUtil::createDirectory($import_dir);
988  }
989 
990  // move uploaded file to user import directory
991 
992  $file_name = $_FILES["importFile"]["name"];
993 
994  // added to prevent empty file names
995  if (!strcmp($file_name,"")) {
996  ilUtil::sendFailure($lng->txt("no_import_file_found"), true);
997  $this->ctrl->redirect($this);
998  }
999 
1000  $parts = pathinfo($file_name);
1001  $full_path = $import_dir."/".$file_name;
1002  //move_uploaded_file($_FILES["importFile"]["tmp_name"], $full_path);
1003  ilUtil::moveUploadedFile($_FILES["importFile"]["tmp_name"], $file_name, $full_path);
1004 
1005  // unzip file
1006  ilUtil::unzip($full_path);
1007 
1008  $subdir = basename($parts["basename"],".".$parts["extension"]);
1009  $xml_file = $import_dir."/".$subdir."/".$subdir.".xml";
1010  // CategoryImportParser
1011  //var_dump($_POST);
1012  $importParser = new ilCategoryImportParser($xml_file, $a_ref_id, $withrol_tmp);
1013  $importParser->startParsing();
1014 
1015  ilUtil::sendSuccess($lng->txt("categories_imported"), true);
1016  $this->ctrl->redirect($this);
1017  }
1018 
1023  protected function resetFilterObject()
1024  {
1025  include_once("./Services/User/classes/class.ilUserTableGUI.php");
1026  $utab = new ilUserTableGUI($this, "listUsers",ilUserTableGUI::MODE_LOCAL_USER);
1027  $utab->resetOffset();
1028  $utab->resetFilter();
1029 
1030  // from "old" implementation
1031  $this->listUsersObject();
1032  }
1033 
1038  protected function applyFilterObject()
1039  {
1040  global $ilTabs;
1041 
1042  include_once("./Services/User/classes/class.ilUserTableGUI.php");
1043  $utab = new ilUserTableGUI($this, "listUsers", ilUserTableGUI::MODE_LOCAL_USER);
1044  $utab->resetOffset();
1045  $utab->writeFilterToSession();
1046  $this->listUsersObject();
1047  }
1048 
1049  // METHODS for local user administration
1050  function listUsersObject($show_delete = false)
1051  {
1052  global $ilUser,$rbacreview, $ilToolbar;
1053 
1054  include_once './Services/User/classes/class.ilLocalUser.php';
1055  include_once './Services/User/classes/class.ilObjUserGUI.php';
1056 
1057  global $rbacsystem,$rbacreview;
1058 
1059  if(!$rbacsystem->checkAccess("cat_administrate_users",$this->object->getRefId()))
1060  {
1061  $this->ilias->raiseError($this->lng->txt("msg_no_perm_admin_users"),$this->ilias->error_obj->MESSAGE);
1062  }
1063  $this->tabs_gui->setTabActive('administrate_users');
1064 
1065 
1066 
1067  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.cat_admin_users.html',
1068  "Modules/Category");
1069 
1070  if(count($rbacreview->getGlobalAssignableRoles()) or in_array(SYSTEM_ROLE_ID,$rbacreview->assignedRoles($ilUser->getId())))
1071  {
1072  $ilToolbar->addButton(
1073  $this->lng->txt('add_user'),
1074  $this->ctrl->getLinkTargetByClass('ilobjusergui','create')
1075  );
1076 
1077  $ilToolbar->addButton(
1078  $this->lng->txt('import_users'),
1079  $this->ctrl->getLinkTargetByClass('ilobjuserfoldergui','importUserForm')
1080  );
1081  }
1082  else
1083  {
1084  ilUtil::sendInfo($this->lng->txt('no_roles_user_can_be_assigned_to'));
1085  }
1086 
1087  if($show_delete)
1088  {
1089  $this->tpl->setCurrentBlock("confirm_delete");
1090  $this->tpl->setVariable("CONFIRM_FORMACTION",$this->ctrl->getFormAction($this));
1091  $this->tpl->setVariable("TXT_CANCEL",$this->lng->txt('cancel'));
1092  $this->tpl->setVariable("CONFIRM_CMD",'performDeleteUsers');
1093  $this->tpl->setVariable("TXT_CONFIRM",$this->lng->txt('delete'));
1094  $this->tpl->parseCurrentBlock();
1095  }
1096 
1097  $this->lng->loadLanguageModule('user');
1098 
1099  include_once("./Services/User/classes/class.ilUserTableGUI.php");
1100  $utab = new ilUserTableGUI($this, 'listUsers',ilUserTableGUI::MODE_LOCAL_USER);
1101  $this->tpl->setVariable('USERS_TABLE',$utab->getHTML());
1102 
1103  return true;
1104  }
1105 
1109  protected function addUserAutoCompleteObject()
1110  {
1111  include_once './Services/User/classes/class.ilUserAutoComplete.php';
1112  $auto = new ilUserAutoComplete();
1113  $auto->setSearchFields(array('login','firstname','lastname','email'));
1114  $auto->enableFieldSearchableCheck(true);
1115  echo $auto->getList($_REQUEST['term']);
1116  exit();
1117  }
1118 
1119 
1121  {
1122  include_once './Services/User/classes/class.ilLocalUser.php';
1123  $this->checkPermission("cat_administrate_users");
1124 
1125  foreach($_POST['user_ids'] as $user_id)
1126  {
1127  if(!in_array($user_id,ilLocalUser::_getAllUserIds($this->object->getRefId())))
1128  {
1129  die('user id not valid');
1130  }
1131  if(!$tmp_obj =& ilObjectFactory::getInstanceByObjId($user_id,false))
1132  {
1133  continue;
1134  }
1135  $tmp_obj->delete();
1136  }
1137  ilUtil::sendSuccess($this->lng->txt('deleted_users'));
1138  $this->listUsersObject();
1139 
1140  return true;
1141  }
1142 
1144  {
1145  $this->checkPermission("cat_administrate_users");
1146  if(!count($_POST['id']))
1147  {
1148  ilUtil::sendFailure($this->lng->txt('no_users_selected'));
1149  $this->listUsersObject();
1150 
1151  return true;
1152  }
1153 
1154  include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
1155  $confirm = new ilConfirmationGUI();
1156  $confirm->setFormAction($this->ctrl->getFormAction($this));
1157  $confirm->setHeaderText($this->lng->txt('sure_delete_selected_users'));
1158  $confirm->setConfirm($this->lng->txt('delete'), 'performDeleteUsers');
1159  $confirm->setCancel($this->lng->txt('cancel'), 'listUsers');
1160 
1161  foreach($_POST['id'] as $user)
1162  {
1163  $name = ilObjUser::_lookupName($user);
1164 
1165  $confirm->addItem(
1166  'user_ids[]',
1167  $user,
1168  $name['lastname'].', '.$name['firstname'].' ['.$name['login'].']'
1169  );
1170  }
1171  $this->tpl->setContent($confirm->getHTML());
1172  }
1173 
1175  {
1176  global $rbacreview,$ilTabs;
1177 
1178  $this->checkPermission("cat_administrate_users");
1179 
1180  include_once './Services/User/classes/class.ilLocalUser.php';
1181 
1182  if(!isset($_GET['obj_id']))
1183  {
1184  ilUtil::sendFailure('no_user_selected');
1185  $this->listUsersObject();
1186 
1187  return true;
1188  }
1189 
1190  $ilTabs->clearTargets();
1191  $ilTabs->setBackTarget($this->lng->txt('backto_lua'), $this->ctrl->getLinkTarget($this,'listUsers'));
1192  global $ilHelp;
1193  $ilHelp->setScreenIdComponent("cat");
1194  $ilHelp->setScreenId("administrate_user");
1195  $ilHelp->setSubScreenId("assign_roles");
1196 
1197 
1198  $roles = $this->__getAssignableRoles();
1199 
1200  if(!count($roles))
1201  {
1202  #ilUtil::sendInfo($this->lng->txt('no_roles_user_can_be_assigned_to'));
1203  #$this->listUsersObject();
1204 
1205  #return true;
1206  }
1207 
1208  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.cat_role_assignment.html',
1209  "Modules/Category");
1210 
1211  $ass_roles = $rbacreview->assignedRoles($_GET['obj_id']);
1212 
1213  $counter = 0;
1214  foreach($roles as $role)
1215  {
1216  $role_obj =& ilObjectFactory::getInstanceByObjId($role['obj_id']);
1217 
1218  $disabled = false;
1219  $f_result[$counter][] = ilUtil::formCheckbox(in_array($role['obj_id'],$ass_roles) ? 1 : 0,
1220  'role_ids[]',
1221  $role['obj_id'],
1222  $disabled);
1223  $f_result[$counter][] = $role_obj->getTitle() ? $role_obj->getTitle() : "";
1224  $f_result[$counter][] = $role_obj->getDescription() ? $role_obj->getDescription() : "";
1225  $f_result[$counter][] = $role['role_type'] == 'global' ?
1226  $this->lng->txt('global') :
1227  $this->lng->txt('local');
1228 
1229  unset($role_obj);
1230  ++$counter;
1231  }
1232  $this->__showRolesTable($f_result,"assignRolesObject");
1233  }
1234 
1235  function assignSaveObject()
1236  {
1237  global $rbacreview,$rbacadmin;
1238  $this->checkPermission("cat_administrate_users");
1239 
1240  include_once './Services/User/classes/class.ilLocalUser.php';
1241  // check hack
1242  if(!isset($_GET['obj_id']) or !in_array($_REQUEST['obj_id'],ilLocalUser::_getAllUserIds()))
1243  {
1244  ilUtil::sendFailure('no_user_selected');
1245  $this->listUsersObject();
1246 
1247  return true;
1248  }
1249  $roles = $this->__getAssignableRoles();
1250 
1251  // check minimum one global role
1252  if(!$this->__checkGlobalRoles($_POST['role_ids']))
1253  {
1254  ilUtil::sendFailure($this->lng->txt('no_global_role_left'));
1255  $this->assignRolesObject();
1256 
1257  return false;
1258  }
1259 
1260  $new_role_ids = $_POST['role_ids'] ? $_POST['role_ids'] : array();
1261  $assigned_roles = $rbacreview->assignedRoles((int) $_REQUEST['obj_id']);
1262  foreach($roles as $role)
1263  {
1264  if(in_array($role['obj_id'],$new_role_ids) and !in_array($role['obj_id'],$assigned_roles))
1265  {
1266  $rbacadmin->assignUser($role['obj_id'],(int) $_REQUEST['obj_id']);
1267  }
1268  if(in_array($role['obj_id'],$assigned_roles) and !in_array($role['obj_id'],$new_role_ids))
1269  {
1270  $rbacadmin->deassignUser($role['obj_id'],(int) $_REQUEST['obj_id']);
1271  }
1272  }
1273  ilUtil::sendSuccess($this->lng->txt('role_assignment_updated'));
1274  $this->assignRolesObject();
1275 
1276  return true;
1277  }
1278 
1279  // PRIVATE
1281  {
1282  global $rbacreview,$ilUser;
1283 
1284  // check local user
1285  $tmp_obj =& ilObjectFactory::getInstanceByObjId($_REQUEST['obj_id']);
1286  // Admin => all roles
1287  if(in_array(SYSTEM_ROLE_ID,$rbacreview->assignedRoles($ilUser->getId())))
1288  {
1289  $global_roles = $rbacreview->getGlobalRolesArray();
1290  }
1291  elseif($tmp_obj->getTimeLimitOwner() == $this->object->getRefId())
1292  {
1293  $global_roles = $rbacreview->getGlobalAssignableRoles();
1294  }
1295  else
1296  {
1297  $global_roles = array();
1298  }
1299  return $roles = array_merge($global_roles,
1300  $rbacreview->getAssignableChildRoles($this->object->getRefId()));
1301  }
1302 
1303  function __checkGlobalRoles($new_assigned)
1304  {
1305  global $rbacreview,$ilUser;
1306 
1307  $this->checkPermission("cat_administrate_users");
1308 
1309  // return true if it's not a local user
1310  $tmp_obj =& ilObjectFactory::getInstanceByObjId($_REQUEST['obj_id']);
1311  if($tmp_obj->getTimeLimitOwner() != $this->object->getRefId() and
1312  !in_array(SYSTEM_ROLE_ID,$rbacreview->assignedRoles($ilUser->getId())))
1313  {
1314  return true;
1315  }
1316 
1317  // new assignment by form
1318  $new_assigned = $new_assigned ? $new_assigned : array();
1319  $assigned = $rbacreview->assignedRoles((int) $_GET['obj_id']);
1320 
1321  // all assignable globals
1322  if(!in_array(SYSTEM_ROLE_ID,$rbacreview->assignedRoles($ilUser->getId())))
1323  {
1324  $ga = $rbacreview->getGlobalAssignableRoles();
1325  }
1326  else
1327  {
1328  $ga = $rbacreview->getGlobalRolesArray();
1329  }
1330  $global_assignable = array();
1331  foreach($ga as $role)
1332  {
1333  $global_assignable[] = $role['obj_id'];
1334  }
1335 
1336  $new_visible_assigned_roles = array_intersect($new_assigned,$global_assignable);
1337  $all_assigned_roles = array_intersect($assigned,$rbacreview->getGlobalRoles());
1338  $main_assigned_roles = array_diff($all_assigned_roles,$global_assignable);
1339 
1340  if(!count($new_visible_assigned_roles) and !count($main_assigned_roles))
1341  {
1342  return false;
1343  }
1344  return true;
1345  }
1346 
1347 
1348  function __showRolesTable($a_result_set,$a_from = "")
1349  {
1350  $this->checkPermission("cat_administrate_users");
1351 
1352  $tbl =& $this->__initTableGUI();
1353  $tpl =& $tbl->getTemplateObject();
1354 
1355  // SET FORMAACTION
1356  $tpl->setCurrentBlock("tbl_form_header");
1357 
1358  $this->ctrl->setParameter($this,'obj_id',$_GET['obj_id']);
1359  $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
1360  $tpl->parseCurrentBlock();
1361 
1362  // SET FOOTER BUTTONS
1363  $tpl->setVariable("COLUMN_COUNTS",4);
1364  $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.png"));
1365 
1366 // $tpl->setCurrentBlock("tbl_action_button");
1367  $tpl->setVariable("BTN_NAME","assignSave");
1368  $tpl->setVariable("BTN_VALUE",$this->lng->txt("change_assignment"));
1369  $tpl->parseCurrentBlock();
1370 
1371  $tpl->setCurrentBlock("tbl_action_row");
1372  $tpl->setVariable("TPLPATH",$this->tpl->tplPath);
1373  $tpl->parseCurrentBlock();
1374 
1375  $tmp_obj =& ilObjectFactory::getInstanceByObjId($_GET['obj_id']);
1376  $title = $this->lng->txt('role_assignment').' ('.$tmp_obj->getFullname().')';
1377 
1378  $tbl->setTitle($title,"icon_role.png",$this->lng->txt("role_assignment"));
1379  $tbl->setHeaderNames(array('',
1380  $this->lng->txt("title"),
1381  $this->lng->txt('description'),
1382  $this->lng->txt("type")));
1383  $tbl->setHeaderVars(array("",
1384  "title",
1385  "description",
1386  "type"),
1387  array("ref_id" => $this->object->getRefId(),
1388  "cmd" => "assignRoles",
1389  "obj_id" => $_GET['obj_id'],
1390  "cmdClass" => "ilobjcategorygui",
1391  "cmdNode" => $_GET["cmdNode"]));
1392  $tbl->setColumnWidth(array("4%","35%","45%","16%"));
1393 
1394  $this->set_unlimited = true;
1395  $this->__setTableGUIBasicData($tbl,$a_result_set,$a_from,true);
1396  $tbl->render();
1397 
1398  $this->tpl->setVariable("ROLES_TABLE",$tbl->tpl->get());
1399 
1400  return true;
1401  }
1402 
1403  function __showUsersTable($a_result_set,$a_from = "",$a_footer = true)
1404  {
1405  $this->checkPermission("cat_administrate_users");
1406 
1407  $tbl =& $this->__initTableGUI();
1408  $tpl =& $tbl->getTemplateObject();
1409 
1410  // SET FORMAACTION
1411  $tpl->setCurrentBlock("tbl_form_header");
1412 
1413  $this->ctrl->setParameter($this,'sort_by',$_GET['sort_by']);
1414  $this->ctrl->setParameter($this,'sort_order',$_GET['sort_order']);
1415  $this->ctrl->setParameter($this,'offset',$_GET['offset']);
1416  $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
1417  $tpl->parseCurrentBlock();
1418 
1419 
1420  if($a_footer)
1421  {
1422  // SET FOOTER BUTTONS
1423  $tpl->setVariable("COLUMN_COUNTS",6);
1424  $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.png"));
1425 
1426  $tpl->setCurrentBlock("tbl_action_button");
1427  $tpl->setVariable("BTN_NAME","deleteUser");
1428  $tpl->setVariable("BTN_VALUE",$this->lng->txt("delete"));
1429  $tpl->parseCurrentBlock();
1430 
1431  $tpl->setCurrentBlock("tbl_action_row");
1432  $tpl->setVariable("TPLPATH",$this->tpl->tplPath);
1433  $tpl->parseCurrentBlock();
1434 
1435  $tbl->setFormName('cmd');
1436  $tbl->enable('select_all');
1437  }
1438 
1439  $tbl->setTitle($this->lng->txt("users"),"icon_usr.png",$this->lng->txt("users"));
1440  $tbl->setHeaderNames(array('',
1441  $this->lng->txt("username"),
1442  $this->lng->txt("firstname"),
1443  $this->lng->txt("lastname"),
1444  $this->lng->txt('context'),
1445  $this->lng->txt('role_assignment')));
1446  $tbl->setHeaderVars(array("",
1447  "login",
1448  "firstname",
1449  "lastname",
1450  "context",
1451  "role_assignment"),
1452  array("ref_id" => $this->object->getRefId(),
1453  "cmd" => "listUsers",
1454  "cmdClass" => "ilobjcategorygui",
1455  "cmdNode" => $_GET["cmdNode"]));
1456  $tbl->setColumnWidth(array("1px","20%","20%","20%","20%","20%"));
1457  $tbl->setSelectAllCheckbox('user_ids');
1458 
1459  $this->__setTableGUIBasicData($tbl,$a_result_set,$a_from,true);
1460  $tbl->render();
1461 
1462  $this->tpl->setVariable("USERS_TABLE",$tbl->tpl->get());
1463 
1464  return true;
1465  }
1466 
1467  function __setTableGUIBasicData(&$tbl,&$result_set,$a_from = "",$a_footer = true)
1468  {
1469  global $ilUser;
1470 
1471  switch ($a_from)
1472  {
1473  case "listUsersObject":
1474  $tbl->setOrderColumn($_GET["sort_by"]);
1475  $tbl->setOrderDirection($_GET["sort_order"]);
1476  $tbl->setOffset($_GET["offset"]);
1477  $tbl->setMaxCount($this->all_users_count);
1478  $tbl->setLimit($ilUser->getPref('hits_per_page'));
1479  $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
1480  $tbl->setData($result_set);
1481  $tbl->disable('auto_sort');
1482 
1483  return true;
1484 
1485 
1486  case "assignRolesObject":
1487  $offset = $_GET["offset"];
1488  // init sort_by (unfortunatly sort_by is preset with 'title'
1489  if ($_GET["sort_by"] == "title" or empty($_GET["sort_by"]))
1490  {
1491  $_GET["sort_by"] = "login";
1492  }
1493  $order = $_GET["sort_by"];
1494  $direction = $_GET["sort_order"];
1495  break;
1496 
1497  case "clipboardObject":
1498  $offset = $_GET["offset"];
1499  $order = $_GET["sort_by"];
1500  $direction = $_GET["sort_order"];
1501  $tbl->disable("footer");
1502  break;
1503 
1504  default:
1505  $offset = $_GET["offset"];
1506  $order = $_GET["sort_by"];
1507  $direction = $_GET["sort_order"];
1508  break;
1509  }
1510 
1511  $tbl->setOrderColumn($order);
1512  $tbl->setOrderDirection($direction);
1513  $tbl->setOffset($offset);
1514  if($this->set_unlimited)
1515  {
1516  $tbl->setLimit($_GET["limit"]*100);
1517  }
1518  else
1519  {
1520  $tbl->setLimit($_GET['limit']);
1521  }
1522  $tbl->setMaxCount(count($result_set));
1523 
1524  if($a_footer)
1525  {
1526  $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
1527  }
1528  else
1529  {
1530  $tbl->disable('footer');
1531  }
1532  $tbl->setData($result_set);
1533  }
1534 
1535  function &__initTableGUI()
1536  {
1537  include_once "./Services/Table/classes/class.ilTableGUI.php";
1538 
1539  return new ilTableGUI(0,false);
1540  }
1541 
1542  function __buildFilterSelect($a_parent_ids)
1543  {
1544  $action[0] = $this->lng->txt('all_users');
1545  $action[$this->object->getRefId()] = $this->lng->txt('users').
1546  ' ('.ilObject::_lookupTitle(ilObject::_lookupObjId($this->object->getRefId())).')';
1547 
1548  foreach($a_parent_ids as $parent)
1549  {
1550  if($parent == $this->object->getRefId())
1551  {
1552  continue;
1553  }
1554  switch($parent)
1555  {
1557  $action[ilLocalUser::_getUserFolderId()] = $this->lng->txt('global_user');
1558 
1559  break;
1560 
1561  default:
1562  $action[$parent] = $this->lng->txt('users').' ('.ilObject::_lookupTitle(ilObject::_lookupObjId($parent)).')';
1563 
1564  break;
1565  }
1566  }
1567  return ilUtil::formSelect($_SESSION['filtered_users'][$this->object->getRefId()],"filter",$action,false,true);
1568  }
1569 
1570  function _goto($a_target)
1571  {
1572  global $ilAccess, $ilErr, $lng;
1573 
1574  if ($ilAccess->checkAccess("read", "", $a_target))
1575  {
1577  }
1578  else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
1579  {
1580  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
1581  ilObject::_lookupTitle(ilObject::_lookupObjId($a_target))), true);
1583  }
1584 
1585  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1586 
1587  }
1588 
1589 
1593 
1597  function editIconsObject($a_form = null)
1598  {
1599  global $tpl;
1600 
1601  $this->checkPermission('write');
1602 
1603  $this->tabs_gui->setTabActive('settings');
1604 
1605  if(!$a_form)
1606  {
1607  $a_form = $this->initIconsForm();
1608  }
1609 
1610  $tpl->setContent($a_form->getHTML());
1611  }
1612 
1613  function initIconsForm()
1614  {
1615  $this->setEditTabs("icons");
1616 
1617  include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
1618  $form = new ilPropertyFormGUI();
1619  $form->setFormAction($this->ctrl->getFormAction($this));
1620 
1621  $this->showCustomIconsEditing(1, $form);
1622 
1623  // $form->setTitle($this->lng->txt('edit_grouping'));
1624  $form->addCommandButton('updateIcons', $this->lng->txt('save'));
1625 
1626  return $form;
1627  }
1628 
1633  {
1634  $this->checkPermission('write');
1635 
1636  $form = $this->initIconsForm();
1637  if($form->checkInput())
1638  {
1639  //save custom icons
1640  if ($this->ilias->getSetting("custom_icons"))
1641  {
1642  if($_POST["cont_big_icon_delete"])
1643  {
1644  $this->object->removeBigIcon();
1645  }
1646  if($_POST["cont_small_icon_delete"])
1647  {
1648  $this->object->removeSmallIcon();
1649  }
1650  if($_POST["cont_tiny_icon_delete"])
1651  {
1652  $this->object->removeTinyIcon();
1653  }
1654  $this->object->saveIcons($_FILES["cont_big_icon"]['tmp_name'],
1655  $_FILES["cont_small_icon"]['tmp_name'], $_FILES["cont_tiny_icon"]['tmp_name']);
1656 
1657  }
1658  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
1659  $this->ctrl->redirect($this,"editIcons");
1660  }
1661 
1662  $form->setValuesByPost();
1663  $this->editIconsObject($form);
1664  }
1665 
1666 } // END class.ilObjCategoryGUI
1667 ?>
< 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
This class represents an option in a radio group.
ILIAS Setting Class.
Class ilContainerLinkListGUI.
importCancelledObject()
import cancelled
exit
Definition: login.php:54
Class ilInfoScreenGUI.
$_POST['username']
Definition: cron.php:12
importCategoriesWithRolObject()
import categories with local rol
infoScreen()
show information screen
__checkGlobalRoles($new_assigned)
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.
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
setInfo($a_info)
Set Info.
_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.
listUsersObject($show_delete=false)
global $ilCtrl
Definition: ilias.php:18
deleteTranslationsObject()
Remove translation.
setInfo($a_info)
Set Information Text.
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.
This class represents a property in a property form.
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 _gotoRepositoryNode($a_ref_id, $a_cmd="frameset")
Goto repository root.
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)
_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
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.
global $ilUser
Definition: imgupload.php:15
static getDataDir()
get data directory (outside webspace)
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.
loadFromPost()
Load values from post.
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.