diff --git a/lib/classes/plugin_manager.php b/lib/classes/plugin_manager.php index 3eca388a974..be8cb4fabbb 100644 --- a/lib/classes/plugin_manager.php +++ b/lib/classes/plugin_manager.php @@ -910,7 +910,7 @@ class core_plugin_manager { // branch, listed should be no plugins that were removed at 1.9.x - 2.1.x versions as // Moodle 2.3 supports upgrades from 2.2.x only. $plugins = array( - 'qformat' => array('blackboard'), + 'qformat' => array('blackboard', 'learnwise'), 'enrol' => array('authorize'), 'tinymce' => array('dragmath'), 'tool' => array('bloglevelupgrade', 'qeupgradehelper'), @@ -1086,7 +1086,7 @@ class core_plugin_manager { 'qformat' => array( 'aiken', 'blackboard_six', 'examview', 'gift', - 'learnwise', 'missingword', 'multianswer', 'webct', + 'missingword', 'multianswer', 'webct', 'xhtml', 'xml' ), diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index d1cde7ae24b..fc57a4ab581 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -3964,5 +3964,15 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2014100700.01); } + if ($oldversion < 2014100800.00) { + // Remove qformat_learnwise (unless it has manually been added back). + if (!file_exists($CFG->dirroot . '/question/format/learnwise/format.php')) { + unset_all_config_for_plugin('qformat_learnwise'); + } + + // Main savepoint reached. + upgrade_main_savepoint(true, 2014100800.00); + } + return true; } diff --git a/question/format/learnwise/format.php b/question/format/learnwise/format.php deleted file mode 100644 index 71d35739d58..00000000000 --- a/question/format/learnwise/format.php +++ /dev/null @@ -1,190 +0,0 @@ -. - -/** - * Examview question importer. - * - * @package qformat_learnwise - * @copyright 2005 Alton College, Hampshire, UK - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - - -defined('MOODLE_INTERNAL') || die(); - - -/** - * Examview question importer. - * - * Alton College, Hampshire, UK - Tom Flannaghan, Andrew Walker - * - * Imports learnwise multiple choice questions (single and multiple answers) - * currently ignores the deduct attribute for multiple answer questions - * deductions are currently simply found by dividing the award for the incorrect - * answer by the total number of options - * - * @copyright 2005 Alton College, Hampshire, UK - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ -class qformat_learnwise extends qformat_default { - - public function provide_import() { - return true; - } - - public function export_file_extension() { - return '.xml'; - } - - protected function readquestions($lines) { - $questions = array(); - $currentquestion = array(); - - foreach ($lines as $line) { - $line = trim($line); - $currentquestion[] = $line; - - if ($question = $this->readquestion($currentquestion)) { - $questions[] = $question; - $currentquestion = array(); - } - } - return $questions; - } - - protected function readquestion($lines) { - global $OUTPUT; - - $text = implode(' ', $lines); - $text = str_replace(array('\t', '\n', '\r'), array('', '', ''), $text); - - $startpos = strpos($text, ''); - if ($startpos === false || $endpos === false) { - return false; - } - - preg_match("//i", $text, $matches); - $type = strtolower($matches[1]); // Multichoice or multianswerchoice. - - $questiontext = core_text::entities_to_utf8($this->stringbetween($text, '', '')); - $questionhint = core_text::entities_to_utf8($this->stringbetween($text, '', '')); - $questionaward = $this->stringbetween($text, '', ''); - $optionlist = $this->stringbetween($text, '', ''); - - $optionlist = explode('stringbetween($option, ' correct="', '">'); - $answer = $this->stringbetween($option, '">', ''); - $optionscorrect[$n] = $correct; - $optionstext[$n] = core_text::entities_to_utf8($answer); - ++$n; - } - } else if ($type == 'multianswerchoice') { - $numcorrect = 0; - $totalaward = 0; - - $optionsaward = array(); - - foreach ($optionlist as $option) { - if (trim($option) === '') { - continue; - } - preg_match("/correct=\"([^\"]*)\"/i", $option, $correctmatch); - preg_match("/award=\"([^\"]*)\"/i", $option, $awardmatch); - - $correct = $correctmatch[1]; - $award = $awardmatch[1]; - if ($correct == 'yes') { - $totalaward += $award; - ++$numcorrect; - } - - $answer = $this->stringbetween($option, '">', ''); - - $optionscorrect[$n] = $correct; - $optionstext[$n] = core_text::entities_to_utf8($answer); - $optionsaward[$n] = $award; - ++$n; - } - - } else { - echo $OUTPUT->notification(get_string('unknownorunhandledtype', 'question', $type)); - } - - $question = $this->defaultquestion(); - $question->qtype = 'multichoice'; - $question->name = $this->create_default_question_name($questiontext, get_string('questionname', 'question')); - $this->add_blank_combined_feedback($question); - - $question->questiontext = $questiontext; - $question->questiontextformat = FORMAT_HTML; - $question->single = ($type == 'multichoice') ? 1 : 0; - - $question->fraction = array(); - $question->answer = array(); - for ($n = 0; $n < count($optionstext); ++$n) { - if ($optionstext[$n]) { - if (!isset($numcorrect)) { - // Single answer. - if ($optionscorrect[$n] == 'yes') { - $fraction = (int) $questionaward; - } else { - $fraction = 0; - } - } else { - // Multiple answers. - if ($optionscorrect[$n] == 'yes') { - $fraction = $optionsaward[$n] / $totalaward; - } else { - $fraction = -$optionsaward[$n] / count($optionstext); - } - } - $question->fraction[] = $fraction; - $question->answer[] = array('text' => $optionstext[$n], 'format' => FORMAT_HTML); - $question->feedback[] = array('text' => '', 'format' => FORMAT_HTML); // No feedback in this type. - } - } - - return $question; - } - - /** - * Extract the substring of $text between $start and $end. - * @param string $text text to analyse. - * @param string $start opening delimiter. - * @param string $end closing delimiter. - * @return string the requested substring. - */ - protected function stringbetween($text, $start, $end) { - $startpos = strpos($text, $start) + strlen($start); - $endpos = strpos($text, $end); - - if ($startpos <= $endpos) { - return substr($text, $startpos, $endpos - $startpos); - } - } -} diff --git a/question/format/learnwise/lang/en/qformat_learnwise.php b/question/format/learnwise/lang/en/qformat_learnwise.php deleted file mode 100644 index cae2d7b0454..00000000000 --- a/question/format/learnwise/lang/en/qformat_learnwise.php +++ /dev/null @@ -1,26 +0,0 @@ -. - -/** - * Strings for component 'qformat_learnwise', language 'en', branch 'MOODLE_20_STABLE' - * - * @package qformat_learnwise - * @copyright 2010 Helen Foster - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -$string['pluginname'] = 'Learnwise format'; -$string['pluginname_help'] = 'This format enables the import of multiple choice questions saved in Learnwise\'s XML format.'; diff --git a/question/format/learnwise/learnwise-example.xml b/question/format/learnwise/learnwise-example.xml deleted file mode 100644 index 4dae12b7d31..00000000000 --- a/question/format/learnwise/learnwise-example.xml +++ /dev/null @@ -1,145 +0,0 @@ - - - Maths - - - The ages, in years, of 10 horses in a field were 3, 3, 4, 5, 7, 7, 7, 8, 8, 8,<p> -Which one of the following is true? - 1 - mean = (3+3+4+5+7+7+7+8+8+8)/10 = 6<p> -median = 7 i.e the middle number<p> -range = 8-3 = 5 - - - - - - - - - At a college, students are given a points score calculated from their GCSE grades.<p> -Someone with 4 A grades and 4 B grades gains a score of 36 points.<br>Someone with 2 A grades and 4 B grades gains a score of 26 points.<br>Someone with 3 A grades and 3 B grades would have a score of - 1 - 4A + 4B = 36 and 2A + 4B = 26<p>solving simultaneously gives A = 5 and B = 4 - - - - - - - - - A sequence consists of adding the previous three terms together to form the next term. The first three terms of the sequence are 1, 2, 3.<p> -What is the sixth term in the sequence? - 1 - 1, 2, 3, 6, 11, ... - - - - - - - - - The value of an item is described as decreasing exponentially. Which description below best matches this statement? - 1 - No hint - you either know this or you don't! - - - - - - - - - Consider the statement<p> -"Schools with high numbers of pupils on free school meals do not do well in league tables."<p> -Which of the following statements follows logically from the one above? - 1 - Factors other than the number of pupils on free school meals affect how well a school does in league tables. - - - - - - - - - The force between two point electric charges is inversely proportional to the square of their distance apart. What effect does doubling this distance have on the force? - 1 - Inversely proportional means that increasing the distance decreases the force.<br>2 squared gives 4. - - - - - - - - - Two of the five playing cards that Colin has are aces. He shuffles the five cards, then puts them face down on the table. Madge takes a card and then another. The probability that she now has <b>both</b> of the aces is - 1 - 2/5 x 1/4 - - - - - - - - - A college's guidelines say that classes must have a minimum of 12 students and a maximum of 20 students. For what numbers of students studying a particular subject is it impossible to run classes without breaking the guidelines? - 1 - between 12 and 20 students - one class<br> -between 24 and 36 students - two classes<br> -between 36 and 40 students - two classes - - - - - - - - - The ages of two friends are in the ratio 3:4. In 8 years time their ages will be in the ratio 5:6. How old are they now? - 1 - (12+8):(16+8) = 20:24 = 5:6 - - - - - - - - - A heavy construction vehicle travels for 40 minutes between sites, at an average speed of 16 km per second. The distance between sites is - 1 - 16/60 x 40 - - - - - - - - - Which of the following are features of a Virtual Learning Environment? (Select all that apply) - - - - - - - - - - - Which of the following may a Virtual Learning Environment be used for? (Select all that apply) - - - - - - - - - diff --git a/question/format/learnwise/version.php b/question/format/learnwise/version.php deleted file mode 100644 index 05bce4acca9..00000000000 --- a/question/format/learnwise/version.php +++ /dev/null @@ -1,32 +0,0 @@ -. - -/** - * Version information for the calculated question type. - * - * @package qformat_learnwise - * @copyright 2011 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -defined('MOODLE_INTERNAL') || die(); - -$plugin->component = 'qformat_learnwise'; -$plugin->version = 2014051200; - -$plugin->requires = 2014050800; - -$plugin->maturity = MATURITY_STABLE; diff --git a/version.php b/version.php index 5acac654564..da46cfee28f 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2014100700.01; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2014100800.00; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes.