100 $this->anonymous_id = 0;
102 $this->lastsequence = 0;
103 $this->lastPresentationMode =
null;
104 $this->submitted =
false;
105 $this->submittedTimestamp =
"";
110 $this->lastStartedPass =
null;
111 $this->lastFinishedPass =
null;
112 $this->objectiveOrientedContainerId = 0;
122 $this->ref_id = $a_val;
132 return $this->ref_id;
140 if (
$GLOBALS[
'DIC'][
'ilUser']->getId() != ANONYMOUS_USER_ID) {
142 "SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
143 array(
'integer',
'integer'),
148 $this->active_id = $row[
"active_id"];
149 $this->user_id = $row[
"user_fi"];
150 $this->anonymous_id = $row[
"anonymous_id"];
151 $this->test_id = $row[
"test_fi"];
152 $this->lastsequence = $row[
"lastindex"];
153 $this->pass = $row[
"tries"];
154 $this->submitted = ($row[
"submitted"]) ?
true :
false;
155 $this->submittedTimestamp = $row[
"submittimestamp"];
156 $this->tstamp = $row[
"tstamp"];
174 if (!$this->active_id) {
175 require_once
'Modules/Test/exceptions/class.ilTestException.php';
183 if (!isset(
$_SESSION[$this->active_id][
'tst_last_increase_pass'])) {
190 $this->tstamp = time();
195 'tries' => array(
'integer', $this->
getPass()),
198 'tstamp' => array(
'integer', time()),
204 'active_id' => array(
'integer', $this->
getActiveId())
217 if ($this->active_id > 0) {
222 'tries' => array(
'integer', $this->
getPass()),
225 'tstamp' => array(
'integer', time() - 10),
227 'last_started_pass' => array(
'integer', $this->
getPass()),
231 'active_id' => array(
'integer', $this->
getActiveId())
238 $next_id =
$ilDB->nextId(
'tst_active');
242 'active_id' => array(
'integer', $next_id),
243 'user_fi' => array(
'integer', $this->
getUserId()),
245 'test_fi' => array(
'integer', $this->
getTestId()),
247 'tries' => array(
'integer', $this->
getPass()),
250 'tstamp' => array(
'integer', time() - 10),
252 'last_started_pass' => array(
'integer', $this->
getPass()),
256 $this->active_id = $next_id;
272 "SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
273 array(
'integer',
'integer',
'text'),
278 "SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
279 array(
'integer',
'integer',
'text'),
283 if (
$GLOBALS[
'DIC'][
'ilUser']->getId() == ANONYMOUS_USER_ID) {
287 "SELECT * FROM tst_active WHERE user_fi = %s AND test_fi = %s",
288 array(
'integer',
'integer'),
298 $this->active_id = $row[
"active_id"];
299 $this->user_id = $row[
"user_fi"];
300 $this->anonymous_id = $row[
"anonymous_id"];
301 $this->test_id = $row[
"test_fi"];
302 $this->lastsequence = $row[
"lastindex"];
303 $this->pass = $row[
"tries"];
304 $this->submitted = ($row[
"submitted"]) ?
true :
false;
305 $this->submittedTimestamp = $row[
"submittimestamp"];
306 $this->tstamp = $row[
"tstamp"];
326 "SELECT * FROM tst_active WHERE active_id = %s",
332 $this->active_id = $row[
"active_id"];
333 $this->user_id = $row[
"user_fi"];
334 $this->anonymous_id = $row[
"anonymous_id"];
335 $this->test_id = $row[
"test_fi"];
336 $this->lastsequence = $row[
"lastindex"];
337 $this->pass = $row[
"tries"];
338 $this->submitted = ($row[
"submitted"]) ?
true :
false;
339 $this->submittedTimestamp = $row[
"submittimestamp"];
340 $this->tstamp = $row[
"tstamp"];
415 $this->submitted =
true;
425 $this->submittedTimestamp = strftime(
"%Y-%m-%d %H:%M:%S");
440 $this->objectiveOrientedContainerId = $objectiveOriented;
476 array(
'start_lock' => array(
'text', $testStartLock)),
477 array(
'active_id' => array(
'integer', $this->
getActiveId()))
487 "SELECT start_lock FROM tst_active WHERE active_id = %s",
493 return $row[
'start_lock'];
501 if (!is_array(
$_SESSION[self::ACCESS_CODE_SESSION_INDEX])) {
515 if (!is_array(
$_SESSION[self::ACCESS_CODE_SESSION_INDEX])) {
528 if (!is_array(
$_SESSION[self::ACCESS_CODE_SESSION_INDEX])) {
549 $query =
"SELECT anonymous_id FROM tst_active WHERE test_fi = %s AND anonymous_id = %s";
553 array(
'integer',
'text'),
557 return (
$result->numRows() > 0);
570 $index = mt_rand(0, strlen($codestring) - 1);
571 $code .= substr($codestring,
$index, 1);
579 return $this->
getUserId() == ANONYMOUS_USER_ID;
615 require_once
'Modules/Test/classes/class.ilTestPassesSelector.php';
617 $testPassesSelector->setActiveId($this->
getActiveId());
620 if (count($testPassesSelector->getReportablePasses()) == 1) {
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
An exception for terminatinating execution or to throw for unit testing.
canShowTestResults(ilTestSession $testSession)
Base Exception for all Exceptions relating to Modules/Test.
activeIDExists($user_id, $test_id)
setAccessCodeToSession($access_code)
$reportableResultsAvailable
persistTestStartLock($testStartLock)
__construct()
ilTestSession constructor
getAccessCodeFromSession()
setAnonymousId($anonymous_id)
setRefId($a_val)
Set Ref id.
setObjectiveOrientedContainerId($objectiveOriented)
const ACCESS_CODE_SESSION_INDEX
loadTestSession($test_id, $user_id="", $anonymous_id="")
loadFromDb($active_id)
Loads the session data for a given active id.
getObjectiveOrientedContainerId()
setLastSequence($lastsequence)
$objectiveOrientedContainerId
const ACCESS_CODE_CHAR_DOMAIN
setLastFinishedPass($lastFinishedPass)
doesAccessCodeInSessionExists()
reportableResultsAvailable(ilObjTest $testOBJ)
setLastStartedPass($lastStartedPass)
unsetAccessCodeInSession()
hasSinglePassReportable(ilObjTest $testObj)
foreach($_POST as $key=> $value) $res