ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilTestAccess.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 require_once 'Modules/Test/classes/class.ilTestParticipantData.php';
6 
16 {
20  protected $access;
21 
25  protected $refId;
26 
30  protected $testId;
31 
36  public function __construct($refId, $testId)
37  {
38  global $DIC; /* @var ILIAS\DI\Container $DIC */
39  $this->setAccess($DIC->access());
40 
41  $this->setRefId($refId);
42  $this->setTestId($testId);
43  }
44 
48  public function getAccess()
49  {
50  return $this->access;
51  }
52 
56  public function setAccess($access)
57  {
58  $this->access = $access;
59  }
60 
64  public function getRefId()
65  {
66  return $this->refId;
67  }
68 
72  public function setRefId($refId)
73  {
74  $this->refId = $refId;
75  }
76 
80  public function getTestId()
81  {
82  return $this->testId;
83  }
84 
88  public function setTestId($testId)
89  {
90  $this->testId = $testId;
91  }
92 
96  public function checkCorrectionsAccess()
97  {
98  return $this->getAccess()->checkAccess('write', '', $this->getRefId());
99  }
100 
105  {
106  if ($this->getAccess()->checkAccess('write', '', $this->getRefId())) {
107  return true;
108  }
109 
110  if ($this->getAccess()->checkPositionAccess(ilOrgUnitOperation::OP_SCORE_PARTICIPANTS, $this->getRefId())) {
111  return true;
112  }
113 
114  return false;
115  }
116 
121  {
122  if ($this->getAccess()->checkAccess('tst_results', '', $this->getRefId())) {
123  return true;
124  }
125 
126  if ($this->getAccess()->checkPositionAccess(ilOrgUnitOperation::OP_MANAGE_PARTICIPANTS, $this->getRefId())) {
127  return true;
128  }
129 
130  return false;
131  }
132 
137  {
138  if ($this->getAccess()->checkAccess('tst_results', '', $this->getRefId())) {
139  return true;
140  }
141 
142  if ($this->getAccess()->checkPositionAccess(ilOrgUnitOperation::OP_ACCESS_RESULTS, $this->getRefId())) {
143  return true;
144  }
145 
146  return false;
147  }
148 
152  public function checkStatisticsAccess()
153  {
154  if ($this->getAccess()->checkAccess('tst_statistics', '', $this->getRefId())) {
155  return true;
156  }
157  return false;
158  }
159 
165  protected function checkAccessForActiveId($accessFilter, $activeId)
166  {
167  global $DIC; /* @var ILIAS\DI\Container $DIC */
168 
169  $participantData = new ilTestParticipantData($DIC->database(), $DIC->language());
170  $participantData->setActiveIdsFilter(array($activeId));
171  $participantData->setParticipantAccessFilter($accessFilter);
172  $participantData->load($this->getTestId());
173 
174  return in_array($activeId, $participantData->getActiveIds());
175  }
176 
181  public function checkResultsAccessForActiveId($activeId)
182  {
184  return $this->checkAccessForActiveId($accessFilter, $activeId);
185  }
186 
191  public function checkScoreParticipantsAccessForActiveId($activeId)
192  {
194  return $this->checkAccessForActiveId($accessFilter, $activeId);
195  }
196 
201  public function checkStatisticsAccessForActiveId($activeId)
202  {
204  return $this->checkAccessForActiveId($accessFilter, $activeId);
205  }
206 }
checkScoreParticipantsAccessForActiveId($activeId)
checkAccessForActiveId($accessFilter, $activeId)
__construct($refId, $testId)
checkResultsAccessForActiveId($activeId)
global $DIC
Definition: goto.php:24
checkStatisticsAccessForActiveId($activeId)