@@ -34,21 +34,21 @@ discard block |
||
| 34 | 34 | * |
| 35 | 35 | * @param Ims2Question $question Ims2Question object we want to export. |
| 36 | 36 | */ |
| 37 | - function __construct($question) |
|
| 38 | - { |
|
| 37 | + function __construct($question) |
|
| 38 | + { |
|
| 39 | 39 | $this->question = $question; |
| 40 | 40 | $this->answer = $this->question->setAnswer(); |
| 41 | 41 | $this->questionIdent = "QST_" . $question->id ; |
| 42 | - } |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * Start the XML flow. |
|
| 46 | - * |
|
| 47 | - * This opens the <item> block, with correct attributes. |
|
| 48 | - * |
|
| 49 | - */ |
|
| 50 | - function start_item() |
|
| 51 | - { |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * Start the XML flow. |
|
| 46 | + * |
|
| 47 | + * This opens the <item> block, with correct attributes. |
|
| 48 | + * |
|
| 49 | + */ |
|
| 50 | + function start_item() |
|
| 51 | + { |
|
| 52 | 52 | $string = '<assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1" |
| 53 | 53 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 54 | 54 | xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p1 imsqti_v2p1.xsd" |
@@ -56,55 +56,55 @@ discard block |
||
| 56 | 56 | title="'.htmlspecialchars(formatExerciseQtiTitle($this->question->selectTitle())).'">'."\n"; |
| 57 | 57 | |
| 58 | 58 | return $string; |
| 59 | - } |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * End the XML flow, closing the </item> tag. |
|
| 63 | - * |
|
| 64 | - */ |
|
| 65 | - function end_item() |
|
| 66 | - { |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * End the XML flow, closing the </item> tag. |
|
| 63 | + * |
|
| 64 | + */ |
|
| 65 | + function end_item() |
|
| 66 | + { |
|
| 67 | 67 | return "</assessmentItem>\n"; |
| 68 | - } |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * Start the itemBody |
|
| 72 | - * |
|
| 73 | - */ |
|
| 74 | - function start_item_body() |
|
| 75 | - { |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * Start the itemBody |
|
| 72 | + * |
|
| 73 | + */ |
|
| 74 | + function start_item_body() |
|
| 75 | + { |
|
| 76 | 76 | return ' <itemBody>' . "\n"; |
| 77 | - } |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * End the itemBody part. |
|
| 81 | - * |
|
| 82 | - */ |
|
| 83 | - function end_item_body() |
|
| 84 | - { |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * End the itemBody part. |
|
| 81 | + * |
|
| 82 | + */ |
|
| 83 | + function end_item_body() |
|
| 84 | + { |
|
| 85 | 85 | return " </itemBody>\n"; |
| 86 | - } |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * add the response processing template used. |
|
| 90 | - * |
|
| 91 | - */ |
|
| 92 | - |
|
| 93 | - function add_response_processing() |
|
| 94 | - { |
|
| 95 | - return ' <responseProcessing template="http://www.imsglobal.org/question/qti_v2p1/rptemplates/map_correct"/>' . "\n"; |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - /** |
|
| 99 | - * Export the question as an IMS/QTI Item. |
|
| 100 | - * |
|
| 101 | - * This is a default behaviour, some classes may want to override this. |
|
| 102 | - * |
|
| 103 | - * @param $standalone: Boolean stating if it should be exported as a stand-alone question |
|
| 104 | - * @return string string, the XML flow for an Item. |
|
| 105 | - */ |
|
| 106 | - function export($standalone = false) |
|
| 107 | - { |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * add the response processing template used. |
|
| 90 | + * |
|
| 91 | + */ |
|
| 92 | + |
|
| 93 | + function add_response_processing() |
|
| 94 | + { |
|
| 95 | + return ' <responseProcessing template="http://www.imsglobal.org/question/qti_v2p1/rptemplates/map_correct"/>' . "\n"; |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + /** |
|
| 99 | + * Export the question as an IMS/QTI Item. |
|
| 100 | + * |
|
| 101 | + * This is a default behaviour, some classes may want to override this. |
|
| 102 | + * |
|
| 103 | + * @param $standalone: Boolean stating if it should be exported as a stand-alone question |
|
| 104 | + * @return string string, the XML flow for an Item. |
|
| 105 | + */ |
|
| 106 | + function export($standalone = false) |
|
| 107 | + { |
|
| 108 | 108 | $head = $foot = ""; |
| 109 | 109 | |
| 110 | 110 | if ($standalone) { |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | .$foot; |
| 132 | 132 | |
| 133 | 133 | return $res; |
| 134 | - } |
|
| 134 | + } |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -194,8 +194,8 @@ discard block |
||
| 194 | 194 | function export_presentation() |
| 195 | 195 | { |
| 196 | 196 | $out = "<presentation_material><flow_mat><material>\n" |
| 197 | - . " <mattext><![CDATA[" . formatExerciseQtiDescription($this->exercise->selectDescription()) . "]]></mattext>\n" |
|
| 198 | - . "</material></flow_mat></presentation_material>\n"; |
|
| 197 | + . " <mattext><![CDATA[" . formatExerciseQtiDescription($this->exercise->selectDescription()) . "]]></mattext>\n" |
|
| 198 | + . "</material></flow_mat></presentation_material>\n"; |
|
| 199 | 199 | return $out; |
| 200 | 200 | } |
| 201 | 201 | |
@@ -209,15 +209,15 @@ discard block |
||
| 209 | 209 | $out = ''; |
| 210 | 210 | if ($n = $this->exercise->getShuffle()) { |
| 211 | 211 | $out.= "<selection_ordering>" |
| 212 | - . " <selection>\n" |
|
| 213 | - . " <selection_number>" . $n . "</selection_number>\n" |
|
| 214 | - . " </selection>\n" |
|
| 215 | - . ' <order order_type="Random" />' |
|
| 216 | - . "\n</selection_ordering>\n"; |
|
| 212 | + . " <selection>\n" |
|
| 213 | + . " <selection_number>" . $n . "</selection_number>\n" |
|
| 214 | + . " </selection>\n" |
|
| 215 | + . ' <order order_type="Random" />' |
|
| 216 | + . "\n</selection_ordering>\n"; |
|
| 217 | 217 | } else { |
| 218 | 218 | $out.= '<selection_ordering sequence_type="Normal">' . "\n" |
| 219 | - . " <selection />\n" |
|
| 220 | - . "</selection_ordering>\n"; |
|
| 219 | + . " <selection />\n" |
|
| 220 | + . "</selection_ordering>\n"; |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | return $out; |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | { |
| 232 | 232 | $out = ""; |
| 233 | 233 | foreach ($this->exercise->selectQuestionList() as $q) { |
| 234 | - $out .= export_question_qti($q, false); |
|
| 234 | + $out .= export_question_qti($q, false); |
|
| 235 | 235 | } |
| 236 | 236 | return $out; |
| 237 | 237 | } |
@@ -248,18 +248,18 @@ discard block |
||
| 248 | 248 | $head = $foot = ""; |
| 249 | 249 | if ($standalone) { |
| 250 | 250 | $head = '<?xml version = "1.0" encoding = "UTF-8" standalone = "no"?>' . "\n" |
| 251 | - . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n" |
|
| 252 | - . "<questestinterop>\n"; |
|
| 251 | + . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n" |
|
| 252 | + . "<questestinterop>\n"; |
|
| 253 | 253 | $foot = "</questestinterop>\n"; |
| 254 | 254 | } |
| 255 | 255 | $out = $head |
| 256 | - . $this->start_section() |
|
| 257 | - . $this->export_duration() |
|
| 258 | - . $this->export_presentation() |
|
| 259 | - . $this->export_ordering() |
|
| 260 | - . $this->export_questions() |
|
| 261 | - . $this->end_section() |
|
| 262 | - . $foot; |
|
| 256 | + . $this->start_section() |
|
| 257 | + . $this->export_duration() |
|
| 258 | + . $this->export_presentation() |
|
| 259 | + . $this->export_ordering() |
|
| 260 | + . $this->export_questions() |
|
| 261 | + . $this->end_section() |
|
| 262 | + . $foot; |
|
| 263 | 263 | |
| 264 | 264 | return $out; |
| 265 | 265 | } |
@@ -306,97 +306,97 @@ discard block |
||
| 306 | 306 | * @return ImsItem |
| 307 | 307 | * @author Anamd Tihon |
| 308 | 308 | */ |
| 309 | - function __construct($question) |
|
| 310 | - { |
|
| 309 | + function __construct($question) |
|
| 310 | + { |
|
| 311 | 311 | $this->question = $question; |
| 312 | 312 | $this->answer = $question->answer; |
| 313 | 313 | $this->questionIdent = "QST_" . $question->selectId() ; |
| 314 | - } |
|
| 315 | - |
|
| 316 | - /** |
|
| 317 | - * Start the XML flow. |
|
| 318 | - * |
|
| 319 | - * This opens the <item> block, with correct attributes. |
|
| 320 | - * |
|
| 321 | - * @author Amand Tihon <[email protected]> |
|
| 322 | - */ |
|
| 323 | - function start_item() |
|
| 324 | - { |
|
| 314 | + } |
|
| 315 | + |
|
| 316 | + /** |
|
| 317 | + * Start the XML flow. |
|
| 318 | + * |
|
| 319 | + * This opens the <item> block, with correct attributes. |
|
| 320 | + * |
|
| 321 | + * @author Amand Tihon <[email protected]> |
|
| 322 | + */ |
|
| 323 | + function start_item() |
|
| 324 | + { |
|
| 325 | 325 | return '<item title="' . cleanAttribute(formatExerciseQtiDescription($this->question->selectTitle())) . '" ident="' . $this->questionIdent . '">' . "\n"; |
| 326 | - } |
|
| 327 | - |
|
| 328 | - /** |
|
| 329 | - * End the XML flow, closing the </item> tag. |
|
| 330 | - * |
|
| 331 | - * @author Amand Tihon <[email protected]> |
|
| 332 | - */ |
|
| 333 | - function end_item() |
|
| 334 | - { |
|
| 326 | + } |
|
| 327 | + |
|
| 328 | + /** |
|
| 329 | + * End the XML flow, closing the </item> tag. |
|
| 330 | + * |
|
| 331 | + * @author Amand Tihon <[email protected]> |
|
| 332 | + */ |
|
| 333 | + function end_item() |
|
| 334 | + { |
|
| 335 | 335 | return "</item>\n"; |
| 336 | - } |
|
| 337 | - |
|
| 338 | - /** |
|
| 339 | - * Create the opening, with the question itself. |
|
| 340 | - * |
|
| 341 | - * This means it opens the <presentation> but doesn't close it, as this is the role of end_presentation(). |
|
| 342 | - * In between, the export_responses from the subclass should have been called. |
|
| 343 | - * |
|
| 344 | - * @author Amand Tihon <[email protected]> |
|
| 345 | - */ |
|
| 346 | - function start_presentation() |
|
| 347 | - { |
|
| 336 | + } |
|
| 337 | + |
|
| 338 | + /** |
|
| 339 | + * Create the opening, with the question itself. |
|
| 340 | + * |
|
| 341 | + * This means it opens the <presentation> but doesn't close it, as this is the role of end_presentation(). |
|
| 342 | + * In between, the export_responses from the subclass should have been called. |
|
| 343 | + * |
|
| 344 | + * @author Amand Tihon <[email protected]> |
|
| 345 | + */ |
|
| 346 | + function start_presentation() |
|
| 347 | + { |
|
| 348 | 348 | return '<presentation label="' . $this->questionIdent . '"><flow>' . "\n" |
| 349 | - . '<material><mattext>' . formatExerciseQtiDescription($this->question->selectDescription()) . "</mattext></material>\n"; |
|
| 350 | - } |
|
| 351 | - |
|
| 352 | - /** |
|
| 353 | - * End the </presentation> part, opened by export_header. |
|
| 354 | - * |
|
| 355 | - * @author Amand Tihon <[email protected]> |
|
| 356 | - */ |
|
| 357 | - function end_presentation() |
|
| 358 | - { |
|
| 349 | + . '<material><mattext>' . formatExerciseQtiDescription($this->question->selectDescription()) . "</mattext></material>\n"; |
|
| 350 | + } |
|
| 351 | + |
|
| 352 | + /** |
|
| 353 | + * End the </presentation> part, opened by export_header. |
|
| 354 | + * |
|
| 355 | + * @author Amand Tihon <[email protected]> |
|
| 356 | + */ |
|
| 357 | + function end_presentation() |
|
| 358 | + { |
|
| 359 | 359 | return "</flow></presentation>\n"; |
| 360 | - } |
|
| 361 | - |
|
| 362 | - /** |
|
| 363 | - * Start the response processing, and declare the default variable, SCORE, at 0 in the outcomes. |
|
| 364 | - * |
|
| 365 | - * @author Amand Tihon <[email protected]> |
|
| 366 | - */ |
|
| 367 | - function start_processing() |
|
| 368 | - { |
|
| 360 | + } |
|
| 361 | + |
|
| 362 | + /** |
|
| 363 | + * Start the response processing, and declare the default variable, SCORE, at 0 in the outcomes. |
|
| 364 | + * |
|
| 365 | + * @author Amand Tihon <[email protected]> |
|
| 366 | + */ |
|
| 367 | + function start_processing() |
|
| 368 | + { |
|
| 369 | 369 | return '<resprocessing><outcomes><decvar vartype="Integer" defaultval="0" /></outcomes>' . "\n"; |
| 370 | - } |
|
| 371 | - |
|
| 372 | - /** |
|
| 373 | - * End the response processing part. |
|
| 374 | - * |
|
| 375 | - * @author Amand Tihon <[email protected]> |
|
| 376 | - */ |
|
| 377 | - function end_processing() |
|
| 378 | - { |
|
| 370 | + } |
|
| 371 | + |
|
| 372 | + /** |
|
| 373 | + * End the response processing part. |
|
| 374 | + * |
|
| 375 | + * @author Amand Tihon <[email protected]> |
|
| 376 | + */ |
|
| 377 | + function end_processing() |
|
| 378 | + { |
|
| 379 | 379 | return "</resprocessing>\n"; |
| 380 | - } |
|
| 381 | - |
|
| 382 | - /** |
|
| 383 | - * Export the question as an IMS/QTI Item. |
|
| 384 | - * |
|
| 385 | - * This is a default behaviour, some classes may want to override this. |
|
| 386 | - * |
|
| 387 | - * @param $standalone: Boolean stating if it should be exported as a stand-alone question |
|
| 388 | - * @return string string, the XML flow for an Item. |
|
| 389 | - * @author Amand Tihon <[email protected]> |
|
| 390 | - */ |
|
| 391 | - function export($standalone = False) |
|
| 392 | - { |
|
| 380 | + } |
|
| 381 | + |
|
| 382 | + /** |
|
| 383 | + * Export the question as an IMS/QTI Item. |
|
| 384 | + * |
|
| 385 | + * This is a default behaviour, some classes may want to override this. |
|
| 386 | + * |
|
| 387 | + * @param $standalone: Boolean stating if it should be exported as a stand-alone question |
|
| 388 | + * @return string string, the XML flow for an Item. |
|
| 389 | + * @author Amand Tihon <[email protected]> |
|
| 390 | + */ |
|
| 391 | + function export($standalone = False) |
|
| 392 | + { |
|
| 393 | 393 | global $charset; |
| 394 | 394 | $head = $foot = ""; |
| 395 | 395 | |
| 396 | 396 | if ($standalone) { |
| 397 | 397 | $head = '<?xml version = "1.0" encoding = "'.$charset.'" standalone = "no"?>' . "\n" |
| 398 | - . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n" |
|
| 399 | - . "<questestinterop>\n"; |
|
| 398 | + . '<!DOCTYPE questestinterop SYSTEM "ims_qtiasiv2p1.dtd">' . "\n" |
|
| 399 | + . "<questestinterop>\n"; |
|
| 400 | 400 | $foot = "</questestinterop>\n"; |
| 401 | 401 | } |
| 402 | 402 | |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | . $this->answer->imsExportFeedback($this->questionIdent) |
| 412 | 412 | . $this->end_item() |
| 413 | 413 | . $foot; |
| 414 | - } |
|
| 414 | + } |
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | /** |
@@ -450,9 +450,9 @@ discard block |
||
| 450 | 450 | $question->type = $qst->type; |
| 451 | 451 | $question->question = $qst->question; |
| 452 | 452 | $question->description = $qst->description; |
| 453 | - $question->weighting=$qst->weighting; |
|
| 454 | - $question->position=$qst->position; |
|
| 455 | - $question->picture=$qst->picture; |
|
| 453 | + $question->weighting=$qst->weighting; |
|
| 454 | + $question->position=$qst->position; |
|
| 455 | + $question->picture=$qst->picture; |
|
| 456 | 456 | $ims = new ImsAssessmentItem($question); |
| 457 | 457 | |
| 458 | 458 | return $ims->export($standalone); |
@@ -11,13 +11,13 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | if (!function_exists('mime_content_type')) { |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * @param string $filename |
|
| 14 | + /** |
|
| 15 | + * @param string $filename |
|
| 16 | 16 | * @return string |
| 17 | - */ |
|
| 18 | - function mime_content_type($filename) { |
|
| 19 | - return DocumentManager::file_get_mime_type((string)$filename); |
|
| 20 | - } |
|
| 17 | + */ |
|
| 18 | + function mime_content_type($filename) { |
|
| 19 | + return DocumentManager::file_get_mime_type((string)$filename); |
|
| 20 | + } |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | case MCUA : |
| 36 | 36 | $answer = new AikenAnswerMultipleChoice($this->id); |
| 37 | - return $answer; |
|
| 37 | + return $answer; |
|
| 38 | 38 | default : |
| 39 | 39 | $answer = null; |
| 40 | 40 | break; |
@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | function createAnswersForm($form) |
| 45 | 45 | { |
| 46 | - return true; |
|
| 46 | + return true; |
|
| 47 | 47 | } |
| 48 | 48 | function processAnswersCreation($form) |
| 49 | 49 | { |
| 50 | - return true; |
|
| 50 | + return true; |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |