ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
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)
 
 getTestObject ()
 
 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(
75 false,
76 '',
77 '',
78 -1,
79 $clone_test_obj->getId()
80 );
81 $question_clone = assQuestion::instantiateQuestion(
82 $clone_test_obj->questions[$key]
83 );
84 $question_clone->updateOriginalId(
85 $question_orig->getOriginalId()
86 );
87
88 // Save the mapping of old question id <-> new question id
89 // This will be used in class.ilObjCourse::cloneDependencies to copy learning objectives
90 $original_key = $this->test_obj->getRefId() . '_question_' . $question_id;
91 $mapped_key = $clone_test_obj->getRefId() . '_question_' . $clone_test_obj->questions[$key];
92 $cwo->appendMapping($original_key, $mapped_key);
93 $this->logger->info(__METHOD__ . ": Added question id mapping $original_key <-> $mapped_key");
94 }
95 }
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 140 of file class.ilTestFixedQuestionSetConfig.php.

140 : void
141 {
142 // TODO: Implement saveToDbByTestId() method.
143 }

◆ deleteFromDb()

ilTestFixedQuestionSetConfig::deleteFromDb ( )

Reimplemented from ilTestQuestionSetConfig.

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

145 : void
146 {
147 // TODO: Implement deleteFromDb() method.
148 }

◆ 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 150 of file class.ilTestFixedQuestionSetConfig.php.

150 : bool
151 {
152 return false;
153 }

◆ loadFromDb()

ilTestFixedQuestionSetConfig::loadFromDb ( )

Reimplemented from ilTestQuestionSetConfig.

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

97 : void
98 {
99 // TODO: Implement loadFromDb() method.
100 }

◆ reindexQuestionOrdering()

ilTestFixedQuestionSetConfig::reindexQuestionOrdering ( )

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

108 {
109 $query = "
110 SELECT question_fi, sequence FROM tst_test_question
111 WHERE test_fi = %s
112 ORDER BY sequence ASC
113 ";
114
115 $res = $this->db->queryF(
116 $query,
117 ['integer'],
118 [$this->test_obj->getTestId()]
119 );
120
121 $sequenceIndex = 0;
122
123 $reindexedSequencePositionMap = new ilTestReindexedSequencePositionMap();
124
125 while ($row = $this->db->fetchAssoc($res)) {
126 $sequenceIndex++; // start with 1
127
128 $reindexedSequencePositionMap->addPositionMapping((int) $row['sequence'], $sequenceIndex);
129
130 $this->db->update(
131 'tst_test_question',
132 ['sequence' => ['integer', $sequenceIndex]],
133 ['question_fi' => ['integer', $row['question_fi']]]
134 );
135 }
136
137 return $reindexedSequencePositionMap;
138 }
foreach($_POST as $key=> $value) $res

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 102 of file class.ilTestFixedQuestionSetConfig.php.

102 : void
103 {
104 // TODO: Implement saveToDb() method.
105 }

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