ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilAssSpecificFeedbackIdentifierList.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 require_once 'Modules/TestQuestionPool/classes/feedback/class.ilAssSpecificFeedbackIdentifier.php';
6 
16 {
20  protected $map = array();
21 
25  protected function add(ilAssSpecificFeedbackIdentifier $identifier)
26  {
27  $this->map[] = $identifier;
28  }
29 
33  public function load($questionId)
34  {
35  global $DIC; /* @var ILIAS\DI\Container $DIC */
36 
37  $res = $DIC->database()->queryF(
38  "SELECT feedback_id, question, answer FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
39  array('integer'),
40  array($questionId)
41  );
42 
43  $feedbackIdByAnswerIndexMap = array();
44 
45  while ($row = $DIC->database()->fetchAssoc($res)) {
46  $identifier = new ilAssSpecificFeedbackIdentifier();
47 
48  $identifier->setQuestionId($questionId);
49 
50  $identifier->setQuestionIndex($row['question']);
51  $identifier->setAnswerIndex($row['answer']);
52 
53  $identifier->setFeedbackId($row['feedback_id']);
54 
55  $this->add($identifier);
56  }
57  }
58 
62  public function current()
63  {
64  return current($this->map);
65  }
66 
70  public function next()
71  {
72  return next($this->map);
73  }
74 
78  public function key()
79  {
80  return key($this->map);
81  }
82 
86  public function valid()
87  {
88  return key($this->map) !== null;
89  }
90 
94  public function rewind()
95  {
96  return reset($this->map);
97  }
98 
99  protected function getSpecificFeedbackTableName()
100  {
101  require_once 'Modules/TestQuestionPool/classes/feedback/class.ilAssClozeTestFeedback.php';
103  }
104 }
add(ilAssSpecificFeedbackIdentifier $identifier)
global $DIC
Definition: saml.php:7
const TABLE_NAME_SPECIFIC_FEEDBACK
table name for specific feedback
foreach($_POST as $key=> $value) $res
$row