ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilAssSpecificFeedbackIdentifierList.php
Go to the documentation of this file.
1 <?php
2 
28 {
32  protected array $map = array();
33 
34  protected function add(ilAssSpecificFeedbackIdentifier $identifier): void
35  {
36  $this->map[] = $identifier;
37  }
38 
39  public function load(int $questionId): void
40  {
41  global $DIC; /* @var ILIAS\DI\Container $DIC */
42 
43  $res = $DIC->database()->queryF(
44  "SELECT feedback_id, question, answer FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
45  array('integer'),
46  array($questionId)
47  );
48 
49  while ($row = $DIC->database()->fetchAssoc($res)) {
50  $identifier = new ilAssSpecificFeedbackIdentifier();
51 
52  $identifier->setQuestionId($questionId);
53 
54  $identifier->setQuestionIndex($row['question']);
55  $identifier->setAnswerIndex($row['answer']);
56 
57  $identifier->setFeedbackId($row['feedback_id']);
58 
59  $this->add($identifier);
60  }
61  }
62 
64  public function current()
65  {
66  return current($this->map);
67  }
68 
70  public function next()
71  {
72  return next($this->map);
73  }
74 
76  public function key()
77  {
78  return key($this->map);
79  }
80 
81  public function valid(): bool
82  {
83  return key($this->map) !== null;
84  }
85 
87  public function rewind()
88  {
89  return reset($this->map);
90  }
91 
92  protected function getSpecificFeedbackTableName(): string
93  {
94  require_once 'Modules/TestQuestionPool/classes/feedback/class.ilAssClozeTestFeedback.php';
96  }
97 }
$res
Definition: ltiservices.php:69
add(ilAssSpecificFeedbackIdentifier $identifier)
const TABLE_NAME_SPECIFIC_FEEDBACK
table name for specific feedback
global $DIC
Definition: feed.php:28