4 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHint.php';
32 return current($this->questionHints);
43 return reset($this->questionHints);
54 return next($this->questionHints);
65 return key($this->questionHints);
76 return key($this->questionHints) !== null;
96 $this->questionHints[] = $questionHint;
108 foreach ($this as $questionHint) {
111 if ($questionHint->getId() == $hintId) {
112 return $questionHint;
116 require_once
'Modules/TestQuestionPool/exceptions/class.ilTestQuestionPoolException.php';
130 foreach ($this as $questionHint) {
133 if ($questionHint->getId() == $hintId) {
154 foreach ($this as $questionHint) {
157 $questionHint->setIndex(++$counter);
158 $questionHint->save();
175 $questionHintList = self::getListByQuestionId($originalQuestionId);
177 foreach ($questionHintList as $questionHint) {
180 $originalHintId = $questionHint->getId();
182 $questionHint->setId(null);
183 $questionHint->setQuestionId($duplicateQuestionId);
185 $questionHint->save();
187 $duplicateHintId = $questionHint->getId();
189 $hintIds[$originalHintId] = $duplicateHintId;
204 $tableData = array();
206 foreach ($this as $questionHint) {
209 $tableData[] = array(
210 'hint_id' => $questionHint->getId(),
211 'hint_index' => $questionHint->getIndex(),
212 'hint_points' => $questionHint->getPoints(),
213 'hint_text' => $questionHint->getText()
232 $ilDB = $DIC[
'ilDB'];
243 WHERE qht_question_fi = %s 245 ORDER BY qht_hint_index ASC 251 array((
int) $questionId)
254 $questionHintList =
new self();
261 $questionHintList->addHint($questionHint);
264 return $questionHintList;
279 $ilDB = $DIC[
'ilDB'];
281 $qht_hint_id__IN__hintIds =
$ilDB->in(
'qht_hint_id', $hintIds,
false,
'integer');
292 WHERE $qht_hint_id__IN__hintIds 294 ORDER BY qht_hint_index ASC 299 $questionHintList =
new self();
306 $questionHintList->addHint($questionHint);
309 return $questionHintList;
326 $ilDB = $DIC[
'ilDB'];
329 SELECT 1 + COALESCE( MAX(qht_hint_index), 0 ) next_index 333 WHERE qht_question_fi = %s 339 array((
int) $questionId)
344 return $row[
'next_index'];
356 $ilDB = $DIC[
'ilDB'];
358 $__qht_question_fi__IN__questionIds =
$ilDB->in(
'qht_question_fi', $questionIds,
false,
'integer');
361 DELETE FROM qpl_hints 362 WHERE $__qht_question_fi__IN__questionIds static getListByQuestionId($questionId)
instantiates a question hint list for the passed question id
rewind()
iterator interface method
static deleteHintsByQuestionIds($questionIds)
Deletes all question hints relating to questions included in given question ids.
static getListByHintIds($hintIds)
instantiates a question hint list for the passed hint ids
hintExists($hintId)
checks wether a question hint object relating to the passed id exists or not
static getNextIndexByQuestionId($questionId)
determines the next index to be used for a new hint that is to be added to the list of existing hints...
foreach($_POST as $key=> $value) $res
key()
iterator interface method
static duplicateListForQuestion($originalQuestionId, $duplicateQuestionId)
duplicates a hint list from given original question id to given duplicate question id and returns an ...
next()
iterator interface method
reIndex()
re-indexes the list's hints sequentially by current order (starting with index "1") ...
valid()
iterator interface method
static assignDbRow(self $questionHint, $hintDbRow)
assigns the field elements of passed hint db row array to the corresponding hint object properties of...
addHint(ilAssQuestionHint $questionHint)
adds a question hint object to the current list instance
current()
iterator interface method
__construct()
Constructor.
getTableData()
returns an array with data of the hints in this list that is adopted to be used as table gui data ...
getHint($hintId)
returns the question hint object relating to the passed hint id