19 declare(strict_types=1);
58 public function __construct(
int $a_id = 0,
int $a_id_type = self::REPOSITORY_NODE_ID,
int $a_parent_node_id = 0)
64 $this->
tabs = $DIC->tabs();
66 $this->
lng->loadLanguageModule(
'dcl');
67 $this->
lng->loadLanguageModule(
'content');
68 $this->
lng->loadLanguageModule(
'obj');
69 $this->
lng->loadLanguageModule(
'cntr');
73 if (!$this->
ctrl->isAsynch()) {
77 $this->
ctrl->saveParameter($this,
'table_id');
80 private function setTableId(
int $objectOrRefId = 0): void
82 if ($this->
http->wrapper()->query()->has(
'table_id')) {
83 $this->table_id = $this->
http->wrapper()->query()->retrieve(
'table_id', $this->
refinery->kindlyTo()->int());
84 } elseif ($this->
http->wrapper()->query()->has(
'tableview_id')) {
85 $this->table_id = ilDclTableView::find(
86 $this->
http->wrapper()->query()->retrieve(
'tableview_id', $this->
refinery->kindlyTo()->int())
88 } elseif ($objectOrRefId > 0) {
91 $this->table_id = array_shift($tables)->getId();
103 $this->tpl->addJavaScript(
'assets/js/datacollection.js');
120 $ilNavigationHistory = $DIC[
'ilNavigationHistory'];
121 $DIC->help()->setScreenIdComponent(
'dcl');
122 $link = $this->
ctrl->getLinkTarget($this,
'render');
125 $ilNavigationHistory->addItem($this->
object->getRefId(), $link,
'dcl');
128 $next_class = $this->
ctrl->getNextClass($this);
129 $cmd = $this->
ctrl->getCmd();
132 $DIC->ui()->mainTemplate()->loadStandardTemplate();
133 $DIC->ui()->mainTemplate()->setContent(
'Permission Denied.');
137 switch ($next_class) {
138 case strtolower(ilInfoScreenGUI::class):
140 $this->
tabs->activateTab(self::TAB_INFO);
143 case strtolower(ilCommonActionDispatcherGUI::class):
146 $gui->enableCommentsSettings(
false);
147 $this->
ctrl->forwardCommand($gui);
149 case strtolower(ilPermissionGUI::class):
151 $this->
tabs->activateTab(self::TAB_LIST_PERMISSIONS);
153 $this->
ctrl->forwardCommand($perm_gui);
155 case strtolower(ilObjectCopyGUI::class):
158 $DIC->ui()->mainTemplate()->loadStandardTemplate();
159 $this->
ctrl->forwardCommand($cp);
161 case strtolower(ilDclTableListGUI::class):
163 $this->
tabs->activateTab(self::TAB_LIST_TABLES);
165 $this->
ctrl->forwardCommand($tablelist_gui);
167 case strtolower(ilDclRecordListGUI::class):
170 $this->
tabs->activateTab(self::TAB_CONTENT);
173 $this->
ctrl->forwardCommand($recordlist_gui);
175 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_INFO, $this->
lng->txt(
'dcl_no_tableview_found'));
178 case strtolower(ilDclRecordEditGUI::class):
180 $this->
tabs->activateTab(self::TAB_CONTENT);
182 $this->
ctrl->forwardCommand($recordedit_gui);
184 case strtolower(ilObjFileGUI::class):
186 $this->
tabs->activateTab(self::TAB_CONTENT);
188 $this->
ctrl->forwardCommand($file_gui);
190 case strtolower(ilRatingGUI::class):
193 $record_id = $this->
http->wrapper()->query()->retrieve(
'record_id', $this->
refinery->kindlyTo()->int());
194 $field_id = $this->
http->wrapper()->query()->retrieve(
'field_id', $this->
refinery->kindlyTo()->int());
196 $rgui->setObject($record_id,
'dcl_record', $field_id,
'dcl_field');
197 $rgui->executeCommand();
198 $this->
ctrl->redirectToURL($this->
http->request()->getServerParams()[
'HTTP_REFERER'] ??
'');
200 case strtolower(ilDclDetailedViewGUI::class):
203 $this->
ctrl->forwardCommand($recordview_gui);
204 $this->
tabs->setBackTarget(
205 $this->
lng->txt(
'back'),
206 $this->
ctrl->getLinkTargetByClass(
207 ilDclRecordListGUI::class,
212 case strtolower(ilNoteGUI::class):
215 $this->
ctrl->forwardCommand($recordviewGui);
216 $this->
tabs->clearTargets();
217 $this->
tabs->setBackTarget($this->
lng->txt(
'back'), $this->
ctrl->getLinkTarget($this,
''));
219 case strtolower(ilExportGUI::class):
223 case strtolower(ilDclPropertyFormGUI::class):
225 $recordedit_gui->getRecord();
226 $recordedit_gui->initForm();
227 $form = $recordedit_gui->getForm();
228 $this->
ctrl->forwardCommand($form);
230 case strtolower(ilObjectMetaDataGUI::class):
233 $this->
tabs->activateTab(self::TAB_META_DATA);
235 $this->
ctrl->forwardCommand($gui);
237 case strtolower(ilObjectContentStyleSettingsGUI::class):
240 $this->
tabs->activateTab(
'settings');
241 $this->
tabs->activateSubTab(
'cont_style');
243 $settings_gui = $DIC->contentStyle()->gui()->objectSettingsGUIForRefId(
null, $this->ref_id);
244 $this->
ctrl->forwardCommand($settings_gui);
247 parent::executeCommand();
253 $this->
tabs->setTabActive(self::TAB_EXPORT);
256 $exp_gui->listExportFiles();
258 $this->
ctrl->forwardCommand($exp_gui);
264 $this->
tabs->setTabActive(self::TAB_EXPORT);
268 $this->
ctrl->redirect($exp_gui);
273 $tableview_id =
null;
274 if ($this->
http->wrapper()->query()->has(
'tableview_id')) {
275 $tableview_id = $this->
http->wrapper()->query()->retrieve(
280 if ($this->
http->wrapper()->post()->has(
'tableview_id')) {
281 $tableview_id = $this->
http->wrapper()->post()->retrieve(
286 if (!$tableview_id) {
288 $tableview_id = $table_obj->getFirstTableViewId();
290 if ($tableview_id ===
null) {
293 return $tableview_id;
298 $this->
ctrl->redirectByClass(ilInfoScreenGUI::class,
'showSummary');
308 $this->
tabs->activateTab(self::TAB_INFO);
315 $info->enablePrivateNotes();
316 $info->addMetaDataSections($this->
object->getId(), 0, $this->
object->getType());
323 if (is_object($this->
object) ===
true) {
325 $this->
object->getTitle(),
326 $this->
ctrl->getLinkTarget($this,
''),
327 (string) $this->
object->getRefId()
332 public static function _goto(
string $a_target): void
335 $lng = $DIC->language();
337 $ctrl = $DIC->ctrl();
339 $tpl = $DIC->ui()->mainTemplate();
341 $values = [self::GET_REF_ID, self::GET_TABLE_ID, self::GET_VIEW_ID, self::GET_RECORD_ID];
342 $values = array_combine($values, array_pad(explode(
'_', $a_target), count($values), 0));
349 $table_id = (
int) $values[self::GET_TABLE_ID];
350 if ($table_id !== 0 && isset($object->getVisibleTables()[
$table_id])) {
352 $table = $object->getVisibleTables()[
$table_id];
353 $view_id = (
int) $values[self::GET_VIEW_ID];
354 if ($view_id !== 0 && isset($table->getTableViews()[$view_id])) {
357 $record_id = (
int) $values[self::GET_RECORD_ID];
358 if ($record_id !== 0 && isset($table->getRecords()[$record_id])) {
360 $ctrl->
redirectByClass([ilRepositoryGUI::class, self::class, ilDclDetailedViewGUI::class],
'renderRecord');
363 $ctrl->
redirectByClass([ilRepositoryGUI::class, self::class, ilDclRecordListGUI::class],
'listRecords');
368 $lng->
txt(
'msg_no_perm_read_item'),
379 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'object_added'),
true);
380 $this->
ctrl->redirectByClass(ilDclTableListGUI::class,
'listTables');
385 $ref_id = $this->
object->getRefId();
387 if ($this->
access->checkAccess(
'read',
'',
$ref_id) ===
true) {
388 $this->
addTab(self::TAB_CONTENT, $this->
ctrl->getLinkTargetByClass(ilDclRecordListGUI::class,
'show'));
391 if ($this->
access->checkAccess(
'visible',
'',
$ref_id) ===
true || $this->
access->checkAccess(
'read',
'',
$ref_id) ===
true) {
392 $this->
addTab(self::TAB_INFO, $this->
ctrl->getLinkTargetByClass(ilInfoScreenGUI::class,
'showSummary'));
395 if ($this->
access->checkAccess(
'write',
'',
$ref_id) ===
true) {
396 $this->
addTab(self::TAB_EDIT_DCL, $this->
ctrl->getLinkTarget($this,
'edit'));
397 $this->
addTab(self::TAB_LIST_TABLES, $this->
ctrl->getLinkTargetByClass(ilDclTableListGUI::class,
'listTables'));
399 if ($mdtab = $mdgui->getTab()) {
400 $this->tabs_gui->addTab(self::TAB_META_DATA, $this->
lng->txt(
'meta_data'), $mdtab);
402 $this->
addTab(self::TAB_EXPORT, $this->
ctrl->getLinkTargetByClass(ilExportGUI::class,
''));
405 if ($this->
access->checkAccess(
'edit_permission',
'',
$ref_id) ===
true) {
406 $this->
addTab(self::TAB_LIST_PERMISSIONS, $this->
ctrl->getLinkTargetByClass(ilPermissionGUI::class,
'perm'));
410 private function addTab(
string $langKey,
string $link): void
412 $this->
tabs->addTab($langKey, $this->
lng->txt($langKey), $link);
420 $edit[
'title'] = $this->ui_factory->input()->field()->text($this->
lng->txt(
'title'))->withRequired(
true);
421 $edit[
'description'] = $this->ui_factory->input()->field()->textarea($this->
lng->txt(
'description'));
422 $edit[
'notification'] = $this->ui_factory->input()->field()->checkbox(
423 $this->
lng->txt(
'dcl_activate_notification'),
424 $this->
lng->txt(
'dcl_notification_info')
426 $inputs[
'edit'] = $this->ui_factory->input()->field()->section($edit, $this->
lng->txt($this->type .
'_edit'))
428 'title' => $this->
object->getTitle(),
429 'description' => $this->
object->getLongDescription(),
430 'notification' => $this->
object->getNotification(),
434 $availability[
'online'] = $this->ui_factory->input()->field()->checkbox(
435 $this->
lng->txt(
'online'),
436 $this->
lng->txt(
'dcl_online_info')
438 $inputs[
'availability'] = $this->ui_factory->input()->field()->section($availability, $this->
lng->txt(
'obj_activation_list_gui'))
442 $presentation[
'tile_image'] = $this->
object->getObjectProperties()->getPropertyTileImage()->toForm(
444 $this->ui_factory->input()->field(),
447 $inputs[
'presentation'] = $this->ui_factory->input()->field()->section($presentation, $this->
lng->txt(
'cont_presentation'));
449 return $this->ui_factory->input()->container()->form()->standard($this->
ctrl->getFormAction($this,
'update'),
$inputs);
455 $this->tpl->setOnScreenMessage($this->tpl::MESSAGE_TYPE_FAILURE, $this->
lng->txt(
'permission_denied'));
459 $this->
tabs->activateTab(self::TAB_EDIT_DCL);
461 $this->tpl->setContent($this->ui_renderer->render($this->initForm()));
467 $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
471 $this->
tabs->activateTab(self::TAB_EDIT_DCL);
473 $form = $this->
initForm()->withRequest($this->
http->request());
474 $data = $form->getData();
477 $this->
object->setTitle(
$data[
'edit'][
'title']);
478 $this->
object->setDescription(
$data[
'edit'][
'description']);
479 $this->
object->setNotification(
$data[
'edit'][
'notification']);
480 $this->
object->setOnline(
$data[
'availability'][
'online']);
481 $this->
object->getObjectProperties()->storePropertyTileImage(
$data[
'presentation'][
'tile_image']);
482 $this->
object->update();
483 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_obj_modified'),
true);
486 $this->tpl->setContent($this->ui_renderer->render($form));
491 $this->
tabs->addSubTab(
493 $this->
lng->txt(
'general'),
494 $this->
ctrl->getLinkTargetByClass(self::class,
'edit')
496 $this->
tabs->addSubTab(
498 $this->
lng->txt(
'cont_style'),
499 $this->
ctrl->getLinkTargetByClass(ilObjectContentStyleSettingsGUI::class)
502 $this->
tabs->activateSubTab(
'general');
507 $this->
ctrl->redirectByClass(ilDclRecordListGUI::class,
'show');
517 $ntf = $this->
http->wrapper()->query()->retrieve(
'ntf', $this->
refinery->kindlyTo()->int());
522 $this->
user->getId(),
530 $this->
user->getId(),
535 $this->
ctrl->redirectByClass(ilDclRecordListGUI::class,
'show');
541 $this->
ctrl->getLinkTarget($this,
'redrawHeaderAction',
'',
true),
543 $this->
ctrl->getLinkTargetByClass([ilCommonActionDispatcherGUI::class, ilTaggingGUI::class],
'',
'',
true)
548 $lg = $dispatcher->initHeaderAction();
552 $this->
ctrl->setParameter($this,
'ntf', 1);
553 $lg->addCustomCommand($this->
ctrl->getLinkTarget($this,
'toggleNotification'),
'dcl_notification_deactivate_dcl');
554 $lg->addHeaderIcon(
'not_icon',
ilUtil::getImagePath(
'object/notification_on.svg'), $this->
lng->txt(
'dcl_notification_activated'));
556 $this->
ctrl->setParameter($this,
'ntf', 2);
557 $lg->addCustomCommand($this->
ctrl->getLinkTarget($this,
'toggleNotification'),
'dcl_notification_activate_dcl');
558 $lg->addHeaderIcon(
'not_icon',
ilUtil::getImagePath(
'object/notification_off.svg'), $this->
lng->txt(
'dcl_notification_deactivated'));
560 $this->
ctrl->setParameter($this,
'ntf',
'');
563 $this->tpl->setHeaderActionMenu($lg->getHeaderAction());
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
handleExport(bool $do_default=false)
__construct(int $a_id=0, int $a_id_type=self::REPOSITORY_NODE_ID, int $a_parent_node_id=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
New implementation of ilObjectGUI.
GUI class for the workflow of copying objects.
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 _gotoRepositoryNode(int $ref_id, string $cmd="")
setParameterByClass(string $a_class, string $a_parameter, $a_value)
prepareOutput(bool $show_sub_objects=true)
ilDclTableListGUI: ilDclFieldListGUI, ilDclFieldEditGUI, ilDclTableViewGUI, ilDclTableEditGUI ...
redirectByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
static _lookupObjId(int $ref_id)
const TYPE_DATA_COLLECTION
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilObjDataCollectionGUI: ilInfoScreenGUI, ilNoteGUI, ilCommonActionDispatcherGUI ilObjDataCollectionG...
static http()
Fetches the global http state from ILIAS.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
static _lookupTitle(int $obj_id)
static setNotification(int $type, int $user_id, int $id, bool $status=true)
Set notification status for object and user.
ilGlobalTemplateInterface $tpl
exportAsync(string $format=self::EXPORT_EXCEL, ?string $filepath=null)
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
afterSave(ilObject $new_object)
static getTableCache(?int $table_id=null)
static hasWriteAccess(int $ref, ?int $user_id=0)
static _goto(string $a_target)
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
setTableId(int $objectOrRefId=0)
const TAB_LIST_PERMISSIONS
static prepareJsLinks(string $redraw_url, string $notes_url, string $tags_url, ?ilGlobalTemplateInterface $tpl=null)
Insert js/ajax links into template.
__construct(Container $dic, ilPlugin $plugin)
static hasNotification(int $type, int $user_id, int $id)
Check notification status for object and user.
getDataCollectionObject()
Hook-Class for exporting data-collections (used in SOAP-Class) This Class avoids duplicated code by r...
addTab(string $langKey, string $link)
Class ilCommonActionDispatcherGUI.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
ilDclDetailedViewGUI: ilDclDetailedViewDefinitionGUI, ilEditClipboardGUI, ilCommentGUI ...