129 $cmd = $this->ctrl->getCmd();
131 if (!$this->rbacsystem->checkAccess(
'read', $this->accs->getRefId())) {
132 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
135 if ($cmd ==
'' || !method_exists($this, $cmd)) {
136 $cmd =
'showDocuments';
148 if ($this->rbacsystem->checkAccess(
'write', $this->accs->getRefId())) {
149 $addDocumentBtn = $this->uiFactory->button()->primary(
150 $this->lng->txt(
'acc_add_document_btn_label'),
151 $this->ctrl->getLinkTarget($this,
'showAddDocumentForm')
153 $this->toolbar->addStickyItem($addDocumentBtn);
159 $this->criterionTypeFactory,
162 $this->rbacsystem->checkAccess(
'write', $this->accs->getRefId())
165 $documentTableGui->populate();
167 $this->tpl->setContent($documentTableGui->getHTML());
176 if ($document->getId() > 0) {
177 $this->ctrl->setParameter($this,
'acc_id', $document->getId());
180 $formAction = $this->ctrl->
getFormAction($this,
'saveAddDocumentForm');
181 $saveCommand =
'saveAddDocumentForm';
183 if ($document->getId() > 0) {
184 $formAction = $this->ctrl->getFormAction($this,
'saveEditDocumentForm');
185 $saveCommand =
'saveEditDocumentForm';
190 $this->documentPurifier,
192 $this->fileSystems->temp(),
197 $this->rbacsystem->checkAccess(
'write', $this->accs->getRefId())
208 if (!$this->rbacsystem->checkAccess(
'write', $this->accs->getRefId())) {
209 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
213 if ($form->saveObject()) {
214 ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'),
true);
215 if ($form->hasTranslatedInfo()) {
218 $this->ctrl->redirect($this,
'showDocuments');
219 } elseif ($form->hasTranslatedError()) {
223 $this->tpl->setContent($form->getHTML());
231 if (!$this->rbacsystem->checkAccess(
'write', $this->accs->getRefId())) {
232 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
236 $this->tpl->setContent($form->getHTML());
244 if (!$this->rbacsystem->checkAccess(
'write', $this->accs->getRefId())) {
245 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
251 $this->tpl->setContent($form->getHTML());
259 if (!$this->rbacsystem->checkAccess(
'write', $this->accs->getRefId())) {
260 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
266 if ($form->saveObject()) {
267 ilUtil::sendSuccess($this->lng->txt(
'saved_successfully'),
true);
268 if ($form->hasTranslatedInfo()) {
271 $this->ctrl->redirect($this,
'showDocuments');
272 } elseif ($form->hasTranslatedError()) {
276 $this->tpl->setContent($form->getHTML());
286 $documentIds = $this->httpState->request()->getParsedBody()[
'acc_id'] ?? [];
287 if (!is_array($documentIds) || 0 === count($documentIds)) {
288 $documentIds = $this->httpState->request()->getQueryParams()[
'acc_id'] ? [$this->httpState->request()->getQueryParams()[
'acc_id']] : [];
291 if (0 === count($documentIds)) {
296 [
'id' => array_filter(array_map(
'intval', $documentIds))],
310 if (1 !== count($documents)) {
315 $document = $document->buildFromArray(current($documents));
323 protected function deleteDocuments() : void
325 if (!$this->rbacsystem->checkAccess(
'write', $this->accs->getRefId())) {
326 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
330 if (0 === count($documents)) {
334 $documents = array_map(
function (array
$data) {
336 $document = $document->buildFromArray(
$data);
342 $isDeletionRequest = (bool) ($this->httpState->request()->getQueryParams()[
'delete'] ??
false);
343 if ($isDeletionRequest) {
344 $this->processDocumentDeletion($documents);
346 $this->ctrl->redirect($this);
348 $this->ctrl->setParameter($this,
'delete', 1);
350 $confirmation->setFormAction($this->ctrl->getFormAction($this,
'deleteDocuments'));
351 $confirmation->setConfirm($this->lng->txt(
'confirm'),
'deleteDocuments');
352 $confirmation->setCancel($this->lng->txt(
'cancel'),
'showDocuments');
354 $confirmation->setHeaderText($this->lng->txt(
'acc_sure_delete_documents_p'));
355 if (1 === count($documents)) {
356 $confirmation->setHeaderText($this->lng->txt(
'acc_sure_delete_documents_s'));
359 foreach ($documents as $document) {
361 $confirmation->addItem(
'acc_id[]', $document->getId(), implode(
' | ', [
362 $document->getTitle()
366 $this->tpl->setContent($confirmation->getHTML());
373 protected function processDocumentDeletion(array $documents) : void
375 foreach ($documents as $document) {
380 ilUtil::sendSuccess($this->lng->txt(
'acc_deleted_documents_p'),
true);
381 if (1 === count($documents)) {
382 ilUtil::sendSuccess($this->lng->txt(
'acc_deleted_documents_s'),
true);
391 if (!$this->rbacsystem->checkAccess(
'write', $this->accs->getRefId())) {
392 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
397 $this->processDocumentDeletion([$document]);
399 $this->ctrl->redirect($this);
407 if (!$this->rbacsystem->checkAccess(
'write', $this->accs->getRefId())) {
408 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
411 $sorting = $this->httpState->request()->getParsedBody()[
'sorting'] ?? [];
412 if (!is_array($sorting) || 0 === count($sorting)) {
417 asort($sorting, SORT_NUMERIC);
420 foreach ($sorting as $documentId => $ignoredSortValue) {
421 if (!is_numeric($documentId)) {
427 $document->setSorting(++$position);
434 ilUtil::sendSuccess($this->lng->txt(
'acc_saved_sorting'),
true);
435 $this->ctrl->redirect($this);
447 $this->ctrl->setParameter($this,
'acc_id', $document->getId());
449 if ($criterionAssignment->getId() > 0) {
450 $this->ctrl->setParameter($this,
'crit_id', $criterionAssignment->getId());
453 $formAction = $this->ctrl->
getFormAction($this,
'saveAttachCriterionForm');
454 $saveCommand =
'saveAttachCriterionForm';
456 if ($criterionAssignment->getId() > 0) {
457 $formAction = $this->ctrl->getFormAction($this,
'saveChangeCriterionForm');
458 $saveCommand =
'saveChangeCriterionForm';
463 $criterionAssignment,
464 $this->criterionTypeFactory,
479 if (!$this->rbacsystem->checkAccess(
'write', $this->accs->getRefId())) {
480 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
483 $document = $this->getFirstDocumentFromList($this->getDocumentsByServerRequest());
486 if ($form->saveObject()) {
487 ilUtil::sendSuccess($this->lng->txt(
'acc_doc_crit_attached'),
true);
488 $this->ctrl->redirect($this,
'showDocuments');
489 } elseif ($form->hasTranslatedError()) {
493 $this->tpl->setContent($form->getHTML());
501 if (!$this->rbacsystem->checkAccess(
'write', $this->accs->getRefId())) {
502 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
505 $document = $this->getFirstDocumentFromList($this->getDocumentsByServerRequest());
508 $this->tpl->setContent($form->getHTML());
516 if (!$this->rbacsystem->checkAccess(
'write', $this->accs->getRefId())) {
517 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
520 $document = $this->getFirstDocumentFromList($this->getDocumentsByServerRequest());
522 $criterionId = $this->httpState->request()->getQueryParams()[
'crit_id'] ?? 0;
523 if (!is_numeric($criterionId) || $criterionId < 1) {
524 $this->showDocuments();
528 $criterionAssignment = array_values(array_filter(
531 return $criterionAssignment->getId() == $criterionId;
535 $form = $this->getCriterionForm($document, $criterionAssignment);
536 $this->tpl->setContent($form->getHTML());
544 if (!$this->rbacsystem->checkAccess(
'write', $this->accs->getRefId())) {
545 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
548 $document = $this->getFirstDocumentFromList($this->getDocumentsByServerRequest());
550 $criterionId = $this->httpState->request()->getQueryParams()[
'crit_id'] ?? 0;
551 if (!is_numeric($criterionId) || $criterionId < 1) {
552 $this->showDocuments();
556 $criterionAssignment = array_values(array_filter(
559 return $criterionAssignment->getId() == $criterionId;
563 $form = $this->getCriterionForm($document, $criterionAssignment);
564 if ($form->saveObject()) {
565 ilUtil::sendSuccess($this->lng->txt(
'acc_doc_crit_changed'),
true);
566 $this->ctrl->redirect($this,
'showDocuments');
567 } elseif ($form->hasTranslatedError()) {
571 $this->tpl->setContent($form->getHTML());
579 if (!$this->rbacsystem->checkAccess(
'write', $this->accs->getRefId())) {
580 $this->
error->raiseError($this->lng->txt(
'permission_denied'), $this->error->MESSAGE);
583 $document = $this->getFirstDocumentFromList($this->getDocumentsByServerRequest());
585 $criterionId = $this->httpState->request()->getQueryParams()[
'crit_id'] ?? 0;
586 if (!is_numeric($criterionId) || $criterionId < 1) {
587 $this->showDocuments();
591 $criterionAssignment = array_values(array_filter(
594 return $criterionAssignment->getId() == $criterionId;
601 ilUtil::sendSuccess($this->lng->txt(
'acc_doc_crit_detached'),
true);
602 $this->ctrl->redirect($this,
'showDocuments');
static where($where, $operator=null)
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
Class ilAccessibilityDocumentCriterionAssignment.
Class ilAccessibilityDocumentGUI.
$tableDataProviderFactory
__construct(ilObjAccessibilitySettings $accs, ilAccessibilityCriterionTypeFactoryInterface $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, ilAccessibilityTableDataProviderFactory $tableDataProviderFactory, ilHtmlPurifierInterface $documentPurifier)
ilAccessibilityDocumentGUI constructor.
showChangeCriterionForm()
getFirstDocumentFromList(array $documents)
saveAttachCriterionForm()
showAttachCriterionForm()
getCriterionForm(ilAccessibilityDocument $document, ilAccessibilityDocumentCriterionAssignment $criterionAssignment)
executeCommand()
The implemented class should be ilCtrl enabled and execute or forward the given command.
detachCriterionAssignment()
saveChangeCriterionForm()
getDocumentForm(ilAccessibilityDocument $document)
getDocumentsByServerRequest()
Class ilAccessibilityDocumentTableGUI.
Class ilAccessibilityDocument.
detachCriterion(ilAccessibilityDocumentCriterionAssignment $criterionAssignment)
criteria()
ilAccessibilityEvaluableCriterion[]
Class ilAccessibilityTableDataProviderFactory.
Confirmation screen class.
This class provides processing control methods.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilGlobalPageTemplate.
Component logger with individual log levels by component id.
Class ilObjAccessibilitySettings.
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Class Filesystems The Filesystems interface defines the access methods which can be used to fetch the...
Interface GlobalHttpState.
This is how the factory for UI elements looks.
An entity that renders components to a string output.
Interface ilAccessibilityControllerEnabled.
Interface ilAccessibilityCriterionTypeFactoryInterface.
Interface for html sanitizing functionality.