19 declare(strict_types=1);
55 public function __construct(
int $a_id = 0,
int $a_id_type = self::REPOSITORY_NODE_ID,
int $a_parent_node_id = 0)
61 $this->
http = $DIC->http();
62 $this->
tabs = $DIC->tabs();
64 $this->
lng->loadLanguageModule(
'dcl');
65 $this->
lng->loadLanguageModule(
'content');
66 $this->
lng->loadLanguageModule(
'obj');
67 $this->
lng->loadLanguageModule(
'cntr');
71 if (!$this->
ctrl->isAsynch()) {
75 $this->
ctrl->saveParameter($this,
'table_id');
78 private function setTableId(
int $objectOrRefId = 0): void
80 if ($this->
http->wrapper()->query()->has(
'table_id')) {
81 $this->table_id = $this->
http->wrapper()->query()->retrieve(
'table_id', $this->
refinery->kindlyTo()->int());
82 } elseif ($this->
http->wrapper()->query()->has(
'tableview_id')) {
83 $this->table_id = ilDclTableView::find(
84 $this->
http->wrapper()->query()->retrieve(
'tableview_id', $this->
refinery->kindlyTo()->int())
86 } elseif ($objectOrRefId > 0) {
89 $this->table_id = array_shift($tables)->getId();
101 $this->tpl->addJavaScript(
'Modules/DataCollection/js/datacollection.js');
118 $ilNavigationHistory = $DIC[
'ilNavigationHistory'];
119 $DIC->help()->setScreenIdComponent(
'dcl');
121 $link = $this->
ctrl->getLinkTarget($this,
'render');
124 $ilNavigationHistory->addItem($this->
object->getRefId(), $link,
'dcl');
127 $next_class = $this->
ctrl->getNextClass($this);
128 $cmd = $this->
ctrl->getCmd();
131 $DIC->ui()->mainTemplate()->loadStandardTemplate();
132 $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(ilDclExportGUI::class):
222 case strtolower(ilDclPropertyFormGUI::class):
224 $recordedit_gui->getRecord();
225 $recordedit_gui->initForm();
226 $form = $recordedit_gui->getForm();
227 $this->
ctrl->forwardCommand($form);
239 parent::executeCommand();
247 $this->
tabs->setTabActive(self::TAB_EXPORT);
250 $exp_gui->addFormat(
"xlsx", $this->
lng->txt(
'dcl_xls_async_export'), $exporter,
'exportAsync');
251 $exp_gui->addFormat(
"xml");
253 $exp_gui->listExportFiles();
255 $this->
ctrl->forwardCommand($exp_gui);
261 $tableview_id = null;
262 if ($this->
http->wrapper()->query()->has(
'tableview_id')) {
263 $tableview_id = $this->
http->wrapper()->query()->retrieve(
268 if ($this->
http->wrapper()->post()->has(
'tableview_id')) {
269 $tableview_id = $this->
http->wrapper()->post()->retrieve(
274 if (!$tableview_id) {
276 $tableview_id = $table_obj->getFirstTableViewId();
278 if ($tableview_id === null) {
281 return $tableview_id;
286 $this->
ctrl->setCmd(
"showSummary");
287 $this->
ctrl->setCmdClass(ilInfoScreenGUI::class);
301 $this->
tabs->activateTab(self::TAB_INFO);
308 $info->enablePrivateNotes();
309 $info->addMetaDataSections($this->
object->getId(), 0, $this->
object->getType());
311 $this->
ctrl->forwardCommand($info);
316 if (is_object($this->
object) ===
true) {
318 $this->
object->getTitle(),
319 $this->
ctrl->getLinkTarget($this,
''),
320 (string) $this->
object->getRefId()
325 public static function _goto(
string $a_target): void
328 $lng = $DIC->language();
330 $ctrl = $DIC->ctrl();
332 $tpl = $DIC->ui()->mainTemplate();
334 $params = explode(
'_', $a_target);
337 if (!str_contains($DIC->http()->request()->getServerParams()[
'HTTP_REFERER'] ??
'',
'login.php')) {
338 $goto_string = explode(
'/', $DIC->http()->request()->getRequestTarget());
339 if (str_contains(end($goto_string),
'dcl_')) {
341 $params = [$params[0], $view->getTableId(), $params[1] ?? null, $params[2] ?? null];
345 $values = [self::GET_REF_ID, self::GET_TABLE_ID, self::GET_VIEW_ID, self::GET_RECORD_ID];
346 $values = array_combine($values, array_pad(
$params, count($values), 0));
353 $table_id = (
int) $values[self::GET_TABLE_ID];
354 if ($table_id !== 0 && isset($object->getVisibleTables()[
$table_id])) {
356 $table = $object->getVisibleTables()[
$table_id];
357 $view_id = (
int) $values[self::GET_VIEW_ID];
358 if ($view_id !== 0 && isset($table->getTableViews()[$view_id])) {
362 $record_id = (
int) $values[self::GET_RECORD_ID];
363 if ($record_id !== 0 && isset($table->getRecords()[$record_id])) {
365 $ctrl->
redirectByClass([ilRepositoryGUI::class, self::class, ilDclDetailedViewGUI::class],
'renderRecord');
368 $ctrl->
redirectByClass([ilRepositoryGUI::class, self::class, ilDclRecordListGUI::class],
'listRecords');
373 $lng->
txt(
'msg_no_perm_read_item'),
384 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'object_added'),
true);
385 $this->
ctrl->redirectByClass(ilDclTableListGUI::class,
'listTables');
390 $ref_id = $this->
object->getRefId();
392 if ($this->
access->checkAccess(
'read',
'',
$ref_id) ===
true) {
393 $this->
addTab(self::TAB_CONTENT, $this->
ctrl->getLinkTargetByClass(ilDclRecordListGUI::class,
'show'));
396 if ($this->
access->checkAccess(
'visible',
'',
$ref_id) ===
true 397 || $this->
access->checkAccess(
'read',
'',
$ref_id) ===
true) {
398 $this->
addTab(self::TAB_INFO, $this->
ctrl->getLinkTargetByClass(
399 ilInfoScreenGUI::class,
404 if ($this->
access->checkAccess(
'write',
'',
$ref_id) ===
true) {
405 $this->
addTab(self::TAB_EDIT_DCL, $this->
ctrl->getLinkTarget($this,
'editObject'));
406 $this->
addTab(self::TAB_LIST_TABLES, $this->
ctrl->getLinkTargetByClass(ilDclTableListGUI::class,
'listTables'));
407 $this->
addTab(self::TAB_EXPORT, $this->
ctrl->getLinkTargetByClass(ilDclExportGUI::class,
''));
410 if ($this->
access->checkAccess(
'edit_permission',
'',
$ref_id) ===
true) {
411 $this->
addTab(self::TAB_LIST_PERMISSIONS, $this->
ctrl->getLinkTargetByClass(ilPermissionGUI::class,
'perm'));
415 private function addTab(
string $langKey,
string $link): void
417 $this->
tabs->addTab($langKey, $this->
lng->txt($langKey), $link);
424 $ref_id = $this->
object->getRefId();
425 if ($this->
access->checkAccess(
'write',
'',
$ref_id) ===
false) {
426 $this->error->raiseError($this->
lng->txt(
'msg_no_perm_write'), null);
429 $this->
tabs->activateTab(self::TAB_EDIT_DCL);
434 $form->setValuesByArray($values,
true);
439 $dataCollectionTemplate->setContent($form->getHTML());
444 $this->
tabs->activateTab(self::TAB_EDIT_DCL);
447 $form->setFormAction($this->
ctrl->getFormAction($this,
'update'));
448 $form->setTitle($this->
lng->txt($this->object->getType() .
'_edit'));
453 $ti->setRequired(
true);
462 $cb->setInfo($this->
lng->txt(
'dcl_online_info'));
466 $cb->setInfo($this->
lng->txt(
'dcl_notification_info'));
470 $section_appearance->setTitle($this->
lng->txt(
'cont_presentation'));
471 $form->addItem($section_appearance);
472 $form = $this->object_service->commonSettings()->legacyForm($form, $this->
object)->addTileImage();
474 $form->addCommandButton(
'update', $this->
lng->txt(
'save'));
481 $this->
ctrl->redirectByClass(ilDclRecordListGUI::class,
'show');
491 $a_values[
'is_online'] = $this->
object->getOnline();
492 $a_values[
'rating'] = $this->
object->getRating();
493 $a_values[
'public_notes'] = $this->
object->getPublicNotes();
494 $a_values[
'approval'] = $this->
object->getApproval();
495 $a_values[
'notification'] = $this->
object->getNotification();
500 $this->
object->setOnline((
bool) $form->
getInput(
'is_online'));
501 $this->
object->setRating((
bool) $form->
getInput(
'rating'));
502 $this->
object->setPublicNotes((
bool) $form->
getInput(
'public_notes'));
503 $this->
object->setApproval((
bool) $form->
getInput(
'approval'));
504 $this->
object->setNotification((
bool) $form->
getInput(
'notification'));
506 $this->object_service->commonSettings()->legacyForm($form, $this->
object)->saveTileImage();
511 $ntf = $this->
http->wrapper()->query()->retrieve(
'ntf', $this->
refinery->kindlyTo()->int());
516 $this->
user->getId(),
524 $this->
user->getId(),
529 $this->
ctrl->redirectByClass(ilDclRecordListGUI::class,
'show');
535 $this->
ctrl->getLinkTarget($this,
'redrawHeaderAction',
'',
true),
537 $this->
ctrl->getLinkTargetByClass([ilCommonActionDispatcherGUI::class, ilTaggingGUI::class],
'',
'',
true)
542 $lg = $dispatcher->initHeaderAction();
546 $this->
ctrl->setParameter($this,
'ntf', 1);
547 $lg->addCustomCommand($this->
ctrl->getLinkTarget($this,
'toggleNotification'),
'dcl_notification_deactivate_dcl');
548 $lg->addHeaderIcon(
'not_icon',
ilUtil::getImagePath(
'object/notification_on.svg'), $this->
lng->txt(
'dcl_notification_activated'));
550 $this->
ctrl->setParameter($this,
'ntf', 2);
551 $lg->addCustomCommand($this->
ctrl->getLinkTarget($this,
'toggleNotification'),
'dcl_notification_activate_dcl');
552 $lg->addHeaderIcon(
'not_icon',
ilUtil::getImagePath(
'object/notification_off.svg'), $this->
lng->txt(
'dcl_notification_deactivated'));
554 $this->
ctrl->setParameter($this,
'ntf',
'');
557 $this->tpl->setHeaderActionMenu($lg->getHeaderAction());
ILIAS HTTP Services $http
checkPermission(string $perm, string $cmd="", string $type="", int $ref_id=null)
handleExport(bool $do_default=false)
__construct(int $a_id=0, int $a_id_type=self::REPOSITORY_NODE_ID, int $a_parent_node_id=0)
redirectByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
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.
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
static prepareJsLinks(string $redraw_url, string $notes_url, string $tags_url, ilGlobalTemplateInterface $tpl=null)
Insert js/ajax links into template.
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 getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
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 ...
addExternalEditFormCustom(ilPropertyFormGUI $form)
static _lookupObjId(int $ref_id)
const TYPE_DATA_COLLECTION
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 getTableCache(int $table_id=null)
static setNotification(int $type, int $user_id, int $id, bool $status=true)
Set notification status for object and user.
updateCustom(ilPropertyFormGUI $form)
ilGlobalTemplateInterface $tpl
afterSave(ilObject $new_object)
static hasWriteAccess(int $ref, ?int $user_id=0)
static _goto(string $a_target)
setTableId(int $objectOrRefId=0)
const TAB_LIST_PERMISSIONS
This class represents a text area property in a property form.
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...
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
addTab(string $langKey, string $link)
getEditFormCustomValues(array &$a_values)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
infoScreenForward()
show information screen
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
ilDclDetailedViewGUI: ilDclDetailedViewDefinitionGUI, ilEditClipboardGUI, ilCommentGUI ...