ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilTestSequence Class Reference

Test sequence handler. More...

+ Inheritance diagram for ilTestSequence:
+ Collaboration diagram for ilTestSequence:

Public Member Functions

 ilTestSequence ($active_id, $pass, $randomtest)
 ilTestSequence constructor More...
 
 getActiveId ()
 
 createNewSequence ($max, $shuffle)
 
 loadQuestions (ilTestQuestionSetConfig $testQuestionSetConfig=null, $taxonomyFilterSelection=array())
 Loads the question mapping. More...
 
 loadFromDb ()
 Loads the sequence data for a given active id. More...
 
 saveToDb ()
 Saves the sequence data for a given pass to the database. More...
 
 postponeQuestion ($question_id)
 
 hideQuestion ($question_id)
 
 isPostponedQuestion ($question_id)
 
 isHiddenQuestion ($question_id)
 
 isPostponedSequence ($sequence)
 
 isHiddenSequence ($sequence)
 
 postponeSequence ($sequence)
 
 hideSequence ($sequence)
 
 setQuestionChecked ($questionId)
 
 isQuestionChecked ($questionId)
 
 getPositionOfSequence ($sequence)
 
 getUserQuestionCount ()
 
 getOrderedSequence ()
 
 getOrderedSequenceQuestions ()
 
 getUserSequence ()
 
 getUserSequenceQuestions ()
 
 getSequenceForQuestion ($question_id)
 
 getFirstSequence ()
 
 getLastSequence ()
 
 getNextSequence ($sequence)
 
 getPreviousSequence ($sequence)
 
 pcArrayShuffle ($array)
 Shuffles the values of a given array. More...
 
 getQuestionForSequence ($sequence)
 
getSequenceSummary ($obligationsFilter=false)
 
 getPass ()
 
 setPass ($pass)
 
 hasSequence ()
 
 hasHiddenQuestions ()
 
 clearHiddenQuestions ()
 
 hasStarted (ilTestSession $testSession)
 
 openQuestionExists ()
 
 getQuestionIds ()
 
 questionExists ($questionId)
 

Data Fields

 $sequencedata
 
 $questions
 
 $active_id
 
 $pass
 
 $isRandomTest
 

Protected Member Functions

 getCorrectedSequence ($with_hidden_questions=FALSE)
 

Private Member Functions

 loadQuestionSequence ()
 
 loadCheckedQuestions ()
 
 saveQuestionSequence ()
 
 saveNewlyCheckedQuestion ()
 @global ilDB $ilDB More...
 
 hideCorrectAnsweredQuestions (ilObjTest $testOBJ, $activeId, $pass)
 

Private Attributes

 $alreadyCheckedQuestions
 
 $newlyCheckedQuestion
 

Detailed Description

Test sequence handler.

This class manages the sequence settings for a given user

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Version
$Id$

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

Member Function Documentation

◆ clearHiddenQuestions()

ilTestSequence::clearHiddenQuestions ( )

Definition at line 592 of file class.ilTestSequence.php.

593 {
594 $this->sequencedata["hidden"] = array();
595 }

Referenced by ilLOTestQuestionAdapter\hideQuestions().

+ Here is the caller graph for this function:

◆ createNewSequence()

ilTestSequence::createNewSequence (   $max,
  $shuffle 
)

Definition at line 89 of file class.ilTestSequence.php.

90 {
91 $newsequence = array();
92 if ($max > 0)
93 {
94 for ($i = 1; $i <= $max; $i++)
95 {
96 array_push($newsequence, $i);
97 }
98 if ($shuffle) $newsequence = $this->pcArrayShuffle($newsequence);
99 }
100 $this->sequencedata["sequence"] = $newsequence;
101 }
pcArrayShuffle($array)
Shuffles the values of a given array.

References pcArrayShuffle().

+ Here is the call graph for this function:

◆ getActiveId()

ilTestSequence::getActiveId ( )

Definition at line 84 of file class.ilTestSequence.php.

85 {
86 return $this->active_id;
87 }

References $active_id.

◆ getCorrectedSequence()

ilTestSequence::getCorrectedSequence (   $with_hidden_questions = FALSE)
protected

Definition at line 378 of file class.ilTestSequence.php.

379 {
380 $correctedsequence = $this->sequencedata["sequence"];
381 if (!$with_hidden_questions)
382 {
383 if (is_array($this->sequencedata["hidden"]))
384 {
385 foreach ($this->sequencedata["hidden"] as $question_id)
386 {
387 $foundsequence = array_search($question_id, $this->questions);
388 if ($foundsequence !== FALSE)
389 {
390 $sequencekey = array_search($foundsequence, $correctedsequence);
391 if ($sequencekey !== FALSE)
392 {
393 unset($correctedsequence[$sequencekey]);
394 }
395 }
396 }
397 }
398 }
399 if (is_array($this->sequencedata["postponed"]))
400 {
401 foreach ($this->sequencedata["postponed"] as $question_id)
402 {
403 $foundsequence = array_search($question_id, $this->questions);
404 if ($foundsequence !== FALSE)
405 {
406 $sequencekey = array_search($foundsequence, $correctedsequence);
407 if ($sequencekey !== FALSE)
408 {
409 unset($correctedsequence[$sequencekey]);
410 array_push($correctedsequence, $foundsequence);
411 }
412 }
413 }
414 }
415 return array_values($correctedsequence);
416 }

Referenced by getFirstSequence(), getLastSequence(), getNextSequence(), getPositionOfSequence(), getPreviousSequence(), getSequenceSummary(), getUserQuestionCount(), getUserSequence(), and getUserSequenceQuestions().

+ Here is the caller graph for this function:

◆ getFirstSequence()

ilTestSequence::getFirstSequence ( )

Definition at line 423 of file class.ilTestSequence.php.

424 {
425 $correctedsequence = $this->getCorrectedSequence();
426 if (count($correctedsequence))
427 {
428 return reset($correctedsequence);
429 }
430 else
431 {
432 return FALSE;
433 }
434 }
getCorrectedSequence($with_hidden_questions=FALSE)

References getCorrectedSequence().

Referenced by openQuestionExists().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLastSequence()

ilTestSequence::getLastSequence ( )

Definition at line 436 of file class.ilTestSequence.php.

437 {
438 $correctedsequence = $this->getCorrectedSequence();
439 if (count($correctedsequence))
440 {
441 return end($correctedsequence);
442 }
443 else
444 {
445 return FALSE;
446 }
447 }

References getCorrectedSequence().

+ Here is the call graph for this function:

◆ getNextSequence()

ilTestSequence::getNextSequence (   $sequence)

Definition at line 449 of file class.ilTestSequence.php.

450 {
451 $correctedsequence = $this->getCorrectedSequence();
452 $sequencekey = array_search($sequence, $correctedsequence);
453 if ($sequencekey !== FALSE)
454 {
455 $nextsequencekey = $sequencekey + 1;
456 if (array_key_exists($nextsequencekey, $correctedsequence))
457 {
458 return $correctedsequence[$nextsequencekey];
459 }
460 }
461 return FALSE;
462 }

References getCorrectedSequence().

+ Here is the call graph for this function:

◆ getOrderedSequence()

ilTestSequence::getOrderedSequence ( )

Definition at line 352 of file class.ilTestSequence.php.

353 {
354 return array_keys($this->questions);
355 }

◆ getOrderedSequenceQuestions()

ilTestSequence::getOrderedSequenceQuestions ( )

Definition at line 357 of file class.ilTestSequence.php.

358 {
359 return $this->questions;
360 }

References $questions.

◆ getPass()

ilTestSequence::getPass ( )

Definition at line 558 of file class.ilTestSequence.php.

559 {
560 return $this->pass;
561 }

References $pass.

◆ getPositionOfSequence()

ilTestSequence::getPositionOfSequence (   $sequence)

Definition at line 333 of file class.ilTestSequence.php.

334 {
335 $correctedsequence = $this->getCorrectedSequence();
336 $sequencekey = array_search($sequence, $correctedsequence);
337 if ($sequencekey !== FALSE)
338 {
339 return $sequencekey + 1;
340 }
341 else
342 {
343 return "";
344 }
345 }

References getCorrectedSequence().

+ Here is the call graph for this function:

◆ getPreviousSequence()

ilTestSequence::getPreviousSequence (   $sequence)

Definition at line 464 of file class.ilTestSequence.php.

465 {
466 $correctedsequence = $this->getCorrectedSequence();
467 $sequencekey = array_search($sequence, $correctedsequence);
468 if ($sequencekey !== FALSE)
469 {
470 $prevsequencekey = $sequencekey - 1;
471 if (($prevsequencekey >= 0) && (array_key_exists($prevsequencekey, $correctedsequence)))
472 {
473 return $correctedsequence[$prevsequencekey];
474 }
475 }
476 return FALSE;
477 }

References getCorrectedSequence().

+ Here is the call graph for this function:

◆ getQuestionForSequence()

ilTestSequence::getQuestionForSequence (   $sequence)

Definition at line 499 of file class.ilTestSequence.php.

500 {
501 if ($sequence < 1) return FALSE;
502 if (array_key_exists($sequence, $this->questions))
503 {
504 return $this->questions[$sequence];
505 }
506 else
507 {
508 return FALSE;
509 }
510 }

Referenced by getSequenceSummary(), and getUserSequenceQuestions().

+ Here is the caller graph for this function:

◆ getQuestionIds()

ilTestSequence::getQuestionIds ( )

Definition at line 639 of file class.ilTestSequence.php.

640 {
641 return array_values($this->questions);
642 }

Referenced by ilLOTestQuestionAdapter\hideQuestions(), and ilLOTestQuestionAdapter\updateRandomQuestions().

+ Here is the caller graph for this function:

◆ getSequenceForQuestion()

ilTestSequence::getSequenceForQuestion (   $question_id)

Definition at line 418 of file class.ilTestSequence.php.

419 {
420 return array_search($question_id, $this->questions);
421 }

◆ getSequenceSummary()

& ilTestSequence::getSequenceSummary (   $obligationsFilter = false)

Definition at line 512 of file class.ilTestSequence.php.

513 {
514 $correctedsequence = $this->getCorrectedSequence();
515 $result_array = array();
516 include_once "./Modules/Test/classes/class.ilObjTest.php";
517 $solved_questions = ilObjTest::_getSolvedQuestions($this->active_id);
518 $key = 1;
519 foreach ($correctedsequence as $sequence)
520 {
521 $question =& ilObjTest::_instanciateQuestion($this->getQuestionForSequence($sequence));
522 if (is_object($question))
523 {
524 $worked_through = $question->_isWorkedThrough($this->active_id, $question->getId(), $this->pass);
525 $solved = 0;
526 if (array_key_exists($question->getId(), $solved_questions))
527 {
528 $solved = $solved_questions[$question->getId()]["solved"];
529 }
530 $is_postponed = $this->isPostponedQuestion($question->getId());
531
532 $row = array(
533 "nr" => "$key",
534 "title" => $question->getTitle(),
535 "qid" => $question->getId(),
536 "visited" => $worked_through,
537 "solved" => (($solved)?"1":"0"),
538 "description" => $question->getComment(),
539 "points" => $question->getMaximumPoints(),
540 "worked_through" => $worked_through,
541 "postponed" => $is_postponed,
542 "sequence" => $sequence,
543 "obligatory" => ilObjTest::isQuestionObligatory($question->getId()),
544 'isAnswered' => $question->isAnswered($this->active_id, $this->pass)
545 );
546
547 if( !$obligationsFilter || $row['obligatory'] )
548 {
549 array_push($result_array, $row);
550 }
551
552 $key++;
553 }
554 }
555 return $result_array;
556 }
_getSolvedQuestions($active_id, $question_fi=null)
get solved questions
& _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
static isQuestionObligatory($question_id)
checks wether the question with given id is marked as obligatory or not
getQuestionForSequence($sequence)
isPostponedQuestion($question_id)

References $row, ilObjTest\_getSolvedQuestions(), ilObjTest\_instanciateQuestion(), getCorrectedSequence(), getQuestionForSequence(), isPostponedQuestion(), and ilObjTest\isQuestionObligatory().

+ Here is the call graph for this function:

◆ getUserQuestionCount()

ilTestSequence::getUserQuestionCount ( )

Definition at line 347 of file class.ilTestSequence.php.

348 {
349 return count($this->getCorrectedSequence());
350 }

References getCorrectedSequence().

+ Here is the call graph for this function:

◆ getUserSequence()

ilTestSequence::getUserSequence ( )

Definition at line 362 of file class.ilTestSequence.php.

363 {
364 return $this->getCorrectedSequence(TRUE);
365 }

References getCorrectedSequence().

+ Here is the call graph for this function:

◆ getUserSequenceQuestions()

ilTestSequence::getUserSequenceQuestions ( )

Definition at line 367 of file class.ilTestSequence.php.

368 {
369 $seq = $this->getCorrectedSequence(TRUE);
370 $found = array();
371 foreach ($seq as $sequence)
372 {
373 array_push($found, $this->getQuestionForSequence($sequence));
374 }
375 return $found;
376 }

References getCorrectedSequence(), and getQuestionForSequence().

+ Here is the call graph for this function:

◆ hasHiddenQuestions()

ilTestSequence::hasHiddenQuestions ( )

Definition at line 580 of file class.ilTestSequence.php.

581 {
582 if ((is_array($this->sequencedata["hidden"])) && (count($this->sequencedata["hidden"]) > 0))
583 {
584 return TRUE;
585 }
586 else
587 {
588 return FALSE;
589 }
590 }

◆ hasSequence()

ilTestSequence::hasSequence ( )

Definition at line 568 of file class.ilTestSequence.php.

569 {
570 if ((is_array($this->sequencedata["sequence"])) && (count($this->sequencedata["sequence"]) > 0))
571 {
572 return TRUE;
573 }
574 else
575 {
576 return FALSE;
577 }
578 }

◆ hasStarted()

ilTestSequence::hasStarted ( ilTestSession  $testSession)

Definition at line 618 of file class.ilTestSequence.php.

619 {
620 if( $testSession->getLastSequence() < 1 )
621 {
622 return false;
623 }
624
625 // WTF ?? heard about tests with only one question !?
626 if( $testSession->getLastSequence() == $this->getFirstSequence() )
627 {
628 return false;
629 }
630
631 return true;
632 }

References ilTestSession\getLastSequence().

+ Here is the call graph for this function:

◆ hideCorrectAnsweredQuestions()

ilTestSequence::hideCorrectAnsweredQuestions ( ilObjTest  $testOBJ,
  $activeId,
  $pass 
)
private

Definition at line 597 of file class.ilTestSequence.php.

598 {
599 if( $activeId > 0 )
600 {
601 $result = $testOBJ->getTestResult($activeId, $pass, TRUE);
602
603 foreach( $result as $sequence => $question )
604 {
605 if( is_numeric($sequence) )
606 {
607 if( $question['reached'] == $question['max'] )
608 {
609 $this->hideQuestion($question['qid']);
610 }
611 }
612 }
613
614 $this->saveToDb();
615 }
616 }
$result
& getTestResult($active_id, $pass=NULL, $ordered_sequence=FALSE)
Calculates the results of a test for a given user and returns an array with all test results.
hideQuestion($question_id)
saveToDb()
Saves the sequence data for a given pass to the database.

References $pass, $result, ilObjTest\getTestResult(), hideQuestion(), and saveToDb().

+ Here is the call graph for this function:

◆ hideQuestion()

ilTestSequence::hideQuestion (   $question_id)

Definition at line 237 of file class.ilTestSequence.php.

238 {
239 if (!$this->isHiddenQuestion($question_id))
240 {
241 array_push($this->sequencedata["hidden"], intval($question_id));
242 }
243 }
isHiddenQuestion($question_id)

References isHiddenQuestion().

Referenced by hideCorrectAnsweredQuestions(), and ilLOTestQuestionAdapter\hideQuestions().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hideSequence()

ilTestSequence::hideSequence (   $sequence)

Definition at line 311 of file class.ilTestSequence.php.

312 {
313 if (!$this->isHiddenSequence($sequence))
314 {
315 if (array_key_exists($sequence, $this->questions))
316 {
317 if (!is_array($this->sequencedata["hidden"])) $this->sequencedata["hidden"] = array();
318 array_push($this->sequencedata["hidden"], intval($this->questions[$sequence]));
319 }
320 }
321 }

