Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 include_once "./assessment/classes/class.ilQTIResponse.php";
00025
00026 define ("QT_UNKNOWN", 0);
00027 define ("QT_MULTIPLE_CHOICE_SR", 1);
00028 define ("QT_MULTIPLE_CHOICE_MR", 2);
00029 define ("QT_CLOZE", 3);
00030 define ("QT_MATCHING", 4);
00031 define ("QT_ORDERING", 5);
00032 define ("QT_IMAGEMAP", 6);
00033 define ("QT_JAVAAPPLET", 7);
00034 define ("QT_TEXT", 8);
00035
00044 class ilQTIItem
00045 {
00046 var $ident;
00047 var $title;
00048 var $maxattempts;
00049 var $label;
00050 var $xmllang;
00051
00052 var $comment;
00053 var $ilias_version;
00054 var $author;
00055 var $questiontype;
00056 var $duration;
00057 var $questiontext;
00058 var $resprocessing;
00059 var $itemfeedback;
00060 var $presentation;
00061 var $presentationitem;
00062 var $suggested_solutions;
00063
00064 function ilQTIItem()
00065 {
00066 $this->response = array();
00067 $this->resprocessing = array();
00068 $this->itemfeedback = array();
00069 $this->presentation = NULL;
00070 $this->presentationitem = array();
00071 $this->suggested_solutions = array();
00072 }
00073
00074 function setIdent($a_ident)
00075 {
00076 $this->ident = $a_ident;
00077 }
00078
00079 function getIdent()
00080 {
00081 return $this->ident;
00082 }
00083
00084 function setTitle($a_title)
00085 {
00086 $this->title = $a_title;
00087 }
00088
00089 function getTitle()
00090 {
00091 return $this->title;
00092 }
00093
00094 function setComment($a_comment)
00095 {
00096 if (preg_match("/(.*?)\=(.*)/", $a_comment, $matches))
00097 {
00098
00099 switch ($matches[1])
00100 {
00101 case "ILIAS Version":
00102 $this->ilias_version = $matches[2];
00103 return;
00104 break;
00105 case "Questiontype":
00106 $this->questiontype = $matches[2];
00107 return;
00108 break;
00109 case "Author":
00110 $this->author = $matches[2];
00111 return;
00112 break;
00113 }
00114 }
00115 $this->comment = $a_comment;
00116 }
00117
00118 function getComment()
00119 {
00120 return $this->comment;
00121 }
00122
00123 function setDuration($a_duration)
00124 {
00125 if (preg_match("/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $a_duration, $matches))
00126 {
00127 $this->duration = array(
00128 "h" => $matches[4],
00129 "m" => $matches[5],
00130 "s" => $matches[6]
00131 );
00132 }
00133 }
00134
00135 function getDuration()
00136 {
00137 return $this->duration;
00138 }
00139
00140 function setQuestiontext($a_questiontext)
00141 {
00142 $this->questiontext = $a_questiontext;
00143 }
00144
00145 function getQuestiontext()
00146 {
00147 return $this->questiontext;
00148 }
00149
00150 function addResprocessing($a_resprocessing)
00151 {
00152 array_push($this->resprocessing, $a_resprocessing);
00153 }
00154
00155 function addItemfeedback($a_itemfeedback)
00156 {
00157 array_push($this->itemfeedback, $a_itemfeedback);
00158 }
00159
00160 function setMaxattempts($a_maxattempts)
00161 {
00162 $this->maxattempts = $a_maxattempts;
00163 }
00164
00165 function getMaxattempts()
00166 {
00167 return $this->maxattempts;
00168 }
00169
00170 function setLabel($a_label)
00171 {
00172 $this->label = $a_label;
00173 }
00174
00175 function getLabel()
00176 {
00177 return $this->label;
00178 }
00179
00180 function setXmllang($a_xmllang)
00181 {
00182 $this->xmllang = $a_xmllang;
00183 }
00184
00185 function getXmllang()
00186 {
00187 return $this->xmllang;
00188 }
00189
00190 function setPresentation($a_presentation)
00191 {
00192 $this->presentation = $a_presentation;
00193 }
00194
00195 function getPresentation()
00196 {
00197 return $this->presentation;
00198 }
00199
00200 function collectResponses()
00201 {
00202 $result = array();
00203 if ($this->presentation != NULL)
00204 {
00205 }
00206 }
00207
00208 function setQuestiontype($a_questiontype)
00209 {
00210 $this->questiontype = $a_questiontype;
00211 }
00212
00213 function getQuestiontype()
00214 {
00215 return $this->questiontype;
00216 }
00217
00218 function addPresentationitem($a_presentationitem)
00219 {
00220 array_push($this->presentationitem, $a_presentationitem);
00221 }
00222
00223 function determineQuestionType()
00224 {
00225 switch ($this->questiontype)
00226 {
00227 case "ORDERING QUESTION":
00228 return QT_ORDERING;
00229 case "MULTIPLE CHOICE QUESTION":
00230 break;
00231 case "MATCHING QUESTION":
00232 return QT_MATCHING;
00233 case "CLOZE QUESTION":
00234 return QT_CLOZE;
00235 case "IMAGE MAP QUESTION":
00236 return QT_IMAGEMAP;
00237 case "JAVA APPLET QUESTION":
00238 return QT_JAVAAPPLET;
00239 case "TEXT QUESTION":
00240 return QT_TEXT;
00241 }
00242 if (!$this->presentation) return QT_UNKNOWN;
00243 foreach ($this->presentation->order as $entry)
00244 {
00245 switch ($entry["type"])
00246 {
00247 case "response":
00248 $response = $this->presentation->response[$entry["index"]];
00249 switch ($response->getResponsetype())
00250 {
00251 case RT_RESPONSE_LID:
00252 switch ($response->getRCardinality())
00253 {
00254 case R_CARDINALITY_ORDERED:
00255 return QT_ORDERING;
00256 break;
00257 case R_CARDINALITY_SINGLE:
00258 return QT_MULTIPLE_CHOICE_SR;
00259 break;
00260 case R_CARDINALITY_MULTIPLE:
00261 return QT_MULTIPLE_CHOICE_MR;
00262 break;
00263 }
00264 break;
00265 case RT_RESPONSE_XY:
00266 return QT_IMAGEMAP;
00267 break;
00268 case RT_RESPONSE_STR:
00269 switch ($response->getRCardinality())
00270 {
00271 case R_CARDINALITY_ORDERED:
00272 return QT_TEXT;
00273 break;
00274 case R_CARDINALITY_SINGLE:
00275 return QT_CLOZE;
00276 break;
00277 }
00278 break;
00279 case RT_RESPONSE_GRP:
00280 return QT_MATCHING;
00281 break;
00282 default:
00283 break;
00284 }
00285 break;
00286 case "material":
00287 $material = $this->presentation->material[$entry["index"]];
00288 if (count($material->matapplet) > 0) return QT_JAVAAPPLET;
00289 break;
00290 }
00291 }
00292 return QT_UNKNOWN;
00293 }
00294
00295 function setAuthor($a_author)
00296 {
00297 $this->author = $a_author;
00298 }
00299
00300 function getAuthor()
00301 {
00302 return $this->author;
00303 }
00304
00305 function addSuggestedSolution($a_solution, $a_gap_index)
00306 {
00307 array_push($this->suggested_solutions, array("solution" => $a_solution, "gap_index" => $a_gap_index));
00308 }
00309 }
00310 ?>