19declare(strict_types=1);
60 public function __construct(
int $a_id = 0,
int $a_id_type = self::REPOSITORY_NODE_ID,
int $a_parent_node_id = 0)
66 $this->
tabs = $DIC->tabs();
69 $this->
lng->loadLanguageModule(
'dcl');
70 $this->
lng->loadLanguageModule(
'content');
71 $this->
lng->loadLanguageModule(
'obj');
72 $this->
lng->loadLanguageModule(
'cntr');
76 if (!$this->
ctrl->isAsynch()) {
80 $this->
ctrl->saveParameter($this,
'table_id');
83 private function setTableId(
int $objectOrRefId = 0): void
85 if ($this->
http->wrapper()->query()->has(
'table_id')) {
86 $this->table_id = $this->
http->wrapper()->query()->retrieve(
'table_id', $this->
refinery->kindlyTo()->int());
87 } elseif ($this->
http->wrapper()->query()->has(
'tableview_id')) {
88 $this->table_id = ilDclTableView::find(
89 $this->
http->wrapper()->query()->retrieve(
'tableview_id', $this->refinery->kindlyTo()->int())
91 } elseif ($objectOrRefId > 0) {
94 $this->table_id = array_shift($tables)->getId();
106 $this->tpl->addJavaScript(
'assets/js/datacollection.js');
123 $ilNavigationHistory =
$DIC[
'ilNavigationHistory'];
124 $DIC->help()->setScreenIdComponent(
'dcl');
125 $link = $this->
ctrl->getLinkTarget($this,
'render');
128 $ilNavigationHistory->addItem($this->
object->getRefId(), $link,
'dcl');
131 $next_class = $this->
ctrl->getNextClass($this);
132 $cmd = $this->
ctrl->getCmd();
135 $DIC->ui()->mainTemplate()->loadStandardTemplate();
136 $DIC->ui()->mainTemplate()->setContent(
'Permission Denied.');
140 switch ($next_class) {
141 case strtolower(ilInfoScreenGUI::class):
143 $this->
tabs->activateTab(self::TAB_INFO);
146 case strtolower(ilCommonActionDispatcherGUI::class):
149 $gui->enableCommentsSettings(
false);
150 $this->
ctrl->forwardCommand($gui);
152 case strtolower(ilPermissionGUI::class):
154 $this->
tabs->activateTab(self::TAB_LIST_PERMISSIONS);
156 $this->
ctrl->forwardCommand($perm_gui);
158 case strtolower(ilObjectCopyGUI::class):
161 $DIC->ui()->mainTemplate()->loadStandardTemplate();
162 $this->
ctrl->forwardCommand($cp);
164 case strtolower(ilDclTableListGUI::class):
166 $this->
tabs->activateTab(self::TAB_LIST_TABLES);
168 $this->
ctrl->forwardCommand($tablelist_gui);
170 case strtolower(ilDclRecordListGUI::class):
173 $this->
tabs->activateTab(self::TAB_CONTENT);
176 $this->
ctrl->forwardCommand($recordlist_gui);
178 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_INFO, $this->
lng->txt(
'dcl_no_tableview_found'));
181 case strtolower(ilDclRecordEditGUI::class):
183 $this->
tabs->activateTab(self::TAB_CONTENT);
185 $this->
ctrl->forwardCommand($recordedit_gui);
187 case strtolower(ilObjFileGUI::class):
189 $this->
tabs->activateTab(self::TAB_CONTENT);
191 $this->
ctrl->forwardCommand($file_gui);
193 case strtolower(ilRatingGUI::class):
196 $record_id = $this->
http->wrapper()->query()->retrieve(
'record_id', $this->
refinery->kindlyTo()->int());
197 $field_id = $this->
http->wrapper()->query()->retrieve(
'field_id', $this->
refinery->kindlyTo()->int());
199 $rgui->setObject($record_id,
'dcl_record', $field_id,
'dcl_field');
200 $rgui->executeCommand();
202 $detail = $this->
http->wrapper()->query()->retrieve(
'detail_view', $this->
refinery->kindlyTo()->bool());
203 $this->
ctrl->setParameterByClass(
204 $detail ? ilDclDetailedViewGUI::class : ilDclRecordListGUI::class,
206 $this->
http->wrapper()->query()->retrieve(
'tableview_id', $this->refinery->kindlyTo()->int())
209 $this->
ctrl->setParameterByClass(
210 ilDclDetailedViewGUI::class,
212 $this->
http->wrapper()->query()->retrieve(
'record_id', $this->refinery->kindlyTo()->int())
214 $this->
ctrl->redirectByClass([ilRepositoryGUI::class, self::class, ilDclDetailedViewGUI::class],
'renderRecord');
219 case strtolower(ilDclDetailedViewGUI::class):
222 $this->
ctrl->forwardCommand($recordview_gui);
223 $this->
tabs->setBackTarget(
224 $this->
lng->txt(
'back'),
225 $this->ctrl->getLinkTargetByClass(
226 ilDclRecordListGUI::class,
231 case strtolower(ilNoteGUI::class):
234 $this->
ctrl->forwardCommand($recordviewGui);
235 $this->
tabs->clearTargets();
236 $this->
tabs->setBackTarget($this->
lng->txt(
'back'), $this->ctrl->getLinkTarget($this,
''));
238 case strtolower(ilExportGUI::class):
242 case strtolower(ilDclPropertyFormGUI::class):
244 $recordedit_gui->getRecord();
245 $recordedit_gui->initForm();
246 $form = $recordedit_gui->getForm();
247 $this->
ctrl->forwardCommand($form);
249 case strtolower(ilObjectMetaDataGUI::class):
252 $this->
tabs->activateTab(self::TAB_META_DATA);
254 $this->
ctrl->forwardCommand($gui);
256 case strtolower(ilObjectContentStyleSettingsGUI::class):
259 $this->
tabs->activateTab(
'settings');
260 $this->
tabs->activateSubTab(
'cont_style');
262 $settings_gui =
$DIC->contentStyle()->gui()->objectSettingsGUIForRefId(
null, $this->ref_id);
263 $this->
ctrl->forwardCommand($settings_gui);
266 parent::executeCommand();
272 $this->
tabs->setTabActive(self::TAB_EXPORT);
275 $exp_gui->listExportFiles();
277 $this->
ctrl->forwardCommand($exp_gui);
283 $this->
tabs->setTabActive(self::TAB_EXPORT);
286 $exporter->exportAsync();
287 $this->
ctrl->redirect($exp_gui);
292 $tableview_id =
null;
293 if ($this->
http->wrapper()->query()->has(
'tableview_id')) {
294 $tableview_id = $this->
http->wrapper()->query()->retrieve(
299 if ($this->
http->wrapper()->post()->has(
'tableview_id')) {
300 $tableview_id = $this->
http->wrapper()->post()->retrieve(
305 if (!$tableview_id) {
307 $tableview_id = $table_obj->getFirstTableViewId();
309 if ($tableview_id ===
null) {
312 return $tableview_id;
317 $this->
ctrl->redirectByClass(ilInfoScreenGUI::class,
'showSummary');
327 $this->
tabs->activateTab(self::TAB_INFO);
334 $info->enablePrivateNotes();
335 $info->addMetaDataSections($this->
object->getId(), 0, $this->object->getType());
342 if (is_object($this->
object) ===
true) {
344 $this->
object->getTitle(),
345 $this->ctrl->getLinkTarget($this,
''),
346 (
string) $this->object->getRefId()
351 public static function _goto(
string $a_target): void
361 $values = array_combine($values, array_pad(explode(
'_', $a_target), count($values), 0));
372 $view_id = (
int) $values[self::GET_VIEW_ID];
373 if ($view_id !== 0 && isset($table->getTableViews()[$view_id])) {
376 $record_id = (
int) $values[self::GET_RECORD_ID];
377 if ($record_id !== 0 && isset($table->getRecords()[$record_id])) {
379 $ctrl->
redirectByClass([ilRepositoryGUI::class, self::class, ilDclDetailedViewGUI::class],
'renderRecord');
382 $ctrl->
redirectByClass([ilRepositoryGUI::class, self::class, ilDclRecordListGUI::class],
'listRecords');
387 $lng->
txt(
'msg_no_perm_read_item'),
398 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'object_added'),
true);
399 $this->
ctrl->redirectByClass(ilDclTableListGUI::class,
'listTables');
404 $ref_id = $this->
object->getRefId();
406 if ($this->
access->checkAccess(
'read',
'',
$ref_id) ===
true) {
407 $this->
addTab(self::TAB_CONTENT, $this->
ctrl->getLinkTargetByClass(ilDclRecordListGUI::class,
'show'));
410 if ($this->
access->checkAccess(
'visible',
'',
$ref_id) ===
true || $this->access->checkAccess(
'read',
'',
$ref_id) ===
true) {
411 $this->
addTab(self::TAB_INFO, $this->
ctrl->getLinkTargetByClass(ilInfoScreenGUI::class,
'showSummary'));
414 if ($this->
access->checkAccess(
'write',
'',
$ref_id) ===
true) {
415 $this->
addTab(self::TAB_EDIT_DCL, $this->
ctrl->getLinkTarget($this,
'edit'));
416 $this->
addTab(self::TAB_LIST_TABLES, $this->
ctrl->getLinkTargetByClass(ilDclTableListGUI::class,
'listTables'));
418 if ($mdtab = $mdgui->getTab()) {
419 $this->tabs_gui->addTab(self::TAB_META_DATA, $this->
lng->txt(
'meta_data'), $mdtab);
421 $this->
addTab(self::TAB_EXPORT, $this->
ctrl->getLinkTargetByClass(ilExportGUI::class,
''));
424 if ($this->
access->checkAccess(
'edit_permission',
'',
$ref_id) ===
true) {
425 $this->
addTab(self::TAB_LIST_PERMISSIONS, $this->
ctrl->getLinkTargetByClass(ilPermissionGUI::class,
'perm'));
429 private function addTab(
string $langKey,
string $link): void
431 $this->
tabs->addTab($langKey, $this->
lng->txt($langKey), $link);
439 $edit[
'title'] = $this->ui_factory->input()->field()->text($this->
lng->txt(
'title'))->withRequired(
true);
440 $edit[
'description'] = $this->ui_factory->input()->field()->textarea($this->
lng->txt(
'description'));
441 $edit[
'notification'] = $this->ui_factory->input()->field()->checkbox(
442 $this->
lng->txt(
'dcl_activate_notification'),
443 $this->lng->txt(
'dcl_notification_info')
445 $inputs[
'edit'] = $this->ui_factory->input()->field()->section($edit, $this->
lng->txt($this->type .
'_edit'))
447 'title' => $this->
object->getTitle(),
448 'description' => $this->object->getLongDescription(),
449 'notification' => $this->object->getNotification(),
453 $availability[
'online'] = $this->ui_factory->input()->field()->checkbox(
454 $this->
lng->txt(
'online'),
455 $this->lng->txt(
'dcl_online_info')
457 $inputs[
'availability'] = $this->ui_factory->input()->field()->section($availability, $this->
lng->txt(
'obj_activation_list_gui'))
458 ->withValue([
'online' => $this->
object->getOnline(),]);
461 $presentation[
'tile_image'] = $this->
object->getObjectProperties()->getPropertyTileImage()->toForm(
463 $this->ui_factory->input()->field(),
466 $inputs[
'presentation'] = $this->ui_factory->input()->field()->section($presentation, $this->
lng->txt(
'cont_presentation'));
468 return $this->ui_factory->input()->container()->form()->standard($this->
ctrl->getFormAction($this,
'update'),
$inputs);
474 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_FAILURE, $this->
lng->txt(
'permission_denied'));
478 $this->
tabs->activateTab(self::TAB_EDIT_DCL);
480 $this->tpl->setContent($this->ui_renderer->render($this->initForm()));
486 $this->
error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
490 $this->
tabs->activateTab(self::TAB_EDIT_DCL);
492 $form = $this->
initForm()->withRequest($this->
http->request());
493 $data = $form->getData();
495 if (
$data !==
null) {
496 $this->
object->setTitle(
$data[
'edit'][
'title']);
497 $this->
object->setDescription(
$data[
'edit'][
'description']);
498 $this->
object->setNotification(
$data[
'edit'][
'notification']);
499 $this->
object->setOnline(
$data[
'availability'][
'online']);
500 $this->
object->getObjectProperties()->storePropertyTileImage(
$data[
'presentation'][
'tile_image']);
501 $this->
object->update();
502 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_obj_modified'),
true);
505 $this->tpl->setContent($this->ui_renderer->render($form));
510 $this->
tabs->addSubTab(
512 $this->
lng->txt(
'general'),
513 $this->ctrl->getLinkTargetByClass(self::class,
'edit')
515 $this->
tabs->addSubTab(
517 $this->
lng->txt(
'cont_style'),
518 $this->ctrl->getLinkTargetByClass(ilObjectContentStyleSettingsGUI::class)
521 $this->
tabs->activateSubTab(
'general');
526 $this->
ctrl->redirectByClass(ilDclRecordListGUI::class,
'show');
537 foreach (ilDclNotificationType::cases() as $notification) {
538 $this->notification_settings->add($this->
object, $this->
user, $notification);
540 $this->
ctrl->redirectByClass(ilDclRecordListGUI::class,
'show');
546 $this->notification_settings->clear($this->
object, $this->
user);
547 $this->
ctrl->redirectByClass(ilDclRecordListGUI::class,
'show');
553 $this->notification_settings->clear($this->
object, $this->
user);
554 foreach (ilDclNotificationType::cases() as $notification) {
555 if (
$data[$notification->value]) {
556 $this->notification_settings->add($this->
object, $this->
user, $notification);
560 $this->
ctrl->redirectByClass(ilDclRecordListGUI::class,
'show');
566 $this->
ctrl->getLinkTarget($this,
'redrawHeaderAction',
'',
true),
568 $this->ctrl->getLinkTargetByClass([ilCommonActionDispatcherGUI::class, ilTaggingGUI::class],
'',
'',
true)
573 $lg = $dispatcher->initHeaderAction();
577 $lg->addCustomCommandButton(
578 $this->ui_factory->button()->shy(
579 $this->lng->txt(
'dcl_notification_deactivate'),
580 $this->ctrl->getLinkTarget($this,
'deactivateNotification')
584 $lg->addCustomCommandButton(
585 $this->ui_factory->button()->shy(
586 $this->lng->txt(
'dcl_notification_settings'),
587 $modal->getShowSignal()
591 $lg->addHeaderIcon(
'not_icon',
ilUtil::getImagePath(
'object/notification_on.svg'), $this->
lng->txt(
'dcl_notification_activated'));
593 $lg->addCustomCommandButton(
594 $this->ui_factory->button()->shy(
595 $this->lng->txt(
'dcl_notification_activate'),
596 $this->ctrl->getLinkTarget($this,
'activateNotification')
599 $lg->addHeaderIcon(
'not_icon',
ilUtil::getImagePath(
'object/notification_off.svg'), $this->
lng->txt(
'dcl_notification_deactivated'));
601 $this->
ctrl->setParameter($this,
'ntf',
'');
604 $this->tpl->setHeaderActionMenu($lg->getHeaderAction());
609 return $this->ui_factory->modal()->roundtrip(
610 $this->
lng->txt(
'dcl_notification_settings'),
613 ilDclNotificationType::RECORD_CREATE->value => $this->ui_factory->input()->field()->checkbox($this->lng->txt(
'dcl_new_entries'))
614 ->withValue($this->notification_settings->has($this->object, $this->user->getId(), ilDclNotificationType::RECORD_CREATE)),
615 ilDclNotificationType::RECORD_UPDATE->value => $this->ui_factory->input()->field()->checkbox($this->lng->txt(
'dcl_updated_entries'))
616 ->withValue($this->notification_settings->has($this->object, $this->user->getId(), ilDclNotificationType::RECORD_UPDATE)),
620 $this->ctrl->getLinkTarget($this,
'editNotification')
Class ilCommonActionDispatcherGUI.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Class ilCtrl provides processing control methods.
redirectByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
@inheritDoc
setParameterByClass(string $a_class, string $a_parameter, $a_value)
@inheritDoc
static getTableCache(?int $table_id=null)
Hook-Class for exporting data-collections (used in SOAP-Class) This Class avoids duplicated code by r...
@ilCtrl_Calls ilDclDetailedViewGUI: ilDclDetailedViewDefinitionGUI, ilEditClipboardGUI,...
@ilCtrl_Calls ilDclTableListGUI: ilDclFieldListGUI, ilDclFieldEditGUI, ilDclTableViewGUI,...
Export User Interface Class.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
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...
setTableId(int $objectOrRefId=0)
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.
ilGlobalTemplateInterface $tpl
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 _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
static _gotoRepositoryNode(int $ref_id, string $cmd="")
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.
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
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)
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
checkAccess(string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance)
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc