ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilTestFixedQuestionSetConfig Class Reference
+ Inheritance diagram for ilTestFixedQuestionSetConfig:
+ Collaboration diagram for ilTestFixedQuestionSetConfig:

Public Member Functions

 isQuestionSetConfigured ()
 
 doesQuestionSetRelatedDataExist ()
 
 removeQuestionSetRelatedData ()
 
 cloneQuestionSetRelatedData (ilObjTest $clone_test_obj)
 
 loadFromDb ()
 
 saveToDb ()
 
 reindexQuestionOrdering ()
 
 cloneToDbForTestId (int $test_id)
 
 deleteFromDb ()
 
 isResultTaxonomyFilterSupported ()
 
- Public Member Functions inherited from ilTestQuestionSetConfig
 __construct (protected readonly ilTree $tree, protected readonly ilDBInterface $db, protected readonly ilLanguage $lng, protected readonly TestLogger $logger, protected readonly ilComponentRepository $component_repository, protected readonly ilObjTest $test_obj, protected readonly GeneralQuestionPropertiesRepository $questionrepository)
 
 loadFromDb ()
 
 saveToDb ()
 
 cloneToDbForTestId (int $testId)
 
 deleteFromDb ()
 
 isQuestionSetConfigured ()
 
 doesQuestionSetRelatedDataExist ()
 
 removeQuestionSetRelatedData ()
 
 cloneQuestionSetRelatedData (ilObjTest $clone_test_obj)
 
 getQuestionPoolPathString (int $pool_id)
 
 getFirstQuestionPoolRefIdByObjId (int $pool_obj_id)
 
 isResultTaxonomyFilterSupported ()
 

Detailed Description

Definition at line 29 of file class.ilTestFixedQuestionSetConfig.php.

Member Function Documentation

◆ cloneQuestionSetRelatedData()

ilTestFixedQuestionSetConfig::cloneQuestionSetRelatedData ( ilObjTest  $clone_test_obj)

Reimplemented from ilTestQuestionSetConfig.

Definition at line 67 of file class.ilTestFixedQuestionSetConfig.php.

67 : void
68 {
70
71 foreach ($this->test_obj->questions as $key => $question_id) {
72 $question_orig = assQuestion::instantiateQuestion($question_id);
73
74 $clone_test_obj->questions[$key] = $question_orig->duplicate(true, '', '', -1, $clone_test_obj->getId());
75
76 $original_id = $this->questionrepository->getForQuestionId($question_id)->getOriginalId();
77
78 $question_clone = assQuestion::instantiateQuestion($clone_test_obj->questions[$key]);
79 $question_clone->saveToDb($original_id);
80
81 // Save the mapping of old question id <-> new question id
82 // This will be used in class.ilObjCourse::cloneDependencies to copy learning objectives
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");
87 }
88 }
static instantiateQuestion(int $question_id)
static _getInstance(int $a_copy_id)

References ilCopyWizardOptions\_getInstance(), ilObject\getId(), ilObject\getRefId(), ilObjTest\getTmpCopyWizardCopyId(), assQuestion\instantiateQuestion(), and ILIAS\Repository\logger().

+ Here is the call graph for this function:

◆ cloneToDbForTestId()

ilTestFixedQuestionSetConfig::cloneToDbForTestId ( int  $test_id)

Reimplemented from ilTestQuestionSetConfig.

Definition at line 133 of file class.ilTestFixedQuestionSetConfig.php.

133 : void
134 {
135 // TODO: Implement saveToDbByTestId() method.
136 }

◆ deleteFromDb()

ilTestFixedQuestionSetConfig::deleteFromDb ( )

Reimplemented from ilTestQuestionSetConfig.

Definition at line 138 of file class.ilTestFixedQuestionSetConfig.php.

138 : void
139 {
140 // TODO: Implement deleteFromDb() method.
141 }

◆ doesQuestionSetRelatedDataExist()

ilTestFixedQuestionSetConfig::doesQuestionSetRelatedDataExist ( )

Reimplemented from ilTestQuestionSetConfig.

Definition at line 39 of file class.ilTestFixedQuestionSetConfig.php.

39 : bool
40 {
41 return $this->isQuestionSetConfigured();
42 }

References isQuestionSetConfigured().

+ Here is the call graph for this function:

◆ isQuestionSetConfigured()

ilTestFixedQuestionSetConfig::isQuestionSetConfigured ( )

Reimplemented from ilTestQuestionSetConfig.

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

31 : bool
32 {
33 if ($this->test_obj->getQuestionCountWithoutReloading() > 0) {
34 return true;
35 }
36 return false;
37 }

Referenced by doesQuestionSetRelatedDataExist().

+ Here is the caller graph for this function:

◆ isResultTaxonomyFilterSupported()

ilTestFixedQuestionSetConfig::isResultTaxonomyFilterSupported ( )

Reimplemented from ilTestQuestionSetConfig.

Definition at line 143 of file class.ilTestFixedQuestionSetConfig.php.

143 : bool
144 {
145 return false;
146 }

◆ loadFromDb()

ilTestFixedQuestionSetConfig::loadFromDb ( )

Reimplemented from ilTestQuestionSetConfig.

Definition at line 90 of file class.ilTestFixedQuestionSetConfig.php.

90 : void
91 {
92 // TODO: Implement loadFromDb() method.
93 }

◆ reindexQuestionOrdering()

ilTestFixedQuestionSetConfig::reindexQuestionOrdering ( )

Definition at line 100 of file class.ilTestFixedQuestionSetConfig.php.

101 {
102 $query = "
103 SELECT question_fi, sequence FROM tst_test_question
104 WHERE test_fi = %s
105 ORDER BY sequence ASC
106 ";
107
108 $res = $this->db->queryF(
109 $query,
110 ['integer'],
111 [$this->test_obj->getTestId()]
112 );
113
114 $sequenceIndex = 0;
115
116 $reindexedSequencePositionMap = new ilTestReindexedSequencePositionMap();
117
118 while ($row = $this->db->fetchAssoc($res)) {
119 $sequenceIndex++; // start with 1
120
121 $reindexedSequencePositionMap->addPositionMapping((int) $row['sequence'], $sequenceIndex);
122
123 $this->db->update(
124 'tst_test_question',
125 ['sequence' => ['integer', $sequenceIndex]],
126 ['question_fi' => ['integer', $row['question_fi']]]
127 );
128 }
129
130 return $reindexedSequencePositionMap;
131 }
$res
Definition: ltiservices.php:69

References $res.

◆ removeQuestionSetRelatedData()

ilTestFixedQuestionSetConfig::removeQuestionSetRelatedData ( )

Reimplemented from ilTestQuestionSetConfig.

Definition at line 44 of file class.ilTestFixedQuestionSetConfig.php.

44 : void
45 {
46 $res = $this->db->queryF(
47 'SELECT question_fi FROM tst_test_question WHERE test_fi = %s',
48 ['integer'],
49 [$this->test_obj->getTestId()]
50 );
51
52 while ($row = $this->db->fetchAssoc($res)) {
53 $this->test_obj->removeQuestion((int) $row['question_fi']);
54 }
55
56 $this->db->manipulateF(
57 'DELETE FROM tst_test_question WHERE test_fi = %s',
58 ['integer'],
59 [$this->test_obj->getTestId()]
60 );
61
62 $this->test_obj->questions = [];
63
64 $this->test_obj->saveCompleteStatus($this);
65 }

References $res.

◆ saveToDb()

ilTestFixedQuestionSetConfig::saveToDb ( )

Reimplemented from ilTestQuestionSetConfig.

Definition at line 95 of file class.ilTestFixedQuestionSetConfig.php.

95 : void
96 {
97 // TODO: Implement saveToDb() method.
98 }

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