ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilTermsOfServiceDocumentGUI Class Reference

Class ilTermsOfServiceDocumentGUI. More...

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

Public Member Functions

 __construct (ilObjTermsOfService $tos, ilTermsOfServiceCriterionTypeFactoryInterface $criterionTypeFactory, ilGlobalPageTemplate $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,
ilGlobalPageTemplate  $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
ilGlobalPageTemplate$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 145 of file class.ilTermsOfServiceDocumentGUI.php.

145 : void
146 {
147 if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
148 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
149 }
150
151 $confirmation = new ilConfirmationGUI();
152 $confirmation->setFormAction($this->ctrl->getFormAction($this, 'confirmReset'));
153 $confirmation->setConfirm($this->lng->txt('confirm'), 'reset');
154 $confirmation->setCancel($this->lng->txt('cancel'), 'showDocuments');
155 $confirmation->setHeaderText($this->lng->txt('tos_sure_reset_tos'));
156
157 $this->tpl->setContent($confirmation->getHTML());
158 }
Confirmation screen class.

References error().

+ Here is the call graph for this function:

◆ deleteDocument()

ilTermsOfServiceDocumentGUI::deleteDocument ( )
protected

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

469 : void
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.

657 : void
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.

128 : void
129 {
130 $cmd = $this->ctrl->getCmd();
131
132 if (!$this->rbacsystem->checkAccess('read', $this->tos->getRefId())) {
133 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
134 }
135
136 if ($cmd == '' || !method_exists($this, $cmd)) {
137 $cmd = 'showDocuments';
138 }
139 $this->$cmd();
140 }

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
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.

◆ 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
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 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
ilTermsOfServiceDocument[]

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
Exceptions
ilDateTimeException

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

212 : string
213 {
214 if ($this->tos->getLastResetDate() && $this->tos->getLastResetDate()->get(IL_CAL_UNIX) != 0) {
217 $resetText = sprintf(
218 $this->lng->txt('tos_last_reset_date'),
219 ilDatePresentation::formatDate($this->tos->getLastResetDate())
220 );
222 } else {
223 $resetText = $this->lng->txt('tos_never_reset');
224 }
225
226 $buttons = [];
227 if ($this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
228 $buttons = [
229 $this->uiFactory
230 ->button()
231 ->standard(
232 $this->lng->txt('tos_reset_tos_for_all_users'),
233 $this->ctrl->getLinkTarget($this, 'confirmReset')
234 )
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 163 of file class.ilTermsOfServiceDocumentGUI.php.

163 : void
164 {
165 if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
166 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
167 }
168
169 $this->tos->resetAll();
170
171 $this->log->info('Terms of service reset by ' . $this->user->getId() . ' [' . $this->user->getLogin() . ']');
172 ilUtil::sendSuccess($this->lng->txt('tos_reset_successful'));
173
174 $this->showDocuments();
175 }

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.

281 : void
282 {
283 if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
284 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
285 }
286
287 $form = $this->getDocumentForm(new ilTermsOfServiceDocument());
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 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.

557 : void
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
565 $form = $this->getCriterionForm($document, new ilTermsOfServiceDocumentCriterionAssignment());
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 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.

622 : void
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 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.

485 : void
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 Vendor\Package\$e, error(), and showDocuments().

+ Here is the call graph for this function:

◆ saveEditDocumentForm()

ilTermsOfServiceDocumentGUI::saveEditDocumentForm ( )
protected

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

332 : void
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 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.

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

References error(), and getDocumentForm().

+ Here is the call graph for this function:

◆ showAttachCriterionForm()

ilTermsOfServiceDocumentGUI::showAttachCriterionForm ( )
protected

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

579 : void
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
587 $form = $this->getCriterionForm($document, new ilTermsOfServiceDocumentCriterionAssignment());
588 $this->tpl->setContent($form->getHTML());
589 }

References error().

+ Here is the call graph for this function:

◆ showChangeCriterionForm()

ilTermsOfServiceDocumentGUI::showChangeCriterionForm ( )
protected

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

594 : void
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 ilTermsOfServiceDocument\criteria(), and error().

+ Here is the call graph for this function:

◆ showDocuments()

ilTermsOfServiceDocumentGUI::showDocuments ( )
protected
Exceptions
ilDateTimeException
ilTermsOfServiceMissingDatabaseAdapterException

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

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

317 : void
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 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: