ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilObjTalkTemplateAdministrationGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
33 {
34  public function __construct()
35  {
39  $container = $GLOBALS['DIC'];
40  $language = $container->language();
42  ->http()
43  ->wrapper()
44  ->query()
45  ->retrieve("ref_id", $container->refinery()->kindlyTo()->int());
46  parent::__construct([], $refId, true, false);
47 
48  $this->type = 'tala';
49 
50  $language->loadLanguageModule("tala");
51  $language->loadLanguageModule('etal');
52  }
53 
54  protected function supportsPageEditor(): bool
55  {
56  return false;
57  }
58 
59  public function isActiveAdministrationPanel(): bool
60  {
61  return false;
62  }
63 
64  public function setContentSubTabs(): void
65  {
66  }
67 
68  public function executeCommand(): void
69  {
70  $cmd = $this->ctrl->getCmd();
71  $next_class = $this->ctrl->getNextClass($this);
72 
73 
74  switch ($next_class) {
75  case 'ilpermissiongui':
76  parent::prepareOutput();
77  $this->tabs_gui->activateTab('perm_settings');
78  $ilPermissionGUI = new ilPermissionGUI($this);
79  $this->ctrl->forwardCommand($ilPermissionGUI);
80  break;
81  case 'ilinfoscreengui':
82  parent::prepareOutput();
83  $this->tabs_gui->activateTab('info_short');
84  $ilInfoScreenGUI = new ilInfoScreenGUI($this);
85  $this->ctrl->forwardCommand($ilInfoScreenGUI);
86  break;
87  case strtolower(ilObjTalkTemplateGUI::class):
88  $ilTalkTemplateGUI = new ilObjTalkTemplateGUI();
89  $ilTalkTemplateGUI->setAdminMode($this->admin_mode);
90  $this->ctrl->setParameter(
91  $this,
92  'ref_id',
94  );
95  $this->tabs->setBackTarget(
96  $this->lng->txt('obj_tala'),
97  $this->ctrl->getLinkTarget($this, 'view')
98  );
99  $this->ctrl->clearParameters($this);
100  $this->ctrl->forwardCommand($ilTalkTemplateGUI);
101  break;
102  default:
103  parent::executeCommand();
104  }
105  }
106 
110  protected function setTitleAndDescription(): void
111  {
112  # all possible create permissions
113  parent::setTitleAndDescription();
114  $this->tpl->setTitle($this->lng->txt("objs_tala"));
115  $this->tpl->setDescription($this->lng->txt("objs_tala"));
116 
117  $this->tpl->setTitleIcon("", $this->lng->txt("obj_" . $this->object->getType()));
118  }
119 
120  protected function showPossibleSubObjects(): void
121  {
122  $subtypes = $this->getCreatableObjectTypes();
123  if (empty($subtypes)) {
124  return;
125  }
127  [$this->buildGroup(
128  self::class,
129  array_keys($subtypes),
130  $this->lng->txt('other'),
131  $subtypes
132  )]
133  );
134  $gui->render();
135  }
136 
137  protected function getCreatableObjectTypes(): array
138  {
139  $subtypes = $this->obj_definition->getCreatableSubObjects(
140  $this->object->getType(),
142  $this->object->getRefId()
143  );
144  unset($subtypes[ilObjEmployeeTalkSeries::TYPE]);
145 
146  return array_filter(
147  $subtypes,
148  fn($key) => $this->access->checkAccess('create_' . $key, '', $this->ref_id, $this->type),
149  ARRAY_FILTER_USE_KEY
150  );
151  }
152 
153  public function viewObject(): void
154  {
155  $this->tabs_gui->activateTab('view_content');
156 
157  if (!$this->rbacsystem->checkAccess("read", $this->getRefId())) {
158  if ($this->rbacsystem->checkAccess("visible", $this->getRefId())) {
159  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("msg_no_perm_read"));
160  $this->ctrl->redirectByClass(strtolower(ilInfoScreenGUI::class), '');
161  }
162 
163  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"), $this->ilias->error_obj->WARNING);
164  }
165 
170  if (!in_array(SYSTEM_ROLE_ID, $this->rbacreview->assignedRoles($this->user->getId()), true)) {
171  $this->tpl->setOnScreenMessage(
173  $this->lng->txt("tala_no_content_without_admin_info")
174  );
175  }
176 
177  parent::renderObject();
178  }
179 
187  {
188  $this->container_user_filter = new ilContainerUserFilter([
190  ]);
191  return new ilContainerByTypeContentGUI(
192  $this,
193  $this->getItemPresentation()
194  );
195  }
196 
201  public function returnObject(): void
202  {
203  $this->viewObject();
204  }
205 
206  protected function getTabs(): void
207  {
208  $read_access_ref_id = $this->rbacsystem->checkAccess('visible,read', $this->object->getRefId());
209  if ($read_access_ref_id) {
210  $this->tabs_gui->addTab('view_content', $this->lng->txt("content"), $this->ctrl->getLinkTarget($this, "view"));
211  $this->tabs_gui->addTab(
212  "info_short",
213  $this->lng->txt('tab_info'),
214  $this->ctrl->getLinkTargetByClass([
215  strtolower(self::class),
216  strtolower(ilInfoScreenGUI::class)
217  ], "showSummary")
218  );
219  }
220  if ($this->tree->getSavedNodeData($this->object->getRefId())) {
221  $this->tabs_gui->addTarget('trash', $this->ctrl->getLinkTarget($this, 'trash'), 'trash', get_class($this));
222  }
223  parent::getTabs();
224  }
225 
229  public function getAdminTabs(): void
230  {
231  $this->getTabs();
232  }
233 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const SYSTEM_ROLE_ID
Definition: constants.php:29
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$refId
Definition: xapitoken.php:58
$container
Definition: wac.php:36
Parent class of all container content GUIs.
getItemPresentation( $include_empty_blocks=true, ?string $lang=null)
Class ilObjTalkTemplateGUI.
$GLOBALS["DIC"]
Definition: wac.php:53
Class ilObjForumAdministration.
Class ilObjTalkTemplateAdministrationGUI GUI class.
getContentGUI()
Filter the view by talk templates because the talk series objects are also children of the talk templ...
Render add new item selector.
__construct(Container $dic, ilPlugin $plugin)
ILIAS Container InternalGUIService $gui
buildGroup(string $create_target_class, array $obj_types_in_group, string $title, array $subtypes)
returnObject()
Not completely sure why this is necessary, after creation of talk templates the redirect leads here...