ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilDclDetailedViewGUI Class Reference

@ilCtrl_Calls ilDclDetailedViewGUI: ilDclDetailedViewDefinitionGUI, ilEditClipboardGUI, ilCommentGUI More...

+ Collaboration diagram for ilDclDetailedViewGUI:

Public Member Functions

 __construct (ilObjDataCollectionGUI $a_dcl_object, int $tableview_id)
 
 executeCommand ()
 
 jumpToRecord ()
 
 renderRecord (bool $editComments=false)
 
 sendFile ()
 

Protected Member Functions

 renderComments (bool $edit=false)
 
 checkAccess ()
 

Protected Attributes

Factory $ui_factory
 
ilObjDataCollectionGUI $dcl_gui_object
 
ilDclTable $table
 
int $tableview_id
 
ilDclBaseRecordModel $record_obj
 
bool $is_enabled_paging = true
 
ilLanguage $lng
 
ilCtrlInterface $ctrl
 
HTTP $http
 
Refinery $refinery
 
int $record_id
 
ilCommentGUI $commentGUI
 
ilDclBaseFieldModel $currentField
 

Private Member Functions

 loadSession ()
 

Private Attributes

ilGlobalTemplateInterface $main_tpl
 
RS $irss
 
ilHelpGUI $help
 
ilToolbarGUI $toolbar
 
ilTabsGUI $tabs
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDclDetailedViewGUI::__construct ( ilObjDataCollectionGUI  $a_dcl_object,
int  $tableview_id 
)

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

52 {
53 global $DIC;
54
55 $tpl = $DIC->ui()->mainTemplate();
56 $this->ctrl = $DIC->ctrl();
57 $this->dcl_gui_object = $a_dcl_object;
58 $this->lng = $DIC->language();
59 $this->http = $DIC->http();
60 $this->refinery = $DIC->refinery();
61 $this->main_tpl = $DIC->ui()->mainTemplate();
62 $this->ui_factory = $DIC->ui()->factory();
63 $this->irss = $DIC->resourceStorage();
64 $this->help = $DIC->help();
65 $this->toolbar = $DIC->toolbar();
66 $this->tabs = $DIC->tabs();
67
68 if (
69 !$this->http->wrapper()->query()->has('table_id') ||
70 !$this->http->wrapper()->query()->has('tableview_id')
71 ) {
72 $this->main_tpl->setOnScreenMessage($this->main_tpl::MESSAGE_TYPE_FAILURE, $this->lng->txt('table_not_found'), true);
73 $this->ctrl->redirectByClass(ilDclRecordListGUI::class, "show");
74 }
75
76 $this->tableview_id = $this->http->wrapper()->query()->retrieve('tableview_id', $this->refinery->kindlyTo()->int());
77 $table_id = $this->http->wrapper()->query()->retrieve('table_id', $this->refinery->kindlyTo()->int());
78 $this->table = ilDclCache::getTableCache($table_id);
79 $this->loadSession();
80
81 $this->record_id = null;
82 if ($this->http->wrapper()->query()->has('record_id')) {
83 $this->record_id = $this->http->wrapper()->query()->retrieve(
84 'record_id',
85 $this->refinery->kindlyTo()->int()
86 );
87 } elseif ($this->http->wrapper()->query()->has('record_pos')) {
88 $record_ids = ilSession::get('dcl_record_ids');
89 $pos = $this->http->wrapper()->query()->retrieve('record_pos', $this->refinery->kindlyTo()->int());
90 if ($record_ids === [] || !array_key_exists($pos, $record_ids)) {
91 $this->ctrl->redirectToURL($this->http->request()->getServerParams()['HTTP_REFERER']);
92 }
93 $this->record_id = $record_ids[$pos];
94 }
95 if ($this->http->wrapper()->post()->has('record_id')) {
96 $this->record_id = $this->http->wrapper()->post()->retrieve(
97 'record_id',
98 $this->refinery->kindlyTo()->int()
99 );
100 }
101
102 if ($this->record_id) {
103 $this->record_obj = ilDclCache::getRecordCache($this->record_id);
104 if (!$this->record_obj->hasPermissionToView($this->dcl_gui_object->getRefId())) {
105 $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt('dcl_msg_no_perm_view'), true);
106 $this->ctrl->redirectByClass(ilDclRecordListGUI::class, "show");
107 }
108 }
109
110 $tpl->setCurrentBlock("SyntaxStyle");
111 $tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
113
114 $tpl->setCurrentBlock("ContentStyle");
115 $tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
117
118 $repId = $this->dcl_gui_object->getDataCollectionObject()->getId();
120 $this->commentGUI = new ilCommentGUI($repId, $objId);
121 $this->commentGUI->enablePublicNotes();
122 $this->commentGUI->enablePublicNotesDeletion();
123 $this->ctrl->setParameterByClass(ilCommentGUI::class, "record_id", $this->record_id);
124 $this->ctrl->setParameterByClass(ilCommentGUI::class, "rep_id", $repId);
125
126 $this->tableview_id = $tableview_id;
127
128 if ($this->http->wrapper()->query()->has('disable_paging')
129 && $this->http->wrapper()->query()->retrieve('disable_paging', $this->refinery->kindlyTo()->bool())) {
130 $this->is_enabled_paging = false;
131 }
132 }
static getRecordCache(?int $record_id)
static getTableCache(?int $table_id=null)
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
static get(string $a_var)
setVariable(string $variable, $value='')
Sets the given variable to the given value.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
static http()
Fetches the global http state from ILIAS.
readonly ilGlobalTemplateInterface $tpl
global $DIC
Definition: shib_login.php:26
$objId
Definition: xapitoken.php:57

