ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTermsOfServiceDocumentGUI Class Reference

Class ilTermsOfServiceDocumentGUI. More...

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

Public Member Functions

 __construct (ilObjTermsOfService $tos, ilTermsOfServiceCriterionTypeFactoryInterface $criterionTypeFactory, ilGlobalTemplateInterface $tpl, ilObjUser $user, ilCtrlInterface $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, Refinery $refinery)
 
 executeCommand ()
 The implemented class should be ilCtrlInterface enabled and execute or forward the given command. More...
 
 detachCriterionAssignment ()
 

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

ilTermsOfServiceTableDataProviderFactory $tableDataProviderFactory
 
ilObjTermsOfService $tos
 
ilGlobalTemplateInterface $tpl
 
ilCtrlInterface $ctrl
 
ilLanguage $lng
 
ilRbacSystem $rbacsystem
 
ilErrorHandling $error
 
ilObjUser $user
 
ilLogger $log
 
Factory $uiFactory
 
Renderer $uiRenderer
 
ILIAS HTTP GlobalHttpState $httpState
 
ilToolbarGUI $toolbar
 
FileUpload $fileUpload
 
Filesystems $fileSystems
 
ilTermsOfServiceCriterionTypeFactoryInterface $criterionTypeFactory
 
ilHtmlPurifierInterface $documentPurifier
 
Refinery $refinery
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTermsOfServiceDocumentGUI::__construct ( ilObjTermsOfService  $tos,
ilTermsOfServiceCriterionTypeFactoryInterface  $criterionTypeFactory,
ilGlobalTemplateInterface  $tpl,
ilObjUser  $user,
ilCtrlInterface  $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,
Refinery  $refinery 
)

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

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

72  {
73  $this->tos = $tos;
74  $this->criterionTypeFactory = $criterionTypeFactory;
75  $this->tpl = $tpl;
76  $this->ctrl = $ctrl;
77  $this->lng = $lng;
78  $this->rbacsystem = $rbacsystem;
79  $this->error = $error;
80  $this->user = $user;
81  $this->log = $log;
82  $this->toolbar = $toolbar;
83  $this->httpState = $httpState;
84  $this->uiFactory = $uiFactory;
85  $this->uiRenderer = $uiRenderer;
86  $this->fileSystems = $fileSystems;
87  $this->fileUpload = $fileUpload;
88  $this->tableDataProviderFactory = $tableDataProviderFactory;
89  $this->documentPurifier = $documentPurifier;
90  $this->refinery = $refinery;
91  }
ilTermsOfServiceTableDataProviderFactory $tableDataProviderFactory
ilTermsOfServiceCriterionTypeFactoryInterface $criterionTypeFactory
+ Here is the call graph for this function:

Member Function Documentation

◆ confirmReset()

ilTermsOfServiceDocumentGUI::confirmReset ( )
protected

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

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

107  : void
108  {
109  if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
110  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
111  }
112 
113  $confirmation = new ilConfirmationGUI();
114  $confirmation->setFormAction($this->ctrl->getFormAction($this, 'confirmReset'));
115  $confirmation->setConfirm($this->lng->txt('confirm'), 'reset');
116  $confirmation->setCancel($this->lng->txt('cancel'), 'showDocuments');
117  $confirmation->setHeaderText($this->lng->txt('tos_sure_reset_tos'));
118 
119  $this->tpl->setContent($confirmation->getHTML());
120  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ deleteDocument()

ilTermsOfServiceDocumentGUI::deleteDocument ( )
protected

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

References ILIAS\Repository\ctrl(), getDocumentsByServerRequest(), getFirstDocumentFromList(), and ILIAS\Repository\lng().

402  : void
403  {
404  if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
405  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
406  }
407 
408  $document = $this->getFirstDocumentFromList($this->getDocumentsByServerRequest());
409 
410  $this->processDocumentDeletion([$document]);
411 
412  $this->ctrl->redirect($this);
413  }
+ Here is the call graph for this function:

◆ detachCriterionAssignment()

ilTermsOfServiceDocumentGUI::detachCriterionAssignment ( )

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

References ILIAS\Repository\ctrl(), getDocumentsByServerRequest(), getFirstDocumentFromList(), ILIAS\Repository\lng(), and showDocuments().

