19 declare(strict_types=1);
51 $tpl = $DIC->ui()->mainTemplate();
52 $this->
ctrl = $DIC->ctrl();
53 $this->dcl_gui_object = $a_dcl_object;
54 $this->
lng = $DIC->language();
55 $this->
http = $DIC->http();
57 $this->main_tpl = $DIC->ui()->mainTemplate();
58 $this->ui_factory = $DIC->ui()->factory();
59 $this->renderer = $DIC->ui()->renderer();
61 $this->record_id = null;
62 if ($this->
http->wrapper()->query()->has(
'record_id')) {
63 $this->record_id = $this->
http->wrapper()->query()->retrieve(
68 if ($this->
http->wrapper()->post()->has(
'record_id')) {
69 $this->record_id = $this->
http->wrapper()->post()->retrieve(
74 $ref_id = $this->dcl_gui_object->getRefId();
76 if ($this->record_id) {
78 $this->table = $this->record_obj->getTable();
79 if (!$this->record_obj->hasPermissionToView(
$ref_id)) {
80 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'dcl_msg_no_perm_view'),
true);
81 $this->
ctrl->redirectByClass(ilDclRecordListGUI::class,
"show");
86 $tpl->setCurrentBlock(
"SyntaxStyle");
88 $tpl->parseCurrentBlock();
90 $tpl->setCurrentBlock(
"ContentStyle");
92 $tpl->parseCurrentBlock();
95 $repId = $this->dcl_gui_object->getDataCollectionObject()->getId();
98 $this->commentGUI->enablePublicNotes();
99 $this->commentGUI->enablePublicNotesDeletion();
100 $this->
ctrl->setParameterByClass(ilCommentGUI::class,
"record_id", $this->record_id);
101 $this->
ctrl->setParameterByClass(ilCommentGUI::class,
"rep_id", $repId);
105 if ($this->
http->wrapper()->query()->has(
'disable_paging')
106 && $this->
http->wrapper()->query()->retrieve(
'disable_paging', $this->
refinery->kindlyTo()->bool())) {
107 $this->is_enabled_paging =
false;
110 if ($this->is_enabled_paging) {
117 $this->
ctrl->setParameter($this,
'tableview_id', $this->tableview_id);
120 if ($this->table->getVisibleTableViews(0,
true)) {
123 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
129 $cmd = $this->
ctrl->getCmd();
130 $cmdClass = $this->
ctrl->getCmdClass();
131 switch (strtolower($cmdClass)) {
133 $this->commentGUI->executeCommand();
145 $this->main_tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'dcl_msg_info_alternatives'));
146 $table_gui =
new ilDclTableViewTableGUI($this,
'renderRecord', $this->table, $this->dcl_gui_object->getRefId());
147 $tpl->setContent($table_gui->getHTML());
154 $DIC->help()->setScreenId(
'dcl_record');
155 $ilTabs = $DIC->tabs();
156 $tpl = $DIC->ui()->mainTemplate();
157 $ilCtrl = $DIC->ctrl();
161 $ilTabs->setTabActive(
"id_content");
163 if (!$this->tableview_id) {
164 $ilCtrl->redirectByClass(ilDclRecordListGUI::class,
"listRecords");
169 $pageObj->setOutputMode($pageObj::PRESENTATION);
171 $html = $pageObj->showPage();
172 $rctpl->addCss(
"./Services/COPage/css/content.css");
173 $rctpl->fillCssFiles();
177 $pattern =
'/\[dcliln field="' . preg_quote($field->getTitle(),
"/") .
'"\](.*?)\[\/dcliln\]/';
178 if (preg_match($pattern, $html)) {
179 $html = preg_replace(
181 $this->record_obj->getRecordFieldSingleHTML($field->getId(), $this->
setOptions(
"$1")),
187 $pattern =
'/\[dclrefln field="' . preg_quote($field->getTitle(),
"/") .
'"\](.*?)\[\/dclrefln\]/';
188 if (preg_match($pattern, $html)) {
189 $this->currentField = $field;
190 $html = preg_replace_callback($pattern, [$this,
"doReplace"], $html);
193 $pattern =
'/\[ext tableOf="' . preg_quote($field->getTitle(),
"/") .
'" field="(.*?)"\]/';
194 if (preg_match($pattern, $html)) {
195 $this->currentField = $field;
196 $html = preg_replace_callback($pattern, [$this,
"doExtReplace"], $html);
199 $html = str_ireplace(
200 "[" . $field->getTitle() .
"]",
201 $this->record_obj->getRecordFieldSingleHTML($field->getId(), [
'tableview_id' =>
$this->tableview_id]),
205 foreach ($table->getStandardFields() as $field) {
206 $html = str_ireplace(
207 "[" . $field->getId() .
"]",
208 $this->record_obj->getRecordFieldSingleHTML($field->getId(), [
'tableview_id' =>
$this->tableview_id]),
212 $rctpl->setVariable(
"CONTENT", $html);
215 $tpl->setPermanentLink(
217 filter_input(INPUT_GET,
'ref_id', FILTER_VALIDATE_INT),
218 $this->table->getId() .
'_' . $this->tableview_id .
'_' . $this->record_obj->getId()
223 if ($this->is_enabled_paging) {
225 $rctpl->setVariable(
'PREV_NEXT_RECORD_LINKS', $prevNextLinks);
226 $ilCtrl->clearParameters($this);
227 $rctpl->setVariable(
'FORM_ACTION', $ilCtrl->getFormAction($this));
228 $rctpl->setVariable(
'RECORD', $this->
lng->txt(
'dcl_record'));
232 $this->
lng->txt(
'dcl_record_from_total'),
234 count($this->record_ids)
237 $rctpl->setVariable(
'TABLEVIEW_ID', $this->tableview_id);
242 $ref_id = $this->
http->wrapper()->query()->retrieve(
'ref_id', $this->
refinery->kindlyTo()->int());
244 if ($this->record_obj->hasPermissionToEdit(
$ref_id)) {
245 $ilCtrl->setParameterByClass(ilDclRecordEditGUI::class,
'table_id', $this->table->getId());
246 $ilCtrl->setParameterByClass(ilDclRecordEditGUI::class,
'tableview_id', $this->tableview_id);
248 $ilCtrl->saveParameterByClass(ilDclRecordEditGUI::class,
'record_id');
249 $edit_button = $this->ui_factory->button()->standard(
250 $this->
lng->txt(
'dcl_edit_record'),
251 $ilCtrl->getLinkTargetByClass(ilDclRecordEditGUI::class,
'edit')
253 $rctpl->setVariable(
'EDIT_RECORD_BUTTON', $this->renderer->render($edit_button));
257 if ($this->table->getPublicCommentsEnabled()) {
258 $rctpl->setVariable(
'COMMENTS', $this->
renderComments($editComments));
261 $tpl->setContent($rctpl->get());
266 return $this->record_obj->getRecordFieldSingleHTML($this->currentField->getId(), $this->
setOptions($found[1]));
271 $ref_rec_ids = $this->record_obj->getRecordFieldValue($this->currentField->getId());
272 if (!is_array($ref_rec_ids)) {
273 $ref_rec_ids = [$ref_rec_ids];
275 if (!count($ref_rec_ids) || !$ref_rec_ids) {
279 foreach ($ref_rec_ids as $ref_rec_id) {
282 $field = $ref_recs[0]->getTable()->getFieldByTitle($found[1]);
284 $tpl =
new ilTemplate(
"tpl.reference_list.html",
true,
true,
"Modules/DataCollection");
285 $tpl->setCurrentBlock(
"reference_list");
289 $this->main_tpl->setOnScreenMessage(
291 "Bad Viewdefinition at [ext tableOf=\"" . $found[1] .
"\" ...]",
299 foreach ($ref_recs as $ref_record) {
300 $tpl->setCurrentBlock(
"reference");
301 $tpl->setVariable(
"CONTENT", $ref_record->getRecordFieldHTML($field->getId()));
302 $tpl->parseCurrentBlock();
310 return $this->commentGUI->getListHTML();
312 return $this->commentGUI->addNoteForm();
327 foreach ($this->record_ids as $k => $recId) {
328 if ($recId == $this->record_id) {
330 $this->prev_record_id = $this->record_ids[$k - 1];
332 if (($k + 1) < count($this->record_ids)) {
333 $this->next_record_id = $this->record_ids[$k + 1];
335 $this->current_record_position = $k + 1;
348 $ilCtrl = $DIC[
'ilCtrl'];
349 $ilCtrl->setParameter($this,
'tableview_id', $this->tableview_id);
350 $prevStr = $this->
lng->txt(
'dcl_prev_record');
351 $nextStr = $this->
lng->txt(
'dcl_next_record');
352 $ilCtrl->setParameter($this,
'record_id', $this->prev_record_id);
353 $url = $ilCtrl->getLinkTarget($this,
'renderRecord');
356 $ilCtrl->setParameter($this,
'record_id', $this->next_record_id);
357 $url = $ilCtrl->getLinkTarget($this,
'renderRecord');
369 foreach ($this->record_ids as $k => $recId) {
371 $out .=
"<option value='$recId'$selected>" . ($k + 1) .
"</option>";
384 $options[
'link'][
'display'] =
true;
385 $options[
'link'][
'name'] = $link_name;
402 $list->determineOffsetAndOrder();
403 $this->table->getPartialRecords(
404 (
string) $this->table->getId(),
405 $list->getOrderField(),
406 $list->getOrderDirection(),
418 $ref_id = $this->dcl_gui_object->getRefId();
421 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)
setOptions string $link_name
doExtReplace(array $found)
renderSelectOptions()
Render select options.
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)
renderPrevNextLinks()
Determine and return the markup for the previous/next records.
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)
int $current_record_position
static getRecordCache(?int $record_id)
determineNextPrevRecords()
Find the previous/next record from the current position.
__construct(ilObjDataCollectionGUI $a_dcl_object, int $tableview_id)
ilDclDetailedViewGUI: ilDclDetailedViewDefinitionGUI, ilEditClipboardGUI, ilCommentGUI ...