References isHiddenSequence().

+ Here is the call graph for this function:

◆ ilTestSequence()

ilTestSequence::ilTestSequence (   $active_id,
  $pass,
  $randomtest 
)

ilTestSequence constructor

The constructor takes possible arguments an creates an instance of the ilTestSequence object.

Parameters
object$a_objectA reference to the test container object @access public

Definition at line 69 of file class.ilTestSequence.php.

70 {
71 $this->active_id = $active_id;
72 $this->pass = $pass;
73 $this->isRandomTest = $randomtest;
74 $this->sequencedata = array(
75 "sequence" => array(),
76 "postponed" => array(),
77 "hidden" => array()
78 );
79
80 $this->alreadyCheckedQuestions = array();
81 $this->newlyCheckedQuestion = null;
82 }

References $active_id, and $pass.

◆ isHiddenQuestion()

ilTestSequence::isHiddenQuestion (   $question_id)

Definition at line 258 of file class.ilTestSequence.php.

259 {
260 if (!is_array($this->sequencedata["hidden"])) return FALSE;
261 if (!in_array($question_id, $this->sequencedata["hidden"]))
262 {
263 return FALSE;
264 }
265 else
266 {
267 return TRUE;
268 }
269 }

Referenced by hideQuestion().

+ Here is the caller graph for this function:

◆ isHiddenSequence()

ilTestSequence::isHiddenSequence (   $sequence)

Definition at line 285 of file class.ilTestSequence.php.

286 {
287 if (!array_key_exists($sequence, $this->questions)) return FALSE;
288 if (!is_array($this->sequencedata["hidden"])) return FALSE;
289 if (!in_array($this->questions[$sequence], $this->sequencedata["hidden"]))
290 {
291 return FALSE;
292 }
293 else
294 {
295 return TRUE;
296 }
297 }

Referenced by hideSequence().

+ Here is the caller graph for this function:

◆ isPostponedQuestion()

ilTestSequence::isPostponedQuestion (   $question_id)

Definition at line 245 of file class.ilTestSequence.php.

246 {
247 if (!is_array($this->sequencedata["postponed"])) return FALSE;
248 if (!in_array($question_id, $this->sequencedata["postponed"]))
249 {
250 return FALSE;
251 }
252 else
253 {
254 return TRUE;
255 }
256 }

Referenced by getSequenceSummary(), and postponeQuestion().

+ Here is the caller graph for this function:

◆ isPostponedSequence()

ilTestSequence::isPostponedSequence (   $sequence)

Definition at line 271 of file class.ilTestSequence.php.

272 {
273 if (!array_key_exists($sequence, $this->questions)) return FALSE;
274 if (!is_array($this->sequencedata["postponed"])) return FALSE;
275 if (!in_array($this->questions[$sequence], $this->sequencedata["postponed"]))
276 {
277 return FALSE;
278 }
279 else
280 {
281 return TRUE;
282 }
283 }

Referenced by postponeSequence().

+ Here is the caller graph for this function:

◆ isQuestionChecked()

ilTestSequence::isQuestionChecked (   $questionId)

Definition at line 328 of file class.ilTestSequence.php.

329 {
330 return isset($this->alreadyCheckedQuestions[$questionId]);
331 }

◆ loadCheckedQuestions()

ilTestSequence::loadCheckedQuestions ( )
private

Definition at line 157 of file class.ilTestSequence.php.

158 {
159 global $ilDB;
160
161 $res = $ilDB->queryF("SELECT question_fi FROM tst_seq_qst_checked WHERE active_fi = %s AND pass = %s",
162 array('integer','integer'), array($this->active_id, $this->pass)
163 );
164
165 while( $row = $ilDB->fetchAssoc($res) )
166 {
167 $this->alreadyCheckedQuestions[ $row['question_fi'] ] = $row['question_fi'];
168 }
169 }
global $ilDB

References $ilDB, $res, and $row.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ loadFromDb()

ilTestSequence::loadFromDb ( )

Loads the sequence data for a given active id.

Returns
string The filesystem path of the certificate

Definition at line 130 of file class.ilTestSequence.php.

131 {
132 $this->loadQuestionSequence();
133 $this->loadCheckedQuestions();
134 }

References loadCheckedQuestions(), and loadQuestionSequence().

+ Here is the call graph for this function:

◆ loadQuestions()

ilTestSequence::loadQuestions ( ilTestQuestionSetConfig  $testQuestionSetConfig = null,
  $taxonomyFilterSelection = array() 
)

Loads the question mapping.

Definition at line 106 of file class.ilTestSequence.php.

107 {
108 global $ilDB;
109
110 $this->questions = array();
111
112 $result = $ilDB->queryF("SELECT tst_test_question.* FROM tst_test_question, qpl_questions, tst_active WHERE tst_active.active_id = %s AND tst_test_question.test_fi = tst_active.test_fi AND qpl_questions.question_id = tst_test_question.question_fi ORDER BY tst_test_question.sequence",
113 array('integer'),
114 array($this->active_id)
115 );
116
117 $index = 1;
118
119 while ($data = $ilDB->fetchAssoc($result))
120 {
121 $this->questions[$index++] = $data["question_fi"];
122 }
123 }

References $data, $ilDB, and $result.

◆ loadQuestionSequence()

ilTestSequence::loadQuestionSequence ( )
private

Definition at line 136 of file class.ilTestSequence.php.

137 {
138 global $ilDB;
139 $result = $ilDB->queryF("SELECT * FROM tst_sequence WHERE active_fi = %s AND pass = %s",
140 array('integer','integer'),
141 array($this->active_id, $this->pass)
142 );
143 if ($result->numRows())
144 {
145 $row = $ilDB->fetchAssoc($result);
146 $this->sequencedata = array(
147 "sequence" => unserialize($row["sequence"]),
148 "postponed" => unserialize($row["postponed"]),
149 "hidden" => unserialize($row["hidden"])
150 );
151 if (!is_array($this->sequencedata["sequence"])) $this->sequencedata["sequence"] = array();
152 if (!is_array($this->sequencedata["postponed"])) $this->sequencedata["postponed"] = array();
153 if (!is_array($this->sequencedata["hidden"])) $this->sequencedata["hidden"] = array();
154 }
155 }

References $ilDB, $result, and $row.

Referenced by loadFromDb().

+ Here is the caller graph for this function:

◆ openQuestionExists()

ilTestSequence::openQuestionExists ( )

Definition at line 634 of file class.ilTestSequence.php.

635 {
636 return $this->getFirstSequence() !== false;
637 }

References getFirstSequence().

+ Here is the call graph for this function:

◆ pcArrayShuffle()

ilTestSequence::pcArrayShuffle (   $array)

Shuffles the values of a given array.

Shuffles the values of a given array

Parameters
array$arrayAn array which should be shuffled @access public

Definition at line 487 of file class.ilTestSequence.php.

488 {
489 $keys = array_keys($array);
490 shuffle($keys);
491 $result = array();
492 foreach ($keys as $key)
493 {
494 $result[$key] = $array[$key];
495 }
496 return $result;
497 }

References $result.

Referenced by createNewSequence().

+ Here is the caller graph for this function:

◆ postponeQuestion()

ilTestSequence::postponeQuestion (   $question_id)

Definition at line 229 of file class.ilTestSequence.php.

230 {
231 if (!$this->isPostponedQuestion($question_id))
232 {
233 array_push($this->sequencedata["postponed"], intval($question_id));
234 }
235 }

References isPostponedQuestion().

+ Here is the call graph for this function:

◆ postponeSequence()

ilTestSequence::postponeSequence (   $sequence)

Definition at line 299 of file class.ilTestSequence.php.

300 {
301 if (!$this->isPostponedSequence($sequence))
302 {
303 if (array_key_exists($sequence, $this->questions))
304 {
305 if (!is_array($this->sequencedata["postponed"])) $this->sequencedata["postponed"] = array();
306 array_push($this->sequencedata["postponed"], intval($this->questions[$sequence]));
307 }
308 }
309 }
isPostponedSequence($sequence)

References isPostponedSequence().

+ Here is the call graph for this function:

◆ questionExists()

ilTestSequence::questionExists (   $questionId)

Definition at line 644 of file class.ilTestSequence.php.

645 {
646 return in_array($questionId, $this->questions);
647 }

◆ saveNewlyCheckedQuestion()

ilTestSequence::saveNewlyCheckedQuestion ( )
private

@global ilDB $ilDB

Definition at line 215 of file class.ilTestSequence.php.

216 {
217 if( (int)$this->newlyCheckedQuestion )
218 {
219 global $ilDB;
220
221 $ilDB->replace('tst_seq_qst_checked', array(
222 'active_fi' => array('integer', (int)$this->active_id),
223 'pass' => array('integer', (int)$this->pass),
224 'question_fi' => array('integer', (int)$this->newlyCheckedQuestion)
225 ), array());
226 }
227 }

References $ilDB.

Referenced by saveToDb().

+ Here is the caller graph for this function:

◆ saveQuestionSequence()

ilTestSequence::saveQuestionSequence ( )
private

Definition at line 182 of file class.ilTestSequence.php.

183 {
184 global $ilDB;
185
186 $postponed = NULL;
187 if ((is_array($this->sequencedata["postponed"])) && (count($this->sequencedata["postponed"])))
188 {
189 $postponed = serialize($this->sequencedata["postponed"]);
190 }
191 $hidden = NULL;
192 if ((is_array($this->sequencedata["hidden"])) && (count($this->sequencedata["hidden"])))
193 {
194 $hidden = serialize($this->sequencedata["hidden"]);
195 }
196
197 $affectedRows = $ilDB->manipulateF("DELETE FROM tst_sequence WHERE active_fi = %s AND pass = %s",
198 array('integer','integer'),
199 array($this->active_id, $this->pass)
200 );
201
202 $affectedRows = $ilDB->insert("tst_sequence", array(
203 "active_fi" => array("integer", $this->active_id),
204 "pass" => array("integer", $this->pass),
205 "sequence" => array("clob", serialize($this->sequencedata["sequence"])),
206 "postponed" => array("text", $postponed),
207 "hidden" => array("text", $hidden),
208 "tstamp" => array("integer", time())
209 ));
210 }

References $ilDB.

Referenced by saveToDb().

+ Here is the caller graph for this function:

◆ saveToDb()

ilTestSequence::saveToDb ( )

Saves the sequence data for a given pass to the database.

@access public

Definition at line 176 of file class.ilTestSequence.php.

177 {
178 $this->saveQuestionSequence();
180 }
saveNewlyCheckedQuestion()
@global ilDB $ilDB

References saveNewlyCheckedQuestion(), and saveQuestionSequence().

Referenced by ilLOTestQuestionAdapter\filterQuestions(), hideCorrectAnsweredQuestions(), and ilTestOutputGUI\updateContainerObjectivesWithAnsweredQuestion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPass()

ilTestSequence::setPass (   $pass)

Definition at line 563 of file class.ilTestSequence.php.

564 {
565 $this->pass = $pass;
566 }

References $pass.

◆ setQuestionChecked()

ilTestSequence::setQuestionChecked (   $questionId)

Definition at line 323 of file class.ilTestSequence.php.

324 {
325 $this->newlyCheckedQuestion = $questionId;
326 }

Field Documentation

◆ $active_id

ilTestSequence::$active_id

◆ $alreadyCheckedQuestions

ilTestSequence::$alreadyCheckedQuestions
private

Definition at line 53 of file class.ilTestSequence.php.

◆ $isRandomTest

ilTestSequence::$isRandomTest

Definition at line 48 of file class.ilTestSequence.php.

◆ $newlyCheckedQuestion

ilTestSequence::$newlyCheckedQuestion
private

Definition at line 58 of file class.ilTestSequence.php.

◆ $pass

◆ $questions

ilTestSequence::$questions

Definition at line 27 of file class.ilTestSequence.php.

Referenced by getOrderedSequenceQuestions().

◆ $sequencedata

ilTestSequence::$sequencedata

Definition at line 20 of file class.ilTestSequence.php.


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