ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilAssSpecificFeedbackIdentifierList.php
Go to the documentation of this file.
1<?php
2
27class ilAssSpecificFeedbackIdentifierList implements Iterator
28{
32 protected array $map = [];
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 ['integer'],
46 [$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 {
65 return current($this->map);
66 }
67
68 public function next(): void
69 {
70 next($this->map);
71 }
72
73 public function key(): ?int
74 {
75 return key($this->map);
76 }
77
78 public function valid(): bool
79 {
80 return key($this->map) !== null;
81 }
82
83 public function rewind(): void
84 {
85 reset($this->map);
86 }
87
88 protected function getSpecificFeedbackTableName(): string
89 {
91 }
92}
const TABLE_NAME_SPECIFIC_FEEDBACK
table name for specific feedback
add(ilAssSpecificFeedbackIdentifier $identifier)
$res
Definition: ltiservices.php:69
global $DIC
Definition: shib_login.php:26