4require_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();
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()
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;
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;
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'];
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
An exception for terminatinating execution or to throw for unit testing.
rewind()
iterator interface method
getHint($hintId)
returns the question hint object relating to the passed hint id
key()
iterator interface method
current()
iterator interface method
valid()
iterator interface method
static deleteHintsByQuestionIds($questionIds)
Deletes all question hints relating to questions included in given question ids.
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...
hintExists($hintId)
checks wether a question hint object relating to the passed id exists or not
getTableData()
returns an array with data of the hints in this list that is adopted to be used as table gui data
reIndex()
re-indexes the list's hints sequentially by current order (starting with index "1")
__construct()
Constructor.
next()
iterator interface method
addHint(ilAssQuestionHint $questionHint)
adds a question hint object to the current list instance
static duplicateListForQuestion($originalQuestionId, $duplicateQuestionId)
duplicates a hint list from given original question id to given duplicate question id and returns an ...
static getListByHintIds($hintIds)
instantiates a question hint list for the passed hint ids
static getListByQuestionId($questionId)
instantiates a question hint list for the passed question id
static assignDbRow(self $questionHint, $hintDbRow)
assigns the field elements of passed hint db row array to the corresponding hint object properties of...
foreach($_POST as $key=> $value) $res