ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilObjMDSettingsGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
27 {
28  protected ?ilMDSettings $md_settings = null;
30 
31  public function __construct(
32  $data,
33  int $id = 0,
34  bool $call_by_reference = true,
35  bool $prepare_output = true
36  ) {
38 
39  $this->access_service = new ilMDSettingsAccessService(
40  $this->object->getRefId(),
42  );
43 
44  $this->type = 'mds';
45  $this->lng->loadLanguageModule("meta");
46  }
47 
48  public function executeCommand(): void
49  {
50  $next_class = $this->ctrl->getNextClass($this);
51  $cmd = $this->ctrl->getCmd();
52 
53  $this->prepareOutput();
54 
55  if (
56  !$this->access_service->hasCurrentUserVisibleAccess() ||
57  !$this->access_service->hasCurrentUserReadAccess()
58  ) {
59  throw new ilPermissionException($this->lng->txt('no_permission'));
60  }
61 
62  switch ($next_class) {
63  case strtolower(ilMDCopyrightSelectionGUI::class):
64  $gui = new ilMDCopyrightSelectionGUI($this);
65  $ret = $this->ctrl->forwardCommand($gui);
66  break;
67 
68  case strtolower(ilAdvancedMDSettingsGUI::class):
69  $this->tabs_gui->setTabActive('md_advanced');
70  $adv_md = new ilAdvancedMDSettingsGUI(
72  $this->ref_id
73  );
74  $ret = $this->ctrl->forwardCommand($adv_md);
75  break;
76 
77  case strtolower(ilPermissionGUI::class):
78  $this->tabs_gui->setTabActive('perm_settings');
79 
80  $perm_gui = new ilPermissionGUI($this);
81  $ret = $this->ctrl->forwardCommand($perm_gui);
82  break;
83 
84  default:
85  $this->ctrl->redirectByClass(
86  ilMDCopyrightSelectionGUI::class,
87  'view'
88  );
89  break;
90  }
91  }
92 
93  protected function getType(): string
94  {
95  return $this->type;
96  }
97 
98  protected function getParentObjType(): string
99  {
100  return 'meta';
101  }
102 
103  public function getAdminTabs(): void
104  {
105  if (
106  $this->access_service->hasCurrentUserVisibleAccess() &&
107  $this->access_service->hasCurrentUserReadAccess()
108  ) {
109  $this->tabs_gui->addTab(
110  'md_copyright',
111  $this->lng->txt('md_copyright'),
112  $this->ctrl->getLinkTargetByClass(
113  ilMDCopyrightSelectionGUI::class,
114  'showCopyrightSettings'
115  )
116  );
117 
118  $this->tabs_gui->addTab(
119  'md_advanced',
120  $this->lng->txt('md_advanced'),
121  $this->ctrl->getLinkTargetByClass(ilAdvancedMDSettingsGUI::class, '')
122  );
123  }
124 
125  if ($this->access_service->hasCurrentUserPermissionsAccess()) {
126  $this->tabs_gui->addTab(
127  'perm_settings',
128  $this->lng->txt('perm_settings'),
129  $this->ctrl->getLinkTargetByClass(ilPermissionGUI::class, 'perm')
130  );
131  }
132  }
133 
134  protected function MDSettings(): ilMDSettings
135  {
136  if (!isset($this->md_settings)) {
137  $this->md_settings = ilMDSettings::_getInstance();
138  }
139  return $this->md_settings;
140  }
141 }
__construct( $data, int $id=0, bool $call_by_reference=true, bool $prepare_output=true)
ilMDCopyrightSelectionGUI: ilMDCopyrightUsageGUI
prepareOutput(bool $show_sub_objects=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(VocabulariesInterface $vocabularies)
Class ilObjectGUI Basic methods of all Output classes.
ilMDSettingsAccessService $access_service
ilAccessHandler $access
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.