15 $presentation = $item->getPresentation();
17 $questiontext =
array();
18 $seperate_question_field = $item->getMetadataEntry(
"question");
21 $created = sprintf(
"%04d%02d%02d%02d%02d%02d", $now[
'year'], $now[
'mon'], $now[
'mday'], $now[
'hours'], $now[
'minutes'], $now[
'seconds']);
23 $correct_answers =
array();
24 $presentation = $item->getPresentation();
25 $gap_types = json_decode($item->getMetadataEntry(
"gapTypes"));
26 foreach ($presentation->order as $entry)
28 switch ($entry[
"type"])
32 $material = $presentation->material[$entry[
"index"]];
33 if(preg_match(
'/\[Longmenu \d\]/', $this->
object->QTIMaterialToString($material)))
35 $this->
object->setLongMenuTextValue($this->
object->QTIMaterialToString($material));
39 $this->
object->setQuestion($this->
object->QTIMaterialToString($material));
46 foreach ($item->resprocessing as $resprocessing)
48 foreach ($resprocessing->respcondition as $respcondition)
51 $conditionvar = $respcondition->getConditionvar();
52 foreach ($conditionvar->order as $order)
54 switch ($order[
"field"])
57 $equals = $conditionvar->varequal[$order[
"index"]]->getContent();
58 $gapident = $conditionvar->varequal[$order[
"index"]]->getRespident();
60 $answers[$id][] = $equals;
64 foreach ($respcondition->setvar as $setvar)
66 if (strcmp($gapident,
"") != 0)
68 if($setvar->getContent() > 0 )
71 $correct_answers[$id][0][] = $equals;
72 $correct_answers[$id][1] = $setvar->getContent();
73 if(is_array($gap_types) && key_exists($id, $gap_types))
75 $correct_answers[$id][2] = $gap_types[$id];
80 if (count($respcondition->displayfeedback))
82 foreach ($respcondition->displayfeedback as $feedbackpointer)
84 if (strlen($feedbackpointer->getLinkrefid()))
86 foreach ($item->itemfeedback as $ifb)
88 if (strcmp($ifb->getIdent(),
"response_allcorrect") == 0)
91 if (count($ifb->material))
93 foreach ($ifb->material as $material)
95 $feedbacksgeneric[1] = $material;
98 if ((count($ifb->flow_mat) > 0))
100 foreach ($ifb->flow_mat as $fmat)
102 if (count($fmat->material))
104 foreach ($fmat->material as $material)
106 $feedbacksgeneric[1] = $material;
112 else if (strcmp($ifb->getIdent(),
"response_onenotcorrect") == 0)
115 if (count($ifb->material))
117 foreach ($ifb->material as $material)
119 $feedbacksgeneric[0] = $material;
122 if ((count($ifb->flow_mat) > 0))
124 foreach ($ifb->flow_mat as $fmat)
126 if (count($fmat->material))
128 foreach ($fmat->material as $material)
130 $feedbacksgeneric[0] = $material;
139 if (count($ifb->material))
141 foreach ($ifb->material as $material)
143 $feedbacks[$ifb->getIdent()] = $material;
146 if ((count($ifb->flow_mat) > 0))
148 foreach ($ifb->flow_mat as $fmat)
150 if (count($fmat->material))
152 foreach ($fmat->material as $material)
154 $feedbacks[$ifb->getIdent()] = $material;
170 foreach ($correct_answers as
$row)
174 $this->
object->setAnswers($answers);
176 if(count($feedbacks) > 0)
178 foreach($feedbacks as $ident => $material)
180 $m = $this->
object->QTIMaterialToString($material);
181 $feedbacks[$ident] = $m;
184 if(count($feedbacksgeneric) > 0)
186 foreach ($feedbacksgeneric as $correctness => $material)
188 $m = $this->
object->QTIMaterialToString($material);
189 $feedbacksgeneric[$correctness] = $m;
194 $this->
object->setTitle($item->getTitle());
195 $this->
object->setNrOfTries($item->getMaxattempts());
196 $this->
object->setComment($item->getComment());
197 $this->
object->setAuthor($item->getAuthor());
198 $this->
object->setOwner($ilUser->getId());
199 $this->
object->setObjId($questionpool_id);
200 $this->
object->setMinAutoComplete($item->getMetadataEntry(
"minAutoCompleteLength"));
202 $this->
object->setCorrectAnswers($correct_answers);
203 $this->
object->setPoints($sum);
205 $this->
object->setAdditionalContentEditingMode(
208 $this->
object->saveToDb();
210 if(count($feedbacks) > 0)
212 foreach($feedbacks as $ident => $material)
214 $this->
object->feedbackOBJ->importSpecificAnswerFeedback(
219 if(count($feedbacksgeneric) > 0)
221 foreach($feedbacksgeneric as $correctness => $material)
223 $this->
object->feedbackOBJ->importGenericFeedback(
228 $this->
object->saveToDb();
229 if (count($item->suggested_solutions))
231 foreach ($item->suggested_solutions as $suggested_solution)
233 $this->
object->setSuggestedSolution($suggested_solution[
"solution"]->getContent(), $suggested_solution[
"gap_index"],
true);
235 $this->
object->saveToDb();
240 $q_1_id = $this->
object->getId();
241 $question_id = $this->
object->duplicate(
true, null, null, null, $tst_id);
242 $tst_object->questions[$question_counter++] = $question_id;
243 $import_mapping[$item->getIdent()] =
array(
"pool" => $q_1_id,
"test" => $question_id);
247 $import_mapping[$item->getIdent()] =
array(
"pool" => $this->
object->getId(),
"test" => 0);
addGeneralMetadata(ilQTIItem $item)
fetchAdditionalContentEditingModeInformation($qtiItem)
fetches the "additional content editing mode" information from qti item and falls back to ADDITIONAL_...
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate