44 $this->
object = $a_object;
52 foreach ($answers as $index => $answer) {
53 $linkrefid =
"response_$index";
55 "ident" => $linkrefid,
61 $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackExportPresentation(
82 $feedback_allcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
86 $feedback_onenotcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
90 if (strlen($feedback_allcorrect . $feedback_onenotcorrect)) {
91 $a_xml_writer->xmlStartTag(
"resprocessing");
92 $a_xml_writer->xmlStartTag(
"outcomes");
93 $a_xml_writer->xmlStartTag(
"decvar");
94 $a_xml_writer->xmlEndTag(
"decvar");
95 $a_xml_writer->xmlEndTag(
"outcomes");
97 if (strlen($feedback_allcorrect)) {
101 $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
103 $a_xml_writer->xmlStartTag(
"conditionvar");
105 "respident" =>
"points" 107 $a_xml_writer->xmlElement(
"varequal", $attrs, $this->
object->getPoints());
108 $a_xml_writer->xmlEndTag(
"conditionvar");
111 "feedbacktype" =>
"Response",
112 "linkrefid" =>
"response_allcorrect" 114 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
115 $a_xml_writer->xmlEndTag(
"respcondition");
118 if (strlen($feedback_onenotcorrect)) {
122 $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
124 $a_xml_writer->xmlStartTag(
"conditionvar");
125 $a_xml_writer->xmlStartTag(
"not");
127 "respident" =>
"points" 129 $a_xml_writer->xmlElement(
"varequal", $attrs, $this->
object->getPoints());
130 $a_xml_writer->xmlEndTag(
"not");
131 $a_xml_writer->xmlEndTag(
"conditionvar");
134 "feedbacktype" =>
"Response",
135 "linkrefid" =>
"response_onenotcorrect" 137 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
138 $a_xml_writer->xmlEndTag(
"respcondition");
140 $a_xml_writer->xmlEndTag(
"resprocessing");
143 if (strlen($feedback_allcorrect)) {
145 "ident" =>
"response_allcorrect",
148 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
150 $a_xml_writer->xmlStartTag(
"flow_mat");
152 $a_xml_writer->xmlEndTag(
"flow_mat");
153 $a_xml_writer->xmlEndTag(
"itemfeedback");
155 if (strlen($feedback_onenotcorrect)) {
157 "ident" =>
"response_onenotcorrect",
160 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
162 $a_xml_writer->xmlStartTag(
"flow_mat");
164 $a_xml_writer->xmlEndTag(
"flow_mat");
165 $a_xml_writer->xmlEndTag(
"itemfeedback");
174 public function toXML($a_include_header =
true, $a_include_binary =
true, $a_shuffle =
false, $test_output =
false, $force_image_references =
false): string
194 $a_xml_writer->
xmlEndTag(
"qtimetadatafield");
209 'additional_cont_edit_mode',
210 $this->
object->getAdditionalContentEditingMode()
224 $this->
object->getLifecycle()->getIdentifier()
230 $this->
object->getLifecycle()->getMappedLomLifecycle()
238 $question_id = (
int) $this->
object->getId();
241 foreach ($list as $hint) {
243 'index' => $hint->getIndex(),
244 'points' => $hint->getPoints()
246 if ($this->
object->isAdditionalContentEditingModePageObject()) {
253 $data = $hint->getText();
263 $solution = $this->
object->getSuggestedSolution();
264 if ($solution ===
null) {
268 $mattext = [
'type' => $solution->getType()];
270 'label' =>
'suggested_solution',
271 'texttype' =>
'application/json' 275 $mattext[
'title'] = $solution->getTitle();
276 $mattext[
'filename'] = $solution->getFilename();
277 $mattext[
'value'] = base64_encode(file_get_contents(
278 $this->
object->getSuggestedSolutionPath() . $solution->getFilename()
281 if (!preg_match(
'/il_(\d*?)_(\w+)_(\d+)/', $solution->getInternalLink(), $matches)) {
284 $mattext[
'value'] =
'il_' .
IL_INST_ID .
'_' . $matches[2] .
'_' . $matches[3];
285 if ($matches[1] !==
'') {
286 $mattext[
'value'] = $solution[
'internal_link'];
292 $writer->
xmlElement(
'mattext', $attrs, json_encode($mattext));
297 public function addQTIMaterial(
ilXmlWriter $a_xml_writer,
string $a_material,
bool $close_material_tag =
true,
bool $add_mobs =
true): void
301 "texttype" =>
"text/plain" 304 $attrs[
"texttype"] =
"text/xhtml";
309 foreach ($mobs as $mob) {
310 $moblabel =
"il_" .
IL_INST_ID .
"_mob_" . $mob;
311 if (str_contains($a_material,
"mm_$mob")) {
315 "label" => $moblabel,
316 "uri" =>
"objects/" .
"il_" .
IL_INST_ID .
"_mob_" . $mob .
"/" . $mob_obj->getTitle()
323 if ($close_material_tag) {
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...
__construct($a_object)
assQuestionExport constructor
static getListByQuestionId($questionId)
instantiates a question hint list for the passed question id
static isHTML(string $a_text)
Checks if a given string contains HTML or not.
exportFeedbackOnly($a_xml_writer)
addQTIMaterial(ilXmlWriter $a_xml_writer, string $a_material, bool $close_material_tag=true, bool $add_mobs=true)
Class for question exports.
addAnswerSpecificFeedback(ilXmlWriter $a_xml_writer, $answers)
addGeneralMetadata(ilXmlWriter $xmlwriter)
addQtiMetaDataField(ilXmlWriter $a_xml_writer, $fieldLabel, $fieldValue)
adds a qti meta data field with given name and value to the passed xml writer (xml writer must be in ...
xmlEndTag(string $tag)
Writes an endtag.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
a suggested solution for file-contents
addAdditionalContentEditingModeInformation(ilXmlWriter $a_xml_writer)
adds a qti meta data field for ilias specific information of "additional content editing mode" (xml w...
addSuggestedSolution(ilXmlWriter $writer)
addSolutionHints(ilXmlWriter $writer)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addGenericFeedback(ilXmlWriter $a_xml_writer)
toXML($a_include_header=true, $a_include_binary=true, $a_shuffle=false, $test_output=false, $force_image_references=false)
Returns a QTI xml representation of the question Returns a QTI xml representation of the question and...
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)