ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilTermsOfServiceDocumentGUI Class Reference

Class ilTermsOfServiceDocumentGUI. More...

+ Inheritance diagram for ilTermsOfServiceDocumentGUI:
+ Collaboration diagram for ilTermsOfServiceDocumentGUI:

Public Member Functions

 __construct (\ilObjTermsOfService $tos, \ilTermsOfServiceCriterionTypeFactoryInterface $criterionTypeFactory, \ilTemplate $tpl, \ilObjUser $user, \ilCtrl $ctrl, \ilLanguage $lng, \ilRbacSystem $rbacsystem, \ilErrorHandling $error, \ilLogger $log, \ilToolbarGUI $toolbar, GlobalHttpState $httpState, Factory $uiFactory, Renderer $uiRenderer, Filesystems $fileSystems, FileUpload $fileUpload, ilTermsOfServiceTableDataProviderFactory $tableDataProviderFactory, \ilHtmlPurifierInterface $documentPurifier)
 ilTermsOfServiceDocumentGUI constructor. More...
 
 executeCommand ()
 The implemented class should be \ilCtrl enabled and execute or forward the given command. More...
 
 detachCriterionAssignment ()
 
 executeCommand ()
 The implemented class should be \ilCtrl enabled and execute or forward the given command. More...
 

Protected Member Functions

 confirmReset ()
 
 reset ()
 
 showDocuments ()
 
 getResetMessageBoxHtml ()
 
 getDocumentForm (ilTermsOfServiceDocument $document)
 
 saveAddDocumentForm ()
 
 showAddDocumentForm ()
 
 showEditDocumentForm ()
 
 saveEditDocumentForm ()
 
 getDocumentsByServerRequest ()
 
 getFirstDocumentFromList (array $documents)
 
 deleteDocument ()
 
 saveDocumentSorting ()
 
 getCriterionForm (\ilTermsOfServiceDocument $document, \ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment)
 
 saveAttachCriterionForm ()
 
 showAttachCriterionForm ()
 
 showChangeCriterionForm ()
 
 saveChangeCriterionForm ()
 

Protected Attributes

 $tableDataProviderFactory
 
 $tos
 
 $tpl
 
 $ctrl
 
 $lng
 
 $rbacsystem
 
 $error
 
 $user
 
 $log
 
 $uiFactory
 
 $uiRenderer
 
 $httpState
 
 $toolbar
 
 $fileUpload
 
 $fileSystems
 
 $criterionTypeFactory
 
 $documentPurifier
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTermsOfServiceDocumentGUI::__construct ( \ilObjTermsOfService  $tos,
\ilTermsOfServiceCriterionTypeFactoryInterface  $criterionTypeFactory,
\ilTemplate  $tpl,
\ilObjUser  $user,
\ilCtrl  $ctrl,
\ilLanguage  $lng,
\ilRbacSystem  $rbacsystem,
\ilErrorHandling  $error,
\ilLogger  $log,
\ilToolbarGUI  $toolbar,
GlobalHttpState  $httpState,
Factory  $uiFactory,
Renderer  $uiRenderer,
Filesystems  $fileSystems,
FileUpload  $fileUpload,
ilTermsOfServiceTableDataProviderFactory  $tableDataProviderFactory,
\ilHtmlPurifierInterface  $documentPurifier 
)

ilTermsOfServiceDocumentGUI constructor.

Parameters
\ilObjTermsOfService$tos
ilTermsOfServiceCriterionTypeFactoryInterface$criterionTypeFactory
\ilTemplate$tpl
\ilObjUser$user
\ilCtrl$ctrl
\ilLanguage$lng
\ilRbacSystem$rbacsystem
\ilErrorHandling$error
\ilLogger$log
\ilToolbarGUI$toolbar
GlobalHttpState$httpState
Factory$uiFactory
Renderer$uiRenderer
Filesystems$fileSystems

param FileUpload $fileUpload

Parameters
\ilTermsOfServiceTableDataProviderFactory$tableDataProviderFactory
\ilHtmlPurifierInterface$documentPurifier

Definition at line 87 of file class.ilTermsOfServiceDocumentGUI.php.

105 {
106 $this->tos = $tos;
107 $this->criterionTypeFactory = $criterionTypeFactory;
108 $this->tpl = $tpl;
109 $this->ctrl = $ctrl;
110 $this->lng = $lng;
111 $this->rbacsystem = $rbacsystem;
112 $this->error = $error;
113 $this->user = $user;
114 $this->log = $log;
115 $this->toolbar = $toolbar;
116 $this->httpState = $httpState;
117 $this->uiFactory = $uiFactory;
118 $this->uiRenderer = $uiRenderer;
119 $this->fileSystems = $fileSystems;
120 $this->fileUpload = $fileUpload;
121 $this->tableDataProviderFactory = $tableDataProviderFactory;
122 $this->documentPurifier = $documentPurifier;
123 }
user()
Definition: user.php:4
error($a_errmsg)
set error message @access public

References $criterionTypeFactory, $ctrl, $documentPurifier, $error, $fileSystems, $fileUpload, $httpState, $lng, $log, $rbacsystem, $tableDataProviderFactory, $toolbar, $tos, $tpl, $uiFactory, $uiRenderer, $user, error(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ confirmReset()

ilTermsOfServiceDocumentGUI::confirmReset ( )
protected

Definition at line 150 of file class.ilTermsOfServiceDocumentGUI.php.

151 {
152 if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
153 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
154 }
155
156 $confirmation = new \ilConfirmationGUI();
157 $confirmation->setFormAction($this->ctrl->getFormAction($this, 'confirmReset'));
158 $confirmation->setConfirm($this->lng->txt('confirm'), 'reset');
159 $confirmation->setCancel($this->lng->txt('cancel'), 'showDocuments');
160 $confirmation->setHeaderText($this->lng->txt('tos_sure_reset_tos'));
161
162 $this->tpl->setContent($confirmation->getHTML());
163 }

References error().

+ Here is the call graph for this function:

◆ deleteDocument()

ilTermsOfServiceDocumentGUI::deleteDocument ( )
protected

Definition at line 469 of file class.ilTermsOfServiceDocumentGUI.php.

470 {
471 if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
472 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
473 }
474
475 $document = $this->getFirstDocumentFromList($this->getDocumentsByServerRequest());
476
477 $this->processDocumentDeletion([$document]);
478
479 $this->ctrl->redirect($this);
480 }

References error(), getDocumentsByServerRequest(), and getFirstDocumentFromList().

+ Here is the call graph for this function:

◆ detachCriterionAssignment()

ilTermsOfServiceDocumentGUI::detachCriterionAssignment ( )

Definition at line 657 of file class.ilTermsOfServiceDocumentGUI.php.

658 {
659 if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
660 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
661 }
662
663 $document = $this->getFirstDocumentFromList($this->getDocumentsByServerRequest());
664
665 $criterionId = $this->httpState->request()->getQueryParams()['crit_id'] ?? 0;
666 if (!is_numeric($criterionId) || $criterionId < 1) {
667 $this->showDocuments();
668 return;
669 }
670
671 $criterionAssignment = array_values(array_filter(
672 $document->criteria(),
673 function (\ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment) use ($criterionId) {
674 return $criterionAssignment->getId() == $criterionId;
675 }
676 ))[0];
677
678 $document->detachCriterion($criterionAssignment);
679 $document->update();
680
681 \ilUtil::sendSuccess($this->lng->txt('tos_doc_crit_detached'), true);
682 $this->ctrl->redirect($this, 'showDocuments');
683 }

References ilTermsOfServiceDocument\criteria(), ilTermsOfServiceDocument\detachCriterion(), error(), and ActiveRecord\update().

+ Here is the call graph for this function:

◆ executeCommand()

ilTermsOfServiceDocumentGUI::executeCommand ( )

The implemented class should be \ilCtrl enabled and execute or forward the given command.

Implements ilTermsOfServiceControllerEnabled.

Definition at line 128 of file class.ilTermsOfServiceDocumentGUI.php.

129 {
130 $nextClass = $this->ctrl->getNextClass($this);
131 $cmd = $this->ctrl->getCmd();
132
133 if (!$this->rbacsystem->checkAccess('read', $this->tos->getRefId())) {
134 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
135 }
136
137 switch (strtolower($nextClass)) {
138 default:
139 if ($cmd == '' || !method_exists($this, $cmd)) {
140 $cmd = 'showDocuments';
141 }
142 $this->$cmd();
143 break;
144 }
145 }

References error().

+ Here is the call graph for this function:

◆ getCriterionForm()

ilTermsOfServiceDocumentGUI::getCriterionForm ( \ilTermsOfServiceDocument  $document,
\ilTermsOfServiceDocumentCriterionAssignment  $criterionAssignment 
)
protected
Parameters
\ilTermsOfServiceDocument$document
\ilTermsOfServiceDocumentCriterionAssignment$criterionAssignment
Returns
\ilTermsOfServiceCriterionFormGUI

Definition at line 523 of file class.ilTermsOfServiceDocumentGUI.php.

527 $this->ctrl->setParameter($this, 'tos_id', $document->getId());
528
529 if ($criterionAssignment->getId() > 0) {
530 $this->ctrl->setParameter($this, 'crit_id', $criterionAssignment->getId());
531 }
532
533 $formAction = $this->ctrl->getFormAction($this, 'saveAttachCriterionForm');
534 $saveCommand = 'saveAttachCriterionForm';
535
536 if ($criterionAssignment->getId() > 0) {
537 $formAction = $this->ctrl->getFormAction($this, 'saveChangeCriterionForm');
538 $saveCommand = 'saveChangeCriterionForm';
539 }
540
541 $form = new \ilTermsOfServiceCriterionFormGUI(
542 $document,
543 $criterionAssignment,
544 $this->criterionTypeFactory,
545 $this->user,
546 $formAction,
547 $saveCommand,
548 'showDocuments'
549 );
550
551 return $form;
552 }
getFormAction()
Get FormAction.
Class ilTermsOfServiceCriterionFormGUI.
if(isset($_POST['submit'])) $form

◆ getDocumentForm()

ilTermsOfServiceDocumentGUI::getDocumentForm ( ilTermsOfServiceDocument  $document)
protected
Parameters
\ilTermsOfServiceDocument$document
Returns
\ilTermsOfServiceDocumentFormGUI

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

250 {
251 if ($document->getId() > 0) {
252 $this->ctrl->setParameter($this, 'tos_id', $document->getId());
253 }
254
255 $formAction = $this->ctrl->getFormAction($this, 'saveAddDocumentForm');
256 $saveCommand = 'saveAddDocumentForm';
257
258 if ($document->getId() > 0) {
259 $formAction = $this->ctrl->getFormAction($this, 'saveEditDocumentForm');
260 $saveCommand = 'saveEditDocumentForm';
261 }
262
263 $form = new \ilTermsOfServiceDocumentFormGUI(
264 $document,
265 $this->documentPurifier,
266 $this->user,
267 $this->fileSystems->temp(),
268 $this->fileUpload,
269 $formAction,
270 $saveCommand,
271 'showDocuments',
272 $this->rbacsystem->checkAccess('write', $this->tos->getRefId())
273 );
274
275 return $form;
276 }
Class ilTermsOfServiceDocumentFormGUI.

References $form, ilFormGUI\getFormAction(), and user().

Referenced by saveAddDocumentForm(), saveEditDocumentForm(), showAddDocumentForm(), and showEditDocumentForm().

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

◆ getDocumentsByServerRequest()

ilTermsOfServiceDocumentGUI::getDocumentsByServerRequest ( )
protected
Returns
array

Definition at line 357 of file class.ilTermsOfServiceDocumentGUI.php.

357 : array
358 {
359 $documents = [];
360
361 $documentIds = $this->httpState->request()->getParsedBody()['tos_id'] ?? [];
362 if (!is_array($documentIds) || 0 === count($documentIds)) {
363 $documentIds = $this->httpState->request()->getQueryParams()['tos_id'] ? [$this->httpState->request()->getQueryParams()['tos_id']] : [];
364 }
365
366 if (0 === count($documentIds)) {
367 return $documents;
368 }
369
371 ['id' => array_filter(array_map('intval', $documentIds))],
372 ['id' => 'IN']
373 )->getArray();
374
375 return $documents;
376 }
static where($where, $operator=null)

References ActiveRecord\where().

Referenced by deleteDocument(), saveEditDocumentForm(), and showEditDocumentForm().

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

◆ getFirstDocumentFromList()

ilTermsOfServiceDocumentGUI::getFirstDocumentFromList ( array  $documents)
protected
Parameters
array$documents
Returns
\ilTermsOfServiceDocument
Exceptions

UnexpectedValueException

Definition at line 383 of file class.ilTermsOfServiceDocumentGUI.php.

384 {
385 if (1 !== count($documents)) {
386 throw new \UnexpectedValueException('Expected exactly one document in list');
387 }
388
389 $document = new \ilTermsOfServiceDocument(0);
390 $document = $document->buildFromArray(current($documents));
391
392 return $document;
393 }
Class ilTermsOfServiceDocument.

Referenced by deleteDocument(), saveEditDocumentForm(), and showEditDocumentForm().

+ Here is the caller graph for this function:

◆ getResetMessageBoxHtml()

ilTermsOfServiceDocumentGUI::getResetMessageBoxHtml ( )
protected
Returns
string

Definition at line 215 of file class.ilTermsOfServiceDocumentGUI.php.

215 : string
216 {
217 if ($this->tos->getLastResetDate() && $this->tos->getLastResetDate()->get(IL_CAL_UNIX) != 0) {
220 $resetText = sprintf(
221 $this->lng->txt('tos_last_reset_date'),
222 \ilDatePresentation::formatDate($this->tos->getLastResetDate())
223 );
225 } else {
226 $resetText = $this->lng->txt('tos_never_reset');
227 }
228
229 $buttons = [];
230 if ($this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
231 $buttons = [
232 $this->uiFactory
233 ->button()
234 ->standard($this->lng->txt('tos_reset_tos_for_all_users'), $this->ctrl->getLinkTarget($this, 'confirmReset'))
235 ];
236 }
237
238 return $this->uiRenderer->render(
239 $this->uiFactory->messageBox()
240 ->info($resetText)
241 ->withButtons($buttons)
242 );
243 }
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
static setUseRelativeDates($a_status)
set use relative dates
static useRelativeDates()
check if relative dates are used

References ilDatePresentation\formatDate(), IL_CAL_UNIX, ilDatePresentation\setUseRelativeDates(), and ilDatePresentation\useRelativeDates().

Referenced by showDocuments().

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

◆ reset()

ilTermsOfServiceDocumentGUI::reset ( )
protected

Definition at line 168 of file class.ilTermsOfServiceDocumentGUI.php.

169 {
170 if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
171 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
172 }
173
174 $this->tos->resetAll();
175
176 $this->log->info('Terms of service reset by ' . $this->user->getId() . ' [' . $this->user->getLogin() . ']');
177 \ilUtil::sendSuccess($this->lng->txt('tos_reset_successful'));
178
179 $this->showDocuments();
180 }

References error(), showDocuments(), and user().

+ Here is the call graph for this function:

◆ saveAddDocumentForm()

ilTermsOfServiceDocumentGUI::saveAddDocumentForm ( )
protected

Definition at line 281 of file class.ilTermsOfServiceDocumentGUI.php.