571  : void
572  {
573  if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
574  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
575  }
576 
577  $document = $this->getFirstDocumentFromList($this->getDocumentsByServerRequest());
578 
579  $criterionId = $this->httpState->request()->getQueryParams()['crit_id'] ?? 0;
580  if (!is_numeric($criterionId) || $criterionId < 1) {
581  $this->showDocuments();
582  return;
583  }
584 
585  $criterionAssignment = array_values(array_filter(
586  $document->criteria(),
587  static function (ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment) use (
588  $criterionId
589  ): bool {
590  return $criterionAssignment->getId() == $criterionId;
591  }
592  ))[0];
593 
594  $document->detachCriterion($criterionAssignment);
595  $document->update();
596 
597  $this->tpl->setOnScreenMessage('success', $this->lng->txt('tos_doc_crit_detached'), true);
598  $this->ctrl->redirect($this, 'showDocuments');
599  }
+ Here is the call graph for this function:

◆ executeCommand()

ilTermsOfServiceDocumentGUI::executeCommand ( )

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

Implements ilTermsOfServiceControllerEnabled.

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

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

93  : void
94  {
95  $cmd = $this->ctrl->getCmd();
96 
97  if (!$this->rbacsystem->checkAccess('read', $this->tos->getRefId())) {
98  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
99  }
100 
101  if ($cmd === null || $cmd === '' || !method_exists($this, $cmd)) {
102  $cmd = 'showDocuments';
103  }
104  $this->$cmd();
105  }
+ Here is the call graph for this function:

◆ getCriterionForm()

ilTermsOfServiceDocumentGUI::getCriterionForm ( ilTermsOfServiceDocument  $document,
ilTermsOfServiceDocumentCriterionAssignment  $criterionAssignment 
)
protected

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

References ILIAS\Repository\ctrl(), and ILIAS\Repository\user().

Referenced by saveAttachCriterionForm(), saveChangeCriterionForm(), showAttachCriterionForm(), and showChangeCriterionForm().

452  $this->ctrl->setParameter($this, 'tos_id', $document->getId());
453 
454  if ($criterionAssignment->getId() > 0) {
455  $this->ctrl->setParameter($this, 'crit_id', $criterionAssignment->getId());
456  }
457 
458  $formAction = $this->ctrl->getFormAction($this, 'saveAttachCriterionForm');
459  $saveCommand = 'saveAttachCriterionForm';
460 
461  if ($criterionAssignment->getId() > 0) {
462  $formAction = $this->ctrl->getFormAction($this, 'saveChangeCriterionForm');
463  $saveCommand = 'saveChangeCriterionForm';
464  }
465 
467  $document,
468  $criterionAssignment,
469  $this->criterionTypeFactory,
470  $this->user,
471  $formAction,
472  $saveCommand,
473  'showDocuments'
474  );
475 
476  return $form;
477  }
Class ilTermsOfServiceCriterionFormGUI.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDocumentForm()

ilTermsOfServiceDocumentGUI::getDocumentForm ( ilTermsOfServiceDocument  $document)
protected

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

References $fileUpload, ILIAS\Repository\ctrl(), and ILIAS\Repository\user().

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

197  {
198  if ($document->getId() > 0) {
199  $this->ctrl->setParameter($this, 'tos_id', $document->getId());
200  }
201 
202  $formAction = $this->ctrl->getFormAction($this, 'saveAddDocumentForm');
203  $saveCommand = 'saveAddDocumentForm';
204 
205  if ($document->getId() > 0) {
206  $formAction = $this->ctrl->getFormAction($this, 'saveEditDocumentForm');
207  $saveCommand = 'saveEditDocumentForm';
208  }
209 
211  $document,
212  $this->documentPurifier,
213  $this->user,
214  $this->fileSystems->temp(),
216  $formAction,
217  $saveCommand,
218  'showDocuments',
219  $this->rbacsystem->checkAccess('write', $this->tos->getRefId())
220  );
221 
222  return $form;
223  }
Class ilTermsOfServiceDocumentFormGUI.
+ 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 292 of file class.ilTermsOfServiceDocumentGUI.php.

References ILIAS\Repository\refinery(), and ActiveRecord\where().

Referenced by deleteDocument(), detachCriterionAssignment(), getFirstDocumentFromList(), saveAttachCriterionForm(), saveChangeCriterionForm(), saveEditDocumentForm(), showAttachCriterionForm(), showChangeCriterionForm(), and showEditDocumentForm().

292  : array
293  {
294  $documentIds = [];
295 
296  if ($this->httpState->wrapper()->post()->has('tos_id')) {
297  $documentIds = $this->httpState->wrapper()->post()->retrieve(
298  'tos_id',
299  $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())
300  );
301  }
302 
303  if ($documentIds === [] && $this->httpState->wrapper()->query()->has('tos_id')) {
304  $documentIds = [$this->httpState->wrapper()->query()->retrieve(
305  'tos_id',
306  $this->refinery->kindlyTo()->int()
307  )];
308  }
309 
310  if ($documentIds === []) {
311  return $documentIds;
312  }
313 
314  $documents = ilTermsOfServiceDocument::where(
315  ['id' => array_filter(array_map('intval', $documentIds))],
316  ['id' => 'IN']
317  )->getArray();
318 
319  return $documents;
320  }
static where($where, $operator=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFirstDocumentFromList()

ilTermsOfServiceDocumentGUI::getFirstDocumentFromList ( array  $documents)
protected

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

References $data, ILIAS\Repository\ctrl(), ActiveRecord\getCollection(), getDocumentsByServerRequest(), ILIAS\Repository\lng(), and showDocuments().

Referenced by deleteDocument(), detachCriterionAssignment(), saveAttachCriterionForm(), saveChangeCriterionForm(), saveEditDocumentForm(), showAttachCriterionForm(), showChangeCriterionForm(), and showEditDocumentForm().

323  {
324  if (1 !== count($documents)) {
325  throw new UnexpectedValueException('Expected exactly one document in list');
326  }
327 
328  $document = new ilTermsOfServiceDocument(0);
329  $document = $document->buildFromArray(current($documents));
330 
331  return $document;
332  }
Class ilTermsOfServiceDocument.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getResetMessageBoxHtml()

ilTermsOfServiceDocumentGUI::getResetMessageBoxHtml ( )
protected

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

References ILIAS\Repository\ctrl(), ilDatePresentation\formatDate(), IL_CAL_UNIX, ILIAS\Repository\lng(), ilDatePresentation\setUseRelativeDates(), and ilDatePresentation\useRelativeDates().

Referenced by showDocuments().

163  : string
164  {
165  if (((int) $this->tos->getLastResetDate()->get(IL_CAL_UNIX)) !== 0) {
168  $resetText = sprintf(
169  $this->lng->txt('tos_last_reset_date'),
170  ilDatePresentation::formatDate($this->tos->getLastResetDate())
171  );
173  } else {
174  $resetText = $this->lng->txt('tos_never_reset');
175  }
176 
177  $buttons = [];
178  if ($this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
179  $buttons = [
180  $this->uiFactory
181  ->button()
182  ->standard(
183  $this->lng->txt('tos_reset_tos_for_all_users'),
184  $this->ctrl->getLinkTarget($this, 'confirmReset')
185  )
186  ];
187  }
188 
189  return $this->uiRenderer->render(
190  $this->uiFactory->messageBox()
191  ->info($resetText)
192  ->withButtons($buttons)
193  );
194  }
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
const IL_CAL_UNIX
static setUseRelativeDates(bool $a_status)
set use relative dates
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset()

ilTermsOfServiceDocumentGUI::reset ( )
protected

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

References ILIAS\Repository\lng(), showDocuments(), and ILIAS\Repository\user().

122  : void
123  {
124  if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
125  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
126  }
127 
128  $this->tos->resetAll();
129 
130  $this->log->info('Terms of service reset by ' . $this->user->getId() . ' [' . $this->user->getLogin() . ']');
131  $this->tpl->setOnScreenMessage('success', $this->lng->txt('tos_reset_successful'));
132 
133  $this->showDocuments();
134  }
+ Here is the call graph for this function:

◆ saveAddDocumentForm()

ilTermsOfServiceDocumentGUI::saveAddDocumentForm ( )
protected

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

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

225  : void
226  {
227  if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
228  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
229  }
230 
231  $form = $this->getDocumentForm(new ilTermsOfServiceDocument());
232  if ($form->saveObject()) {
233  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'), true);
234  if ($form->hasTranslatedInfo()) {
235  $this->tpl->setOnScreenMessage('info', $form->getTranslatedInfo(), true);
236  }
237  $this->ctrl->redirect($this, 'showDocuments');
238  } elseif ($form->hasTranslatedError()) {
239  $this->tpl->setOnScreenMessage('failure', $form->getTranslatedError());
240  }
241 
242  $this->tpl->setContent($form->getHTML());
243  }
getDocumentForm(ilTermsOfServiceDocument $document)
Class ilTermsOfServiceDocument.
+ Here is the call graph for this function:

