ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilTestPassesSelector Class Reference
+ Collaboration diagram for ilTestPassesSelector:

Public Member Functions

 __construct (ilDB $db, ilObjTest $testOBJ)
 
 isAdminModeEnabled ()
 
 setAdminModeEnabled ($adminModeEnabled)
 
 getActiveId ()
 
 setActiveId ($activeId)
 
 getLastFinishedPass ()
 
 setLastFinishedPass ($lastFinishedPass)
 
 getExistingPasses ()
 
 getNumExistingPasses ()
 
 getClosedPasses ()
 
 getReportablePasses ()
 

Protected Attributes

 $db
 
 $testOBJ
 

Private Member Functions

 loadExistingPasses ()
 
 fetchReportablePasses ($existingPasses)
 
 fetchClosedPasses ($existingPasses)
 
 fetchLastPass ($existingPasses)
 
 isReportablePass ($lastPass, $pass)
 
 isClosedPass ($pass)
 
 isReportingDateReached ()
 
 isProcessingTimeReached ($pass)
 

Private Attributes

 $adminModeEnabled
 
 $activeId
 
 $lastFinishedPass
 

Detailed Description

Definition at line 11 of file class.ilTestPassesSelector.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestPassesSelector::__construct ( ilDB  $db,
ilObjTest  $testOBJ 
)

Definition at line 23 of file class.ilTestPassesSelector.php.

References $db, and $testOBJ.

24  {
25  $this->db = $db;
26  $this->testOBJ = $testOBJ;
27 
28  $this->adminModeEnabled = false;
29  }

Member Function Documentation

◆ fetchClosedPasses()

ilTestPassesSelector::fetchClosedPasses (   $existingPasses)
private

Definition at line 134 of file class.ilTestPassesSelector.php.

References $pass, and isClosedPass().

Referenced by getClosedPasses().