282 {
283 if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
284 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
285 }
286
288 if ($form->saveObject()) {
289 \ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
290 if ($form->hasTranslatedInfo()) {
291 \ilUtil::sendInfo($form->getTranslatedInfo(), true);
292 }
293 $this->ctrl->redirect($this, 'showDocuments');
294 } elseif ($form->hasTranslatedError()) {
295 \ilUtil::sendFailure($form->getTranslatedError());
296 }
297
298 $this->tpl->setContent($form->getHTML());
299 }
getDocumentForm(ilTermsOfServiceDocument $document)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $form, error(), getDocumentForm(), ilUtil\sendFailure(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ saveAttachCriterionForm()

ilTermsOfServiceDocumentGUI::saveAttachCriterionForm ( )
protected

Definition at line 557 of file class.ilTermsOfServiceDocumentGUI.php.

558 {
559 if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
560 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
561 }
562
563 $document = $this->getFirstDocumentFromList($this->getDocumentsByServerRequest());
564
566 if ($form->saveObject()) {
567 \ilUtil::sendSuccess($this->lng->txt('tos_doc_crit_attached'), true);
568 $this->ctrl->redirect($this, 'showDocuments');
569 } elseif ($form->hasTranslatedError()) {
570 \ilUtil::sendFailure($form->getTranslatedError());
571 }
572
573 $this->tpl->setContent($form->getHTML());
574 }
getCriterionForm(\ilTermsOfServiceDocument $document, \ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment)

References $form, error(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ saveChangeCriterionForm()

ilTermsOfServiceDocumentGUI::saveChangeCriterionForm ( )
protected

Definition at line 622 of file class.ilTermsOfServiceDocumentGUI.php.

623 {
624 if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
625 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
626 }
627
628 $document = $this->getFirstDocumentFromList($this->getDocumentsByServerRequest());
629
630 $criterionId = $this->httpState->request()->getQueryParams()['crit_id'] ?? 0;
631 if (!is_numeric($criterionId) || $criterionId < 1) {
632 $this->showDocuments();
633 return;
634 }
635
636 $criterionAssignment = array_values(array_filter(
637 $document->criteria(),
638 function (\ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment) use ($criterionId) {
639 return $criterionAssignment->getId() == $criterionId;
640 }
641 ))[0];
642
643 $form = $this->getCriterionForm($document, $criterionAssignment);
644 if ($form->saveObject()) {
645 \ilUtil::sendSuccess($this->lng->txt('tos_doc_crit_changed'), true);
646 $this->ctrl->redirect($this, 'showDocuments');
647 } elseif ($form->hasTranslatedError()) {
648 \ilUtil::sendFailure($form->getTranslatedError());
649 }
650
651 $this->tpl->setContent($form->getHTML());
652 }

References $form, ilTermsOfServiceDocument\criteria(), error(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ saveDocumentSorting()

ilTermsOfServiceDocumentGUI::saveDocumentSorting ( )
protected

Definition at line 485 of file class.ilTermsOfServiceDocumentGUI.php.

486 {
487 if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
488 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
489 }
490
491 $sorting = $this->httpState->request()->getParsedBody()['sorting'] ?? [];
492 if (!is_array($sorting) || 0 === count($sorting)) {
493 $this->showDocuments();
494 return;
495 }
496
497 asort($sorting, SORT_NUMERIC);
498
499 $position = 0;
500 foreach ($sorting as $documentId => $ignoredSortValue) {
501 if (!is_numeric($documentId)) {
502 continue;
503 }
504
505 try {
506 $document = new \ilTermsOfServiceDocument((int) $documentId);
507 $document->setSorting(++$position);
508 $document->store();
509 } catch (\ilException $e) {
510 // Empty catch block
511 }
512 }
513
514 \ilUtil::sendSuccess($this->lng->txt('tos_saved_sorting'), true);
515 $this->ctrl->redirect($this);
516 }
Base class for ILIAS Exception handling.

References error(), and showDocuments().

+ Here is the call graph for this function:

◆ saveEditDocumentForm()

ilTermsOfServiceDocumentGUI::saveEditDocumentForm ( )
protected

Definition at line 332 of file class.ilTermsOfServiceDocumentGUI.php.

333 {
334 if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
335 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
336 }
337
338 $document = $this->getFirstDocumentFromList($this->getDocumentsByServerRequest());
339
340 $form = $this->getDocumentForm($document);
341 if ($form->saveObject()) {
342 \ilUtil::sendSuccess($this->lng->txt('saved_successfully'), true);
343 if ($form->hasTranslatedInfo()) {
344 \ilUtil::sendInfo($form->getTranslatedInfo(), true);
345 }
346 $this->ctrl->redirect($this, 'showDocuments');
347 } elseif ($form->hasTranslatedError()) {
348 \ilUtil::sendFailure($form->getTranslatedError());
349 }
350
351 $this->tpl->setContent($form->getHTML());
352 }

References $form, error(), getDocumentForm(), getDocumentsByServerRequest(), getFirstDocumentFromList(), ilUtil\sendFailure(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ showAddDocumentForm()

ilTermsOfServiceDocumentGUI::showAddDocumentForm ( )
protected

Definition at line 304 of file class.ilTermsOfServiceDocumentGUI.php.

305 {
306 if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
307 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
308 }
309
311 $this->tpl->setContent($form->getHTML());
312 }

References $form, error(), and getDocumentForm().

+ Here is the call graph for this function:

◆ showAttachCriterionForm()

ilTermsOfServiceDocumentGUI::showAttachCriterionForm ( )
protected

Definition at line 579 of file class.ilTermsOfServiceDocumentGUI.php.

580 {
581 if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
582 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
583 }
584
585 $document = $this->getFirstDocumentFromList($this->getDocumentsByServerRequest());
586
588 $this->tpl->setContent($form->getHTML());
589 }

References $form, and error().

+ Here is the call graph for this function:

◆ showChangeCriterionForm()

ilTermsOfServiceDocumentGUI::showChangeCriterionForm ( )
protected

Definition at line 594 of file class.ilTermsOfServiceDocumentGUI.php.

595 {
596 if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
597 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
598 }
599
600 $document = $this->getFirstDocumentFromList($this->getDocumentsByServerRequest());
601
602 $criterionId = $this->httpState->request()->getQueryParams()['crit_id'] ?? 0;
603 if (!is_numeric($criterionId) || $criterionId < 1) {
604 $this->showDocuments();
605 return;
606 }
607
608 $criterionAssignment = array_values(array_filter(
609 $document->criteria(),
610 function (\ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment) use ($criterionId) {
611 return $criterionAssignment->getId() == $criterionId;
612 }
613 ))[0];
614
615 $form = $this->getCriterionForm($document, $criterionAssignment);
616 $this->tpl->setContent($form->getHTML());
617 }

References $form, ilTermsOfServiceDocument\criteria(), and error().

+ Here is the call graph for this function:

◆ showDocuments()

ilTermsOfServiceDocumentGUI::showDocuments ( )
protected

Definition at line 185 of file class.ilTermsOfServiceDocumentGUI.php.

186 {
187 if ($this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
188 $addDocumentBtn = \ilLinkButton::getInstance();
189 $addDocumentBtn->setPrimary(true);
190 $addDocumentBtn->setUrl($this->ctrl->getLinkTarget($this, 'showAddDocumentForm'));
191 $addDocumentBtn->setCaption('tos_add_document_btn_label');
192 $this->toolbar->addStickyItem($addDocumentBtn);
193 }
194
195 $documentTableGui = new \ilTermsOfServiceDocumentTableGUI(
196 $this,
197 'showDocuments',
198 $this->criterionTypeFactory,
199 $this->uiFactory,
200 $this->uiRenderer,
201 $this->rbacsystem->checkAccess('write', $this->tos->getRefId())
202 );
203 $documentTableGui->setProvider($this->tableDataProviderFactory->getByContext(\ilTermsOfServiceTableDataProviderFactory::CONTEXT_DOCUMENTS));
204 $documentTableGui->populate();
205
206 $this->tpl->setCurrentBlock('mess');
207 $this->tpl->setVariable('MESSAGE', $this->getResetMessageBoxHtml());
208 $this->tpl->parseCurrentBlock('mess');
209 $this->tpl->setContent($documentTableGui->getHTML());
210 }
static getInstance()
Factory.

