45 $this->
object = $a_object;
53 foreach ($answers as $index => $answer) {
54 $linkrefid =
"response_$index";
56 "ident" => $linkrefid,
62 $fb = $this->
object->feedbackOBJ->getSpecificAnswerFeedbackExportPresentation(
83 $feedback_allcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
87 $feedback_onenotcorrect = $this->
object->feedbackOBJ->getGenericFeedbackExportPresentation(
91 if (strlen($feedback_allcorrect . $feedback_onenotcorrect)) {
92 $a_xml_writer->xmlStartTag(
"resprocessing");
93 $a_xml_writer->xmlStartTag(
"outcomes");
94 $a_xml_writer->xmlStartTag(
"decvar");
95 $a_xml_writer->xmlEndTag(
"decvar");
96 $a_xml_writer->xmlEndTag(
"outcomes");
98 if (strlen($feedback_allcorrect)) {
102 $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
104 $a_xml_writer->xmlStartTag(
"conditionvar");
106 "respident" =>
"points" 108 $a_xml_writer->xmlElement(
"varequal", $attrs, $this->
object->getPoints());
109 $a_xml_writer->xmlEndTag(
"conditionvar");
112 "feedbacktype" =>
"Response",
113 "linkrefid" =>
"response_allcorrect" 115 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
116 $a_xml_writer->xmlEndTag(
"respcondition");
119 if (strlen($feedback_onenotcorrect)) {
123 $a_xml_writer->xmlStartTag(
"respcondition", $attrs);
125 $a_xml_writer->xmlStartTag(
"conditionvar");
126 $a_xml_writer->xmlStartTag(
"not");
128 "respident" =>
"points" 130 $a_xml_writer->xmlElement(
"varequal", $attrs, $this->
object->getPoints());
131 $a_xml_writer->xmlEndTag(
"not");
132 $a_xml_writer->xmlEndTag(
"conditionvar");
135 "feedbacktype" =>
"Response",
136 "linkrefid" =>
"response_onenotcorrect" 138 $a_xml_writer->xmlElement(
"displayfeedback", $attrs);
139 $a_xml_writer->xmlEndTag(
"respcondition");
141 $a_xml_writer->xmlEndTag(
"resprocessing");
144 if (strlen($feedback_allcorrect)) {
146 "ident" =>
"response_allcorrect",
149 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
151 $a_xml_writer->xmlStartTag(
"flow_mat");
153 $a_xml_writer->xmlEndTag(
"flow_mat");
154 $a_xml_writer->xmlEndTag(
"itemfeedback");
156 if (strlen($feedback_onenotcorrect)) {
158 "ident" =>
"response_onenotcorrect",
161 $a_xml_writer->xmlStartTag(
"itemfeedback", $attrs);
163 $a_xml_writer->xmlStartTag(
"flow_mat");
165 $a_xml_writer->xmlEndTag(
"flow_mat");
166 $a_xml_writer->xmlEndTag(
"itemfeedback");
175 public function toXML($a_include_header =
true, $a_include_binary =
true, $a_shuffle =
false, $test_output =
false, $force_image_references =
false): string
195 $a_xml_writer->
xmlEndTag(
"qtimetadatafield");
210 'additional_cont_edit_mode',
211 $this->
object->getAdditionalContentEditingMode()
225 $this->
object->getLifecycle()->getIdentifier()
231 $this->
object->getLifecycle()->getMappedLomLifecycle()
237 $solution = $this->
object->getSuggestedSolution();
238 if ($solution ===
null) {
242 $mattext = [
'type' => $solution->getType()];
244 'label' =>
'suggested_solution',
245 'texttype' =>
'application/json' 249 $mattext[
'title'] = $solution->getTitle();
250 $mattext[
'filename'] = $solution->getFilename();
251 $mattext[
'value'] = base64_encode(file_get_contents(
252 $this->
object->getSuggestedSolutionPath() . $solution->getFilename()
255 if (!preg_match(
'/il_(\d*?)_(\w+)_(\d+)/', $solution->getInternalLink(), $matches)) {
258 $mattext[
'value'] =
'il_' .
IL_INST_ID .
'_' . $matches[2] .
'_' . $matches[3];
259 if ($matches[1] !==
'') {
260 $mattext[
'value'] = $solution->getInternalLink();
266 $writer->
xmlElement(
'mattext', $attrs, json_encode($mattext));
271 public function addQTIMaterial(
ilXmlWriter $a_xml_writer,
string $a_material,
bool $close_material_tag =
true,
bool $add_mobs =
true): void
275 "texttype" =>
"text/plain" 278 $attrs[
"texttype"] =
"text/xhtml";
283 foreach ($mobs as $mob) {
284 $moblabel =
"il_" .
IL_INST_ID .
"_mob_" . $mob;
285 if (str_contains($a_material,
"mm_$mob")) {
289 "label" => $moblabel,
290 "uri" =>
"objects/" .
"il_" .
IL_INST_ID .
"_mob_" . $mob .
"/" . $mob_obj->getTitle()
297 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 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
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)
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)