ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilAccessibilityLogicalAndDocumentCriteriaEvaluation.php
Go to the documentation of this file.
1 <?php
2 
23 {
25  protected ilObjUser $user;
26  protected ilLogger $log;
27 
28  public function __construct(
30  ilObjUser $user,
31  ilLogger $log
32  ) {
33  $this->criterionTypeFactory = $criterionTypeFactory;
34  $this->user = $user;
35  $this->log = $log;
36  }
37 
38  public function evaluate(ilAccessibilitySignableDocument $document): bool
39  {
40  $this->log->debug(sprintf(
41  'Evaluating criteria for document "%s" (id: %s) and user "%s" (id: %s)',
42  $document->title(),
43  $document->id(),
44  $this->user->getLogin(),
45  $this->user->getId()
46  ));
47 
48  foreach ($document->criteria() as $criterionAssignment) {
51  $criterionType = $this->criterionTypeFactory->findByTypeIdent($criterionAssignment->getCriterionId(), true);
52 
53  $result = $criterionType->evaluate($this->user, $criterionAssignment->getCriterionValue());
54 
55  $this->log->debug(sprintf(
56  'Criterion of type "%s", configured with %s evaluated: %s',
57  $criterionType->getTypeIdent(),
58  var_export($criterionAssignment->getCriterionValue()->toJson(), true),
59  var_export($result, true)
60  ));
61 
62  if (!$result) {
63  return false;
64  }
65  }
66 
67  return true;
68  }
69 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
evaluate(ilAccessibilitySignableDocument $document)
__construct(ilAccessibilityCriterionTypeFactoryInterface $criterionTypeFactory, ilObjUser $user, ilLogger $log)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...