43 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
45 $this->getPageObjectContent(
65 if (!$this->questionOBJ->getSelfAssessmentEditingMode()) {
67 $header->setTitle($this->
lng->txt(
'feedback_answers'));
76 $propertyPostVar =
"feedback_answer_$index";
81 $this->questionOBJ->isAdditionalContentEditingModePageObject()
93 if (!$this->questionOBJ->getSelfAssessmentEditingMode()) {
95 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
113 if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) {
116 $this->questionOBJ->getId(),
119 (string) ($form->
getInput(
"feedback_answer_$index") ??
'')
127 $res = $this->db->queryF(
128 "SELECT * FROM {$this->getSpecificFeedbackTableName()} 129 WHERE question_fi = %s AND question = %s AND answer = %s",
130 [
'integer',
'integer',
'integer'],
131 [$question_id, $question_index, $answer_index]
134 $feedback_content =
'';
136 if ($this->db->numRows(
$res) > 0) {
137 $row = $this->db->fetchAssoc(
$res);
139 $this->questionOBJ->getHtmlQuestionContentPurifier()->purify($row[
'feedback'] ??
''),
144 return $feedback_content;
149 $res = $this->db->queryF(
150 "SELECT feedback FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
155 $allFeedbackContents =
'';
157 while ($row = $this->db->fetchAssoc(
$res)) {
161 return $allFeedbackContents;
167 $feedback_identifiers->load($question_id);
169 $all_feedback_content =
'';
170 foreach ($feedback_identifiers as $identifier) {
171 $feedback_content = $this->getPageObjectContent(
173 $identifier->getFeedbackId()
178 return $all_feedback_content;
183 if ($feedback_content !==
'') {
185 $this->questionOBJ->getHtmlQuestionContentPurifier()->purify($feedback_content),
192 if ($feedback_id !== -1) {
196 'feedback' => [
'text', $feedback_content],
197 'tstamp' => [
'integer', time()]
200 'feedback_id' => [
'integer', $feedback_id],
207 'feedback_id' => [
'integer', $feedback_id],
208 'question_fi' => [
'integer', $question_id],
209 'question' => [
'integer', $question_index],
210 'answer' => [
'integer', $answer_index],
211 'feedback' => [
'text', $feedback_content],
212 'tstamp' => [
'integer', time()]
221 if ($is_additional_content_editing_mode_page_object) {
223 $feedback_identifiers->load($question_id);
225 foreach ($feedback_identifiers as $identifier) {
228 $identifier->getFeedbackId()
233 $this->db->manipulateF(
234 "DELETE FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
242 $res = $this->db->queryF(
243 "SELECT * FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
245 [$original_question_id]
248 while ($row = $this->db->fetchAssoc(
$res)) {
252 'feedback_id' => [
'integer', $next_id],
253 'question_fi' => [
'integer', $duplicate_question_id],
254 'question' => [
'integer', $row[
'question']],
255 'answer' => [
'integer', $row[
'answer']],
256 'feedback' => [
'text', $row[
'feedback']],
257 'tstamp' => [
'integer', time()]
260 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
262 $this->
duplicatePageObject($pageObjectType, $row[
'feedback_id'], $next_id, $duplicate_question_id);
270 $this->db->manipulateF(
271 "DELETE FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
273 [$original_question_id]
277 $res = $this->db->queryF(
278 "SELECT * FROM {$this->getSpecificFeedbackTableName()} WHERE question_fi = %s",
280 [$duplicate_question_id]
284 while ($row = $this->db->fetchAssoc(
$res)) {
288 'feedback_id' => [
'integer', $next_id],
289 'question_fi' => [
'integer', $original_question_id],
290 'question' => [
'integer', $row[
'question']],
291 'answer' => [
'integer', $row[
'answer']],
292 'feedback' => [
'text', $row[
'feedback']],
293 'tstamp' => [
'integer', time()]
300 $res = $this->db->queryF(
301 "SELECT feedback_id FROM {$this->getSpecificFeedbackTableName()} 302 WHERE question_fi = %s AND question = %s AND answer = %s",
303 [
'integer',
'integer',
'integer'],
304 [$question_id, $question_index, $answer_index]
307 $row = $this->db->fetchAssoc(
$res);
308 return $row[
'feedback_id'] ?? -1;
318 $res = $this->db->query(
319 "SELECT feedback_id, feedback FROM {$this->getSpecificFeedbackTableName()} WHERE " 324 while ($row = $this->db->fetchAssoc(
$res)) {
325 $content[$row[
'feedback_id']] = $row[
'feedback'];
332 $row = $this->db->fetchAssoc($this->db->queryF(
333 "SELECT COUNT(feedback_id) cnt FROM {$this->getSpecificFeedbackTableName()} 334 WHERE question_fi = %s AND feedback_id = %s",
335 [
'integer',
'integer'],
336 [$this->questionOBJ->getId(), $feedback_id]
339 return (
bool) $row[
'cnt'];
344 return self::TABLE_NAME_SPECIFIC_FEEDBACK;
349 return $this->questionOBJ->getAnswers();
354 return $answer->getAnswertext();
366 if ($page_object_id === -1) {
370 return $page_object_id;
375 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
391 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
395 $this->
createPageObject($pageObjectType, $page_object_id, $feedback_content);
403 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
409 return $all_feedback_content !==
'';
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...
getSpecificAnswerFeedbackPageObjectId(int $question_id, int $question_index, int $answer_index)
returns a useable page object id for specific answer feedback page objects for the given question id ...
getAnswerOptionsByAnswerIndex()
duplicateSpecificFeedback(int $original_question_id, int $duplicate_question_id)
getSpecificAnswerFeedbackPageObjectType()
cleanupPageContent(string $content)
getSpecificFeedbackTableName()
deleteSpecificAnswerFeedbacks(int $question_id, bool $is_additional_content_editing_mode_page_object)
importSpecificAnswerFeedback(int $question_id, int $question_index, int $answer_index, string $feedback_content)
specificAnswerFeedbackExists()
getAllSpecificAnswerPageEditorFeedbackContents(int $question_id)
isSpecificAnswerFeedbackId(int $feedback_id)
const TABLE_NAME_SPECIFIC_FEEDBACK
table name for specific feedback
getSpecificFeedbackContentForFeedbackIds(array $feedback_ids)
getPageObjectXML(string $page_object_type, int $page_object_id)
completeSpecificFormProperties(ilPropertyFormGUI $form)
completes a given form object with the specific form properties required by this question type ...
createPageObject(string $page_object_type, int $page_object_id, string $page_object_content)
buildAnswerOptionLabel(int $index, $answer)
getSpecificAnswerFeedbackId(int $question_id, int $question_index, int $answer_index)
initSpecificFormProperties(ilPropertyFormGUI $form)
initialises a given form object's specific form properties relating to this question type ...
getSpecificAnswerFeedbackTestPresentation(int $question_id, int $question_index, int $answer_index)
returns the html of SPECIFIC feedback for the given question id and answer index for test presentatio...
duplicatePageObject(string $page_object_type, int $original_page_object_id, int $duplicate_page_object_id, int $duplicate_page_object_parent_id)
getSpecificAnswerFeedbackContent(int $question_id, int $question_index, int $answer_index)
getPageObjectNonEditableValueHTML(string $page_object_type, int $page_object_id)
returns html content to be used as value for non editable value form properties in feedback editing f...
syncSpecificFeedback(int $original_question_id, int $duplicate_question_id)
ensurePageObjectDeleted(string $page_object_type, int $page_object_id)
saveSpecificFormProperties(ilPropertyFormGUI $form)
buildFeedbackContentFormProperty(string $label, string $post_var, bool $as_non_editable)
builds and returns a form property gui object with the given label and postvar that is addable to pro...
saveSpecificAnswerFeedbackContent(int $question_id, int $question_index, int $answer_index, string $feedback_content)
getAllSpecificAnswerFeedbackContents(int $question_id)
getSpecificAnswerFeedbackExportPresentation(int $question_id, int $question_index, int $answer_index)