ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilAccessibilitySequentialDocumentEvaluation.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
8 {
10  protected $evaluation;
11 
13  protected $user;
14 
16  protected $matchingDocuments = null;
17 
19  protected $possibleDocuments = [];
20 
22  protected $log;
23 
31  public function __construct(
34  ilLogger $log,
35  array $possibleDocuments
36  ) {
37  $this->evaluation = $evaluation;
38  $this->user = $user;
39  $this->log = $log;
40  $this->possibleDocuments = $possibleDocuments;
41  }
42 
46  protected function getMatchingDocuments() : array
47  {
48  if (null === $this->matchingDocuments) {
49  $this->matchingDocuments = [];
50 
51  $this->log->debug(sprintf(
52  'Evaluating document for user "%s" (id: %s) ...',
53  $this->user->getLogin(),
54  $this->user->getId()
55  ));
56 
57  foreach ($this->possibleDocuments as $document) {
58  if ($this->evaluation->evaluate($document)) {
59  $this->matchingDocuments[] = $document;
60  }
61  }
62 
63  $this->log->debug(sprintf(
64  '%s matching document(s) found',
65  count($this->matchingDocuments)
66  ));
67  }
68 
70  }
71 
76  {
78  if (count($matchingDocuments) > 0) {
79  return $matchingDocuments[0];
80  }
81 
83  'Could not find any accessibility control concept document for the passed user (id: %s|login: %s)',
84  $this->user->getId(),
85  $this->user->getLogin()
86  ));
87  }
88 
92  public function hasDocument() : bool
93  {
94  return count($this->getMatchingDocuments()) > 0;
95  }
96 }
Interface ilAccessibilitySignableDocument.
user()
Definition: user.php:4
Interface ilAccessibilityDocumentEvaluation.
Interface ilAccessibilitySequentialDocumentEvaluation.
Component logger with individual log levels by component id.
__construct(ilAccessibilityDocumentCriteriaEvaluation $evaluation, ilObjUser $user, ilLogger $log, array $possibleDocuments)
ilAccessibilityDocumentLogicalAndCriteriaEvaluation constructor.