ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilDclDetailedViewGUI Class Reference
+ Collaboration diagram for ilDclDetailedViewGUI:

Public Member Functions

 __construct (ilObjDataCollectionGUI $a_dcl_object)
 
 executeCommand ()
 
 renderRecord ($editComments=false)
 
 doReplace ($found)
 
 doExtReplace ($found)
 

Protected Member Functions

 offerAlternativeViews ()
 
 renderComments ($edit=false)
 
 determineNextPrevRecords ()
 Find the previous/next record from the current position. More...
 
 renderPrevNextLinks ()
 Determine and return the markup for the previous/next records. More...
 
 renderSelectOptions ()
 Render select options. More...
 
 checkAccess ()
 

Protected Attributes

 $dcl_gui_object
 
 $notes_gui
 
 $table
 
 $tableview_id
 
 $record_obj
 
 $next_record_id = 0
 
 $prev_record_id = 0
 
 $current_record_position = 0
 
 $record_ids = array()
 
 $is_enabled_paging = true
 
 $lng
 

Private Member Functions

 setOptions ($link_name)
 setOptions string $link_name More...
 
 loadSession ()
 If we come from a goto Link we need to build up the session data. More...
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDclDetailedViewGUI::__construct ( ilObjDataCollectionGUI  $a_dcl_object)
Parameters
ilObjDataCollectionGUI$a_dcl_object

Definition at line 66 of file class.ilDclDetailedViewGUI.php.

67 {
68 global $DIC;
69 $tpl = $DIC['tpl'];
70 $ilCtrl = $DIC['ilCtrl'];
71 $lng = $DIC['lng'];
72 $this->dcl_gui_object = $a_dcl_object;
73 $this->lng = $lng;
74
75 $this->record_id = (int) $_REQUEST['record_id'];
76 $this->record_obj = ilDclCache::getRecordCache($this->record_id);
77
78 if (!$this->record_obj->hasPermissionToView((int) $_GET['ref_id'])) {
79 ilUtil::sendFailure('dcl_msg_no_perm_view', true);
80 $ilCtrl->redirectByClass('ildclrecordlistgui', 'listRecords');
81 }
82
83 // content style (using system defaults)
84 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
85
86 $tpl->setCurrentBlock("SyntaxStyle");
87 $tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
88 $tpl->parseCurrentBlock();
89
90 $tpl->setCurrentBlock("ContentStyle");
91 $tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
92 $tpl->parseCurrentBlock();
93
94 $this->table = $this->record_obj->getTable();
95
96 // Comments
97 include_once("./Services/Notes/classes/class.ilNoteGUI.php");
98 $repId = $this->dcl_gui_object->getDataCollectionObject()->getId();
99 $objId = (int) $this->record_id;
100 $this->notesGUI = new ilNoteGUI($repId, $objId);
101 $this->notesGUI->enablePublicNotes(true);
102 $this->notesGUI->enablePublicNotesDeletion(true);
103 $ilCtrl->setParameterByClass("ilnotegui", "record_id", $this->record_id);
104 $ilCtrl->setParameterByClass("ilnotegui", "rep_id", $repId);
105
106 if (isset($_GET['disable_paging']) && $_GET['disable_paging']) {
107 $this->is_enabled_paging = false;
108 }
109 // Find current, prev and next records for navigation
110 if ($this->is_enabled_paging) {
112 }
113 }
$tpl
Definition: ilias.php:10
$_GET["client_id"]
static getRecordCache($record_id=0)
determineNextPrevRecords()
Find the previous/next record from the current position.
Notes GUI class.
static getSyntaxStylePath()
get syntax style path
static getContentStylePath($a_style_id, $add_random=true)
get content style path
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7

