ILIAS  release_8 Revision v8.24
class.ilObjTalkTemplateGUI.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
22
35{
36 public function __construct()
37 {
41 $container = $GLOBALS['DIC'];
42 $lng = $container->language();
44 ->http()
45 ->wrapper()
46 ->query()
47 ->retrieve("ref_id", $container->refinery()->kindlyTo()->int());
48 parent::__construct([], $refId, true, false);
49
50
51 $this->type = 'talt';
52
53 $lng->loadLanguageModule("etal");
54 $lng->loadLanguageModule("meta");
55 }
56
57 public function executeCommand(): void
58 {
59 $cmd = $this->ctrl->getCmd();
60 $next_class = $this->ctrl->getNextClass($this);
61
62 if (!$next_class && ($cmd === 'create' || $cmd === 'save')) {
63 $this->setCreationMode();
64 }
65
66 switch ($next_class) {
67 case 'ilinfoscreengui':
68 parent::prepareOutput();
69 $this->tabs_gui->activateTab('info_short');
70 $ilInfoScreenGUI = new ilInfoScreenGUI($this);
71 $this->ctrl->forwardCommand($ilInfoScreenGUI);
72 break;
73 default:
74 parent::executeCommand();
75 }
76 }
77
78 public function viewObject(): void
79 {
80 $this->tabs_gui->activateTab('view_content');
81
83 $md = new ilAdvancedMDRecordGUI(
85 $this->object->getType(),
86 $this->object->getId(),
87 'etal',
88 0,
89 false
90 );
91 $md->setPropertyForm($form);
92 $md->parse();
93
94 // this is necessary to disable the md fields
95 foreach ($form->getInputItemsRecursive() as $item) {
96 if ($item instanceof ilCombinationInputGUI) {
97 $item->__call('setValue', ['']);
98 $item->__call('setDisabled', [true]);
99 }
100 if (method_exists($item, 'setDisabled')) {
102 $item->setDisabled(true);
103 }
104 }
105
106 $this->tpl->setContent($form->getHTML());
107 }
108
109 protected function initEditForm(): ilPropertyFormGUI
110 {
111 $form = parent::initEditForm();
112 $form->addCommandButton("view", $this->lng->txt("cancel"));
113 return $form;
114 }
115
116 protected function initEditCustomForm(ilPropertyFormGUI $a_form): void
117 {
118 $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'activation_online');
119 $online->setInfo($this->lng->txt('talt_activation_online_info'));
120 $a_form->addItem($online);
121
122 parent::initEditCustomForm($a_form);
123 }
124
125 protected function getEditFormCustomValues(array &$a_values): void
126 {
127 $a_values['activation_online'] = !boolval($this->object->getOfflineStatus());
128
129 parent::getEditFormCustomValues($a_values);
130 }
131
133 {
134 $header = new ilFormSectionHeaderGUI();
135 $header->setParentForm($form);
136 $header->setTitle("Metadata");
137
138 $md = $this->initMetaDataForm($form);
139 $md->parse();
140
141 parent::addExternalEditFormCustom($form);
142 }
143
144 protected function updateCustom(ilPropertyFormGUI $a_form): void
145 {
146 $this->object->setOfflineStatus(!boolval($a_form->getInput('activation_online')));
147
148 $md = $this->initMetaDataForm($a_form);
149 $md->saveSelection();
150
151 parent::updateCustom($a_form);
152 }
153
157 public function infoScreenObject(): void
158 {
159 $this->ctrl->redirectByClass(strtolower(ilInfoScreenGUI::class), "showSummary");
160 }
161
162 protected function getTabs(): void
163 {
164 $read_access_ref_id = $this->rbacsystem->checkAccess('visible,read', $this->object->getRefId());
165 if ($read_access_ref_id) {
166 $this->tabs_gui->addTab('view_content', $this->lng->txt("content"), $this->ctrl->getLinkTarget($this, "view"));
167 $this->tabs_gui->addTab("info_short", "Info", $this->ctrl->getLinkTargetByClass(strtolower(ilInfoScreenGUI::class), "showSummary"));
168 }
169
170 if ($this->rbacsystem->checkAccess('write', $this->object->getRefId(), $this->type)) {
171 $this->tabs_gui->addTab('settings', $this->lng->txt("settings"), $this->ctrl->getLinkTarget($this, "edit"));
172 }
173 }
174
175 protected function initCreationForms(string $new_type): array
176 {
177 return [
178 self::CFORM_NEW => $this->initCreateForm($new_type)
179 ];
180 }
181
182 public function getAdminTabs(): void
183 {
184 $this->getTabs();
185 }
186
187 protected function addAdminLocatorItems(bool $do_not_add_object = false): void
188 {
189 parent::addAdminLocatorItems(true);
190
191 $this->ctrl->setParameterByClass(
192 strtolower(ilObjTalkTemplateAdministrationGUI::class),
193 'ref_id',
195 );
196 $this->locator->addItem(
197 $this->lng->txt('obj_tala'),
198 $this->ctrl->getLinkTargetByClass(
199 ilObjTalkTemplateAdministrationGUI::class,
200 ControlFlowCommand::INDEX
201 )
202 );
203 $this->ctrl->clearParameterByClass(
204 strtolower(ilObjTalkTemplateAdministrationGUI::class),
205 'ref_id'
206 );
207
208 $this->locator->addItem(
210 ilObject::_lookupObjId($this->object->getRefId())
211 ),
212 $this->ctrl->getLinkTargetByClass([
213 strtolower(ilAdministrationGUI::class),
214 strtolower(ilObjTalkTemplateAdministrationGUI::class),
215 strtolower(self::class),
216 ], ControlFlowCommand::INDEX)
217 );
218 }
219
221 {
222 $md = new ilAdvancedMDRecordGUI(
224 $this->object->getType(),
225 $this->object->getId(),
226 "etal",
227 0,
228 false
229 );
230 $md->setRefId($this->object->getRefId());
231 $md->setPropertyForm($form);
232 return $md;
233 }
234
235 public static function _goto(string $refId): void
236 {
240 $container = $GLOBALS['DIC'];
241 if (!ilObject::_exists((int) $refId, true)) {
242 $container["tpl"]->setOnScreenMessage(
243 'failure',
244 $container->language()->txt("permission_denied"),
245 true
246 );
247 $container->ctrl()->redirectByClass(ilDashboardGUI::class, "");
248 }
249 $container->ctrl()->setParameterByClass(strtolower(self::class), 'ref_id', $refId);
250 $container->ctrl()->redirectByClass([
251 strtolower(ilAdministrationGUI::class),
252 strtolower(ilObjTalkTemplateAdministrationGUI::class),
253 strtolower(self::class),
254 ], ControlFlowCommand::INDEX);
255 }
256}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
This class represents a checkbox property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilContainerGUI This is a base GUI class for all container objects in ILIAS: root folder,...
ilPropertyFormGUI $form
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilInfoScreenGUI.
loadLanguageModule(string $a_module)
Load language module.
Class ilObjTalkTemplateGUI.
updateCustom(ilPropertyFormGUI $a_form)
Insert custom update form values into object.
infoScreenObject()
infoScreen redirect handling of ObjListGUI
initCreationForms(string $new_type)
Init creation forms.
getAdminTabs()
administration tabs show only permissions and trash folder
initEditCustomForm(ilPropertyFormGUI $a_form)
Add custom fields to update form.
initMetaDataForm(ilPropertyFormGUI $form)
getEditFormCustomValues(array &$a_values)
Add values to custom edit fields.
addAdminLocatorItems(bool $do_not_add_object=false)
should be overwritten to add object specific items (repository items are preloaded)
getTabs()
@abstract overwrite in derived GUI class of your object type
addExternalEditFormCustom(ilPropertyFormGUI $form)
__construct($data, int $id=0, bool $call_by_reference=true, bool $prepare_output=true)
setCreationMode(bool $mode=true)
if true, a creation screen is displayed the current [ref_id] don't belong to the current class!...
viewObject()
viewObject container presentation for "administration -> repository, trash, permissions"
ilLanguage $lng
initCreateForm(string $new_type)
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
This class represents a property form user interface.
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
getInputItemsRecursive()
returns a flat array of all input items including the possibly existing subitems recursively
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$container
@noRector
Definition: wac.php:14
$refId
Definition: xapitoken.php:58