19 declare(strict_types=1);
33 if ($this->test_obj->getQuestionCountWithoutReloading() > 0) {
46 $res = $this->db->queryF(
47 'SELECT question_fi FROM tst_test_question WHERE test_fi = %s',
49 [$this->test_obj->getTestId()]
52 while ($row = $this->db->fetchAssoc(
$res)) {
53 $this->test_obj->removeQuestion((
int) $row[
'question_fi']);
56 $this->db->manipulateF(
57 'DELETE FROM tst_test_question WHERE test_fi = %s',
59 [$this->test_obj->getTestId()]
62 $this->test_obj->questions = [];
64 $this->test_obj->saveCompleteStatus($this);
71 foreach ($this->test_obj->questions as $key => $question_id) {
74 $clone_test_obj->questions[$key] = $question_orig->duplicate(
true,
'',
'', -1, $clone_test_obj->
getId());
76 $original_id = $this->questionrepository->getForQuestionId($question_id)->getOriginalId();
79 $question_clone->saveToDb($original_id);
83 $original_key = $this->test_obj->getRefId() .
'_question_' . $question_id;
84 $mapped_key = $clone_test_obj->
getRefId() .
'_question_' . $clone_test_obj->questions[$key];
85 $cwo->appendMapping($original_key, $mapped_key);
86 $this->
logger->info(__METHOD__ .
": Added question id mapping $original_key <-> $mapped_key");
103 SELECT question_fi, sequence FROM tst_test_question 105 ORDER BY sequence ASC 108 $res = $this->db->queryF(
111 [$this->test_obj->getTestId()]
118 while ($row = $this->db->fetchAssoc(
$res)) {
121 $reindexedSequencePositionMap->addPositionMapping((
int) $row[
'sequence'], $sequenceIndex);
125 [
'sequence' => [
'integer', $sequenceIndex]],
126 [
'question_fi' => [
'integer', $row[
'question_fi']]]
130 return $reindexedSequencePositionMap;
isResultTaxonomyFilterSupported()
cloneToDbForTestId(int $test_id)
isQuestionSetConfigured()
doesQuestionSetRelatedDataExist()
static instantiateQuestion(int $question_id)
cloneQuestionSetRelatedData(ilObjTest $clone_test_obj)
removeQuestionSetRelatedData()
static _getInstance(int $a_copy_id)
reindexQuestionOrdering()