ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 77 of file class.ilDclDetailedViewGUI.php.

77 {
78 global $DIC;
79 $tpl = $DIC['tpl'];
80 $ilCtrl = $DIC['ilCtrl'];
81 $lng = $DIC['lng'];
82 $this->dcl_gui_object = $a_dcl_object;
83 $this->lng = $lng;
84
85 $this->record_id = (int)$_REQUEST['record_id'];
86 $this->record_obj = ilDclCache::getRecordCache($this->record_id);
87
88 if (!$this->record_obj->hasPermissionToView((int)$_GET['ref_id'])) {
89 ilUtil::sendFailure('dcl_msg_no_perm_view', true);
90 $ilCtrl->redirectByClass('ildclrecordlistgui', 'listRecords');
91 }
92
93 // content style (using system defaults)
94 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
95
96 $tpl->setCurrentBlock("SyntaxStyle");
97 $tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
98 $tpl->parseCurrentBlock();
99
100 $tpl->setCurrentBlock("ContentStyle");
101 $tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
102 $tpl->parseCurrentBlock();
103
104 $this->table = $this->record_obj->getTable();
105
106 // Comments
107 include_once("./Services/Notes/classes/class.ilNoteGUI.php");
108 $repId = $this->dcl_gui_object->getDataCollectionObject()->getId();
109 $objId = (int)$this->record_id;
110 $this->notesGUI = new ilNoteGUI($repId, $objId);
111 $this->notesGUI->enablePublicNotes(true);
112 $this->notesGUI->enablePublicNotesDeletion(true);
113 $ilCtrl->setParameterByClass("ilnotegui", "record_id", $this->record_id);
114 $ilCtrl->setParameterByClass("ilnotegui", "rep_id", $repId);
115
116 if (isset($_GET['disable_paging']) && $_GET['disable_paging']) {
117 $this->is_enabled_paging = false;
118 }
119 // Find current, prev and next records for navigation
120 if ($this->is_enabled_paging) {
122 }
123 }
global $tpl
Definition: ilias.php:8
$_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)
get content style path
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilCtrl
Definition: ilias.php:18
global $DIC

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 428 of file class.ilDclDetailedViewGUI.php.

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

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 340 of file class.ilDclDetailedViewGUI.php.

340 {
341 if(!isset($_SESSION['dcl_record_ids']) || $_SESSION['dcl_table_id'] != $this->table->getId()) {
342 $this->loadSession();
343 }
344
345 if (isset($_SESSION['dcl_record_ids']) && count($_SESSION['dcl_record_ids'])) {
346 $this->record_ids = $_SESSION['dcl_record_ids'];
347 foreach ($this->record_ids as $k => $recId) {
348 if ($recId == $this->record_id) {
349 if ($k != 0) {
350 $this->prev_record_id = $this->record_ids[$k - 1];
351 }
352 if (($k + 1) < count($this->record_ids)) {
353 $this->next_record_id = $this->record_ids[$k + 1];
354 }
355 $this->current_record_position = $k + 1;
356 break;
357 }
358 }
359 }
360 }
$_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 289 of file class.ilDclDetailedViewGUI.php.

289 {
290 $ref_rec_ids = $this->record_obj->getRecordFieldValue($this->currentField->getId());
291 if (!is_array($ref_rec_ids)) {
292 $ref_rec_ids = array( $ref_rec_ids );
293 }
294 if (!count($ref_rec_ids) || !$ref_rec_ids) {
295 return;
296 }
297 $ref_recs = array();
298 foreach ($ref_rec_ids as $ref_rec_id) {
299 $ref_recs[] = ilDclCache::getRecordCache($ref_rec_id);
300 }
301 $field = $ref_recs[0]->getTable()->getFieldByTitle($found[1]);
302
303 $tpl = new ilTemplate("tpl.reference_list.html", true, true, "Modules/DataCollection");
304 $tpl->setCurrentBlock("reference_list");
305
306 if (!$field) {
307 if (ilObjDataCollectionAccess::hasWriteAccess($this->dcl_gui_object->ref_id)) {
308 ilUtil::sendInfo("Bad Viewdefinition at [ext tableOf=\"" . $found[1] . "\" ...]", true);
309 }
310
311 return;
312 }
313
314 foreach ($ref_recs as $ref_record) {
315 $tpl->setCurrentBlock("reference");
316 $tpl->setVariable("CONTENT", $ref_record->getRecordFieldHTML($field->getId()));
317 $tpl->parseCurrentBlock();
318 }
319
320 //$ref_rec->getRecordFieldHTML($field->getId())
321 if ($field) {
322 return $tpl->get();
323 }
324 }
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 279 of file class.ilDclDetailedViewGUI.php.

279 {
280 return $this->record_obj->getRecordFieldSingleHTML($this->currentField->getId(), $this->setOptions($found[1]));
281 }

◆ executeCommand()

ilDclDetailedViewGUI::executeCommand ( )

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

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

References $_GET, $cmd, $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 417 of file class.ilDclDetailedViewGUI.php.

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

Referenced by determineNextPrevRecords().

+ Here is the caller graph for this function:

◆ offerAlternativeViews()

ilDclDetailedViewGUI::offerAlternativeViews ( )
protected

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

173 {
174 global $DIC;
175 $tpl = $DIC['tpl'];
176 ilUtil::sendInfo($this->lng->txt('dcl_msg_info_alternatives'));
177 $table_gui = new ilDclTableViewTableGUI($this, 'renderRecord', $this->table);
178 $tpl->setContent($table_gui->getHTML());
179 }
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 327 of file class.ilDclDetailedViewGUI.php.

327 {
328
329 if (!$edit) {
330 return $this->notesGUI->getOnlyCommentsHtml();
331 } else {
332 return $this->notesGUI->editNoteForm();
333 }
334 }

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 368 of file class.ilDclDetailedViewGUI.php.

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

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 184 of file class.ilDclDetailedViewGUI.php.

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

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 391 of file class.ilDclDetailedViewGUI.php.

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

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 406 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 }
if(!is_array($argv)) $options

References $options.

Field Documentation

◆ $current_record_position

ilDclDetailedViewGUI::$current_record_position = 0
protected

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

◆ $dcl_gui_object

ilDclDetailedViewGUI::$dcl_gui_object
protected

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

◆ $is_enabled_paging

ilDclDetailedViewGUI::$is_enabled_paging = true
protected

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

◆ $lng

ilDclDetailedViewGUI::$lng
protected

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

Referenced by __construct().

◆ $next_record_id

ilDclDetailedViewGUI::$next_record_id = 0
protected

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

Referenced by renderPrevNextLinks().

◆ $notes_gui

ilDclDetailedViewGUI::$notes_gui
protected

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

◆ $prev_record_id

ilDclDetailedViewGUI::$prev_record_id = 0
protected

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

Referenced by renderPrevNextLinks().

◆ $record_ids

ilDclDetailedViewGUI::$record_ids = array()
protected

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

◆ $record_obj

ilDclDetailedViewGUI::$record_obj
protected

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

◆ $table

ilDclDetailedViewGUI::$table
protected

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

Referenced by renderRecord().

◆ $tableview_id

ilDclDetailedViewGUI::$tableview_id
protected

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


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