◆ saveAttachCriterionForm()

ilTermsOfServiceDocumentGUI::saveAttachCriterionForm ( )
protected

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

References ILIAS\Repository\ctrl(), getCriterionForm(), getDocumentsByServerRequest(), getFirstDocumentFromList(), and ILIAS\Repository\lng().

479  : void
480  {
481  if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
482  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
483  }
484 
485  $document = $this->getFirstDocumentFromList($this->getDocumentsByServerRequest());
486 
487  $form = $this->getCriterionForm($document, new ilTermsOfServiceDocumentCriterionAssignment());
488  if ($form->saveObject()) {
489  $this->tpl->setOnScreenMessage('success', $this->lng->txt('tos_doc_crit_attached'), true);
490  $this->ctrl->redirect($this, 'showDocuments');
491  } elseif ($form->hasTranslatedError()) {
492  $this->tpl->setOnScreenMessage('failure', $form->getTranslatedError());
493  }
494 
495  $this->tpl->setContent($form->getHTML());
496  }
getCriterionForm(ilTermsOfServiceDocument $document, ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment)
+ Here is the call graph for this function:

◆ saveChangeCriterionForm()

ilTermsOfServiceDocumentGUI::saveChangeCriterionForm ( )
protected

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

References ILIAS\Repository\ctrl(), getCriterionForm(), getDocumentsByServerRequest(), getFirstDocumentFromList(), ILIAS\Repository\lng(), and showDocuments().

537  : void
538  {
539  if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
540  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
541  }
542 
543  $document = $this->getFirstDocumentFromList($this->getDocumentsByServerRequest());
544 
545  $criterionId = $this->httpState->request()->getQueryParams()['crit_id'] ?? 0;
546  if (!is_numeric($criterionId) || $criterionId < 1) {
547  $this->showDocuments();
548  return;
549  }
550 
551  $criterionAssignment = array_values(array_filter(
552  $document->criteria(),
553  static function (ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment) use (
554  $criterionId
555  ): bool {
556  return $criterionAssignment->getId() == $criterionId;
557  }
558  ))[0];
559 
560  $form = $this->getCriterionForm($document, $criterionAssignment);
561  if ($form->saveObject()) {
562  $this->tpl->setOnScreenMessage('success', $this->lng->txt('tos_doc_crit_changed'), true);
563  $this->ctrl->redirect($this, 'showDocuments');
564  } elseif ($form->hasTranslatedError()) {
565  $this->tpl->setOnScreenMessage('failure', $form->getTranslatedError());
566  }
567 
568  $this->tpl->setContent($form->getHTML());
569  }
getCriterionForm(ilTermsOfServiceDocument $document, ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment)
+ Here is the call graph for this function:

◆ saveDocumentSorting()

ilTermsOfServiceDocumentGUI::saveDocumentSorting ( )
protected

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

References Vendor\Package\$e, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and showDocuments().

415  : void
416  {
417  if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
418  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
419  }
420 
421  $sorting = $this->httpState->request()->getParsedBody()['sorting'] ?? [];
422  if (!is_array($sorting) || 0 === count($sorting)) {
423  $this->showDocuments();
424  return;
425  }
426 
427  asort($sorting, SORT_NUMERIC);
428 
429  $position = 0;
430  foreach ($sorting as $documentId => $ignoredSortValue) {
431  if (!is_numeric($documentId)) {
432  continue;
433  }
434 
435  try {
436  $document = new ilTermsOfServiceDocument((int) $documentId);
437  $document->setSorting(++$position);
438  $document->store();
439  } catch (ilException $e) {
440  // Empty catch block
441  }
442  }
443 
444  $this->tpl->setOnScreenMessage('success', $this->lng->txt('tos_saved_sorting'), true);
445  $this->ctrl->redirect($this);
446  }
Class ilTermsOfServiceDocument.
+ Here is the call graph for this function:

◆ saveEditDocumentForm()

