19 declare(strict_types=1);
47 $tpl = $DIC->ui()->mainTemplate();
48 $this->
ctrl = $DIC->ctrl();
49 $this->dcl_gui_object = $a_dcl_object;
50 $this->
lng = $DIC->language();
51 $this->
http = $DIC->http();
53 $this->main_tpl = $DIC->ui()->mainTemplate();
54 $this->ui_factory = $DIC->ui()->factory();
55 $this->renderer = $DIC->ui()->renderer();
58 !$this->
http->wrapper()->query()->has(
'table_id') ||
59 !$this->
http->wrapper()->query()->has(
'tableview_id')
61 $this->main_tpl->setOnScreenMessage($this->main_tpl::MESSAGE_TYPE_FAILURE,
'Table not found',
true);
62 $this->
ctrl->redirectByClass(ilDclRecordListGUI::class,
"show");
65 $this->tableview_id = $this->
http->wrapper()->query()->retrieve(
'tableview_id', $this->
refinery->kindlyTo()->int());
66 $table_id = $this->
http->wrapper()->query()->retrieve(
'table_id', $this->
refinery->kindlyTo()->int());
70 $this->record_id = null;
71 if ($this->
http->wrapper()->query()->has(
'record_id')) {
72 $this->record_id = $this->
http->wrapper()->query()->retrieve(
76 } elseif ($this->
http->wrapper()->query()->has(
'record_pos')) {
78 $pos = $this->
http->wrapper()->query()->retrieve(
'record_pos', $this->
refinery->kindlyTo()->int());
79 if ($record_ids === [] || !array_key_exists($pos, $record_ids)) {
80 $this->
ctrl->redirectToURL($this->
http->request()->getServerParams()[
'HTTP_REFERER']);
82 $this->record_id = $record_ids[$pos];
84 if ($this->
http->wrapper()->post()->has(
'record_id')) {
85 $this->record_id = $this->
http->wrapper()->post()->retrieve(
91 if ($this->record_id) {
93 if (!$this->record_obj->hasPermissionToView($this->dcl_gui_object->getRefId())) {
94 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'dcl_msg_no_perm_view'),
true);
95 $this->
ctrl->redirectByClass(ilDclRecordListGUI::class,
"show");
100 $tpl->setCurrentBlock(
"SyntaxStyle");
102 $tpl->parseCurrentBlock();
104 $tpl->setCurrentBlock(
"ContentStyle");
106 $tpl->parseCurrentBlock();
109 $repId = $this->dcl_gui_object->getDataCollectionObject()->getId();
112 $this->commentGUI->enablePublicNotes();
113 $this->commentGUI->enablePublicNotesDeletion();
114 $this->
ctrl->setParameterByClass(ilCommentGUI::class,
"record_id", $this->record_id);
115 $this->
ctrl->setParameterByClass(ilCommentGUI::class,
"rep_id", $repId);
119 if ($this->
http->wrapper()->query()->has(
'disable_paging')
120 && $this->
http->wrapper()->query()->retrieve(
'disable_paging', $this->
refinery->kindlyTo()->bool())) {
121 $this->is_enabled_paging =
false;
127 $this->
ctrl->setParameter($this,
'tableview_id', $this->tableview_id);
130 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
134 $cmd = $this->
ctrl->getCmd();
135 $cmdClass = $this->
ctrl->getCmdClass();
136 switch (strtolower($cmdClass)) {
138 $this->commentGUI->executeCommand();
148 $this->
ctrl->setParameterByClass(self::class,
'record_id', $this->record_id);
149 $this->
ctrl->redirectByClass(self::class,
'renderRecord');
156 $DIC->help()->setScreenId(
'dcl_record');
157 $ilTabs = $DIC->tabs();
158 $tpl = $DIC->ui()->mainTemplate();
159 $ilCtrl = $DIC->ctrl();
163 $ilTabs->setTabActive(
"id_content");
165 if (!$this->tableview_id) {
166 $ilCtrl->redirectByClass(ilDclRecordListGUI::class,
"listRecords");
171 $pageObj->setOutputMode($pageObj::PRESENTATION);
173 $html = $pageObj->showPage();
174 $rctpl->addCss(
"./assets/css/content.css");
175 $rctpl->fillCssFiles();
179 $pattern =
'/\[dcliln field="' . preg_quote($field->getTitle(),
"/") .
'"\](.*?)\[\/dcliln\]/';
180 if (preg_match($pattern, $html)) {
181 $html = preg_replace(
183 $this->record_obj->getRecordFieldSingleHTML($field->getId(), $this->
setOptions(
"$1")),
189 $pattern =
'/\[dclrefln field="' . preg_quote($field->getTitle(),
"/") .
'"\](.*?)\[\/dclrefln\]/';
190 if (preg_match($pattern, $html)) {
191 $this->currentField = $field;
192 $html = preg_replace_callback($pattern, [$this,
"doReplace"], $html);
195 $pattern =
'/\[ext tableOf="' . preg_quote($field->getTitle(),
"/") .
'" field="(.*?)"\]/';
196 if (preg_match($pattern, $html)) {
197 $this->currentField = $field;
198 $html = preg_replace_callback($pattern, [$this,
"doExtReplace"], $html);
201 $html = str_ireplace(
202 "[" . $field->getTitle() .
"]",
203 $this->record_obj->getRecordFieldSingleHTML($field->getId(), [
'tableview_id' =>
$this->tableview_id]),
207 foreach ($table->getStandardFields() as $field) {
208 $html = str_ireplace(
209 "[" . $field->getId() .
"]",
210 $this->record_obj->getRecordFieldSingleHTML($field->getId(), [
'tableview_id' =>
$this->tableview_id]),
214 $rctpl->setVariable(
"CONTENT", $html);
217 $tpl->setPermanentLink(
219 filter_input(INPUT_GET,
'ref_id', FILTER_VALIDATE_INT),
220 $this->table->getId() .
'_' . $this->tableview_id .
'_' . $this->record_obj->getId()
225 if ($this->is_enabled_paging) {
227 if ($record_ids !== [] && array_search($this->record_id, $record_ids) !==
false) {
228 $DIC->toolbar()->addComponent(
229 $DIC->ui()->factory()->viewControl()->pagination()
230 ->withTargetURL($this->
ctrl->getLinkTargetByClass(self::class,
'jumpToRecord'),
'record_pos')
233 ->withDropdownLabel($this->
lng->txt(
'entry_of'))
234 ->withCurrentPage(array_search($this->record_id, $record_ids))
235 ->withTotalEntries(count($record_ids))
236 ->withMaxPaginationButtons(20)
241 if ($this->record_obj->hasPermissionToEdit($this->dcl_gui_object->getRefId())) {
242 $DIC->toolbar()->addSpacer(
'100%');
243 $this->
ctrl->setParameterByClass(ilDclRecordEditGUI::class,
'table_id', $this->table->getId());
244 $this->
ctrl->setParameterByClass(ilDclRecordEditGUI::class,
'tableview_id', $this->tableview_id);
246 $this->
ctrl->saveParameterByClass(ilDclRecordEditGUI::class,
'record_id');
247 $DIC->toolbar()->addComponent($DIC->ui()->factory()->button()->standard(
248 $this->
lng->txt(
'dcl_edit_record'),
249 $this->
ctrl->getLinkTargetByClass(ilDclRecordEditGUI::class,
'edit')
254 if ($this->table->getPublicCommentsEnabled()) {
255 $rctpl->setVariable(
'COMMENTS', $this->
renderComments($editComments));
258 $tpl->setContent($rctpl->get());
263 return $this->record_obj->getRecordFieldSingleHTML($this->currentField->getId(), $this->
setOptions($found[1]));
268 $ref_rec_ids = $this->record_obj->getRecordFieldValue($this->currentField->getId());
269 if (!is_array($ref_rec_ids)) {
270 $ref_rec_ids = [$ref_rec_ids];
272 if (!count($ref_rec_ids) || !$ref_rec_ids) {
276 foreach ($ref_rec_ids as $ref_rec_id) {
279 $field = $ref_recs[0]->getTable()->getFieldByTitle($found[1]);
281 $tpl =
new ilTemplate(
"tpl.reference_list.html",
true,
true,
"components/ILIAS/DataCollection");
282 $tpl->setCurrentBlock(
"reference_list");
286 $this->main_tpl->setOnScreenMessage(
288 "Bad Viewdefinition at [ext tableOf=\"" . $found[1] .
"\" ...]",
296 foreach ($ref_recs as $ref_record) {
297 $tpl->setCurrentBlock(
"reference");
298 $tpl->setVariable(
"CONTENT", $ref_record->getRecordFieldHTML($field->getId()));
299 $tpl->parseCurrentBlock();
307 return $this->commentGUI->getListHTML();
309 return $this->commentGUI->addNoteForm();
316 $options[
'link'][
'display'] =
true;
317 $options[
'link'][
'name'] = $link_name;
334 $list->determineOffsetAndOrder();
335 $this->table->getPartialRecords(
336 (
string) $this->table->getId(),
337 $list->getOrderField(),
338 $list->getOrderDirection(),
347 $has_accass = ilObjDataCollectionAccess::hasAccessTo($this->dcl_gui_object->getRefId(), $this->table->getId(),
$this->tableview_id);
349 return $has_accass && $is_active;
ILIAS Refinery Factory $refinery
static get(string $a_var)
loadSession()
If we come from a goto Link we need to build up the session data.
setOptions(string $link_name)
doExtReplace(array $found)
ilGlobalTemplateInterface $main_tpl
ilDclDetailedViewDefinitionGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMediaPoolTargetSelector ilDcl...
ilDclBaseFieldModel $currentField
ilDclBaseRecordModel $record_obj
ILIAS HTTP Services $http
ilObjDataCollectionGUI: ilInfoScreenGUI, ilNoteGUI, ilCommonActionDispatcherGUI ilObjDataCollectionG...
static http()
Fetches the global http state from ILIAS.
renderComments(bool $edit=false)
static getTableCache(int $table_id=null)
ILIAS UI Renderer $renderer
ilObjDataCollectionGUI $dcl_gui_object
getRecordFields()
Returns all fields of this table which are NOT standard fields.
renderRecord(bool $editComments=false)
static getSyntaxStylePath()
static hasWriteAccess(int $ref, ?int $user_id=0)
ILIAS UI Factory $ui_factory
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
static getRecordCache(?int $record_id)
__construct(ilObjDataCollectionGUI $a_dcl_object, int $tableview_id)
ilDclDetailedViewGUI: ilDclDetailedViewDefinitionGUI, ilEditClipboardGUI, ilCommentGUI ...