References $DIC, $objId, $record_id, $tableview_id, ILIAS\News\Common\Table\$tpl, ILIAS\Repository\ctrl(), ilSession\get(), ilObjStyleSheet\getContentStylePath(), ilDclCache\getRecordCache(), ilObjStyleSheet\getSyntaxStylePath(), ilDclCache\getTableCache(), ILIAS\Repository\help(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), loadSession(), ILIAS\UICore\GlobalTemplate\parseCurrentBlock(), ILIAS\Repository\refinery(), ILIAS\UICore\GlobalTemplate\setCurrentBlock(), ILIAS\UICore\GlobalTemplate\setVariable(), ILIAS\Repository\tabs(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

Member Function Documentation

◆ checkAccess()

ilDclDetailedViewGUI::checkAccess ( )
protected

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

269 : bool
270 {
271 return ilObjDataCollectionAccess::hasAccessTo($this->dcl_gui_object->getRefId(), $this->table->getId(), $this->tableview_id);
272 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ executeCommand()

ilDclDetailedViewGUI::executeCommand ( )

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

134 : void
135 {
136 $this->ctrl->setParameter($this, 'table_id', $this->table->getId());
137 $this->ctrl->setParameter($this, 'tableview_id', $this->tableview_id);
138
139 if (!$this->checkAccess()) {
140 $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
141 return;
142 }
143
144 $cmd = $this->ctrl->getCmd('renderRecord');
145 $cmdClass = $this->ctrl->getCmdClass();
146 switch (strtolower($cmdClass)) {
147 case 'ilcommentgui':
148 $this->commentGUI->executeCommand();
149 break;
150 default:
151 $this->$cmd();
152 break;
153 }
154 }

References checkAccess(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ jumpToRecord()

ilDclDetailedViewGUI::jumpToRecord ( )

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

156 : void
157 {
158 $this->ctrl->setParameterByClass(self::class, 'record_id', $this->record_id);
159 $this->ctrl->redirectByClass(self::class, 'renderRecord');
160 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ loadSession()

ilDclDetailedViewGUI::loadSession ( )
private

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

249 : void
250 {
251 $list = new ilDclRecordListTableGUI(
252 new ilDclRecordListGUI($this->dcl_gui_object, $this->table->getId(), $this->tableview_id),
253 "listRecords",
254 $this->table,
255 $this->tableview_id
256 );
257 $list->initFilter();
258 $list->determineOffsetAndOrder();
259 $this->table->getPartialRecords(
260 (string) $this->table->getId(),
261 $list->getOrderField(),
262 $list->getOrderDirection(),
263 $list->getLimit(),
264 $list->getOffset(),
265 $list->getFilter()
266 );
267 }
@ilCtrl_Calls ilDclRecordListGUI: ilDataCollectionUploadHandlerGUI

Referenced by __construct().

+ Here is the caller graph for this function:

◆ renderComments()

ilDclDetailedViewGUI::renderComments ( bool  $edit = false)
protected

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

240 : string
241 {
242 if (!$edit) {
243 return $this->commentGUI->getListHTML();
244 } else {
245 return $this->commentGUI->addNoteForm();
246 }
247 }

Referenced by renderRecord().

+ Here is the caller graph for this function:

◆ renderRecord()

ilDclDetailedViewGUI::renderRecord ( bool  $editComments = false)

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

162 : void
163 {
164 if (!(new ilDclDetailedViewDefinitionGUI($this->tableview_id))->getPageObject()->isActive()) {
165 $this->main_tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
166 return;
167 }
168
169 if (!$this->tableview_id) {
170 $this->ctrl->redirectByClass(ilDclRecordListGUI::class, "listRecords");
171 }
172
173 $this->help->setScreenId('dcl_record');
174 $this->tabs->clearTargets();
175
176 $pageObj = new ilDclDetailedViewDefinitionGUI($this->tableview_id);
177 $pageObj->setOutputMode($pageObj::PRESENTATION);
178 $pageObj->setRecord($this->record_obj);
179 $html = $pageObj->showPage();
180
181 $this->main_tpl->setPermanentLink(
182 'dcl',
183 filter_input(INPUT_GET, 'ref_id', FILTER_VALIDATE_INT),
184 $this->table->getId() . '_' . $this->tableview_id . '_' . $this->record_obj->getId()
185 );
186
187 if ($this->is_enabled_paging) {
188 $record_ids = ilSession::get('dcl_record_ids');
189 if ($record_ids !== [] && in_array($this->record_id, $record_ids)) {
190 $this->toolbar->addComponent(
191 $this->ui_factory->viewControl()->pagination()
192 ->withTargetURL($this->ctrl->getLinkTargetByClass(self::class, 'jumpToRecord'), 'record_pos')
193 ->withPageSize(1)
194 ->withDropdownAt(5)
195 ->withDropdownLabel($this->lng->txt('entry_of'))
196 ->withCurrentPage(array_search($this->record_id, $record_ids))
197 ->withTotalEntries(count($record_ids))
198 ->withMaxPaginationButtons(20)
199 );
200 }
201 }
202
203 if ($this->record_obj->hasPermissionToEdit($this->dcl_gui_object->getRefId())) {
204 $this->toolbar->addSpacer('100%');
205 $this->ctrl->setParameterByClass(ilDclRecordEditGUI::class, 'table_id', $this->table->getId());
206 $this->ctrl->setParameterByClass(ilDclRecordEditGUI::class, 'tableview_id', $this->tableview_id);
207 $this->ctrl->setParameterByClass(ilDclRecordEditGUI::class, 'redirect', ilDclRecordEditGUI::REDIRECT_DETAIL);
208 $this->ctrl->saveParameterByClass(ilDclRecordEditGUI::class, 'record_id');
209 $this->toolbar->addComponent($this->ui_factory->button()->standard(
210 $this->lng->txt('edit'),
211 $this->ctrl->getLinkTargetByClass(ilDclRecordEditGUI::class, 'edit')
212 ));
213 }
214
215 $comments = $this->table->getPublicCommentsEnabled() ? $this->renderComments($editComments) : '';
216
217 $this->main_tpl->setContent($html . $comments);
218 }
@ilCtrl_Calls ilDclDetailedViewDefinitionGUI: ilPageEditorGUI, ilEditClipboardGUI,...
$comments

References $comments, ILIAS\Repository\ctrl(), ilSession\get(), ILIAS\Repository\help(), ILIAS\Repository\lng(), ilDclRecordEditGUI\REDIRECT_DETAIL, renderComments(), ILIAS\Repository\tabs(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

◆ sendFile()

ilDclDetailedViewGUI::sendFile ( )

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

220 : void
221 {
222 $rec_id = $this->http->wrapper()->query()->retrieve('record_id', $this->refinery->kindlyTo()->int());
223
224 $record = ilDclCache::getRecordCache($rec_id);
225
226 if ($this->dcl_gui_object->getObjectId() != $record->getTable()->getCollectionObject()->getId()) {
227 return;
228 }
229
230 $field_id = $this->http->wrapper()->query()->retrieve('field_id', $this->refinery->kindlyTo()->string());
231 $rid_string = $record->getRecordFieldValue($field_id);
232 $identification = $this->irss->manage()->find($rid_string);
233 if ($identification === null) {
234 return;
235 }
236 $current_revision = $this->irss->manage()->getCurrentRevision($identification);
237 $this->irss->consume()->download($identification)->overrideFileName($current_revision->getTitle())->run();
238 }

References ilDclCache\getRecordCache(), ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

Field Documentation

◆ $commentGUI

ilCommentGUI ilDclDetailedViewGUI::$commentGUI
protected

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

◆ $ctrl

ilCtrlInterface ilDclDetailedViewGUI::$ctrl
protected

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

◆ $currentField

ilDclBaseFieldModel ilDclDetailedViewGUI::$currentField
protected

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

◆ $dcl_gui_object

ilObjDataCollectionGUI ilDclDetailedViewGUI::$dcl_gui_object
protected

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

◆ $help

ilHelpGUI ilDclDetailedViewGUI::$help
private

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

◆ $http

HTTP ilDclDetailedViewGUI::$http
protected

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

◆ $irss

RS ilDclDetailedViewGUI::$irss
private

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

◆ $is_enabled_paging

bool ilDclDetailedViewGUI::$is_enabled_paging = true
protected

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

◆ $lng

ilLanguage ilDclDetailedViewGUI::$lng
protected

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

◆ $main_tpl

ilGlobalTemplateInterface ilDclDetailedViewGUI::$main_tpl
private

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

◆ $record_id

int ilDclDetailedViewGUI::$record_id
protected

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

Referenced by __construct().

◆ $record_obj

ilDclBaseRecordModel ilDclDetailedViewGUI::$record_obj
protected

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

◆ $refinery

Refinery ilDclDetailedViewGUI::$refinery
protected

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

◆ $table

ilDclTable ilDclDetailedViewGUI::$table
protected

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

◆ $tableview_id

int ilDclDetailedViewGUI::$tableview_id
protected

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

Referenced by __construct().

◆ $tabs

ilTabsGUI ilDclDetailedViewGUI::$tabs
private

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

◆ $toolbar

ilToolbarGUI ilDclDetailedViewGUI::$toolbar
private

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

◆ $ui_factory

Factory ilDclDetailedViewGUI::$ui_factory
protected

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


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