ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjOrgUnitGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 require_once("./Services/Container/classes/class.ilContainerGUI.php");
4 require_once("./Services/AccessControl/classes/class.ilObjRole.php");
5 require_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
6 require_once("./Services/AccessControl/classes/class.ilPermissionGUI.php");
7 require_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
8 require_once("./Services/User/classes/class.ilUserAccountSettings.php");
9 require_once("./Services/Tracking/classes/class.ilLearningProgressGUI.php");
10 require_once("./Services/User/classes/class.ilObjUserFolderGUI.php");
11 require_once("./Services/Tree/classes/class.ilTree.php");
12 require_once("./Modules/OrgUnit/classes/Staff/class.ilOrgUnitStaffGUI.php");
13 require_once("./Modules/OrgUnit/classes/LocalUser/class.ilLocalUserGUI.php");
14 require_once("./Modules/OrgUnit/classes/Translation/class.ilTranslationGUI.php");
15 require_once("./Modules/OrgUnit/classes/ExtId/class.ilExtIdGUI.php");
16 require_once("./Modules/OrgUnit/classes/SimpleImport/class.ilOrgUnitSimpleImportGUI.php");
17 require_once("./Modules/OrgUnit/classes/SimpleUserImport/class.ilOrgUnitSimpleUserImportGUI.php");
18 require_once("./Modules/OrgUnit/classes/class.ilOrgUnitImporter.php");
19 require_once("./Services/Object/classes/class.ilObjectAddNewItemGUI.php");
20 require_once("class.ilOrgUnitExplorerGUI.php");
21 require_once("class.ilOrgUnitExportGUI.php");
22 require_once("class.ilObjOrgUnitAccess.php");
23 require_once("class.ilObjOrgUnitTree.php");
24 require_once(dirname(__FILE__) . '/Types/class.ilOrgUnitTypeGUI.php');
25 require_once(dirname(__FILE__) . '/Settings/class.ilObjOrgUnitSettingsFormGUI.php');
26 require_once('./Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
27 require_once('./Services/Container/classes/class.ilContainerByTypeContentGUI.php');
28 
47 
51  public $ctrl;
55  public $tpl;
59  public $tabs_gui;
63  protected $ilAccess;
67  protected $toolbar;
71  protected $ilLocator;
75  public $tree;
79  public $object;
83  protected $ilLog;
87  public $ilias;
88 
89 
90  public function __construct() {
91  global $tpl, $ilCtrl, $ilAccess, $ilToolbar, $ilLocator, $tree, $lng, $ilLog, $ilias;
92  parent::ilContainerGUI(array(), $_GET["ref_id"], true, false);
93 
94  $this->tpl = $tpl;
95  $this->ctrl = $ilCtrl;
96  $this->ilAccess = $ilAccess;
97  $this->ilLocator = $ilLocator;
98  $this->tree = $tree;
99  $this->toolbar = $ilToolbar;
100  $this->ilLog = $ilLog;
101  $this->ilias = $ilias;
102 
103  $lng->loadLanguageModule("orgu");
104  $this->tpl->addCss('./Modules/OrgUnit/templates/default/orgu.css');
105  }
106 
107 
108  public function executeCommand() {
109  $cmd = $this->ctrl->getCmd();
110  $next_class = $this->ctrl->getNextClass($this);
112 
113  //Otherwise move-Objects would not work
114  if ($cmd != "cut") {
115  $this->showTree();
116  }
117 
118  switch ($next_class) {
119  case "illocalusergui":
121  ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
122  $this->ctrl->redirect($this);
123  }
124  $this->tabs_gui->setTabActive('administrate_users');
125  $ilLocalUserGUI = new ilLocalUserGUI($this);
126  $this->ctrl->forwardCommand($ilLocalUserGUI);
127  break;
128  case "ilorgunitsimpleimportgui":
129  $this->tabs_gui->setTabActive("view_content");
130  $ilOrgUnitSimpleImportGUI = new ilOrgUnitSimpleImportGUI($this);
131  $this->ctrl->forwardCommand($ilOrgUnitSimpleImportGUI);
132  $this->tabs_gui->clearTargets();
133  $this->tabs_gui->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTarget($this));
134  break;
135  case "ilorgunitsimpleuserimportgui":
136  $this->tabs_gui->setTabActive("view_content");
137  $ilOrgUnitSimpleUserImportGUI = new ilOrgUnitSimpleUserImportGUI($this);
138  $this->ctrl->forwardCommand($ilOrgUnitSimpleUserImportGUI);
139  $this->tabs_gui->clearTargets();
140  $this->tabs_gui->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTarget($this));
141  break;
142  case "ilorgunitstaffgui":
143  case "ilrepositorysearchgui":
144  $this->tabs_gui->setTabActive('orgu_staff');
145  $ilOrgUnitStaffGUI = new ilOrgUnitStaffGUI($this);
146  $this->ctrl->forwardCommand($ilOrgUnitStaffGUI);
147  break;
148  case "ilobjusergui":
149  switch ($cmd) {
150  case "create":
151  $ilObjUserGUI = new ilObjUserGUI("", (int)$_GET['ref_id'], true, false);
152  $ilObjUserGUI->setCreationMode(true);
153  $this->ctrl->forwardCommand($ilObjUserGUI);
154  $this->tabs_gui->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTargetByClass("illocalusergui", 'index'));
155  break;
156  case "save":
157  $ilObjUserGUI = new ilObjUserGUI("", $_GET['ref_id'], true, false);
158  $ilObjUserGUI->setCreationMode(true);
159  $this->ctrl->forwardCommand($ilObjUserGUI);
160  $this->tabs_gui->clearTargets();
161  $this->tabs_gui->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTargetByClass("illocalusergui", 'index'));
162  break;
163  case "view":
164  case "update":
165  $ilObjUserGUI = new ilObjUserGUI("", (int)$_GET['obj_id'], false, false);
166  $ilObjUserGUI->setCreationMode(false);
167  $this->ctrl->forwardCommand($ilObjUserGUI);
168  $this->tabs_gui->clearTargets();
169  $this->tabs_gui->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTargetByClass("illocalusergui", 'index'));
170  break;
171  case "cancel":
172  $this->ctrl->redirectByClass("illocalusergui", "index");
173  break;
174  }
175  break;
176  case "ilobjuserfoldergui":
177  switch ($cmd) {
178  case "view":
179  $this->ctrl->redirectByClass("illocalusergui", "index");
180  break;
181  default:
182  $ilObjUserFolderGUI = new ilObjUserFolderGUI("", (int)$_GET['ref_id'], true, false);
183  $ilObjUserFolderGUI->setUserOwnerId((int)$_GET['ref_id']);
184  $ilObjUserFolderGUI->setCreationMode(true);
185  $this->ctrl->forwardCommand($ilObjUserFolderGUI);
186  $this->tabs_gui->clearTargets();
187  $this->tabs_gui->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTargetByClass("illocalusergui", 'index'));
188  break;
189  }
190  break;
191  case "ilinfoscreengui":
192  $this->tabs_gui->setTabActive("info_short");
193  if (!$this->ilAccess->checkAccess("read", "", $this->ref_id) AND !$this->ilAccess->checkAccess("visible", "", $this->ref_id)) {
194  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"), $this->ilias->error_obj->MESSAGE);
195  }
196  $info = new ilInfoScreenGUI($this);
197  $this->parseInfoScreen($info);
198  $this->ctrl->forwardCommand($info);
199 
200  // I guess this is how it was supposed to work, but it doesn't... it won't respect our sub-id and sub-type when creating the objects!
201  // So we reimplemented the stuff in the method parseInfoScreen()
202  // $info = new ilInfoScreenGUI($this);
203  // $amd_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_INFO, 'orgu', $this->object->getId(), 'orgu_type', $this->object->getOrgUnitTypeId());
204  // $amd_gui->setInfoObject($info);
205  // $amd_gui->setSelectedOnly(true);
206  // $amd_gui->parse();
207  // $this->ctrl->forwardCommand($info);
208  break;
209  case 'ilpermissiongui':
210  $this->tabs_gui->setTabActive('perm_settings');
211  $ilPermissionGUI = new ilPermissionGUI($this);
212  $this->ctrl->forwardCommand($ilPermissionGUI);
213  break;
214  case "ilcommonactiondispatchergui":
215  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
217  $this->ctrl->forwardCommand($gui);
218  break;
219  case 'illearningprogressgui':
220  case 'illplistofprogressgui':
221  $this->tabs_gui->clearTargets();
222  $this->tabs_gui->setBackTarget($this->lng->txt('backto_staff'), $this->ctrl->getLinkTargetByClass("ilOrgUnitStaffGUI", 'showStaff'));
223  if (!ilObjOrgUnitAccess::_checkAccessToUserLearningProgress($this->object->getRefid(), $_GET['obj_id'])) {
224  ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
225  $this->ctrl->redirectByClass("ilOrgUnitStaffGUI", "showStaff");
226  }
227  $this->ctrl->saveParameterByClass("illearningprogressgui", "obj_id");
228  $this->ctrl->saveParameterByClass("illearningprogressgui", "recursive");
229  include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
230  $new_gui =& new ilLearningProgressGUI(ilLearningProgressGUI::LP_CONTEXT_ORG_UNIT, $_GET["ref_id"], $_GET['obj_id']);
231  $this->ctrl->forwardCommand($new_gui);
232  break;
233  case 'ilorgunitexportgui':
234  $this->tabs_gui->setTabActive('export');;
235  $ilOrgUnitExportGUI = new ilOrgUnitExportGUI($this);
236  $ilOrgUnitExportGUI->addFormat('xml');
237  $this->ctrl->forwardCommand($ilOrgUnitExportGUI);
238  break;
239  case 'iltranslationgui':
240  $this->tabs_gui->setTabActive("settings");
241  $this->setSubTabsSettings('edit_translations');
242 
243  $ilTranslationGui = new ilTranslationGUI($this);
244  $this->ctrl->forwardCommand($ilTranslationGui);
245  break;
246  case 'ilorgunittypegui':
247  $this->tabs_gui->setTabActive('orgu_types');
248  $types_gui = new ilOrgUnitTypeGUI($this);
249  $this->ctrl->forwardCommand($types_gui);
250  break;
251  default:
252  switch ($cmd) {
253  case '':
254  case 'view':
255  case 'render':
256  case 'cancel':
257  case 'cancelDelete':
258  $this->view();
259  break;
260  case 'performPaste':
261  $this->performPaste();
262  break;
263  case 'paste':
264  $this->performPaste();
265  break;
266  case 'performPasteIntoMultipleObjects':
268  break;
269  case 'create':
271  break;
272  case 'save':
274  break;
275  case 'delete':
276  $this->tabs_gui->clearTargets();
277  $this->tabs_gui->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTarget($this));
279  break;
280  case 'confirmedDelete':
282  break;
283  case 'cut':
284  $this->tabs_gui->clearTargets();
285  $this->tabs_gui->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTarget($this));
287  break;
288  case 'clear':
290  break;
291  case 'enableAdministrationPanel':
293  break;
294  case 'disableAdministrationPanel':
296  break;
297  case 'getAsynchItemList':
299  break;
300  case 'editSettings':
301  $this->tabs_gui->setTabActive("settings");
302  $this->setSubTabsSettings('edit_settings');
303  $this->editSettings();
304  break;
305  case 'updateSettings':
306  $this->tabs_gui->setTabActive("settings");
307  $this->setSubTabsSettings('edit_settings');
308  $this->updateSettings();
309  break;
310  case 'editAdvancedSettings':
311  $this->tabs_gui->setTabActive("settings");
312  $this->setSubTabsSettings('edit_advanced_settings');
313  $this->editAdvancedSettings();
314  break;
315  case 'updateAdvancedSettings':
316  $this->tabs_gui->setTabActive("settings");
317  $this->setSubTabsSettings('edit_advanced_settings');
318  $this->updateAdvancedSettings();
319  break;
320  }
321  break;
322  }
323  }
324 
325 
326  public function view() {
327  if (!$this->ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
328  if ($this->ilAccess->checkAccess("visible", "", $_GET["ref_id"])) {
329  ilUtil::sendFailure($this->lng->txt("msg_no_perm_read"));
330  $this->ctrl->redirectByClass('ilinfoscreengui', '');
331  }
332 
333  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"), $this->ilias->error_obj->WARNING);
334  }
335 
337  $this->tabs_gui->setTabActive("view_content");
338  $this->tabs_gui->removeSubTab("page_editor");
339  $this->tabs_gui->removeSubTab("ordering"); // Mantis 0014728
340  if ($this->ilAccess->checkAccess("write", "", $_GET["ref_id"]) AND $this->object->getRefId() == ilObjOrgUnit::getRootOrgRefId()) {
341  $this->toolbar->addButton($this->lng->txt("simple_import"), $this->ctrl->getLinkTargetByClass("ilOrgUnitSimpleImportGUI", "importScreen"));
342  $this->toolbar->addButton($this->lng->txt("simple_user_import"), $this->ctrl->getLinkTargetByClass("ilOrgUnitSimpleUserImportGUI", "userImportScreen"));
343  }
344  }
345 
346 
357  protected function initCreationForms($a_new_type) {
358  $forms = array(
359  self::CFORM_NEW => $this->initCreateForm($a_new_type),
360  self::CFORM_IMPORT => $this->initImportForm($a_new_type),
361  );
362 
363  return $forms;
364  }
365 
366 
367  public function showPossibleSubObjects() {
368  $gui = new ilObjectAddNewItemGUI($this->object->getRefId());
370  $gui->setCreationUrl("ilias.php?ref_id=" . $_GET["ref_id"] . "&admin_mode=settings&cmd=create&baseClass=ilAdministrationGUI");
371  $gui->render();
372  }
373 
374 
375  public function showTree() {
376  $tree = new ilOrgUnitExplorerGUI("orgu_explorer", "ilObjOrgUnitGUI", "showTree", new ilTree(1));
377  $tree->setTypeWhiteList(array( "orgu" ));
378  if (!$tree->handleCommand()) {
379  $this->tpl->setLeftNavContent($tree->getHTML());
380  }
381  $this->ctrl->setParameterByClass("ilObjOrgUnitGUI", "ref_id", $_GET["ref_id"]);
382  }
383 
384 
388  public function setTitleAndDescription() {
389  # all possible create permissions
390  //$possible_ops_ids = $rbacreview->getOperationsByTypeAndClass('orgu', 'create');
392  if ($this->object->getTitle() == "__OrgUnitAdministration") {
393  $this->tpl->setTitle($this->lng->txt("objs_orgu"));
394  $this->tpl->setDescription($this->lng->txt("objs_orgu"));
395  }
396 
397  // Check for custom icon of type
398  if ($this->ilias->getSetting('custom_icons')) {
399  $icons_cache = ilObjOrgUnit::getIconsCache();
400  $icon_file = (isset($icons_cache[$this->object->getId()])) ? $icons_cache[$this->object->getId()] : '';
401  if ($icon_file) {
402  $this->tpl->setTitleIcon($icon_file, $this->lng->txt("obj_" . $this->object->getType()));
403  }
404  }
405  }
406 
407 
408  protected function addAdminLocatorItems() {
409  $path = $this->tree->getPathFull($_GET["ref_id"], ilObjOrgUnit::getRootOrgRefId());
410  // add item for each node on path
411  foreach ((array)$path as $key => $row) {
412  if ($row["title"] == "__OrgUnitAdministration") {
413  $row["title"] = $this->lng->txt("objs_orgu");
414  }
415  $this->ctrl->setParameterByClass("ilobjorgunitgui", "ref_id", $row["child"]);
416  $this->ilLocator->addItem($row["title"], $this->ctrl->getLinkTargetByClass("ilobjorgunitgui", "view"), ilFrameTargetInfo::_getFrame("MainContent"), $row["child"]);
417  $this->ctrl->setParameterByClass("ilobjorgunitgui", "ref_id", $_GET["ref_id"]);
418  }
419  }
420 
421 
426  protected function redirectToRefId($a_ref_id, $a_cmd = "") {
427  $obj_type = ilObject::_lookupType($a_ref_id, true);
428  if ($obj_type != "orgu") {
429  parent::redirectToRefId($a_ref_id, $a_cmd);
430  } else {
431  $this->ctrl->setParameterByClass("ilObjOrgUnitGUI", "ref_id", $a_ref_id);
432  $this->ctrl->redirectByClass("ilObjOrgUnitGUI", $a_cmd);
433  }
434  }
435 
436 
440  public function getTabs(ilTabsGUI $tabs_gui = NULL) {
441  if ($this->ilAccess->checkAccess('read', '', $this->object->getRefId())) {
442  $this->tabs_gui->addTab("view_content", $this->lng->txt("content"), $this->ctrl->getLinkTarget($this, ""));
443  $this->tabs_gui->addTab("info_short", "Info", $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"));
444  }
445 
446  // Tabs for OrgUnits exclusive root!
447  if ($this->object->getRefId() != ilObjOrgUnit::getRootOrgRefId()) {
448  if (ilObjOrgUnitAccess::_checkAccessStaff($this->object->getRefId())) {
449  $this->tabs_gui->addTab("orgu_staff", $this->lng->txt("orgu_staff"), $this->ctrl->getLinkTargetByClass("ilOrgUnitStaffGUI", "showStaff"));
450  }
451  if ($this->ilAccess->checkAccess('write', '', $this->object->getRefId())) {
452  $this->tabs_gui->addTab("settings", $this->lng->txt("settings"), $this->ctrl->getLinkTarget($this, 'editSettings'));
453  }
454  if (ilObjOrgUnitAccess::_checkAccessAdministrateUsers($this->object->getRefId())) {
455  $this->tabs_gui->addTab("administrate_users", $this->lng->txt("administrate_users"), $this->ctrl->getLinkTargetByClass("ilLocalUserGUI", "index"));
456  }
457  }
458 
459  if ($this->ilAccess->checkAccess('write', '', $this->object->getRefId())) {
460  $this->tabs_gui->addTarget('export', $this->ctrl->getLinkTargetByClass('ilorgunitexportgui', ''), 'export', 'ilorgunitexportgui');
461 
462  // Add OrgUnit types tab
463  if ($this->object->getRefId() == ilObjOrgUnit::getRootOrgRefId()) {
464  $this->tabs_gui->addTab('orgu_types', $this->lng->txt('orgu_types'), $this->ctrl->getLinkTargetByClass('ilOrgUnitTypeGUI'));
465  }
466  }
467  parent::getTabs($this->tabs_gui);
468  }
469 
470 
474  protected function setSubTabsSettings($active_tab_id) {
475  $next_class = $this->ctrl->getNextClass($this);
476  $cmd = $this->ctrl->getCmd();
477  $this->tabs_gui->addSubTab('edit_settings', $this->lng->txt('settings'), $this->ctrl->getLinkTarget($this, 'editSettings'));
478  $this->tabs_gui->addSubTab("edit_translations", $this->lng->txt("obj_multilinguality"), $this->ctrl->getLinkTargetByClass("iltranslationgui", "editTranslations"));
479 
480  $ilOrgUnitType = $this->object->getOrgUnitType();
481  if ($ilOrgUnitType instanceof ilOrgUnitType) {
482  if (count($ilOrgUnitType->getAssignedAdvancedMDRecords(true))) {
483  $this->tabs_gui->addSubTab('edit_advanced_settings', $this->lng->txt('orgu_adv_settings'), $this->ctrl->getLinkTarget($this, 'editAdvancedSettings'));
484  }
485  }
486 
487  $this->tabs_gui->setSubTabActive($active_tab_id);
488  switch ($next_class) {
489  case 'iltranslationgui':
490  $this->tabs_gui->setSubTabActive("edit_translations");
491  break;
492  case '':
493  switch ($cmd) {
494  case 'editSettings':
495  $this->tabs_gui->setSubTabActive('edit_settings');
496  break;
497  case 'editAdvancedSettings':
498  case 'updateAdvancedSettings':
499  $this->tabs_gui->setSubTabActive('edit_advanced_settings');
500  break;
501  }
502  break;
503  }
504 
505  return;
506  }
507 
508 
514  protected function initAdvancedSettingsForm() {
515  $form = new ilPropertyFormGUI();
516  $form->setFormAction($this->ctrl->getFormAction($this));
517  $form->addCommandButton('updateAdvancedSettings', $this->lng->txt('save'));
518  $form->addCommandButton('editSettings', $this->lng->txt('cancel'));
519 
520  return $form;
521  }
522 
523 
527  protected function editAdvancedSettings() {
528  if (!$this->ilAccess->checkAccess("write", "", $this->ref_id)) {
529  ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
530  $this->ctrl->redirect($this);
531  }
532  $form = $this->initAdvancedSettingsForm();
533  $gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_EDITOR, 'orgu', $this->object->getId(), 'orgu_type', $this->object->getOrgUnitTypeId());
534  $gui->setPropertyForm($form);
535  $gui->setSelectedOnly(true);
536  $gui->parse();
537  $this->tpl->setContent($form->getHTML());
538  }
539 
540 
544  protected function updateAdvancedSettings() {
545  if (!$this->ilAccess->checkAccess("write", "", $this->ref_id)) {
546  ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
547  $this->ctrl->redirect($this);
548  }
549  $form = $this->initAdvancedSettingsForm();
550  $gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_EDITOR, 'orgu', $this->object->getId(), 'orgu_type', $this->object->getOrgUnitTypeId());
551  $gui->setPropertyForm($form);
552  $gui->setSelectedOnly(true);
553  $form->checkInput();
554  $gui->parse();
555  if ($gui->importEditFormPostValues()) {
556  $gui->writeEditForm();
557  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
558  $this->ctrl->redirect($this, 'editAdvancedSettings');
559  } else {
560  $this->tpl->setContent($form->getHTML());
561  }
562  }
563 
564 
570  protected function parseInfoScreen(ilInfoScreenGUI $info) {
571  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
572  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php');
573  include_once('Services/ADT/classes/class.ilADTFactory.php');
574 
575  $type = $this->object->getOrgUnitType();
576  if (!$type) {
577  return;
578  }
579  $assigned_record_ids = $type->getAssignedAdvancedMDRecordIds();
580 
581  foreach (ilAdvancedMDValues::getInstancesForObjectId($this->object->getId(), 'orgu') as $record_id => $a_values) {
582  // Skip record ids not assigned to the type
583  if (!in_array($record_id, $assigned_record_ids)) {
584  continue;
585  }
586 
587  // Note that we have to do this because with the instances above the sub-type and sub-id are missing...
588  $a_values = new ilAdvancedMDValues($record_id, $this->object->getId(), 'orgu_type', $this->object->getOrgUnitTypeId());
589 
590  // this correctly binds group and definitions
591  $a_values->read();
592 
593  $info->addSection(ilAdvancedMDRecord::_lookupTitle($record_id));
594 
595  $defs = $a_values->getDefinitions();
596  foreach ($a_values->getADTGroup()->getElements() as $element_id => $element) {
597  if (!$element->isNull()) {
598  $info->addProperty($defs[$element_id]->getTitle(), ilADTFactory::getInstance()->getPresentationBridgeForInstance($element)
599  ->getHTML());
600  }
601  }
602  }
603  }
604 
605 
606  public function editSettings() {
607  if (!$this->ilAccess->checkAccess("write", "", $this->ref_id)) {
608  ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
609  $this->ctrl->redirect($this);
610  }
611  $form = new ilObjOrgUnitSettingsFormGUI($this, $this->object);
612  $this->tpl->setContent($form->getHTML());
613  }
614 
615 
616  public function updateSettings() {
617  if (!$this->ilAccess->checkAccess("write", "", $this->ref_id)) {
618  ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
619  $this->ctrl->redirect($this);
620  }
621  $form = new ilObjOrgUnitSettingsFormGUI($this, $this->object);
622  if ($form->saveObject()) {
623  ilUtil::sendSuccess($this->lng->txt('msg_obj_modified'), true);
624  $this->ctrl->redirect($this, 'editSettings');
625  } else {
626  $this->tpl->setContent($form->getHTML());
627  }
628  }
629 
630 
631  public function showAdministrationPanel($tpl) {
633  //an ugly encapsulation violation in order to remove the "verknüpfen"/"link" and copy button.
635  if (!$toolbar = $tpl->admin_panel_commands_toolbar) {
636  return;
637  }
638  if (is_array($toolbar->items)) {
639  foreach ($toolbar->items as $key => $item) {
640  if ($item["cmd"] == "link" || $item["cmd"] == "copy") {
641  unset($toolbar->items[$key]);
642  }
643  }
644  }
645  }
646 
647 
648  public static function _goto($ref_id) {
649  global $ilCtrl;
650  $ilCtrl->initBaseClass("ilAdministrationGUI");
651  $ilCtrl->setTargetScript("ilias.php");
652  $ilCtrl->setParameterByClass("ilObjOrgUnitGUI", "ref_id", $ref_id);
653  $ilCtrl->setParameterByClass("ilObjOrgUnitGUI", "admin_mode", "settings");
654  $ilCtrl->redirectByClass(array( "ilAdministrationGUI", "ilObjOrgUnitGUI" ), "view");
655  }
656 
657 
658  protected function getTreeSelectorGUI($cmd) {
659  global $tree;
660  $explorer = new ilOrgUnitExplorerGUI("rep_exp_sel", $this, "showPasteTree", $tree);
661  $explorer->setAjax(false);
662  $explorer->setSelectMode('nodes[]', false);
663 
664  return $explorer;
665  }
666 
667 
671  public function getAdminTabs(ilTabsGUI $tabs_gui) {
672  $this->getTabs($tabs_gui);
673  }
674 
675 
679  public function performPaste() {
680 
681  if (!in_array($_SESSION['clipboard']['cmd'], array( 'cut' ))) {
682  $message = __METHOD__ . ": cmd was not 'cut' ; may be a hack attempt!";
683  $this->ilias->raiseError($message, $this->ilias->error_obj->WARNING);
684  }
685  if ($_SESSION['clipboard']['cmd'] == 'cut') {
686  if (isset($_GET['ref_id']) && (int)$_GET['ref_id']) {
687  $_POST['nodes'] = array( $_GET['ref_id'] );
689  }
690  }
691  $this->ctrl->returnToParent($this);
692  }
693 
694 
699  }
700 
701  //
702  // METHODS for local user administration.
703  //
708  public function __initTableGUI() {
709  return parent::__initTableGUI();
710  }
711 
712 
717  public function __setTableGUIBasicData($tbl, $a_result_set, $a_from, $a_form) {
718  return parent::__setTableGUIBasicData($tbl, $a_result_set, $a_from, $a_form);
719  }
720 }
721 
722 ?>