19declare(strict_types=1);
61 public function __construct(
int $a_id = 0,
int $a_id_type = self::REPOSITORY_NODE_ID,
int $a_parent_node_id = 0)
67 $this->
tabs = $DIC->tabs();
70 $this->
lng->loadLanguageModule(
'dcl');
71 $this->
lng->loadLanguageModule(
'content');
72 $this->
lng->loadLanguageModule(
'obj');
73 $this->
lng->loadLanguageModule(
'cntr');
77 if (!$this->
ctrl->isAsynch()) {
81 $this->
ctrl->saveParameter($this,
'table_id');
86 if ($this->ref_id > 0) {
87 if ($this->
http->wrapper()->post()->has(
'table_id')) {
88 $this->table_id = $this->
http->wrapper()->post()->retrieve(
92 } elseif ($this->
http->wrapper()->query()->has(
'table_id')) {
93 $this->table_id = $this->
http->wrapper()->query()->retrieve(
99 if (!isset($this->table_id) || !in_array($this->table_id, array_keys($this->
object->getTables()))) {
100 if (isset($this->table_id)) {
101 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_FAILURE, $this->
lng->txt(
'table_not_found'),
true);
102 unset($this->table_id);
105 if ($tables !== []) {
106 $this->table_id = array_shift($tables)->getId();
108 if ($tableview !==
null) {
109 $this->tableview_id = $tableview;
113 if ($this->
http->wrapper()->post()->has(
'tableview_id')) {
114 $this->tableview_id = $this->
http->wrapper()->post()->retrieve(
118 } elseif ($this->
http->wrapper()->query()->has(
'tableview_id')) {
119 $this->tableview_id = $this->
http->wrapper()->query()->retrieve(
125 if (!isset($this->tableview_id) || !in_array($this->tableview_id, array_keys($this->
object->getTableById($this->table_id)->getTableViews()))) {
126 if (isset($this->tableview_id)) {
127 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_FAILURE, $this->
lng->txt(
'tableview_not_found'),
true);
130 if ($tableview !==
null) {
131 $this->tableview_id = $tableview;
145 $this->tpl->addJavaScript(
'assets/js/datacollection.js');
162 $ilNavigationHistory =
$DIC[
'ilNavigationHistory'];
163 $DIC->help()->setScreenIdComponent(
'dcl');
164 $link = $this->
ctrl->getLinkTarget($this,
'render');
167 $ilNavigationHistory->addItem($this->
object->getRefId(), $link,
'dcl');
170 $next_class = $this->
ctrl->getNextClass($this);
171 $cmd = $this->
ctrl->getCmd();
174 $DIC->ui()->mainTemplate()->loadStandardTemplate();
175 $DIC->ui()->mainTemplate()->setContent(
'Permission Denied.');
179 switch ($next_class) {
180 case strtolower(ilInfoScreenGUI::class):
182 $this->
tabs->activateTab(self::TAB_INFO);
185 case strtolower(ilCommonActionDispatcherGUI::class):
188 $gui->enableCommentsSettings(
false);
189 $this->
ctrl->forwardCommand($gui);
191 case strtolower(ilPermissionGUI::class):
193 $this->
tabs->activateTab(self::TAB_LIST_PERMISSIONS);
195 $this->
ctrl->forwardCommand($perm_gui);
197 case strtolower(ilObjectCopyGUI::class):
200 $DIC->ui()->mainTemplate()->loadStandardTemplate();
201 $this->
ctrl->forwardCommand($cp);
203 case strtolower(ilDclTableListGUI::class):
205 $this->
tabs->activateTab(self::TAB_LIST_TABLES);
207 $this->
ctrl->forwardCommand($tablelist_gui);
209 case strtolower(ilDclRecordListGUI::class):
212 $this->
tabs->activateTab(self::TAB_CONTENT);
213 if (!isset($this->table_id)) {
214 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_INFO, $this->
lng->txt(
'dcl_no_table_found'));
215 } elseif (!isset($this->tableview_id)) {
216 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_INFO, $this->
lng->txt(
'dcl_no_tableview_found'));
218 $recordlist_gui =
new ilDclRecordListGUI($this, $this->table_id, $this->tableview_id);
219 $this->
ctrl->forwardCommand($recordlist_gui);
222 case strtolower(ilDclRecordEditGUI::class):
224 $this->
tabs->activateTab(self::TAB_CONTENT);
225 if (!isset($this->table_id)) {
226 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_INFO, $this->
lng->txt(
'dcl_no_table_found'));
227 } elseif (!isset($this->tableview_id)) {
228 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_INFO, $this->
lng->txt(
'dcl_no_tableview_found'));
230 $recordedit_gui =
new ilDclRecordEditGUI($this, $this->table_id, $this->tableview_id);
231 $this->
ctrl->forwardCommand($recordedit_gui);
234 case strtolower(ilObjFileGUI::class):
236 $this->
tabs->activateTab(self::TAB_CONTENT);
238 $this->
ctrl->forwardCommand($file_gui);
240 case strtolower(ilRatingGUI::class):
243 $record_id = $this->
http->wrapper()->query()->retrieve(
'record_id', $this->
refinery->kindlyTo()->int());
244 $field_id = $this->
http->wrapper()->query()->retrieve(
'field_id', $this->
refinery->kindlyTo()->int());
246 $rgui->setObject($record_id,
'dcl_record', $field_id,
'dcl_field');
247 $rgui->executeCommand();
249 $detail = $this->
http->wrapper()->query()->retrieve(
'detail_view', $this->
refinery->kindlyTo()->bool());
250 $this->
ctrl->setParameterByClass(
251 $detail ? ilDclDetailedViewGUI::class : ilDclRecordListGUI::class,
253 $this->
http->wrapper()->query()->retrieve(
'tableview_id', $this->refinery->kindlyTo()->int())
256 $this->
ctrl->setParameterByClass(
257 ilDclDetailedViewGUI::class,
259 $this->
http->wrapper()->query()->retrieve(
'record_id', $this->refinery->kindlyTo()->int())
261 $this->
ctrl->redirectByClass([ilRepositoryGUI::class, self::class, ilDclDetailedViewGUI::class],
'renderRecord');
266 case strtolower(ilDclDetailedViewGUI::class):
268 if (!isset($this->tableview_id)) {
269 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_INFO, $this->
lng->txt(
'dcl_no_tableview_found'));
272 $this->
ctrl->forwardCommand($recordview_gui);
273 $this->
tabs->setBackTarget(
274 $this->
lng->txt(
'back'),
275 $this->ctrl->getLinkTargetByClass(
276 ilDclRecordListGUI::class,
282 case strtolower(ilNoteGUI::class):
284 if (!isset($this->tableview_id)) {
285 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_INFO, $this->
lng->txt(
'dcl_no_tableview_found'));
288 $this->
ctrl->forwardCommand($recordviewGui);
289 $this->
tabs->clearTargets();
290 $this->
tabs->setBackTarget($this->
lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
''));
293 case strtolower(ilExportGUI::class):
297 case strtolower(ilDclPropertyFormGUI::class):
298 if (!isset($this->table_id)) {
299 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_INFO, $this->
lng->txt(
'dcl_no_table_found'));
300 } elseif (!isset($this->tableview_id)) {
301 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_INFO, $this->
lng->txt(
'dcl_no_tableview_found'));
303 $recordedit_gui =
new ilDclRecordEditGUI($this, $this->table_id, $this->tableview_id);
304 $recordedit_gui->getRecord();
305 $recordedit_gui->initForm();
306 $form = $recordedit_gui->getForm();
307 $this->
ctrl->forwardCommand($form);
310 case strtolower(ilObjectMetaDataGUI::class):
313 $this->
tabs->activateTab(self::TAB_META_DATA);
315 $this->
ctrl->forwardCommand($gui);
317 case strtolower(ilObjectContentStyleSettingsGUI::class):
320 $this->
tabs->activateTab(
'settings');
321 $this->
tabs->activateSubTab(
'cont_style');
323 $settings_gui =
$DIC->contentStyle()->gui()->objectSettingsGUIForRefId(
null, $this->ref_id);
324 $this->
ctrl->forwardCommand($settings_gui);
327 parent::executeCommand();
333 $this->
tabs->setTabActive(self::TAB_EXPORT);
336 $exp_gui->listExportFiles();
338 $this->
ctrl->forwardCommand($exp_gui);
344 $this->
tabs->setTabActive(self::TAB_EXPORT);
347 $exporter->exportAsync();
348 $this->
ctrl->redirect($exp_gui);
353 $this->
ctrl->redirectByClass(ilInfoScreenGUI::class,
'showSummary');
363 $this->
tabs->activateTab(self::TAB_INFO);
370 $info->enablePrivateNotes();
371 $info->addMetaDataSections($this->
object->getId(), 0, $this->object->getType());
378 if (is_object($this->
object) ===
true) {
380 $this->
object->getTitle(),
381 $this->ctrl->getLinkTarget($this,
''),
382 (
string) $this->object->getRefId()
387 public static function _goto(
string $a_target): void
392 $values = array_combine($values, array_pad(explode(
'_', $a_target), count($values), 0));
396 $DIC->ctrl()->setParameterByClass(ilRepositoryGUI::class, self::GET_REF_ID,
$ref_id);
399 $DIC->ctrl()->setParameterByClass(ilObjDataCollectionGUI::class, self::GET_TABLE_ID,
$table_id);
400 $view_id = (
int) $values[self::GET_VIEW_ID];
401 if ($view_id !== 0) {
402 $DIC->ctrl()->setParameterByClass(ilObjDataCollectionGUI::class, self::GET_VIEW_ID, $view_id);
404 $record_id = (
int) $values[self::GET_RECORD_ID];
405 if ($record_id !== 0) {
406 $DIC->ctrl()->setParameterByClass(ilDclDetailedViewGUI::class, self::GET_RECORD_ID, $record_id);
407 $DIC->ctrl()->redirectByClass([ilRepositoryGUI::class, self::class, ilDclDetailedViewGUI::class],
'renderRecord');
411 $DIC->ctrl()->redirectByClass([ilRepositoryGUI::class, self::class, ilDclRecordListGUI::class],
'listRecords');
416 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'object_added'),
true);
417 $this->
ctrl->redirectByClass(ilDclTableListGUI::class,
'listTables');
422 $ref_id = $this->
object->getRefId();
424 if ($this->
access->checkAccess(
'read',
'',
$ref_id) ===
true) {
425 $this->
addTab(self::TAB_CONTENT, $this->
ctrl->getLinkTargetByClass(ilDclRecordListGUI::class,
'show'));
428 if ($this->
access->checkAccess(
'visible',
'',
$ref_id) ===
true || $this->access->checkAccess(
'read',
'',
$ref_id) ===
true) {
429 $this->
addTab(self::TAB_INFO, $this->
ctrl->getLinkTargetByClass(ilInfoScreenGUI::class,
'showSummary'));
432 if ($this->
access->checkAccess(
'write',
'',
$ref_id) ===
true) {
433 $this->
addTab(self::TAB_EDIT_DCL, $this->
ctrl->getLinkTarget($this,
'edit'));
434 $this->
addTab(self::TAB_LIST_TABLES, $this->
ctrl->getLinkTargetByClass(ilDclTableListGUI::class,
'listTables'));
436 if ($mdtab = $mdgui->getTab()) {
437 $this->tabs_gui->addTab(self::TAB_META_DATA, $this->
lng->txt(
'meta_data'), $mdtab);
439 $this->
addTab(self::TAB_EXPORT, $this->
ctrl->getLinkTargetByClass(ilExportGUI::class,
''));
442 if ($this->
access->checkAccess(
'edit_permission',
'',
$ref_id) ===
true) {
443 $this->
addTab(self::TAB_LIST_PERMISSIONS, $this->
ctrl->getLinkTargetByClass(ilPermissionGUI::class,
'perm'));
447 private function addTab(
string $langKey,
string $link): void
449 $this->
tabs->addTab($langKey, $this->
lng->txt($langKey), $link);
457 $edit[
'title'] = $this->ui_factory->input()->field()->text($this->
lng->txt(
'title'))->withRequired(
true);
458 $edit[
'description'] = $this->ui_factory->input()->field()->textarea($this->
lng->txt(
'description'));
459 $edit[
'notification'] = $this->ui_factory->input()->field()->checkbox(
460 $this->
lng->txt(
'dcl_activate_notification'),
461 $this->lng->txt(
'dcl_notification_info')
463 $inputs[
'edit'] = $this->ui_factory->input()->field()->section($edit, $this->
lng->txt($this->type .
'_edit'))
465 'title' => $this->
object->getTitle(),
466 'description' => $this->object->getLongDescription(),
467 'notification' => $this->object->getNotification(),
471 $availability[
'online'] = $this->ui_factory->input()->field()->checkbox(
472 $this->
lng->txt(
'online'),
473 $this->lng->txt(
'dcl_online_info')
475 $inputs[
'availability'] = $this->ui_factory->input()->field()->section($availability, $this->
lng->txt(
'obj_activation_list_gui'))
476 ->withValue([
'online' => $this->
object->getOnline(),]);
479 $presentation[
'tile_image'] = $this->
object->getObjectProperties()->getPropertyTileImage()->toForm(
481 $this->ui_factory->input()->field(),
484 $inputs[
'presentation'] = $this->ui_factory->input()->field()->section($presentation, $this->
lng->txt(
'cont_presentation'));
486 return $this->ui_factory->input()->container()->form()->standard($this->
ctrl->getFormAction($this,
'update'),
$inputs);
492 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_FAILURE, $this->
lng->txt(
'permission_denied'));
496 $this->
tabs->activateTab(self::TAB_EDIT_DCL);
498 $this->tpl->setContent($this->ui_renderer->render($this->initForm()));
504 $this->
error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
508 $this->
tabs->activateTab(self::TAB_EDIT_DCL);
510 $form = $this->
initForm()->withRequest($this->
http->request());
511 $data = $form->getData();
513 if (
$data !==
null) {
514 $this->
object->setTitle(
$data[
'edit'][
'title']);
515 $this->
object->setDescription(
$data[
'edit'][
'description']);
516 $this->
object->setNotification(
$data[
'edit'][
'notification']);
517 $this->
object->setOnline(
$data[
'availability'][
'online']);
518 $this->
object->getObjectProperties()->storePropertyTileImage(
$data[
'presentation'][
'tile_image']);
519 $this->
object->update();
520 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_obj_modified'),
true);
523 $this->
ctrl->redirect($this,
'edit');
528 $this->
tabs->addSubTab(
530 $this->
lng->txt(
'general'),
531 $this->ctrl->getLinkTargetByClass(self::class,
'edit')
533 $this->
tabs->addSubTab(
535 $this->
lng->txt(
'cont_style'),
536 $this->ctrl->getLinkTargetByClass(ilObjectContentStyleSettingsGUI::class)
539 $this->
tabs->activateSubTab(
'general');
544 $this->
ctrl->redirectByClass(ilDclRecordListGUI::class,
'show');
555 foreach (ilDclNotificationType::cases() as $notification) {
556 $this->notification_settings->add($this->
object, $this->
user, $notification);
558 $this->
ctrl->redirectByClass(ilDclRecordListGUI::class,
'show');
564 $this->notification_settings->clear($this->
object, $this->
user);
565 $this->
ctrl->redirectByClass(ilDclRecordListGUI::class,
'show');
571 $this->notification_settings->clear($this->
object, $this->
user);
572 foreach (ilDclNotificationType::cases() as $notification) {
573 if (
$data[$notification->value]) {
574 $this->notification_settings->add($this->
object, $this->
user, $notification);
578 $this->
ctrl->redirectByClass(ilDclRecordListGUI::class,
'show');
584 $this->
ctrl->getLinkTarget($this,
'redrawHeaderAction',
'',
true),
586 $this->ctrl->getLinkTargetByClass([ilCommonActionDispatcherGUI::class, ilTaggingGUI::class],
'',
'',
true)
591 $lg = $dispatcher->initHeaderAction();
595 $lg->addCustomCommandButton(
596 $this->ui_factory->button()->shy(
597 $this->lng->txt(
'dcl_notification_deactivate'),
598 $this->ctrl->getLinkTarget($this,
'deactivateNotification')
602 $lg->addCustomCommandButton(
603 $this->ui_factory->button()->shy(
604 $this->lng->txt(
'dcl_notification_settings'),
605 $modal->getShowSignal()
609 $lg->addHeaderIcon(
'not_icon',
ilUtil::getImagePath(
'object/notification_on.svg'), $this->
lng->txt(
'dcl_notification_activated'));
611 $lg->addCustomCommandButton(
612 $this->ui_factory->button()->shy(
613 $this->lng->txt(
'dcl_notification_activate'),
614 $this->ctrl->getLinkTarget($this,
'activateNotification')
617 $lg->addHeaderIcon(
'not_icon',
ilUtil::getImagePath(
'object/notification_off.svg'), $this->
lng->txt(
'dcl_notification_deactivated'));
619 $this->
ctrl->setParameter($this,
'ntf',
'');
622 $this->tpl->setHeaderActionMenu($lg->getHeaderAction());
627 return $this->ui_factory->modal()->roundtrip(
628 $this->
lng->txt(
'dcl_notification_settings'),
631 ilDclNotificationType::RECORD_CREATE->value => $this->ui_factory->input()->field()->checkbox($this->lng->txt(
'dcl_new_entries'))
632 ->withValue($this->notification_settings->has($this->object, $this->user->getId(), ilDclNotificationType::RECORD_CREATE)),
633 ilDclNotificationType::RECORD_UPDATE->value => $this->ui_factory->input()->field()->checkbox($this->lng->txt(
'dcl_updated_entries'))
634 ->withValue($this->notification_settings->has($this->object, $this->user->getId(), ilDclNotificationType::RECORD_UPDATE)),
638 $this->ctrl->getLinkTarget($this,
'editNotification')
Class ilCommonActionDispatcherGUI.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Class ilCtrl provides processing control methods.
static getTableCache(?int $table_id=null)
@ilCtrl_Calls ilDclDetailedViewGUI: ilDclDetailedViewDefinitionGUI, ilEditClipboardGUI,...
@ilCtrl_Calls ilDclTableListGUI: ilDclFieldListGUI, ilDclFieldEditGUI, ilDclTableViewGUI,...
Export User Interface Class.
static setNotification(int $type, int $user_id, int $id, bool $status=true)
Set notification status for object and user.
static hasNotification(int $type, int $user_id, int $id)
Check notification status for object and user.
const TYPE_DATA_COLLECTION
static hasWriteAccess(int $ref, ?int $user_id=0)
@ilCtrl_Calls ilObjDataCollectionGUI: ilInfoScreenGUI, ilNoteGUI, ilCommonActionDispatcherGUI @ilCtrl...
addLocatorItems()
Functions to be overwritten.
setTabs()
create tabs (repository/workspace switch)
addTab(string $langKey, string $link)
ilDclNotification $notification_settings
static _goto(string $a_target)
__construct(int $a_id=0, int $a_id_type=self::REPOSITORY_NODE_ID, int $a_parent_node_id=0)
addHeaderAction()
Add header action menu.
handleExport(bool $do_default=false)
getType()
Functions that must be overwritten.
getDataCollectionObject()
const TAB_LIST_PERMISSIONS
afterSave(ilObject $new_object)
Post (successful) object creation hook.
executeCommand()
execute command
New implementation of ilObjectGUI.
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
prepareOutput(bool $show_sub_objects=true)
GUI class for the workflow of copying objects.
static prepareJsLinks(string $redraw_url, string $notes_url, string $tags_url, ?ilGlobalTemplateInterface $tpl=null)
Insert js/ajax links into template.
Class ilObject Basic functions for all objects.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc