ILIAS  release_4-4 Revision
class.assQuestionImport.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once "./Modules/Test/classes/inc.AssessmentConstants.php";
5 
16 {
24  var $object;
25 
32  function assQuestionImport(&$a_object)
33  {
34  $this->object =& $a_object;
35  }
36 
37  function getFeedbackGeneric($item)
38  {
39  $feedbacksgeneric = array();
40  foreach ($item->resprocessing as $resprocessing)
41  {
42  foreach ($resprocessing->respcondition as $respcondition)
43  {
44  foreach ($respcondition->displayfeedback as $feedbackpointer)
45  {
46  if (strlen($feedbackpointer->getLinkrefid()))
47  {
48  foreach ($item->itemfeedback as $ifb)
49  {
50  if (strcmp($ifb->getIdent(), "response_allcorrect") == 0)
51  {
52  // found a feedback for the identifier
53  if (count($ifb->material))
54  {
55  foreach ($ifb->material as $material)
56  {
57  $feedbacksgeneric[1] = $material;
58  }
59  }
60  if ((count($ifb->flow_mat) > 0))
61  {
62  foreach ($ifb->flow_mat as $fmat)
63  {
64  if (count($fmat->material))
65  {
66  foreach ($fmat->material as $material)
67  {
68  $feedbacksgeneric[1] = $material;
69  }
70  }
71  }
72  }
73  }
74  else if (strcmp($ifb->getIdent(), "response_onenotcorrect") == 0)
75  {
76  // found a feedback for the identifier
77  if (count($ifb->material))
78  {
79  foreach ($ifb->material as $material)
80  {
81  $feedbacksgeneric[0] = $material;
82  }
83  }
84  if ((count($ifb->flow_mat) > 0))
85  {
86  foreach ($ifb->flow_mat as $fmat)
87  {
88  if (count($fmat->material))
89  {
90  foreach ($fmat->material as $material)
91  {
92  $feedbacksgeneric[0] = $material;
93  }
94  }
95  }
96  }
97  }
98  }
99  }
100  }
101  }
102  }
103  // handle the import of media objects in XHTML code
104  foreach ($feedbacksgeneric as $correctness => $material)
105  {
106  $m = $this->object->QTIMaterialToString($material);
107  $feedbacksgeneric[$correctness] = $m;
108  }
109  return $feedbacksgeneric;
110  }
111 
125  function fromXML(&$item, $questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
126  {
127  }
128 
132  protected function addGeneralMetadata(ilQTIItem $item)
133  {
134  $this->object->setExternalId($item->getMetadataEntry('externalID'));
135  }
136 
140  protected function getQplImportArchivDirectory()
141  {
142  include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
143  return ilObjQuestionPool::_getImportDirectory() . '/' . $_SESSION["qpl_import_subdir"];
144  }
145 
149  protected function getTstImportArchivDirectory()
150  {
151  include_once "./Modules/Test/classes/class.ilObjTest.php";
152  return ilObjTest::_getImportDirectory() . '/' . $_SESSION["tst_import_subdir"];
153  }
154 
164  final protected function fetchAdditionalContentEditingModeInformation($qtiItem)
165  {
166  $additionalContentEditingMode = $qtiItem->getMetadataEntry('additional_cont_edit_mode');
167 
168  if( !$this->object->isValidAdditionalContentEditingMode($additionalContentEditingMode) )
169  {
170  $additionalContentEditingMode = assQuestion::ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT;
171  }
172 
173  return $additionalContentEditingMode;
174  }
175 }
176 
177 ?>
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
addGeneralMetadata(ilQTIItem $item)
_getImportDirectory()
Get the import directory location of the test.
fetchAdditionalContentEditingModeInformation($qtiItem)
fetches the "additional content editing mode" information from qti item and falls back to ADDITIONAL_...
getQplImportArchivDirectory()
returns the full path to extracted qpl import archiv (qpl import dir + qpl archiv subdir) ...
getMetadataEntry($a_label)
fromXML(&$item, $questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
Creates a question from a QTI file.
_getImportDirectory()
get import directory of lm
const ADDITIONAL_CONTENT_EDITING_MODE_DEFAULT
constant for additional content editing mode "default"
getTstImportArchivDirectory()
returns the full path to extracted tst import archiv (tst import dir + tst archiv subdir) ...
Class for question imports.
assQuestionImport(&$a_object)
assQuestionImport constructor