References ilTermsOfServiceTableDataProviderFactory\CONTEXT_DOCUMENTS, ilLinkButton\getInstance(), and getResetMessageBoxHtml().

Referenced by reset(), and saveDocumentSorting().

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

◆ showEditDocumentForm()

ilTermsOfServiceDocumentGUI::showEditDocumentForm ( )
protected

Definition at line 317 of file class.ilTermsOfServiceDocumentGUI.php.

318 {
319 if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
320 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
321 }
322
323 $document = $this->getFirstDocumentFromList($this->getDocumentsByServerRequest());
324
325 $form = $this->getDocumentForm($document);
326 $this->tpl->setContent($form->getHTML());
327 }

References $form, error(), getDocumentForm(), getDocumentsByServerRequest(), and getFirstDocumentFromList().

+ Here is the call graph for this function:

Field Documentation

◆ $criterionTypeFactory

ilTermsOfServiceDocumentGUI::$criterionTypeFactory
protected

Definition at line 62 of file class.ilTermsOfServiceDocumentGUI.php.

Referenced by __construct().

◆ $ctrl

ilTermsOfServiceDocumentGUI::$ctrl
protected

Definition at line 26 of file class.ilTermsOfServiceDocumentGUI.php.

Referenced by __construct().

◆ $documentPurifier

ilTermsOfServiceDocumentGUI::$documentPurifier
protected

Definition at line 65 of file class.ilTermsOfServiceDocumentGUI.php.

Referenced by __construct().

◆ $error

ilTermsOfServiceDocumentGUI::$error
protected

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

Referenced by __construct().

◆ $fileSystems

ilTermsOfServiceDocumentGUI::$fileSystems
protected

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

Referenced by __construct().

◆ $fileUpload

ilTermsOfServiceDocumentGUI::$fileUpload
protected

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

Referenced by __construct().

◆ $httpState

ilTermsOfServiceDocumentGUI::$httpState
protected

Definition at line 50 of file class.ilTermsOfServiceDocumentGUI.php.

Referenced by __construct().

◆ $lng

ilTermsOfServiceDocumentGUI::$lng
protected

Definition at line 29 of file class.ilTermsOfServiceDocumentGUI.php.

Referenced by __construct().

◆ $log

ilTermsOfServiceDocumentGUI::$log
protected

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

Referenced by __construct().

◆ $rbacsystem

ilTermsOfServiceDocumentGUI::$rbacsystem
protected

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

Referenced by __construct().

◆ $tableDataProviderFactory

ilTermsOfServiceDocumentGUI::$tableDataProviderFactory
protected

Definition at line 17 of file class.ilTermsOfServiceDocumentGUI.php.

Referenced by __construct().

◆ $toolbar

ilTermsOfServiceDocumentGUI::$toolbar
protected

Definition at line 53 of file class.ilTermsOfServiceDocumentGUI.php.

Referenced by __construct().

◆ $tos

ilTermsOfServiceDocumentGUI::$tos
protected

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

Referenced by __construct().

◆ $tpl

ilTermsOfServiceDocumentGUI::$tpl
protected

Definition at line 23 of file class.ilTermsOfServiceDocumentGUI.php.

Referenced by __construct().

◆ $uiFactory

ilTermsOfServiceDocumentGUI::$uiFactory
protected

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

Referenced by __construct().

◆ $uiRenderer

ilTermsOfServiceDocumentGUI::$uiRenderer
protected

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

Referenced by __construct().

◆ $user

ilTermsOfServiceDocumentGUI::$user
protected

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

Referenced by __construct().


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