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.

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

References $db, and $testOBJ.

Member Function Documentation

◆ fetchClosedPasses()

ilTestPassesSelector::fetchClosedPasses (   $existingPasses)
private

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

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 }

References $pass, and isClosedPass().

Referenced by getClosedPasses().

+ 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.

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 }

References $pass.

Referenced by fetchReportablePasses().

+ Here is the caller graph for this function:

◆ fetchReportablePasses()

ilTestPassesSelector::fetchReportablePasses (   $existingPasses)
private

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

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 }

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

Referenced by getReportablePasses().

+ 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.

72 {
73 $existingPasses = $this->loadExistingPasses();
74 $closedPasses = $this->fetchClosedPasses($existingPasses);
75
76 return $closedPasses;
77 }

References fetchClosedPasses(), and loadExistingPasses().

+ Here is the call graph for this function:

◆ getExistingPasses()

ilTestPassesSelector::getExistingPasses ( )

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

62 {
63 return $this->loadExistingPasses();
64 }

References loadExistingPasses().

+ 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.

67 {
68 return count($this->loadExistingPasses());
69 }

References loadExistingPasses().

+ Here is the call graph for this function:

◆ getReportablePasses()

ilTestPassesSelector::getReportablePasses ( )

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

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 }

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

+ 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.

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 }

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

Referenced by fetchClosedPasses(), and isReportablePass().

+ 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.

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 }

References $pass, and getActiveId().

Referenced by isClosedPass().

+ 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.

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

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

Referenced by fetchReportablePasses().

+ 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.

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 }

Referenced by isReportablePass().

+ Here is the caller graph for this function:

◆ loadExistingPasses()

ilTestPassesSelector::loadExistingPasses ( )
private

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

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 }

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

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

+ 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.

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

References $activeId.

◆ setAdminModeEnabled()

ilTestPassesSelector::setAdminModeEnabled (   $adminModeEnabled)

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

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

References $adminModeEnabled.

◆ setLastFinishedPass()

ilTestPassesSelector::setLastFinishedPass (   $lastFinishedPass)

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

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

References $lastFinishedPass.

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: