51         $this->
object = $a_object;
    60         return (
int) $this->
object->getId();
    65         $feedbacksgeneric = [];
    66         foreach ($item->resprocessing as $resprocessing) {
    67             foreach ($resprocessing->respcondition as $respcondition) {
    68                 foreach ($respcondition->displayfeedback as $feedbackpointer) {
    69                     if (strlen($feedbackpointer->getLinkrefid())) {
    70                         foreach ($item->itemfeedback as $ifb) {
    71                             if (strcmp($ifb->getIdent(), 
"response_allcorrect") == 0) {
    73                                 if (count($ifb->material)) {
    74                                     foreach ($ifb->material as $material) {
    75                                         $feedbacksgeneric[1] = $material;
    78                                 if ((count($ifb->flow_mat) > 0)) {
    79                                     foreach ($ifb->flow_mat as $fmat) {
    80                                         if (count($fmat->material)) {
    81                                             foreach ($fmat->material as $material) {
    82                                                 $feedbacksgeneric[1] = $material;
    87                             } elseif (strcmp($ifb->getIdent(), 
"response_onenotcorrect") == 0) {
    89                                 if (count($ifb->material)) {
    90                                     foreach ($ifb->material as $material) {
    91                                         $feedbacksgeneric[0] = $material;
    94                                 if ((count($ifb->flow_mat) > 0)) {
    95                                     foreach ($ifb->flow_mat as $fmat) {
    96                                         if (count($fmat->material)) {
    97                                             foreach ($fmat->material as $material) {
    98                                                 $feedbacksgeneric[0] = $material;
   110         foreach ($feedbacksgeneric as $correctness => $material) {
   112             $feedbacksgeneric[$correctness] = $m;
   114         return $feedbacksgeneric;
   124         return (
int) str_replace($prefix, 
'', $feedbackIdent);
   136         foreach ($item->itemfeedback as $ifb) {
   137             if ($ifb->getIdent() == 
'response_allcorrect' || $ifb->getIdent() == 
'response_onenotcorrect') {
   141             if ($ifb->getIdent() == $prefix . 
'allcorrect' || $ifb->getIdent() == $prefix . 
'onenotcorrect') {
   145             if (substr($ifb->getIdent(), 0, strlen($prefix)) != $prefix) {
   149             $ident = $ifb->getIdent();
   153             if (count($ifb->material)) {
   154                 foreach ($ifb->material as $material) {
   155                     $feedbacks[$ident] = $material;
   159             if ((count($ifb->flow_mat) > 0)) {
   160                 foreach ($ifb->flow_mat as $fmat) {
   161                     if (count($fmat->material)) {
   162                         foreach ($fmat->material as $material) {
   163                             $feedbacks[$ident] = $material;
   170         foreach ($feedbacks as $ident => $material) {
   172             $feedbacks[$ident] = $m;
   179         string $importdirectory,
   182         int $questionpool_id,
   185         int &$question_counter,
   186         array $import_mapping
   222                     $lomLifecycle->getMappedIliasLifecycleIdentifer()
   234         $reg = 
'/<img.*src=".*\\/mm_(\\d+)\\/(.*?)".*>/m';
   237         if (preg_match_all($reg, 
$text, $matches)) {
   239             for ($i = 0, $max = count($matches[1]); $i < $max; $i++) {
   240                 $mobSrcId = $matches[1][$i];
   241                 $mobSrcName = $matches[2][$i];
   242                 $mobSrcLabel = 
'il_' . $sourceNic . 
'_mob_' . $mobSrcId;
   244                     "mob" => $mobSrcLabel, 
"uri" => 
'objects/' . $mobSrcLabel . 
'/' . $mobSrcName
   263         $additionalContentEditingMode = $qtiItem->getMetadataEntry(
'additional_cont_edit_mode');
   265         if (!$this->
object->isValidAdditionalContentEditingMode($additionalContentEditingMode ?? 
'')) {
   269         return $additionalContentEditingMode;
   274         array $solution_from_import
   276         if (!$solution_from_import === []
   277             || !isset($solution_from_import[0][
'solution'])) {
   281         $solution_item = $solution_from_import[0][
'solution'];
   282         $content = $solution_item->getContent();
   283         if ($solution_item->getTexttype() === 
'application/json') {
   284             $content = json_decode($content, 
true);
   285             if (!isset($content[
'type']) || !isset($content[
'value'])) {
   288             $type = $content[
'type'];
   291             if ($type === null) {
   297         $solution_object = $repo->create($question_id, $type);
   299         if ($type !== SuggestedSolution::TYPE_FILE) {
   300             $link = is_string($content) ? $content : $content[
'value'];
   301             $adapted_link = $this->
object->resolveInternalLink($link);
   302             if ($adapted_link === 
'') {
   305             $solution_object = $solution_object
   306                 ->withInternalLink($adapted_link)
   307                 ->withImportId($link);
   309             if (!isset($content[
'title']) || !isset($content[
'filename'])) {
   312             $path = str_replace(
CLIENT_WEB_DIR . DIRECTORY_SEPARATOR, 
'', $this->
object->getSuggestedSolutionPath() . $content[
'filename']);
   314             $solution_object = $solution_object->withTitle($content[
'title'])
   315                 ->withFilename($content[
'filename'])
   316                 ->withSize((
int) $this->
filesystem->getSize(
$path, DataSize::Byte)->inBytes())
   319         $repo->update([$solution_object]);
   324         foreach (array_keys(SuggestedSolution::TYPES) as $type) {
   325             $search_type = 
'_' . $type . 
'_';
   326             if (strpos($value, $search_type) !== 
false) {
   337         if (is_null($this->suggestedsolution_repo)) {
   338             $dic = QuestionPoolDIC::dic();
   339             $this->suggestedsolution_repo = 
$dic[
'question.repo.suggestedsolutions'];
   354             switch ($material[
'type']) {
   356                     $result .= $material[
'material']->getContent();
   359                     $matimage = $material[
'material'];
   360                     if (preg_match(
"/(il_([0-9]+)_mob_([0-9]+))/", $matimage->getLabel(), $matches)) {
   361                         $mobs[] = [
"mob" => $matimage->getLabel(),
   362                                         "uri" => $matimage->getUri()
   373         if ($size === null) {
   374             return $this->
object->getThumbSize();
   377         if ($size < $this->
object->getMinimumThumbSize()) {
   378             return $this->
object->getMinimumThumbSize();
   381         if ($size > $this->
object->getMaximumThumbSize()) {
   382             return $this->
object->getMaximumThumbSize();
   389         int $questionpool_id,
   391         int &$question_counter,
   394         if ($tst_id !== null && $tst_id === $questionpool_id) {
   395             $tst_object->questions[$question_counter++] = $this->
object->
getId();
   396             return [
'pool' => 0, 
'test' => $this->
object->getId()];
   400             $question_id = $this->
object->duplicate(
true, 
'', 
'', -1, $tst_id);
   401             $tst_object->questions[$question_counter++] = $question_id;
   402             return [
'pool' => $this->
object->getId(), 
'test' => $question_id];
   404         return [
'pool' => $this->
object->getId(), 
'test' => 0];
 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...
 
static get(string $a_var)
 
getFeedbackAnswerSpecific(ilQTIItem $item, $prefix='response_')
 
static getInstance($identifier)
 
getSuggestedSolutionsRepo()
 
deduceThumbSizeFromImportValue(?int $size)
 
addGeneralMetadata(ilQTIItem $item)
 
QTIMaterialToString(ilQTIMaterial $a_material)
Reads an QTI material tag and creates a text or XHTML string. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
addQuestionToParentObjectAndBuildMappingEntry(int $questionpool_id, ?int $tst_id, int &$question_counter, ?ilObjTest &$tst_object)
 
getMetadataEntry(string $a_label)
 
processNonAbstractedImageReferences($text, $sourceNic)
 
fetchAdditionalContentEditingModeInformation($qtiItem)
fetches the "additional content editing mode" information from qti item and falls back to ADDITIONAL_...
 
getMaterial(int $a_index)
 
SuggestedSolutionsDatabaseRepository $suggestedsolution_repo
 
fromXML(string $importdirectory, int $user_id, ilQTIItem $item, int $questionpool_id, ?int $tst_id, ?ilObject &$tst_object, int &$question_counter, array $import_mapping)
 
fetchLifecycle(ilQTIItem $item)
 
getFeedbackGeneric($item)
 
Repository for suggested solutions. 
 
importSuggestedSolutions(int $question_id, array $solution_from_import)
 
findSolutionTypeByValue(string $value)
 
__construct(Container $dic, ilPlugin $plugin)
 
const ADDITIONAL_CONTENT_EDITING_MODE_RTE
 
Class for question imports. 
 
fetchIndexFromFeedbackIdent($feedbackIdent, $prefix='response_')
 
static set(string $a_var, $a_val)
Set a value. 
 
static getDraftInstance()