ilTermsOfServiceDocumentGUI::saveEditDocumentForm ( )
protected

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

References ILIAS\Repository\ctrl(), getDocumentForm(), getDocumentsByServerRequest(), getFirstDocumentFromList(), and ILIAS\Repository\lng().

267  : void
268  {
269  if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
270  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
271  }
272 
273  $document = $this->getFirstDocumentFromList($this->getDocumentsByServerRequest());
274 
275  $form = $this->getDocumentForm($document);
276  if ($form->saveObject()) {
277  $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'), true);
278  if ($form->hasTranslatedInfo()) {
279  $this->tpl->setOnScreenMessage('info', $form->getTranslatedInfo(), true);
280  }
281  $this->ctrl->redirect($this, 'showDocuments');
282  } elseif ($form->hasTranslatedError()) {
283  $this->tpl->setOnScreenMessage('failure', $form->getTranslatedError());
284  }
285 
286  $this->tpl->setContent($form->getHTML());
287  }
getDocumentForm(ilTermsOfServiceDocument $document)
+ Here is the call graph for this function:

◆ showAddDocumentForm()

ilTermsOfServiceDocumentGUI::showAddDocumentForm ( )
protected

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

References getDocumentForm(), and ILIAS\Repository\lng().

245  : void
246  {
247  if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
248  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
249  }
250 
251  $form = $this->getDocumentForm(new ilTermsOfServiceDocument());
252  $this->tpl->setContent($form->getHTML());
253  }
getDocumentForm(ilTermsOfServiceDocument $document)
Class ilTermsOfServiceDocument.
+ Here is the call graph for this function:

◆ showAttachCriterionForm()

ilTermsOfServiceDocumentGUI::showAttachCriterionForm ( )
protected

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

References getCriterionForm(), getDocumentsByServerRequest(), getFirstDocumentFromList(), and ILIAS\Repository\lng().

498  : void
499  {
500  if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
501  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
502  }
503 
504  $document = $this->getFirstDocumentFromList($this->getDocumentsByServerRequest());
505 
506  $form = $this->getCriterionForm($document, new ilTermsOfServiceDocumentCriterionAssignment());
507  $this->tpl->setContent($form->getHTML());
508  }
getCriterionForm(ilTermsOfServiceDocument $document, ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment)
+ Here is the call graph for this function:

◆ showChangeCriterionForm()

ilTermsOfServiceDocumentGUI::showChangeCriterionForm ( )
protected

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

References getCriterionForm(), getDocumentsByServerRequest(), getFirstDocumentFromList(), ILIAS\Repository\lng(), and showDocuments().

510  : void
511  {
512  if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
513  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
514  }
515 
516  $document = $this->getFirstDocumentFromList($this->getDocumentsByServerRequest());
517 
518  $criterionId = $this->httpState->request()->getQueryParams()['crit_id'] ?? 0;
519  if (!is_numeric($criterionId) || $criterionId < 1) {
520  $this->showDocuments();
521  return;
522  }
523 
524  $criterionAssignment = array_values(array_filter(
525  $document->criteria(),
526  static function (ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment) use (
527  $criterionId
528  ): bool {
529  return $criterionAssignment->getId() == $criterionId;
530  }
531  ))[0];
532 
533  $form = $this->getCriterionForm($document, $criterionAssignment);
534  $this->tpl->setContent($form->getHTML());
535  }
getCriterionForm(ilTermsOfServiceDocument $document, ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment)
+ Here is the call graph for this function:

◆ showDocuments()

ilTermsOfServiceDocumentGUI::showDocuments ( )
protected

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

References ilTermsOfServiceTableDataProviderFactory\CONTEXT_DOCUMENTS, ILIAS\Repository\ctrl(), ilLinkButton\getInstance(), getResetMessageBoxHtml(), and ILIAS\Repository\toolbar().

Referenced by detachCriterionAssignment(), getFirstDocumentFromList(), reset(), saveChangeCriterionForm(), saveDocumentSorting(), and showChangeCriterionForm().

136  : void
137  {
138  if ($this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
139  $addDocumentBtn = ilLinkButton::getInstance();
140  $addDocumentBtn->setPrimary(true);
141  $addDocumentBtn->setUrl($this->ctrl->getLinkTarget($this, 'showAddDocumentForm'));
142  $addDocumentBtn->setCaption('tos_add_document_btn_label');
143  $this->toolbar->addStickyItem($addDocumentBtn);
144  }
145 
146  $documentTableGui = new ilTermsOfServiceDocumentTableGUI(
147  $this,
148  'showDocuments',
149  $this->criterionTypeFactory,
150  $this->uiFactory,
151  $this->uiRenderer,
152  $this->rbacsystem->checkAccess('write', $this->tos->getRefId())
153  );
154  $documentTableGui->setProvider($this->tableDataProviderFactory->getByContext(ilTermsOfServiceTableDataProviderFactory::CONTEXT_DOCUMENTS));
155  $documentTableGui->populate();
156 
157  $this->tpl->setCurrentBlock('mess');
158  $this->tpl->setVariable('MESSAGE', $this->getResetMessageBoxHtml());
159  $this->tpl->parseCurrentBlock('mess');
160  $this->tpl->setContent($documentTableGui->getHTML());
161  }
Class ilTermsOfServiceDocumentTableGUI.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showEditDocumentForm()

ilTermsOfServiceDocumentGUI::showEditDocumentForm ( )
protected

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

References getDocumentForm(), getDocumentsByServerRequest(), getFirstDocumentFromList(), and ILIAS\Repository\lng().

255  : void
256  {
257  if (!$this->rbacsystem->checkAccess('write', $this->tos->getRefId())) {
258  $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
259  }
260 
261  $document = $this->getFirstDocumentFromList($this->getDocumentsByServerRequest());
262 
263  $form = $this->getDocumentForm($document);
264  $this->tpl->setContent($form->getHTML());
265  }
getDocumentForm(ilTermsOfServiceDocument $document)
+ Here is the call graph for this function:

Field Documentation

◆ $criterionTypeFactory

ilTermsOfServiceCriterionTypeFactoryInterface ilTermsOfServiceDocumentGUI::$criterionTypeFactory
protected

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

Referenced by __construct().

◆ $ctrl

ilCtrlInterface ilTermsOfServiceDocumentGUI::$ctrl
protected

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

Referenced by __construct().

◆ $documentPurifier

ilHtmlPurifierInterface ilTermsOfServiceDocumentGUI::$documentPurifier
protected

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

Referenced by __construct().

◆ $error

ilErrorHandling ilTermsOfServiceDocumentGUI::$error
protected

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

Referenced by __construct().

◆ $fileSystems

Filesystems ilTermsOfServiceDocumentGUI::$fileSystems
protected

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

Referenced by __construct().

◆ $fileUpload

FileUpload ilTermsOfServiceDocumentGUI::$fileUpload
protected

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

Referenced by __construct(), and getDocumentForm().

◆ $httpState

ILIAS HTTP GlobalHttpState ilTermsOfServiceDocumentGUI::$httpState
protected

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

Referenced by __construct().

◆ $lng

ilLanguage ilTermsOfServiceDocumentGUI::$lng
protected

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

Referenced by __construct().

◆ $log

ilLogger ilTermsOfServiceDocumentGUI::$log
protected

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

Referenced by __construct().

◆ $rbacsystem

ilRbacSystem ilTermsOfServiceDocumentGUI::$rbacsystem
protected

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

Referenced by __construct().

◆ $refinery

Refinery ilTermsOfServiceDocumentGUI::$refinery
protected

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

Referenced by __construct().

◆ $tableDataProviderFactory

ilTermsOfServiceTableDataProviderFactory ilTermsOfServiceDocumentGUI::$tableDataProviderFactory
protected

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

Referenced by __construct().

◆ $toolbar

ilToolbarGUI ilTermsOfServiceDocumentGUI::$toolbar
protected

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

Referenced by __construct().

◆ $tos

ilObjTermsOfService ilTermsOfServiceDocumentGUI::$tos
protected

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

Referenced by __construct().

◆ $tpl

ilGlobalTemplateInterface ilTermsOfServiceDocumentGUI::$tpl
protected

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

Referenced by __construct().

◆ $uiFactory

Factory ilTermsOfServiceDocumentGUI::$uiFactory
protected

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

Referenced by __construct().

◆ $uiRenderer

Renderer ilTermsOfServiceDocumentGUI::$uiRenderer
protected

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

Referenced by __construct().

◆ $user

ilObjUser ilTermsOfServiceDocumentGUI::$user
protected

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

Referenced by __construct().


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