References $_GET, $DIC, $ilCtrl, $lng, $tpl, determineNextPrevRecords(), ilObjStyleSheet\getContentStylePath(), ilDclCache\getRecordCache(), ilObjStyleSheet\getSyntaxStylePath(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

Member Function Documentation

◆ checkAccess()

ilDclDetailedViewGUI::checkAccess ( )
protected
Returns
bool

Definition at line 430 of file class.ilDclDetailedViewGUI.php.

431 {
432 return ilObjDataCollectionAccess::hasAccessTo(filter_input(INPUT_GET, 'ref_id'), $this->table->getId(), $this->tableview_id)
433 && ilDclDetailedViewDefinition::isActive($this->tableview_id);
434 }

References ilDclDetailedViewDefinition\isActive().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ determineNextPrevRecords()

ilDclDetailedViewGUI::determineNextPrevRecords ( )
protected

Find the previous/next record from the current position.

Also determine position of current record in whole set.

Definition at line 336 of file class.ilDclDetailedViewGUI.php.

337 {
338 if (!isset($_SESSION['dcl_record_ids']) || $_SESSION['dcl_table_id'] != $this->table->getId()) {
339 $this->loadSession();
340 }
341
342 if (isset($_SESSION['dcl_record_ids']) && count($_SESSION['dcl_record_ids'])) {
343 $this->record_ids = $_SESSION['dcl_record_ids'];
344 foreach ($this->record_ids as $k => $recId) {
345 if ($recId == $this->record_id) {
346 if ($k != 0) {
347 $this->prev_record_id = $this->record_ids[$k - 1];
348 }
349 if (($k + 1) < count($this->record_ids)) {
350 $this->next_record_id = $this->record_ids[$k + 1];
351 }
352 $this->current_record_position = $k + 1;
353 break;
354 }
355 }
356 }
357 }
$_SESSION["AccountId"]
loadSession()
If we come from a goto Link we need to build up the session data.

References $_SESSION, and loadSession().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doExtReplace()

ilDclDetailedViewGUI::doExtReplace (   $found)
Parameters
$found
Returns
string

Definition at line 284 of file class.ilDclDetailedViewGUI.php.

285 {
286 $ref_rec_ids = $this->record_obj->getRecordFieldValue($this->currentField->getId());
287 if (!is_array($ref_rec_ids)) {
288 $ref_rec_ids = array($ref_rec_ids);
289 }
290 if (!count($ref_rec_ids) || !$ref_rec_ids) {
291 return;
292 }
293 $ref_recs = array();
294 foreach ($ref_rec_ids as $ref_rec_id) {
295 $ref_recs[] = ilDclCache::getRecordCache($ref_rec_id);
296 }
297 $field = $ref_recs[0]->getTable()->getFieldByTitle($found[1]);
298
299 $tpl = new ilTemplate("tpl.reference_list.html", true, true, "Modules/DataCollection");
300 $tpl->setCurrentBlock("reference_list");
301
302 if (!$field) {
303 if (ilObjDataCollectionAccess::hasWriteAccess($this->dcl_gui_object->ref_id)) {
304 ilUtil::sendInfo("Bad Viewdefinition at [ext tableOf=\"" . $found[1] . "\" ...]", true);
305 }
306
307 return;
308 }
309
310 foreach ($ref_recs as $ref_record) {
311 $tpl->setCurrentBlock("reference");
312 $tpl->setVariable("CONTENT", $ref_record->getRecordFieldHTML($field->getId()));
313 $tpl->parseCurrentBlock();
314 }
315
316 //$ref_rec->getRecordFieldHTML($field->getId())
317 if ($field) {
318 return $tpl->get();
319 }
320 }
special template class to simplify handling of ITX/PEAR
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $tpl, ilDclCache\getRecordCache(), ilObjDataCollectionAccess\hasWriteAccess(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ doReplace()

ilDclDetailedViewGUI::doReplace (   $found)
Parameters
$found
Returns
array|string

Definition at line 273 of file class.ilDclDetailedViewGUI.php.

274 {
275 return $this->record_obj->getRecordFieldSingleHTML($this->currentField->getId(), $this->setOptions($found[1]));
276 }

◆ executeCommand()

ilDclDetailedViewGUI::executeCommand ( )

Definition at line 116 of file class.ilDclDetailedViewGUI.php.

117 {
118 global $DIC;
119 $ilCtrl = $DIC['ilCtrl'];
120 $this->tableview_id = $_GET['tableview_id'] ? $_GET['tableview_id'] : $this->table->getFirstTableViewId($_GET['ref_id']);
121 $ilCtrl->setParameter($this, 'tableview_id', $this->tableview_id);
122 $ilCtrl->setParameter($this->dcl_gui_object, 'tableview_id', $_GET['back_tableview_id'] ? $_GET['back_tableview_id'] : $this->tableview_id);
123
124 if (!$this->checkAccess()) {
125 if ($this->table->getVisibleTableViews($_GET['ref_id'], true)) {
126 $this->offerAlternativeViews();
127 } else {
128 ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
129 }
130
131 return;
132 }
133
134 $cmd = $ilCtrl->getCmd();
135 $cmdClass = $ilCtrl->getCmdClass();
136 switch ($cmdClass) {
137 case 'ilnotegui':
138 switch ($cmd) {
139 case 'editNoteForm':
140 $this->renderRecord(true);
141 break;
142 case 'showNotes':
143 $this->renderRecord(false);
144 break;
145 case 'deleteNote':
146 $this->notesGUI->deleteNote();
147 $this->renderRecord();
148 break;
149 case 'cancelDelete':
150 $this->notesGUI->cancelDelete();
151 $this->renderRecord();
152 break;
153 default:
154 $this->notesGUI->$cmd();
155 break;
156 }
157 break;
158 default:
159 $this->$cmd();
160 break;
161 }
162 }
renderRecord($editComments=false)

References $_GET, $DIC, $ilCtrl, checkAccess(), offerAlternativeViews(), renderRecord(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ loadSession()

ilDclDetailedViewGUI::loadSession ( )
private

If we come from a goto Link we need to build up the session data.

Definition at line 418 of file class.ilDclDetailedViewGUI.php.

419 {
420 // We need the default sorting etc. to dertermine on which position we currently are, thus we instantiate the table gui.
421 $list = new ilDclRecordListTableGUI(new ilDclRecordListGUI($this->dcl_gui_object, $this->table->getId()), "listRecords", $this->table, $this->tableview_id);
422 //we then partially load the records. note that this also fills up session data.
423 $this->table->getPartialRecords($list->getOrderField(), $list->getOrderDirection(), $list->getLimit(), $list->getOffset(), $list->getFilter());
424 }
if(isset($_REQUEST['delete'])) $list
Definition: registry.php:41

References $list.

Referenced by determineNextPrevRecords().

+ Here is the caller graph for this function:

◆ offerAlternativeViews()

ilDclDetailedViewGUI::offerAlternativeViews ( )
protected

Definition at line 165 of file class.ilDclDetailedViewGUI.php.

166 {
167 global $DIC;
168 $tpl = $DIC['tpl'];
169 ilUtil::sendInfo($this->lng->txt('dcl_msg_info_alternatives'));
170 $table_gui = new ilDclTableViewTableGUI($this, 'renderRecord', $this->table);
171 $tpl->setContent($table_gui->getHTML());
172 }
Class ilDclTableViewTableGUI.

References $DIC, $tpl, and ilUtil\sendInfo().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderComments()

ilDclDetailedViewGUI::renderComments (   $edit = false)
protected

Definition at line 323 of file class.ilDclDetailedViewGUI.php.

324 {
325 if (!$edit) {
326 return $this->notesGUI->getOnlyCommentsHtml();
327 } else {
328 return $this->notesGUI->editNoteForm();
329 }
330 }

Referenced by renderRecord().

+ Here is the caller graph for this function:

◆ renderPrevNextLinks()

ilDclDetailedViewGUI::renderPrevNextLinks ( )
protected

Determine and return the markup for the previous/next records.

Returns
string

Definition at line 365 of file class.ilDclDetailedViewGUI.php.

366 {
367 global $DIC;
368 $ilCtrl = $DIC['ilCtrl'];
369 $ilCtrl->setParameter($this, 'tableview_id', $this->tableview_id);
370 $prevStr = $this->lng->txt('dcl_prev_record');
371 $nextStr = $this->lng->txt('dcl_next_record');
372 $ilCtrl->setParameter($this, 'record_id', $this->prev_record_id);
373 $url = $ilCtrl->getLinkTarget($this, 'renderRecord');
374 $out = ($this->prev_record_id) ? "<a href='{$url}'>{$prevStr}</a>" : "<span class='light'>{$prevStr}</span>";
375 $out .= " | ";
376 $ilCtrl->setParameter($this, 'record_id', $this->next_record_id);
377 $url = $ilCtrl->getLinkTarget($this, 'renderRecord');
378 $out .= ($this->next_record_id) ? "<a href='{$url}'>{$nextStr}</a>" : "<span class='light'>{$nextStr}</span>";
379
380 return $out;
381 }
$url

References $DIC, $ilCtrl, $next_record_id, $out, $prev_record_id, and $url.

Referenced by renderRecord().

+ Here is the caller graph for this function:

◆ renderRecord()

ilDclDetailedViewGUI::renderRecord (   $editComments = false)
Parameters
bool$editComments

Definition at line 178 of file class.ilDclDetailedViewGUI.php.

179 {
180 global $DIC;
181 $ilTabs = $DIC['ilTabs'];
182 $tpl = $DIC['tpl'];
183 $ilCtrl = $DIC['ilCtrl'];
184
185 $rctpl = new ilTemplate("tpl.record_view.html", false, true, "Modules/DataCollection");
186
187 $ilTabs->setTabActive("id_content");
188
189 if (!$this->tableview_id) {
190 $ilCtrl->redirectByClass("ildclrecordlistgui", "listRecords");
191 }
192
193 // see ilObjDataCollectionGUI->executeCommand about instantiation
194 include_once("class.ilDclDetailedViewDefinitionGUI.php");
195 $pageObj = new ilDclDetailedViewDefinitionGUI($this->tableview_id);
196 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
197 $pageObj->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(0, "dcl"));
198
199 $html = $pageObj->getHTML();
200 $rctpl->addCss("./Services/COPage/css/content.css");
201 $rctpl->fillCssFiles();
202 $table = ilDclCache::getTableCache($this->record_obj->getTableId());
203 foreach ($table->getRecordFields() as $field) {
204 //ILIAS_Ref_Links
205 $pattern = '/\[dcliln field="' . preg_quote($field->getTitle(), "/") . '"\](.*?)\[\/dcliln\]/';
206 if (preg_match($pattern, $html)) {
207 $html = preg_replace($pattern, $this->record_obj->getRecordFieldSingleHTML($field->getId(), $this->setOptions("$1")), $html);
208 }
209
210 //DataCollection Ref Links
211 $pattern = '/\[dclrefln field="' . preg_quote($field->getTitle(), "/") . '"\](.*?)\[\/dclrefln\]/';
212 if (preg_match($pattern, $html)) {
213 $this->currentField = $field;
214 $html = preg_replace_callback($pattern, array($this, "doReplace"), $html);
215 }
216
217 $pattern = '/\[ext tableOf="' . preg_quote($field->getTitle(), "/") . '" field="(.*?)"\]/';
218 if (preg_match($pattern, $html)) {
219 $this->currentField = $field;
220 $html = preg_replace_callback($pattern, array($this, "doExtReplace"), $html);
221 }
222
223 $html = str_ireplace("[" . $field->getTitle() . "]", $this->record_obj->getRecordFieldSingleHTML($field->getId()), $html);
224 }
225 foreach ($table->getStandardFields() as $field) {
226 $html = str_ireplace("[" . $field->getId() . "]", $this->record_obj->getRecordFieldSingleHTML($field->getId()), $html);
227 }
228 $rctpl->setVariable("CONTENT", $html);
229
230 //Permanent Link
231 $perma_link = new ilPermanentLinkGUI("dcl", $_GET["ref_id"], "_" . $this->tableview_id . "_" . $this->record_obj->getId());
232 $tpl->setVariable('PRMLINK', $perma_link->getHTML());
233
234 // Buttons for previous/next records
235
236 if ($this->is_enabled_paging) {
237 $prevNextLinks = $this->renderPrevNextLinks();
238 $rctpl->setVariable('PREV_NEXT_RECORD_LINKS', $prevNextLinks);
239 $ilCtrl->clearParameters($this); // #14083
240 $rctpl->setVariable('FORM_ACTION', $ilCtrl->getFormAction($this));
241 $rctpl->setVariable('RECORD', $this->lng->txt('dcl_record'));
242 $rctpl->setVariable('RECORD_FROM_TOTAL', sprintf($this->lng->txt('dcl_record_from_total'), $this->current_record_position, count($this->record_ids)));
243 $rctpl->setVariable('TABLEVIEW_ID', $this->tableview_id);
244 $rctpl->setVariable('SELECT_OPTIONS', $this->renderSelectOptions());
245 }
246
247 // Edit Button
248 if ($this->record_obj->hasPermissionToEdit((int) $_GET['ref_id'])) {
249 $button = ilLinkButton::getInstance();
250 $ilCtrl->setParameterByClass('ildclrecordeditgui', 'table_id', $this->table->getId());
251 $ilCtrl->setParameterByClass('ildclrecordeditgui', 'tableview_id', $this->tableview_id);
252 $ilCtrl->setParameterByClass('ildclrecordeditgui', 'redirect', ilDclRecordEditGUI::REDIRECT_DETAIL);
253 $ilCtrl->saveParameterByClass('ildclrecordeditgui', 'record_id');
254 $button->setUrl($ilCtrl->getLinkTargetByClass('ildclrecordeditgui', 'edit'));
255 $button->setCaption($this->lng->txt('dcl_edit_record'), false);
256 $rctpl->setVariable('EDIT_RECORD_BUTTON', $button->render());
257 }
258
259 // Comments
260 if ($this->table->getPublicCommentsEnabled()) {
261 $rctpl->setVariable('COMMENTS', $this->renderComments($editComments));
262 }
263
264 $tpl->setContent($rctpl->get());
265 }
static getTableCache($table_id=0)
Class ilDclDetailedViewDefinitionGUI.
renderPrevNextLinks()
Determine and return the markup for the previous/next records.
renderSelectOptions()
Render select options.
static getInstance()
Factory.
static getEffectiveContentStyleId($a_style_id, $a_type="")
Get effective Style Id.
Class for permanent links.
$html
Definition: example_001.php:87

References $_GET, $DIC, $html, $ilCtrl, $table, $tpl, ilObjStyleSheet\getEffectiveContentStyleId(), ilLinkButton\getInstance(), ilDclCache\getTableCache(), ilDclRecordEditGUI\REDIRECT_DETAIL, renderComments(), renderPrevNextLinks(), and renderSelectOptions().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderSelectOptions()

ilDclDetailedViewGUI::renderSelectOptions ( )
protected

Render select options.

Returns
string

Definition at line 389 of file class.ilDclDetailedViewGUI.php.

390 {
391 $out = '';
392 foreach ($this->record_ids as $k => $recId) {
393 $selected = ($recId == $this->record_id) ? " selected" : "";
394 $out .= "<option value='{$recId}'{$selected}>" . ($k + 1) . "</option>";
395 }
396
397 return $out;
398 }

References $out.

Referenced by renderRecord().

+ Here is the caller graph for this function:

◆ setOptions()

ilDclDetailedViewGUI::setOptions (   $link_name)
private

setOptions string $link_name

Definition at line 405 of file class.ilDclDetailedViewGUI.php.

406 {
407 $options = array();
408 $options['link']['display'] = true;
409 $options['link']['name'] = $link_name;
410
411 return $options;
412 }

References PHPMailer\PHPMailer\$options.

Field Documentation

◆ $current_record_position

ilDclDetailedViewGUI::$current_record_position = 0
protected

Definition at line 48 of file class.ilDclDetailedViewGUI.php.

◆ $dcl_gui_object

ilDclDetailedViewGUI::$dcl_gui_object
protected

Definition at line 20 of file class.ilDclDetailedViewGUI.php.

◆ $is_enabled_paging

ilDclDetailedViewGUI::$is_enabled_paging = true
protected

Definition at line 56 of file class.ilDclDetailedViewGUI.php.

◆ $lng

ilDclDetailedViewGUI::$lng
protected

Definition at line 60 of file class.ilDclDetailedViewGUI.php.

Referenced by __construct().

◆ $next_record_id

ilDclDetailedViewGUI::$next_record_id = 0
protected

Definition at line 40 of file class.ilDclDetailedViewGUI.php.

Referenced by renderPrevNextLinks().

◆ $notes_gui

ilDclDetailedViewGUI::$notes_gui
protected

Definition at line 24 of file class.ilDclDetailedViewGUI.php.

◆ $prev_record_id

ilDclDetailedViewGUI::$prev_record_id = 0
protected

Definition at line 44 of file class.ilDclDetailedViewGUI.php.

Referenced by renderPrevNextLinks().

◆ $record_ids

ilDclDetailedViewGUI::$record_ids = array()
protected

Definition at line 52 of file class.ilDclDetailedViewGUI.php.

◆ $record_obj

ilDclDetailedViewGUI::$record_obj
protected

Definition at line 36 of file class.ilDclDetailedViewGUI.php.

◆ $table

ilDclDetailedViewGUI::$table
protected

Definition at line 28 of file class.ilDclDetailedViewGUI.php.

Referenced by renderRecord().

◆ $tableview_id

ilDclDetailedViewGUI::$tableview_id
protected

Definition at line 32 of file class.ilDclDetailedViewGUI.php.


The documentation for this class was generated from the following file: