ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.assQuestionImport.php
Go to the documentation of this file.
1 <?php
2  /*
3  +----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +----------------------------------------------------------------------------+
22 */
23 include_once "./Modules/Test/classes/inc.AssessmentConstants.php";
24 
35 {
43  var $object;
44 
51  function assQuestionImport(&$a_object)
52  {
53  $this->object =& $a_object;
54  }
55 
56  function getFeedbackGeneric($item)
57  {
58  $feedbacksgeneric = array();
59  foreach ($item->resprocessing as $resprocessing)
60  {
61  foreach ($resprocessing->respcondition as $respcondition)
62  {
63  foreach ($respcondition->displayfeedback as $feedbackpointer)
64  {
65  if (strlen($feedbackpointer->getLinkrefid()))
66  {
67  foreach ($item->itemfeedback as $ifb)
68  {
69  if (strcmp($ifb->getIdent(), "response_allcorrect") == 0)
70  {
71  // found a feedback for the identifier
72  if (count($ifb->material))
73  {
74  foreach ($ifb->material as $material)
75  {
76  $feedbacksgeneric[1] = $material;
77  }
78  }
79  if ((count($ifb->flow_mat) > 0))
80  {
81  foreach ($ifb->flow_mat as $fmat)
82  {
83  if (count($fmat->material))
84  {
85  foreach ($fmat->material as $material)
86  {
87  $feedbacksgeneric[1] = $material;
88  }
89  }
90  }
91  }
92  }
93  else if (strcmp($ifb->getIdent(), "response_onenotcorrect") == 0)
94  {
95  // found a feedback for the identifier
96  if (count($ifb->material))
97  {
98  foreach ($ifb->material as $material)
99  {
100  $feedbacksgeneric[0] = $material;
101  }
102  }
103  if ((count($ifb->flow_mat) > 0))
104  {
105  foreach ($ifb->flow_mat as $fmat)
106  {
107  if (count($fmat->material))
108  {
109  foreach ($fmat->material as $material)
110  {
111  $feedbacksgeneric[0] = $material;
112  }
113  }
114  }
115  }
116  }
117  }
118  }
119  }
120  }
121  }
122  // handle the import of media objects in XHTML code
123  foreach ($feedbacksgeneric as $correctness => $material)
124  {
125  $m = $this->object->QTIMaterialToString($material);
126  $feedbacksgeneric[$correctness] = $m;
127  }
128  return $feedbacksgeneric;
129  }
130 
144  function fromXML(&$item, $questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
145  {
146  }
147 
151  protected function getQplImportArchivDirectory()
152  {
153  include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
154  return ilObjQuestionPool::_getImportDirectory() . '/' . $_SESSION["qpl_import_subdir"];
155  }
156 
160  protected function getTstImportArchivDirectory()
161  {
162  include_once "./Modules/Test/classes/class.ilObjTest.php";
163  return ilObjTest::_getImportDirectory() . '/' . $_SESSION["tst_import_subdir"];
164  }
165 }
166 
167 ?>