31         string $importdirectory,
    37         int &$question_counter,
    47         $created = sprintf(
"%04d%02d%02d%02d%02d%02d", $now[
'year'], $now[
'mon'], $now[
'mday'], $now[
'hours'], $now[
'minutes'], $now[
'seconds']);
    49         foreach ($presentation->order as $entry) {
    50             switch ($entry[
"type"]) {
    52                     $response = $presentation->response[$entry[
"index"]];
    54                         array_push($idents, 
$response->getIdent());
    60         $feedbacksgeneric = [];
    61         foreach ($item->resprocessing as $resprocessing) {
    62             foreach ($resprocessing->respcondition as $respcondition) {
    65                 $conditionvar = $respcondition->getConditionvar();
    66                 foreach ($conditionvar->order as $order) {
    67                     switch ($order[
"field"]) {
    69                             $respident = $conditionvar->varsubset[$order[
"index"]]->getRespident();
    70                             $content = $conditionvar->varsubset[$order[
"index"]]->getContent();
    71                             if (!isset($responses[$respident]) || !is_array($responses[$respident])) {
    72                                 $responses[$respident] = [];
    74                             $vars = explode(
",", $content);
    75                             foreach ($vars as $var) {
    76                                 array_push($responses[$respident], [
"solution" => $var, 
"points" => 
""]);
    81                 foreach ($respcondition->setvar as $setvar) {
    83                         foreach ($responses[$respident] as $idx => $solutionarray) {
    84                             if (strlen($solutionarray[
"points"]) == 0) {
    85                                 $responses[$respident][$idx][
"points"] = $setvar->getContent();
    90                 foreach ($resprocessing->respcondition as $e_respcondition) {
    91                     foreach ($e_respcondition->displayfeedback as $feedbackpointer) {
    92                         if (strlen($feedbackpointer->getLinkrefid())) {
    93                             foreach ($item->itemfeedback as $ifb) {
    94                                 if (strcmp($ifb->getIdent(), 
"response_allcorrect") == 0) {
    96                                     if (count($ifb->material)) {
    97                                         foreach ($ifb->material as $material) {
    98                                             $feedbacksgeneric[1] = $material;
   101                                     if ((count($ifb->flow_mat) > 0)) {
   102                                         foreach ($ifb->flow_mat as $fmat) {
   103                                             if (count($fmat->material)) {
   104                                                 foreach ($fmat->material as $material) {
   105                                                     $feedbacksgeneric[1] = $material;
   110                                 } elseif (strcmp($ifb->getIdent(), 
"response_onenotcorrect") == 0) {
   112                                     if (count($ifb->material)) {
   113                                         foreach ($ifb->material as $material) {
   114                                             $feedbacksgeneric[0] = $material;
   117                                     if ((count($ifb->flow_mat) > 0)) {
   118                                         foreach ($ifb->flow_mat as $fmat) {
   119                                             if (count($fmat->material)) {
   120                                                 foreach ($fmat->material as $material) {
   121                                                     $feedbacksgeneric[0] = $material;
   134         $this->
object->setTitle($item->
getTitle());
   136         $this->
object->setComment($item->
getComment());
   137         $this->
object->setAuthor($item->
getAuthor());
   138         $this->
object->setOwner($user_id);
   140         $this->
object->setObjId($questionpool_id);
   142         if (strlen($textrating) == 0) {
   145         $this->
object->setTextRating($textrating);
   146         $this->
object->setCorrectAnswers($item->
getMetadataEntry(
"correctanswers"));
   151                 $this->
object->addAnswer($answer[
"solution"], $answer[
"points"], $counter);
   156         $this->
object->setAdditionalContentEditingMode(
   159         $this->
object->saveToDb();
   161         foreach ($feedbacksgeneric as $correctness => $material) {
   163             $feedbacksgeneric[$correctness] = $m;
   166         $questiontext = $this->
object->getQuestion();
   169                 $importfile = $importdirectory . DIRECTORY_SEPARATOR . $mob[
"uri"];
   172                 $DIC[
'ilLog']->write(__METHOD__ . 
': import mob from dir: ' . $importfile);
   176                 $questiontext = str_replace(
"src=\"" . $mob[
"mob"] . 
"\"", 
"src=\"" . 
"il_" . 
IL_INST_ID . 
"_mob_" . $media_object->getId() . 
"\"", $questiontext);
   177                 foreach ($feedbacksgeneric as $correctness => $material) {
   178                     $feedbacksgeneric[$correctness] = str_replace(
"src=\"" . $mob[
"mob"] . 
"\"", 
"src=\"" . 
"il_" . 
IL_INST_ID . 
"_mob_" . $media_object->getId() . 
"\"", $material);
   183         foreach ($feedbacksgeneric as $correctness => $material) {
   184             $this->
object->feedbackOBJ->importGenericFeedback(
   190         $this->
object->saveToDb();
   197         return $import_mapping;
 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...
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static get(string $a_var)
 
addGeneralMetadata(ilQTIItem $item)
 
QTIMaterialToString(ilQTIMaterial $a_material)
Reads an QTI material tag and creates a text or XHTML string. 
 
addQuestionToParentObjectAndBuildMappingEntry(int $questionpool_id, ?int $tst_id, int &$question_counter, ?ilObjTest &$tst_object)
 
getMetadataEntry(string $a_label)
 
fetchAdditionalContentEditingModeInformation($qtiItem)
fetches the "additional content editing mode" information from qti item and falls back to ADDITIONAL_...
 
importSuggestedSolutions(int $question_id, array $solution_from_import)
 
fromXML(string $importdirectory, int $user_id, ilQTIItem $item, int $questionpool_id, ?int $tst_id, ?ilObject &$tst_object, int &$question_counter, array $import_mapping)
 
Class for question imports. 
 
static clear(string $a_var)