Class ilTermsOfServiceDocumentGUI.
More...
|
| __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 enabled and execute or forward the given command. More...
|
|
| detachCriterionAssignment () |
|
◆ __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 | |
Definition at line 87 of file class.ilTermsOfServiceDocumentGUI.php.
References $criterionTypeFactory, $ctrl, $documentPurifier, $error, $fileSystems, $fileUpload, $httpState, $lng, $log, $rbacsystem, $tableDataProviderFactory, $toolbar, $tos, $tpl, $uiFactory, $uiRenderer, $user, and user().
$tableDataProviderFactory
◆ confirmReset()
ilTermsOfServiceDocumentGUI::confirmReset |
( |
| ) |
|
|
protected |
Definition at line 150 of file class.ilTermsOfServiceDocumentGUI.php.
152 if (!$this->rbacsystem->checkAccess(
'write', $this->tos->getRefId())) {
153 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
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'));
162 $this->tpl->setContent($confirmation->getHTML());
◆ deleteDocument()
ilTermsOfServiceDocumentGUI::deleteDocument |
( |
| ) |
|
|
protected |
◆ detachCriterionAssignment()
ilTermsOfServiceDocumentGUI::detachCriterionAssignment |
( |
| ) |
|
Definition at line 657 of file class.ilTermsOfServiceDocumentGUI.php.
References getDocumentsByServerRequest(), getFirstDocumentFromList(), and showDocuments().
659 if (!$this->rbacsystem->checkAccess(
'write', $this->tos->getRefId())) {
660 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
665 $criterionId = $this->httpState->request()->getQueryParams()[
'crit_id'] ?? 0;
666 if (!is_numeric($criterionId) || $criterionId < 1) {
671 $criterionAssignment = array_values(array_filter(
672 $document->criteria(),
674 return $criterionAssignment->getId() == $criterionId;
678 $document->detachCriterion($criterionAssignment);
681 \ilUtil::sendSuccess($this->lng->txt(
'tos_doc_crit_detached'),
true);
682 $this->ctrl->redirect($this,
'showDocuments');
Class ilTermsOfServiceDocumentCriterionAssignment.
getDocumentsByServerRequest()
getFirstDocumentFromList(array $documents)
◆ executeCommand()
ilTermsOfServiceDocumentGUI::executeCommand |
( |
| ) |
|
The implemented class should be enabled and execute or forward the given command.
Implements ilTermsOfServiceControllerEnabled.
Definition at line 128 of file class.ilTermsOfServiceDocumentGUI.php.
130 $nextClass = $this->ctrl->getNextClass($this);
131 $cmd = $this->ctrl->getCmd();
133 if (!$this->rbacsystem->checkAccess(
'read', $this->tos->getRefId())) {
134 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
137 switch (strtolower($nextClass)) {
139 if ($cmd ==
'' || !method_exists($this, $cmd)) {
140 $cmd =
'showDocuments';
◆ getCriterionForm()
- Parameters
-
\ilTermsOfServiceDocument | $document | |
\ilTermsOfServiceDocumentCriterionAssignment | $criterionAssignment | |
- Returns
Definition at line 523 of file class.ilTermsOfServiceDocumentGUI.php.
References $form, ilFormGUI\getFormAction(), and user().
Referenced by saveAttachCriterionForm(), saveChangeCriterionForm(), showAttachCriterionForm(), and showChangeCriterionForm().
527 $this->ctrl->setParameter($this,
'tos_id', $document->getId());
529 if ($criterionAssignment->getId() > 0) {
530 $this->ctrl->setParameter($this,
'crit_id', $criterionAssignment->getId());
533 $formAction = $this->ctrl->
getFormAction($this,
'saveAttachCriterionForm');
534 $saveCommand =
'saveAttachCriterionForm';
536 if ($criterionAssignment->getId() > 0) {
537 $formAction = $this->ctrl->getFormAction($this,
'saveChangeCriterionForm');
538 $saveCommand =
'saveChangeCriterionForm';
541 $form = new \ilTermsOfServiceCriterionFormGUI(
543 $criterionAssignment,
544 $this->criterionTypeFactory,
if(isset($_POST['submit'])) $form
◆ getDocumentForm()
- Parameters
-
\ilTermsOfServiceDocument | $document | |
- Returns
Definition at line 249 of file class.ilTermsOfServiceDocumentGUI.php.
References $fileUpload, $form, ilFormGUI\getFormAction(), and user().
Referenced by saveAddDocumentForm(), saveEditDocumentForm(), showAddDocumentForm(), and showEditDocumentForm().
251 if ($document->getId() > 0) {
252 $this->ctrl->setParameter($this,
'tos_id', $document->getId());
255 $formAction = $this->ctrl->
getFormAction($this,
'saveAddDocumentForm');
256 $saveCommand =
'saveAddDocumentForm';
258 if ($document->getId() > 0) {
259 $formAction = $this->ctrl->getFormAction($this,
'saveEditDocumentForm');
260 $saveCommand =
'saveEditDocumentForm';
263 $form = new \ilTermsOfServiceDocumentFormGUI(
265 $this->documentPurifier,
267 $this->fileSystems->temp(),
272 $this->rbacsystem->checkAccess(
'write', $this->tos->getRefId())
if(isset($_POST['submit'])) $form
◆ getDocumentsByServerRequest()
ilTermsOfServiceDocumentGUI::getDocumentsByServerRequest |
( |
| ) |
|
|
protected |
- Returns
- array
Definition at line 357 of file class.ilTermsOfServiceDocumentGUI.php.
References ActiveRecord\where().
Referenced by deleteDocument(), detachCriterionAssignment(), getFirstDocumentFromList(), saveAttachCriterionForm(), saveChangeCriterionForm(), saveEditDocumentForm(), showAttachCriterionForm(), showChangeCriterionForm(), and showEditDocumentForm().
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']] : [];
366 if (0 === count($documentIds)) {
371 [
'id' => array_filter(array_map(
'intval', $documentIds))],
static where($where, $operator=null)
◆ getFirstDocumentFromList()
ilTermsOfServiceDocumentGUI::getFirstDocumentFromList |
( |
array |
$documents | ) |
|
|
protected |
- Parameters
-
- Returns
- Exceptions
-
Definition at line 383 of file class.ilTermsOfServiceDocumentGUI.php.
References $data, ActiveRecord\getCollection(), getDocumentsByServerRequest(), ilUtil\sendInfo(), and showDocuments().
Referenced by deleteDocument(), detachCriterionAssignment(), saveAttachCriterionForm(), saveChangeCriterionForm(), saveEditDocumentForm(), showAttachCriterionForm(), showChangeCriterionForm(), and showEditDocumentForm().
385 if (1 !== count($documents)) {
386 throw new \UnexpectedValueException(
'Expected exactly one document in list');
389 $document = new \ilTermsOfServiceDocument(0);
390 $document = $document->buildFromArray(current($documents));
Class ilTermsOfServiceDocument.
◆ getResetMessageBoxHtml()
ilTermsOfServiceDocumentGUI::getResetMessageBoxHtml |
( |
| ) |
|
|
protected |
- Returns
- string
Definition at line 215 of file class.ilTermsOfServiceDocumentGUI.php.
References ilDatePresentation\formatDate(), IL_CAL_UNIX, ilDatePresentation\setUseRelativeDates(), and ilDatePresentation\useRelativeDates().
Referenced by showDocuments().
217 if ($this->tos->getLastResetDate() && $this->tos->getLastResetDate()->get(
IL_CAL_UNIX) != 0) {
220 $resetText = sprintf(
221 $this->lng->txt(
'tos_last_reset_date'),
226 $resetText = $this->lng->txt(
'tos_never_reset');
230 if ($this->rbacsystem->checkAccess(
'write', $this->tos->getRefId())) {
234 ->standard($this->lng->txt(
'tos_reset_tos_for_all_users'), $this->ctrl->getLinkTarget($this,
'confirmReset'))
238 return $this->uiRenderer->render(
239 $this->uiFactory->messageBox()
241 ->withButtons($buttons)
static setUseRelativeDates($a_status)
set use relative dates
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static useRelativeDates()
check if relative dates are used
◆ reset()
ilTermsOfServiceDocumentGUI::reset |
( |
| ) |
|
|
protected |
Definition at line 168 of file class.ilTermsOfServiceDocumentGUI.php.
References showDocuments(), and user().
170 if (!$this->rbacsystem->checkAccess(
'write', $this->tos->getRefId())) {
171 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
174 $this->tos->resetAll();
176 $this->log->info(
'Terms of service reset by ' . $this->
user->getId() .
' [' . $this->
user->getLogin() .
']');
177 \ilUtil::sendSuccess($this->lng->txt(
'tos_reset_successful'));
◆ saveAddDocumentForm()
ilTermsOfServiceDocumentGUI::saveAddDocumentForm |
( |
| ) |
|
|
protected |
Definition at line 281 of file class.ilTermsOfServiceDocumentGUI.php.
References $form, getDocumentForm(), ilUtil\sendFailure(), and ilUtil\sendInfo().
283 if (!$this->rbacsystem->checkAccess(
'write', $this->tos->getRefId())) {
284 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
288 if (
$form->saveObject()) {
289 \ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'),
true);
290 if (
$form->hasTranslatedInfo()) {
293 $this->ctrl->redirect($this,
'showDocuments');
294 } elseif (
$form->hasTranslatedError()) {
298 $this->tpl->setContent(
$form->getHTML());
getDocumentForm(ilTermsOfServiceDocument $document)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(isset($_POST['submit'])) $form
Class ilTermsOfServiceDocument.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
◆ saveAttachCriterionForm()
ilTermsOfServiceDocumentGUI::saveAttachCriterionForm |
( |
| ) |
|
|
protected |
Definition at line 557 of file class.ilTermsOfServiceDocumentGUI.php.
References $form, getCriterionForm(), getDocumentsByServerRequest(), getFirstDocumentFromList(), and ilUtil\sendFailure().
559 if (!$this->rbacsystem->checkAccess(
'write', $this->tos->getRefId())) {
560 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
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()) {
573 $this->tpl->setContent(
$form->getHTML());
Class ilTermsOfServiceDocumentCriterionAssignment.
if(isset($_POST['submit'])) $form
getCriterionForm(\ilTermsOfServiceDocument $document, \ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment)
getDocumentsByServerRequest()
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
getFirstDocumentFromList(array $documents)
◆ saveChangeCriterionForm()
ilTermsOfServiceDocumentGUI::saveChangeCriterionForm |
( |
| ) |
|
|
protected |
Definition at line 622 of file class.ilTermsOfServiceDocumentGUI.php.
References $form, getCriterionForm(), getDocumentsByServerRequest(), getFirstDocumentFromList(), ilUtil\sendFailure(), and showDocuments().
624 if (!$this->rbacsystem->checkAccess(
'write', $this->tos->getRefId())) {
625 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
630 $criterionId = $this->httpState->request()->getQueryParams()[
'crit_id'] ?? 0;
631 if (!is_numeric($criterionId) || $criterionId < 1) {
636 $criterionAssignment = array_values(array_filter(
637 $document->criteria(),
639 return $criterionAssignment->getId() == $criterionId;
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()) {
651 $this->tpl->setContent(
$form->getHTML());
Class ilTermsOfServiceDocumentCriterionAssignment.
if(isset($_POST['submit'])) $form
getCriterionForm(\ilTermsOfServiceDocument $document, \ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment)
getDocumentsByServerRequest()
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
getFirstDocumentFromList(array $documents)
◆ saveDocumentSorting()
ilTermsOfServiceDocumentGUI::saveDocumentSorting |
( |
| ) |
|
|
protected |
Definition at line 485 of file class.ilTermsOfServiceDocumentGUI.php.
References showDocuments().
487 if (!$this->rbacsystem->checkAccess(
'write', $this->tos->getRefId())) {
488 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
491 $sorting = $this->httpState->request()->getParsedBody()[
'sorting'] ?? [];
492 if (!is_array($sorting) || 0 === count($sorting)) {
497 asort($sorting, SORT_NUMERIC);
500 foreach ($sorting as $documentId => $ignoredSortValue) {
501 if (!is_numeric($documentId)) {
506 $document = new \ilTermsOfServiceDocument((
int) $documentId);
507 $document->setSorting(++$position);
514 \ilUtil::sendSuccess($this->lng->txt(
'tos_saved_sorting'),
true);
515 $this->ctrl->redirect($this);
◆ saveEditDocumentForm()
ilTermsOfServiceDocumentGUI::saveEditDocumentForm |
( |
| ) |
|
|
protected |
Definition at line 332 of file class.ilTermsOfServiceDocumentGUI.php.
References $form, getDocumentForm(), getDocumentsByServerRequest(), getFirstDocumentFromList(), ilUtil\sendFailure(), and ilUtil\sendInfo().
334 if (!$this->rbacsystem->checkAccess(
'write', $this->tos->getRefId())) {
335 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
341 if (
$form->saveObject()) {
342 \ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'),
true);
343 if (
$form->hasTranslatedInfo()) {
346 $this->ctrl->redirect($this,
'showDocuments');
347 } elseif (
$form->hasTranslatedError()) {
351 $this->tpl->setContent(
$form->getHTML());
getDocumentForm(ilTermsOfServiceDocument $document)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(isset($_POST['submit'])) $form
getDocumentsByServerRequest()
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
getFirstDocumentFromList(array $documents)
◆ showAddDocumentForm()
ilTermsOfServiceDocumentGUI::showAddDocumentForm |
( |
| ) |
|
|
protected |
Definition at line 304 of file class.ilTermsOfServiceDocumentGUI.php.
References $form, and getDocumentForm().
306 if (!$this->rbacsystem->checkAccess(
'write', $this->tos->getRefId())) {
307 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
311 $this->tpl->setContent(
$form->getHTML());
getDocumentForm(ilTermsOfServiceDocument $document)
if(isset($_POST['submit'])) $form
Class ilTermsOfServiceDocument.
◆ showAttachCriterionForm()
ilTermsOfServiceDocumentGUI::showAttachCriterionForm |
( |
| ) |
|
|
protected |
Definition at line 579 of file class.ilTermsOfServiceDocumentGUI.php.
References $form, getCriterionForm(), getDocumentsByServerRequest(), and getFirstDocumentFromList().
581 if (!$this->rbacsystem->checkAccess(
'write', $this->tos->getRefId())) {
582 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
588 $this->tpl->setContent(
$form->getHTML());
Class ilTermsOfServiceDocumentCriterionAssignment.
if(isset($_POST['submit'])) $form
getCriterionForm(\ilTermsOfServiceDocument $document, \ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment)
getDocumentsByServerRequest()
getFirstDocumentFromList(array $documents)
◆ showChangeCriterionForm()
ilTermsOfServiceDocumentGUI::showChangeCriterionForm |
( |
| ) |
|
|
protected |
Definition at line 594 of file class.ilTermsOfServiceDocumentGUI.php.
References $form, getCriterionForm(), getDocumentsByServerRequest(), getFirstDocumentFromList(), and showDocuments().
596 if (!$this->rbacsystem->checkAccess(
'write', $this->tos->getRefId())) {
597 $this->error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
602 $criterionId = $this->httpState->request()->getQueryParams()[
'crit_id'] ?? 0;
603 if (!is_numeric($criterionId) || $criterionId < 1) {
608 $criterionAssignment = array_values(array_filter(
609 $document->criteria(),
611 return $criterionAssignment->getId() == $criterionId;
616 $this->tpl->setContent(
$form->getHTML());
Class ilTermsOfServiceDocumentCriterionAssignment.
if(isset($_POST['submit'])) $form
getCriterionForm(\ilTermsOfServiceDocument $document, \ilTermsOfServiceDocumentCriterionAssignment $criterionAssignment)
getDocumentsByServerRequest()
getFirstDocumentFromList(array $documents)
◆ showDocuments()
ilTermsOfServiceDocumentGUI::showDocuments |
( |
| ) |
|
|
protected |
Definition at line 185 of file class.ilTermsOfServiceDocumentGUI.php.
References ilTermsOfServiceTableDataProviderFactory\CONTEXT_DOCUMENTS, ilLinkButton\getInstance(), and getResetMessageBoxHtml().
Referenced by detachCriterionAssignment(), getFirstDocumentFromList(), reset(), saveChangeCriterionForm(), saveDocumentSorting(), and showChangeCriterionForm().
187 if ($this->rbacsystem->checkAccess(
'write', $this->tos->getRefId())) {
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);
195 $documentTableGui = new \ilTermsOfServiceDocumentTableGUI(
198 $this->criterionTypeFactory,
201 $this->rbacsystem->checkAccess(
'write', $this->tos->getRefId())
204 $documentTableGui->populate();
206 $this->tpl->setCurrentBlock(
'mess');
208 $this->tpl->parseCurrentBlock(
'mess');
209 $this->tpl->setContent($documentTableGui->getHTML());
◆ showEditDocumentForm()
ilTermsOfServiceDocumentGUI::showEditDocumentForm |
( |
| ) |
|
|
protected |
◆ $criterionTypeFactory
ilTermsOfServiceDocumentGUI::$criterionTypeFactory |
|
protected |
◆ $ctrl
ilTermsOfServiceDocumentGUI::$ctrl |
|
protected |
◆ $documentPurifier
ilTermsOfServiceDocumentGUI::$documentPurifier |
|
protected |
◆ $error
ilTermsOfServiceDocumentGUI::$error |
|
protected |
◆ $fileSystems
ilTermsOfServiceDocumentGUI::$fileSystems |
|
protected |
◆ $fileUpload
ilTermsOfServiceDocumentGUI::$fileUpload |
|
protected |
◆ $httpState
ilTermsOfServiceDocumentGUI::$httpState |
|
protected |
◆ $lng
ilTermsOfServiceDocumentGUI::$lng |
|
protected |
◆ $log
ilTermsOfServiceDocumentGUI::$log |
|
protected |
◆ $rbacsystem
ilTermsOfServiceDocumentGUI::$rbacsystem |
|
protected |
◆ $tableDataProviderFactory
ilTermsOfServiceDocumentGUI::$tableDataProviderFactory |
|
protected |
◆ $toolbar
ilTermsOfServiceDocumentGUI::$toolbar |
|
protected |
◆ $tos
ilTermsOfServiceDocumentGUI::$tos |
|
protected |
◆ $tpl
ilTermsOfServiceDocumentGUI::$tpl |
|
protected |
◆ $uiFactory
ilTermsOfServiceDocumentGUI::$uiFactory |
|
protected |
◆ $uiRenderer
ilTermsOfServiceDocumentGUI::$uiRenderer |
|
protected |
◆ $user
ilTermsOfServiceDocumentGUI::$user |
|
protected |
The documentation for this class was generated from the following file: