From: thepurpleblob Date: Tue, 25 Jan 2005 20:18:05 +0000 (+0000) Subject: Adding Learnwise import - created by Alton College, Hampshire UK X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=1680925333d35cb0ed0209f3b5c27fc681c9d278;p=moodle.git Adding Learnwise import - created by Alton College, Hampshire UK Still to do testing etc. --- diff --git a/mod/quiz/format/learnwise/format.php b/mod/quiz/format/learnwise/format.php new file mode 100755 index 0000000000..b8fe644aab --- /dev/null +++ b/mod/quiz/format/learnwise/format.php @@ -0,0 +1,100 @@ +readquestion($currentquestion)) { + $questions[] = $question; + $currentquestion = array(); + } + } + + return $questions; + } + + function readquestion($lines) { + $text = ''; + foreach ($lines as $line) $text .= $line; + $text = str_replace(array('\t','\n','\r','\''), array('','','','\\\''), $text); + $len = strlen($text); + + $question = NULL; + + if($questiontype = sscanf($text, '')) + { + if($pos = stripos($text, '')) + { + $text = substr($text, 0, $pos); + $text = stristr($text, '', ''); + $questionaward = string_between($text, '', ''); + $questionhint = string_between($text, '', ''); + $optionlist = string_between($text, '', ''); + + $optionlist = explode(''); + $b = string_between($option, '">', ''); + + $options_correct[$n] = $a; $options_text[$n] = $b; + //echo "$a, $b
"; + $n++; + + } + + $question->qtype = MULTICHOICE; + $question->name = substr($questiontext,0,30); + if(strlen($questionlen)<30) $question->name .= '...'; + $question->questiontext = $questiontext; + $question->single = 1; + $question->feedback[] = ''; + $question->usecase = 0; + $question->defaultgrade = 1; + $question->image = ''; + + for($n=0; $nfraction[] = $fraction; + $question->answer[] = $options_text[$n]; + //echo "hello: $options_text[$n], $fraction
"; + } + } + } + } + + return $question; + } +} + +?>