19 require_once
'Modules/TestQuestionPool/classes/feedback/class.ilAssQuestionFeedback.php';
45 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
66 if (!$this->questionOBJ->getSelfAssessmentEditingMode()) {
68 $header->setTitle($this->
lng->txt(
'feedback_answers'));
72 $propertyLabel = $this->questionOBJ->prepareTextareaOutput(
77 $propertyPostVar =
"feedback_answer_$index";
82 $this->questionOBJ->isAdditionalContentEditingModePageObject()
94 if (!$this->questionOBJ->getSelfAssessmentEditingMode()) {
96 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
102 $value = $this->questionOBJ->prepareTextareaOutput(
114 if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) {
117 $this->questionOBJ->getId(),
120 (string) ($form->
getInput(
"feedback_answer_$index") ??
'')
128 require_once
'Services/RTE/classes/class.ilRTE.php';
130 $res = $this->db->queryF(
131 "SELECT * FROM {$this->getSpecificFeedbackTableName()} 132 WHERE question_fi = %s AND question = %s AND answer = %s",
133 [
'integer',
'integer',
'integer'],
134 [$questionId, $questionIndex, $answerIndex]
137 $feedbackContent =
'';
139 if ($this->db->numRows(
$res) > 0) {
140 $row = $this->db->fetchAssoc(
$res);
142 $this->questionOBJ->getHtmlQuestionContentPurifier()->purify($row[
'feedback'] ??
''),
147 return $feedbackContent;
152 require_once
'Services/RTE/classes/class.ilRTE.php';
154 $res = $this->db->queryF(
155 "SELECT feedback FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
160 $allFeedbackContents =
'';
162 while ($row = $this->db->fetchAssoc(
$res)) {
166 return $allFeedbackContents;
171 if ($feedbackContent !==
'') {
173 $this->questionOBJ->getHtmlQuestionContentPurifier()->purify($feedbackContent),
180 if ($feedbackId !== -1) {
184 'feedback' => [
'text', $feedbackContent],
185 'tstamp' => [
'integer', time()]
188 'feedback_id' => [
'integer', $feedbackId],
195 'feedback_id' => [
'integer', $feedbackId],
196 'question_fi' => [
'integer', $questionId],
197 'question' => [
'integer', $questionIndex],
198 'answer' => [
'integer', $answerIndex],
199 'feedback' => [
'text', $feedbackContent],
200 'tstamp' => [
'integer', time()]
209 if ($isAdditionalContentEditingModePageObject) {
210 require_once
'Modules/TestQuestionPool/classes/feedback/class.ilAssSpecificFeedbackIdentifierList.php';
212 $feedbackIdentifiers->load($questionId);
214 foreach ($feedbackIdentifiers as $identifier) {
217 $identifier->getFeedbackId()
222 $this->db->manipulateF(
223 "DELETE FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
231 $res = $this->db->queryF(
232 "SELECT * FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
234 [$originalQuestionId]
237 while ($row = $this->db->fetchAssoc(
$res)) {
241 'feedback_id' => [
'integer', $nextId],
242 'question_fi' => [
'integer', $duplicateQuestionId],
243 'question' => [
'integer', $row[
'question']],
244 'answer' => [
'integer', $row[
'answer']],
245 'feedback' => [
'text', $row[
'feedback']],
246 'tstamp' => [
'integer', time()]
249 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
251 $this->
duplicatePageObject($pageObjectType, $row[
'feedback_id'], $nextId, $duplicateQuestionId);
259 $this->db->manipulateF(
260 "DELETE FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
262 [$originalQuestionId]
266 $res = $this->db->queryF(
267 "SELECT * FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
269 [$duplicateQuestionId]
273 while ($row = $this->db->fetchAssoc(
$res)) {
277 'feedback_id' => [
'integer', $nextId],
278 'question_fi' => [
'integer', $originalQuestionId],
279 'question' => [
'integer', $row[
'question']],
280 'answer' => [
'integer', $row[
'answer']],
281 'feedback' => [
'text', $row[
'feedback']],
282 'tstamp' => [
'integer', time()]
289 $res = $this->db->queryF(
290 "SELECT feedback_id FROM {$this->getSpecificFeedbackTableName()} 291 WHERE question_fi = %s AND question = %s AND answer = %s",
292 [
'integer',
'integer',
'integer'],
293 [$questionId, $questionIndex, $answerIndex]
296 $row = $this->db->fetchAssoc(
$res);
297 return $row[
'feedback_id'] ?? -1;
307 $res = $this->db->query(
308 "SELECT feedback_id, feedback FROM {$this->getSpecificFeedbackTableName()} WHERE " 313 while ($row = $this->db->fetchAssoc(
$res)) {
314 $content[$row[
'feedback_id']] = $row[
'feedback'];
321 $row = $this->db->fetchAssoc($this->db->queryF(
322 "SELECT COUNT(feedback_id) cnt FROM {$this->getSpecificFeedbackTableName()} 323 WHERE question_fi = %s AND feedback_id = %s",
324 [
'integer',
'integer'],
325 [$this->questionOBJ->getId(), $feedbackId]
328 return (
bool) $row[
'cnt'];
333 return self::TABLE_NAME_SPECIFIC_FEEDBACK;
338 return $this->questionOBJ->getAnswers();
343 return $answer->getAnswertext();
355 if ($pageObjectId === -1) {
359 return $pageObjectId;
364 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
377 return $specificAnswerFeedbackExportPresentation;
382 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
394 $res = $this->db->queryF(
395 "SELECT answer FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
397 [$this->questionOBJ->getId()]
400 $allFeedbackContents =
'';
402 while ($row = $this->db->fetchAssoc(
$res)) {
404 $this->questionOBJ->getId(),
410 return (
bool) strlen(trim(strip_tags($allFeedbackContents)));
static _replaceMediaObjectImageSrc(string $a_text, int $a_direction=0, string $nic='')
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
getSpecificAnswerFeedbackContent(int $questionId, int $questionIndex, int $answerIndex)
duplicatePageObject(string $pageObjectType, int $originalPageObjectId, int $duplicatePageObjectId, int $duplicatePageObjectParentId)
importSpecificAnswerFeedback(int $questionId, int $questionIndex, int $answerIndex, string $feedbackContent)
isSpecificAnswerFeedbackId(int $feedbackId)
getAllSpecificAnswerFeedbackContents(int $questionId)
ensurePageObjectDeleted(string $pageObjectType, int $pageObjectId)
getAnswerOptionsByAnswerIndex()
getSpecificAnswerFeedbackPageObjectType()
getPageObjectContent(string $pageObjectType, int $pageObjectId)
cleanupPageContent(string $content)
syncSpecificFeedback(int $originalQuestionId, int $duplicateQuestionId)
getSpecificFeedbackTableName()
getSpecificAnswerFeedbackPageObjectId(int $questionId, int $questionIndex, int $answerIndex)
returns a useable page object id for specific answer feedback page objects for the given question id ...
specificAnswerFeedbackExists()
getSpecificAnswerFeedbackTestPresentation(int $questionId, int $questionIndex, int $answerIndex)
returns the html of SPECIFIC feedback for the given question id and answer index for test presentatio...
const TABLE_NAME_SPECIFIC_FEEDBACK
table name for specific feedback
getSpecificFeedbackContentForFeedbackIds(array $feedback_ids)
createPageObject(string $pageObjectType, int $pageObjectId, string $pageObjectContent)
completeSpecificFormProperties(ilPropertyFormGUI $form)
completes a given form object with the specific form properties required by this question type ...
getSpecificAnswerFeedbackExportPresentation(int $questionId, int $questionIndex, int $answerIndex)
buildAnswerOptionLabel(int $index, $answer)
getPageObjectXML(string $pageObjectType, int $pageObjectId)
getSpecificAnswerFeedbackId(int $questionId, int $questionIndex, int $answerIndex)
buildFeedbackContentFormProperty(string $label, string $postVar, bool $asNonEditable)
builds and returns a form property gui object with the given label and postvar that is addable to pro...
initSpecificFormProperties(ilPropertyFormGUI $form)
initialises a given form object's specific form properties relating to this question type ...
getPageObjectNonEditableValueHTML(string $pageObjectType, int $pageObjectId)
returns html content to be used as value for non editable value form properties in feedback editing f...
duplicateSpecificFeedback(int $originalQuestionId, int $duplicateQuestionId)
deleteSpecificAnswerFeedbacks(int $questionId, bool $isAdditionalContentEditingModePageObject)
saveSpecificFormProperties(ilPropertyFormGUI $form)
saveSpecificAnswerFeedbackContent(int $questionId, int $questionIndex, int $answerIndex, string $feedbackContent)