135  {
136  $closedPasses = array();
137 
138  foreach($existingPasses as $pass)
139  {
140  if( $this->isClosedPass($pass) )
141  {
142  $closedPasses[] = $pass;
143  }
144  }
145 
146  return $closedPasses;
147  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fetchLastPass()

ilTestPassesSelector::fetchLastPass (   $existingPasses)
private

Definition at line 149 of file class.ilTestPassesSelector.php.

References $pass.

Referenced by fetchReportablePasses().

150  {
151  $lastPass = null;
152 
153  foreach($existingPasses as $pass)
154  {
155  if( $lastPass === null || $pass > $lastPass )
156  {
157  $lastPass = $pass;
158  }
159  }
160 
161  return $lastPass;
162  }
+ Here is the caller graph for this function:

◆ fetchReportablePasses()

ilTestPassesSelector::fetchReportablePasses (   $existingPasses)
private

Definition at line 117 of file class.ilTestPassesSelector.php.

References $pass, fetchLastPass(), and isReportablePass().

Referenced by getReportablePasses().

118  {
119  $lastPass = $this->fetchLastPass($existingPasses);
120 
121  $reportablePasses = array();
122 
123  foreach($existingPasses as $pass)
124  {
125  if( $this->isReportablePass($lastPass, $pass) )
126  {
127  $reportablePasses[] = $pass;
128  }
129  }
130 
131  return $reportablePasses;
132  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActiveId()

ilTestPassesSelector::getActiveId ( )

Definition at line 41 of file class.ilTestPassesSelector.php.

References $activeId.

Referenced by isProcessingTimeReached(), and loadExistingPasses().

+ Here is the caller graph for this function:

◆ getClosedPasses()

ilTestPassesSelector::getClosedPasses ( )

Definition at line 71 of file class.ilTestPassesSelector.php.

References fetchClosedPasses(), and loadExistingPasses().

72  {
73  $existingPasses = $this->loadExistingPasses();
74  $closedPasses = $this->fetchClosedPasses($existingPasses);
75 
76  return $closedPasses;
77  }
+ Here is the call graph for this function:

◆ getExistingPasses()

ilTestPassesSelector::getExistingPasses ( )

Definition at line 61 of file class.ilTestPassesSelector.php.

References loadExistingPasses().

62  {
63  return $this->loadExistingPasses();
64  }
+ Here is the call graph for this function:

◆ getLastFinishedPass()

ilTestPassesSelector::getLastFinishedPass ( )

Definition at line 51 of file class.ilTestPassesSelector.php.

References $lastFinishedPass.

Referenced by isClosedPass().

+ Here is the caller graph for this function:

◆ getNumExistingPasses()

ilTestPassesSelector::getNumExistingPasses ( )

Definition at line 66 of file class.ilTestPassesSelector.php.

References loadExistingPasses().

67  {
68  return count($this->loadExistingPasses());
69  }
+ Here is the call graph for this function:

◆ getReportablePasses()

ilTestPassesSelector::getReportablePasses ( )

Definition at line 79 of file class.ilTestPassesSelector.php.

References fetchReportablePasses(), isAdminModeEnabled(), and loadExistingPasses().

80  {
81  $existingPasses = $this->loadExistingPasses();
82 
83  if( $this->isAdminModeEnabled() )
84  {
85  return $existingPasses;
86  }
87 
88  $reportablePasses = $this->fetchReportablePasses($existingPasses);
89 
90  return $reportablePasses;
91  }
+ Here is the call graph for this function:

◆ isAdminModeEnabled()

ilTestPassesSelector::isAdminModeEnabled ( )

Definition at line 31 of file class.ilTestPassesSelector.php.

References $adminModeEnabled.

Referenced by getReportablePasses().

+ Here is the caller graph for this function:

◆ isClosedPass()

ilTestPassesSelector::isClosedPass (   $pass)
private

Definition at line 189 of file class.ilTestPassesSelector.php.

References $pass, getLastFinishedPass(), and isProcessingTimeReached().

Referenced by fetchClosedPasses(), and isReportablePass().

190  {
191  if( $pass <= $this->getLastFinishedPass() )
192  {
193  return true;
194  }
195 
196  if( $this->isProcessingTimeReached($pass) )
197  {
198  return true;
199  }
200 
201  return false;
202  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isProcessingTimeReached()

ilTestPassesSelector::isProcessingTimeReached (   $pass)
private

Definition at line 220 of file class.ilTestPassesSelector.php.

References $pass, and getActiveId().

Referenced by isClosedPass().

221  {
222  if( !$this->testOBJ->getEnableProcessingTime() )
223  {
224  return false;
225  }
226 
227  $startingTime = $this->testOBJ->getStartingTimeOfUser($this->getActiveId(), $pass);
228 
229  if($startingTime === FALSE)
230  {
231  return false;
232  }
233 
234  return $this->testOBJ->isMaxProcessingTimeReached($startingTime, $this->getActiveId());
235  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isReportablePass()

ilTestPassesSelector::isReportablePass (   $lastPass,
  $pass 
)
private

Definition at line 164 of file class.ilTestPassesSelector.php.

References $pass, isClosedPass(), isReportingDateReached(), ilObjTest\SCORE_REPORTING_DATE, ilObjTest\SCORE_REPORTING_FINISHED, and ilObjTest\SCORE_REPORTING_IMMIDIATLY.

Referenced by fetchReportablePasses().

165  {
166  switch( $this->testOBJ->getScoreReporting() )
167  {
169 
170  return true;
171 
173 
174  return $this->isReportingDateReached();
175 
177 
178  if($pass < $lastPass)
179  {
180  return true;
181  }
182 
183  return $this->isClosedPass($pass);
184  }
185 
186  return false;
187  }
const SCORE_REPORTING_IMMIDIATLY
const SCORE_REPORTING_FINISHED
const SCORE_REPORTING_DATE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isReportingDateReached()

ilTestPassesSelector::isReportingDateReached ( )
private

Definition at line 204 of file class.ilTestPassesSelector.php.

Referenced by isReportablePass().

205  {
206  $reg = '/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/';
207  $date = $this->testOBJ->getReportingDate();
208  $matches = null;
209 
210  if( !preg_match($reg, $date, $matches) )
211  {
212  return false;
213  }
214 
215  $repTS = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
216 
217  return time() >= $repTS;
218  }
+ Here is the caller graph for this function:

◆ loadExistingPasses()

ilTestPassesSelector::loadExistingPasses ( )
private

Definition at line 93 of file class.ilTestPassesSelector.php.

References $query, $res, $row, and getActiveId().

Referenced by getClosedPasses(), getExistingPasses(), getNumExistingPasses(), and getReportablePasses().

94  {
95  $query = "
96  SELECT DISTINCT tst_pass_result.pass FROM tst_pass_result
97  LEFT JOIN tst_test_result
98  ON tst_pass_result.pass = tst_test_result.pass
99  AND tst_pass_result.active_fi = tst_test_result.active_fi
100  WHERE tst_pass_result.active_fi = %s
101  ";
102 
103  $res = $this->db->queryF(
104  $query, array('integer'), array($this->getActiveId())
105  );
106 
107  $existingPasses = array();
108 
109  while( $row = $this->db->fetchAssoc($res) )
110  {
111  $existingPasses[] = $row['pass'];
112  }
113 
114  return $existingPasses;
115  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setActiveId()

ilTestPassesSelector::setActiveId (   $activeId)

Definition at line 46 of file class.ilTestPassesSelector.php.

References $activeId.

47  {
48  $this->activeId = $activeId;
49  }

◆ setAdminModeEnabled()

ilTestPassesSelector::setAdminModeEnabled (   $adminModeEnabled)

Definition at line 36 of file class.ilTestPassesSelector.php.

References $adminModeEnabled.

37  {
38  $this->adminModeEnabled = $adminModeEnabled;
39  }

◆ setLastFinishedPass()

ilTestPassesSelector::setLastFinishedPass (   $lastFinishedPass)

Definition at line 56 of file class.ilTestPassesSelector.php.

References $lastFinishedPass.

57  {
58  $this->lastFinishedPass = $lastFinishedPass;
59  }

Field Documentation

◆ $activeId

ilTestPassesSelector::$activeId
private

Definition at line 19 of file class.ilTestPassesSelector.php.

Referenced by getActiveId(), and setActiveId().

◆ $adminModeEnabled

ilTestPassesSelector::$adminModeEnabled
private

Definition at line 17 of file class.ilTestPassesSelector.php.

Referenced by isAdminModeEnabled(), and setAdminModeEnabled().

◆ $db

ilTestPassesSelector::$db
protected

Definition at line 13 of file class.ilTestPassesSelector.php.

Referenced by __construct().

◆ $lastFinishedPass

ilTestPassesSelector::$lastFinishedPass
private

Definition at line 21 of file class.ilTestPassesSelector.php.

Referenced by getLastFinishedPass(), and setLastFinishedPass().

◆ $testOBJ

ilTestPassesSelector::$testOBJ
protected

Definition at line 15 of file class.ilTestPassesSelector.php.

Referenced by __construct().


The documentation for this class was generated from the following file: