<?php
-///////////////////////////////////////////////////////////////////////////
-// //
-// NOTICE OF COPYRIGHT //
-// //
-// Moodle - Modular Object-Oriented Dynamic Learning Environment //
-// http://moodle.org //
-// //
-// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
-// //
-// This program is free software; you can redistribute it and/or modify //
-// it under the terms of the GNU General Public License as published by //
-// the Free Software Foundation; either version 2 of the License, or //
-// (at your option) any later version. //
-// //
-// This program is distributed in the hope that it will be useful, //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
-// GNU General Public License for more details: //
-// //
-// http://www.gnu.org/copyleft/gpl.html //
-// //
-///////////////////////////////////////////////////////////////////////////
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Shows a screen where the user can choose a question type, before being
* redirected to question.php
*
- * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
- * @package questionbank
- *//** */
+ * @package moodlecore
+ * @subpackage questionbank
+ * @copyright 2009 Tim Hunt
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
require_once(dirname(__FILE__) . '/../config.php');
require_once(dirname(__FILE__) . '/editlib.php');
<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
/**
- * Allows a teacher to create, edit and delete categories
+ * This script allows a teacher to create, edit and delete question categories.
*
- * @author Martin Dougiamas and many others.
- * {@link http://moodle.org}
- * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
- * @package questionbank
+ * @package moodlecore
+ * @subpackage questionbank
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
- require_once("../config.php");
- require_once($CFG->dirroot."/question/editlib.php");
- require_once($CFG->dirroot."/question/category_class.php");
- list($thispageurl, $contexts, $cmid, $cm, $module, $pagevars) =
- question_edit_setup('categories', '/question/category.php');
+require_once("../config.php");
+require_once($CFG->dirroot."/question/editlib.php");
+require_once($CFG->dirroot."/question/category_class.php");
+
+list($thispageurl, $contexts, $cmid, $cm, $module, $pagevars) =
+ question_edit_setup('categories', '/question/category.php');
- // get values from form for actions on this page
- $param = new stdClass();
- $param->moveup = optional_param('moveup', 0, PARAM_INT);
- $param->movedown = optional_param('movedown', 0, PARAM_INT);
- $param->moveupcontext = optional_param('moveupcontext', 0, PARAM_INT);
- $param->movedowncontext = optional_param('movedowncontext', 0, PARAM_INT);
- $param->tocontext = optional_param('tocontext', 0, PARAM_INT);
- $param->left = optional_param('left', 0, PARAM_INT);
- $param->right = optional_param('right', 0, PARAM_INT);
- $param->delete = optional_param('delete', 0, PARAM_INT);
- $param->confirm = optional_param('confirm', 0, PARAM_INT);
- $param->cancel = optional_param('cancel', '', PARAM_ALPHA);
- $param->move = optional_param('move', 0, PARAM_INT);
- $param->moveto = optional_param('moveto', 0, PARAM_INT);
- $param->edit = optional_param('edit', 0, PARAM_INT);
+// get values from form for actions on this page
+$param = new stdClass();
+$param->moveup = optional_param('moveup', 0, PARAM_INT);
+$param->movedown = optional_param('movedown', 0, PARAM_INT);
+$param->moveupcontext = optional_param('moveupcontext', 0, PARAM_INT);
+$param->movedowncontext = optional_param('movedowncontext', 0, PARAM_INT);
+$param->tocontext = optional_param('tocontext', 0, PARAM_INT);
+$param->left = optional_param('left', 0, PARAM_INT);
+$param->right = optional_param('right', 0, PARAM_INT);
+$param->delete = optional_param('delete', 0, PARAM_INT);
+$param->confirm = optional_param('confirm', 0, PARAM_INT);
+$param->cancel = optional_param('cancel', '', PARAM_ALPHA);
+$param->move = optional_param('move', 0, PARAM_INT);
+$param->moveto = optional_param('moveto', 0, PARAM_INT);
+$param->edit = optional_param('edit', 0, PARAM_INT);
- $url = new moodle_url($thispageurl);
- foreach ((array)$param as $key=>$value) {
- if (($key !== 'cancel' && $value !== 0) || ($key === 'cancel' && $value !== '')) {
- $url->param($key, $value);
- }
+$url = new moodle_url($thispageurl);
+foreach ((array)$param as $key=>$value) {
+ if (($key !== 'cancel' && $value !== 0) || ($key === 'cancel' && $value !== '')) {
+ $url->param($key, $value);
}
- $PAGE->set_url($url);
- $PAGE->set_pagelayout('standard');
+}
+$PAGE->set_url($url);
+$PAGE->set_pagelayout('standard');
- $qcobject = new question_category_object($pagevars['cpage'], $thispageurl, $contexts->having_one_edit_tab_cap('categories'), $param->edit, $pagevars['cat'], $param->delete,
- $contexts->having_cap('moodle/question:add'));
+$qcobject = new question_category_object($pagevars['cpage'], $thispageurl, $contexts->having_one_edit_tab_cap('categories'), $param->edit, $pagevars['cat'], $param->delete,
+ $contexts->having_cap('moodle/question:add'));
- $streditingcategories = get_string('editcategories', 'quiz');
- if ($param->left || $param->right || $param->moveup || $param->movedown|| $param->moveupcontext || $param->movedowncontext){
- require_sesskey();
- foreach ($qcobject->editlists as $list){
- //processing of these actions is handled in the method where appropriate and page redirects.
- $list->process_actions($param->left, $param->right, $param->moveup, $param->movedown,
- $param->moveupcontext, $param->movedowncontext, $param->tocontext);
- }
+$streditingcategories = get_string('editcategories', 'quiz');
+if ($param->left || $param->right || $param->moveup || $param->movedown|| $param->moveupcontext || $param->movedowncontext){
+ require_sesskey();
+ foreach ($qcobject->editlists as $list){
+ //processing of these actions is handled in the method where appropriate and page redirects.
+ $list->process_actions($param->left, $param->right, $param->moveup, $param->movedown,
+ $param->moveupcontext, $param->movedowncontext, $param->tocontext);
}
- if ($param->delete && ($questionstomove = $DB->count_records("question", array("category" => $param->delete)))){
- if (!$category = $DB->get_record("question_categories", array("id" => $param->delete))) { // security
- print_error('nocate', 'question', $thispageurl->out(), $param->delete);
- }
- $categorycontext = get_context_instance_by_id($category->contextid);
- $qcobject->moveform = new question_move_form($thispageurl,
- array('contexts'=>array($categorycontext), 'currentcat'=>$param->delete));
- if ($qcobject->moveform->is_cancelled()){
- redirect($thispageurl);
- } elseif ($formdata = $qcobject->moveform->get_data()) {
- /// 'confirm' is the category to move existing questions to
- list($tocategoryid, $tocontextid) = explode(',', $formdata->category);
- $qcobject->move_questions_and_delete_category($formdata->delete, $tocategoryid);
- $thispageurl->remove_params('cat', 'category');
- redirect($thispageurl);
- }
- } else {
- $questionstomove = 0;
+}
+if ($param->delete && ($questionstomove = $DB->count_records("question", array("category" => $param->delete)))){
+ if (!$category = $DB->get_record("question_categories", array("id" => $param->delete))) { // security
+ print_error('nocate', 'question', $thispageurl->out(), $param->delete);
}
- if ($qcobject->catform->is_cancelled()) {
- redirect($thispageurl);
- } else if ($catformdata = $qcobject->catform->get_data()) {
- if (!$catformdata->id) {//new category
- $qcobject->add_category($catformdata->parent, $catformdata->name, $catformdata->info);
- } else {
- $qcobject->update_category($catformdata->id, $catformdata->parent, $catformdata->name, $catformdata->info);
- }
+ $categorycontext = get_context_instance_by_id($category->contextid);
+ $qcobject->moveform = new question_move_form($thispageurl,
+ array('contexts'=>array($categorycontext), 'currentcat'=>$param->delete));
+ if ($qcobject->moveform->is_cancelled()){
redirect($thispageurl);
- } else if ((!empty($param->delete) and (!$questionstomove) and confirm_sesskey())) {
- $qcobject->delete_category($param->delete);//delete the category now no questions to move
+ } elseif ($formdata = $qcobject->moveform->get_data()) {
+ /// 'confirm' is the category to move existing questions to
+ list($tocategoryid, $tocontextid) = explode(',', $formdata->category);
+ $qcobject->move_questions_and_delete_category($formdata->delete, $tocategoryid);
$thispageurl->remove_params('cat', 'category');
redirect($thispageurl);
}
-
- if ($param->edit){
- $PAGE->navbar->add(get_string('editingcategory', 'question'));
+} else {
+ $questionstomove = 0;
+}
+if ($qcobject->catform->is_cancelled()) {
+ redirect($thispageurl);
+} else if ($catformdata = $qcobject->catform->get_data()) {
+ if (!$catformdata->id) {//new category
+ $qcobject->add_category($catformdata->parent, $catformdata->name, $catformdata->info);
+ } else {
+ $qcobject->update_category($catformdata->id, $catformdata->parent, $catformdata->name, $catformdata->info);
}
+ redirect($thispageurl);
+} else if ((!empty($param->delete) and (!$questionstomove) and confirm_sesskey())) {
+ $qcobject->delete_category($param->delete);//delete the category now no questions to move
+ $thispageurl->remove_params('cat', 'category');
+ redirect($thispageurl);
+}
- $PAGE->set_title($streditingcategories);
- $PAGE->set_heading($COURSE->fullname);
- echo $OUTPUT->header();
+if ($param->edit){
+ $PAGE->navbar->add(get_string('editingcategory', 'question'));
+}
- // display UI
- if (!empty($param->edit)) {
- $qcobject->edit_single_category($param->edit);
- } else if ($questionstomove){
- $qcobject->display_move_form($questionstomove, $category);
- } else {
- // display the user interface
- $qcobject->display_user_interface();
- }
- echo $OUTPUT->footer();
+$PAGE->set_title($streditingcategories);
+$PAGE->set_heading($COURSE->fullname);
+echo $OUTPUT->header();
+// display UI
+if (!empty($param->edit)) {
+ $qcobject->edit_single_category($param->edit);
+} else if ($questionstomove){
+ $qcobject->display_move_form($questionstomove, $category);
+} else {
+ // display the user interface
+ $qcobject->display_user_interface();
+}
+echo $OUTPUT->footer();
<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * A class for representing question categories.
+ *
+ * @package moodlecore
+ * @subpackage questionbank
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
/**
* Class representing question categories
*
- * @author Martin Dougiamas and many others. {@link http://moodle.org}
- * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
- * @package questionbank
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// number of categories to display on page
-define("QUESTION_PAGE_LENGTH", 25);
+define('QUESTION_PAGE_LENGTH', 25);
require_once($CFG->libdir . '/listlib.php');
require_once($CFG->dirroot . '/question/category_form.php');
<?php
-///////////////////////////////////////////////////////////////////////////
-// //
-// NOTICE OF COPYRIGHT //
-// //
-// Moodle - Modular Object-Oriented Dynamic Learning Environment //
-// http://moodle.org //
-// //
-// Copyright (C) 1999 onwards Martin Dougiamas and others //
-// //
-// This program is free software; you can redistribute it and/or modify //
-// it under the terms of the GNU General Public License as published by //
-// the Free Software Foundation; either version 2 of the License, or //
-// (at your option) any later version. //
-// //
-// This program is distributed in the hope that it will be useful, //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
-// GNU General Public License for more details: //
-// //
-// http://www.gnu.org/copyleft/gpl.html //
-// //
-///////////////////////////////////////////////////////////////////////////
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Page to edit the question bank
*
- * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
- * @package questionbank
+ * @package moodlecore
+ * @subpackage questionbank
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
- require_once("../config.php");
- require_once("editlib.php");
- $url = new moodle_url('/question/edit.php');
- if (($lastchanged = optional_param('lastchanged', 0, PARAM_INT)) !== 0) {
- $url->param('lastchanged', $lastchanged);
- }
- if (($category = optional_param('category', 0, PARAM_TEXT)) !== 0) {
- $url->param('category', $category);
- }
- if (($qpage = optional_param('qpage', 0, PARAM_INT)) !== 0) {
- $url->param('qpage', $qpage);
- }
- if (($cat = optional_param('cat', 0, PARAM_TEXT)) !== 0) {
- $url->param('cat', $cat);
- }
- if (($courseid = optional_param('courseid', 0, PARAM_INT)) !== 0) {
- $url->param('courseid', $courseid);
- }
- if (($returnurl = optional_param('returnurl', 0, PARAM_INT)) !== 0) {
- $url->param('returnurl', $returnurl);
- }
- if (($cmid = optional_param('cmid', 0, PARAM_INT)) !== 0) {
- $url->param('cmid', $cmid);
- }
- $PAGE->set_url($url);
- $PAGE->set_pagelayout('standard');
+require_once(dirname(__FILE__) . '/../config.php');
+require_once($CFG->dirroot . '/question/editlib.php');
- list($thispageurl, $contexts, $cmid, $cm, $module, $pagevars) =
- question_edit_setup('questions', '/question/edit.php');
- $questionbank = new question_bank_view($contexts, $thispageurl, $COURSE, $cm);
- $questionbank->process_actions();
+$url = new moodle_url('/question/edit.php');
+if (($lastchanged = optional_param('lastchanged', 0, PARAM_INT)) !== 0) {
+ $url->param('lastchanged', $lastchanged);
+}
+if (($category = optional_param('category', 0, PARAM_TEXT)) !== 0) {
+ $url->param('category', $category);
+}
+if (($qpage = optional_param('qpage', 0, PARAM_INT)) !== 0) {
+ $url->param('qpage', $qpage);
+}
+if (($cat = optional_param('cat', 0, PARAM_TEXT)) !== 0) {
+ $url->param('cat', $cat);
+}
+if (($courseid = optional_param('courseid', 0, PARAM_INT)) !== 0) {
+ $url->param('courseid', $courseid);
+}
+if (($returnurl = optional_param('returnurl', 0, PARAM_INT)) !== 0) {
+ $url->param('returnurl', $returnurl);
+}
+if (($cmid = optional_param('cmid', 0, PARAM_INT)) !== 0) {
+ $url->param('cmid', $cmid);
+}
+$PAGE->set_url($url);
+$PAGE->set_pagelayout('standard');
- // TODO log this page view.
+list($thispageurl, $contexts, $cmid, $cm, $module, $pagevars) =
+ question_edit_setup('questions', '/question/edit.php');
+$questionbank = new question_bank_view($contexts, $thispageurl, $COURSE, $cm);
+$questionbank->process_actions();
- $context = $contexts->lowest();
- $streditingquestions = get_string('editquestions', "quiz");
- $PAGE->set_title($streditingquestions);
- $PAGE->set_heading($COURSE->fullname);
- echo $OUTPUT->header();
+// TODO log this page view.
- echo '<div class="questionbankwindow boxwidthwide boxaligncenter">';
- $questionbank->display('questions', $pagevars['qpage'],
- $pagevars['qperpage'], $pagevars['qsortorder'], $pagevars['qsortorderdecoded'],
- $pagevars['cat'], $pagevars['recurse'], $pagevars['showhidden'], $pagevars['showquestiontext']);
- echo "</div>\n";
+$context = $contexts->lowest();
+$streditingquestions = get_string('editquestions', "quiz");
+$PAGE->set_title($streditingquestions);
+$PAGE->set_heading($COURSE->fullname);
+echo $OUTPUT->header();
- echo $OUTPUT->footer();
+echo '<div class="questionbankwindow boxwidthwide boxaligncenter">';
+$questionbank->display('questions', $pagevars['qpage'],
+ $pagevars['qperpage'], $pagevars['qsortorder'], $pagevars['qsortorderdecoded'],
+ $pagevars['cat'], $pagevars['recurse'], $pagevars['showhidden'], $pagevars['showquestiontext']);
+echo "</div>\n";
+echo $OUTPUT->footer();
<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
/**
- * Export quiz questions into the given category
+ * Script for importing questions into the question bank.
*
- * @author Martin Dougiamas, Howard Miller, and many others.
- * {@link http://moodle.org}
- * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
- * @package questionbank
- * @subpackage importexport
+ * @package moodlecore
+ * @subpackage questionbank
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
- require_once("../config.php");
- require_once("editlib.php");
- require_once("export_form.php");
- $PAGE->set_pagelayout('standard');
+require_once(dirname(__FILE__) . '/../config.php');
+require_once($CFG->dirroot . '/question/editlib.php');
+require_once($CFG->dirroot . '/question/export_form.php');
- list($thispageurl, $contexts, $cmid, $cm, $module, $pagevars) =
- question_edit_setup('export', '/question/export.php');
+$PAGE->set_pagelayout('standard');
- // get display strings
- $strexportquestions = get_string('exportquestions', 'question');
+list($thispageurl, $contexts, $cmid, $cm, $module, $pagevars) =
+ question_edit_setup('export', '/question/export.php');
- // make sure we are using the user's most recent category choice
- if (empty($categoryid)) {
- $categoryid = $pagevars['cat'];
- }
+// get display strings
+$strexportquestions = get_string('exportquestions', 'question');
- list($catid, $catcontext) = explode(',', $pagevars['cat']);
- if (!$category = $DB->get_record("question_categories", array("id" => $catid, 'contextid' => $catcontext))) {
- print_error('nocategory','quiz');
- }
+// make sure we are using the user's most recent category choice
+if (empty($categoryid)) {
+ $categoryid = $pagevars['cat'];
+}
+
+list($catid, $catcontext) = explode(',', $pagevars['cat']);
+if (!$category = $DB->get_record("question_categories", array("id" => $catid, 'contextid' => $catcontext))) {
+ print_error('nocategory','quiz');
+}
+
+/// Header
+$PAGE->set_url($thispageurl->out());
+$PAGE->set_title($strexportquestions);
+$PAGE->set_heading($COURSE->fullname);
+echo $OUTPUT->header();
+
+$export_form = new question_export_form($thispageurl, array('contexts'=>$contexts->having_one_edit_tab_cap('export'), 'defaultcategory'=>$pagevars['cat']));
- /// Header
- $PAGE->set_url($thispageurl->out());
- $PAGE->set_title($strexportquestions);
- $PAGE->set_heading($COURSE->fullname);
- echo $OUTPUT->header();
-
- $export_form = new question_export_form($thispageurl, array('contexts'=>$contexts->having_one_edit_tab_cap('export'), 'defaultcategory'=>$pagevars['cat']));
-
-
- if ($from_form = $export_form->get_data()) {
- $thiscontext = $contexts->lowest();
- if (!is_readable("format/$from_form->format/format.php")) {
- print_error('unknowformat', '', '', $from_form->format);
- }
- $withcategories = 'nocategories';
- if (!empty($from_form->cattofile)) {
- $withcategories = 'withcategories';
- }
- $withcontexts = 'nocontexts';
- if (!empty($from_form->contexttofile)) {
- $withcontexts = 'withcontexts';
- }
-
- $classname = 'qformat_' . $from_form->format;
- $qformat = new $classname();
- $filename = question_default_export_filename($COURSE, $category) .
- $qformat->export_file_extension();
- $export_url = question_make_export_url($thiscontext->id, $category->id,
- $from_form->format, $withcategories, $withcontexts, $filename);
-
- echo $OUTPUT->box_start();
- echo get_string('yourfileshoulddownload', 'question', $export_url->out());
- echo $OUTPUT->box_end();
-
- $PAGE->requires->js_function_call('document.location.replace', array($export_url->out()), false, 1);
-
- echo $OUTPUT->continue_button(new moodle_url('edit.php', $thispageurl->params()));
- echo $OUTPUT->footer();
- exit;
+
+if ($from_form = $export_form->get_data()) {
+ $thiscontext = $contexts->lowest();
+ if (!is_readable("format/$from_form->format/format.php")) {
+ print_error('unknowformat', '', '', $from_form->format);
+ }
+ $withcategories = 'nocategories';
+ if (!empty($from_form->cattofile)) {
+ $withcategories = 'withcategories';
}
+ $withcontexts = 'nocontexts';
+ if (!empty($from_form->contexttofile)) {
+ $withcontexts = 'withcontexts';
+ }
+
+ $classname = 'qformat_' . $from_form->format;
+ $qformat = new $classname();
+ $filename = question_default_export_filename($COURSE, $category) .
+ $qformat->export_file_extension();
+ $export_url = question_make_export_url($thiscontext->id, $category->id,
+ $from_form->format, $withcategories, $withcontexts, $filename);
- /// Display export form
- echo $OUTPUT->heading_with_help($strexportquestions, 'exportquestions', 'question');
+ echo $OUTPUT->box_start();
+ echo get_string('yourfileshoulddownload', 'question', $export_url->out());
+ echo $OUTPUT->box_end();
- $export_form->display();
+ $PAGE->requires->js_function_call('document.location.replace', array($export_url->out()), false, 1);
+ echo $OUTPUT->continue_button(new moodle_url('edit.php', $thispageurl->params()));
echo $OUTPUT->footer();
+ exit;
+}
+
+/// Display export form
+echo $OUTPUT->heading_with_help($strexportquestions, 'exportquestions', 'question');
+
+$export_form->display();
+
+echo $OUTPUT->footer();
<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Defines the base class for question import and export formats.
+ *
+ * @package moodlecore
+ * @subpackage questionbank
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+
/**
* Base class for question import and export formats.
*
- * @author Martin Dougiamas, Howard Miller, and many others.
- * {@link http://moodle.org}
- * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
- * @package questionbank
- * @subpackage importexport
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qformat_default {
<?php
-///////////////////////////////////////////////////////////////////////////
-// //
-// NOTICE OF COPYRIGHT //
-// //
-// Moodle - Modular Object-Oriented Dynamic Learning Environment //
-// http://moodle.org //
-// //
-// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
-// //
-// This program is free software; you can redistribute it and/or modify //
-// it under the terms of the GNU General Public License as published by //
-// the Free Software Foundation; either version 2 of the License, or //
-// (at your option) any later version. //
-// //
-// This program is distributed in the hope that it will be useful, //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
-// GNU General Public License for more details: //
-// //
-// http://www.gnu.org/copyleft/gpl.html //
-// //
-///////////////////////////////////////////////////////////////////////////
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Aiken format question importer.
+ *
+ * @package qformat
+ * @subpackage aiken
+ * @copyright 2003 Tom Robb <tom@robb.net>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
/**
* Aiken format - a simple format for creating multiple choice questions (with
*
* Be sure to word "All of the above" type choices like "All of these" in
* case choices are being shuffled.
+ *
+ * @copyright 2003 Tom Robb <tom@robb.net>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qformat_aiken extends qformat_default {
<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-////////////////////////////////////////////////////////////////////////////
-/// Blackboard 6.0 Format
-///
-/// This Moodle class provides all functions necessary to import and export
-///
-///
-////////////////////////////////////////////////////////////////////////////
-
-// Based on default.php, included by ../import.php
/**
- * @package questionbank
- * @subpackage importexport
+ * Blackboard question importer.
+ *
+ * @package qformat
+ * @subpackage blackboard
+ * @copyright 2003 Scott Elliott
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-require_once ("$CFG->libdir/xmlize.php");
+
+require_once ($CFG->libdir . '/xmlize.php');
+
+
+/**
+ * Blackboard question importer.
+ *
+ * @copyright 2003 Scott Elliott
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
class qformat_blackboard extends qformat_default {
function provide_import() {
return true;
}
-
function readquestions ($lines) {
/// Parses an array of lines into an array of questions,
/// where each item is a question object as defined by
<?php
-////////////////////////////////////////////////////////////////////////////
-/// Blackboard 6.x Format
-///
-/// This Moodle class provides all functions necessary to import and export
-///
-///
-////////////////////////////////////////////////////////////////////////////
-
-// Based on default.php, included by ../import.php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
/**
- * @package questionbank
- * @subpackage importexport
+ * Blackboard 6.0 question importer.
+ *
+ * @package qformat
+ * @subpackage blackboard_six
+ * @copyright 2005 Michael Penney
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-require_once ("$CFG->libdir/xmlize.php");
+
+require_once ($CFG->libdir . '/xmlize.php');
+
+
+/**
+ * Blackboard 6.0 question importer.
+ *
+ * @copyright 2005 Michael Penney
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
class qformat_blackboard_six extends qformat_default {
function provide_import() {
return true;
<?php
-// Based on default.php, included by ../import.php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
/**
- * @package questionbank
- * @subpackage importexport
+ * Examview question importer.
+ *
+ * @package qformat
+ * @subpackage examview
+ * @copyright 2005 Howard Miller
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-require_once("$CFG->libdir/xmlize.php");
+require_once ($CFG->libdir . '/xmlize.php');
+
+
+/**
+ * Examview question importer.
+ *
+ * @copyright 2005 Howard Miller
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
class qformat_examview extends qformat_default {
public $qtypes = array(
<?php
+
+// This file is part of Moodle - http://moodle.org/
//
-///////////////////////////////////////////////////////////////
-// The GIFT import filter was designed as an easy to use method
-// for teachers writing questions as a text file. It supports most
-// question types and the missing word format.
-//
-// Multiple Choice / Missing Word
-// Who's buried in Grant's tomb?{~Grant ~Jefferson =no one}
-// Grant is {~buried =entombed ~living} in Grant's tomb.
-// True-False:
-// Grant is buried in Grant's tomb.{FALSE}
-// Short-Answer.
-// Who's buried in Grant's tomb?{=no one =nobody}
-// Numerical
-// When was Ulysses S. Grant born?{#1822:5}
-// Matching
-// Match the following countries with their corresponding
-// capitals.{=Canada->Ottawa =Italy->Rome =Japan->Tokyo}
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
//
-// Comment lines start with a double backslash (//).
-// Optional question names are enclosed in double colon(::).
-// Answer feedback is indicated with hash mark (#).
-// Percentage answer weights immediately follow the tilde (for
-// multiple choice) or equal sign (for short answer and numerical),
-// and are enclosed in percent signs (% %). See docs and examples.txt for more.
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
//
-// This filter was written through the collaboration of numerous
-// members of the Moodle community. It was originally based on
-// the missingword format, which included code from Thomas Robb
-// and others. Paul Tsuchido Shew wrote this filter in December 2003.
-//////////////////////////////////////////////////////////////////////////
-// Based on default.php, included by ../import.php
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * GIFT format question importer/exporter.
+ *
+ * @package qformat
+ * @subpackage gift
+ * @copyright 2003 Paul Tsuchido Shew
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+
/**
- * @package questionbank
- * @subpackage importexport
+ * The GIFT import filter was designed as an easy to use method
+ * for teachers writing questions as a text file. It supports most
+ * question types and the missing word format.
+ *
+ * Multiple Choice / Missing Word
+ * Who's buried in Grant's tomb?{~Grant ~Jefferson =no one}
+ * Grant is {~buried =entombed ~living} in Grant's tomb.
+ * True-False:
+ * Grant is buried in Grant's tomb.{FALSE}
+ * Short-Answer.
+ * Who's buried in Grant's tomb?{=no one =nobody}
+ * Numerical
+ * When was Ulysses S. Grant born?{#1822:5}
+ * Matching
+ * Match the following countries with their corresponding
+ * capitals.{=Canada->Ottawa =Italy->Rome =Japan->Tokyo}
+ *
+ * Comment lines start with a double backslash (//).
+ * Optional question names are enclosed in double colon(::).
+ * Answer feedback is indicated with hash mark (#).
+ * Percentage answer weights immediately follow the tilde (for
+ * multiple choice) or equal sign (for short answer and numerical),
+ * and are enclosed in percent signs (% %). See docs and examples.txt for more.
+ *
+ * This filter was written through the collaboration of numerous
+ * members of the Moodle community. It was originally based on
+ * the missingword format, which included code from Thomas Robb
+ * and others. Paul Tsuchido Shew wrote this filter in December 2003.
+ *
+ * @copyright 2003 Paul Tsuchido Shew
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qformat_gift extends qformat_default {
<?php
-// Alton College, Hampshire, UK - Tom Flannaghan, Andrew Walker
-// Imports learnwise multiple choice quizzes (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
-// Based on format.php, included by ../../import.php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
/**
- * @package questionbank
- * @subpackage importexport
+ * Examview question importer.
+ *
+ * @package qformat
+ * @subpackage learnwise
+ * @copyright 2005 Alton College, Hampshire, UK
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+
+/**
+ * Examview question importer.
+ *
+ * Alton College, Hampshire, UK - Tom Flannaghan, Andrew Walker
+ *
+ * Imports learnwise multiple choice quizzes (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 {
function provide_import() {
- return true;
+ return true;
}
function readquestions($lines) {
<?php
-/// Modified by Tom Robb 12 June 2003 to include percentage and comment insertion
-/// facility.
-
-////////////////////////////////////////////////////////////////////////////
-/// MISSING WORD FORMAT
-///
-/// This Moodle class provides all functions necessary to import and export
-/// one-correct-answer multiple choice questions in this format:
-///
-/// As soon as we begin to explore our body parts as infants
-/// we become students of {=anatomy and physiology ~reflexology
-/// ~science ~experiment}, and in a sense we remain students for life.
-///
-/// Each answer is separated with a tilde ~, and the correct answer is
-/// prefixed with an equals sign =
-///
-/// Percentage weights can be included by following the tilde with the
-/// desired percent. Comments can be included for each choice by following
-/// the comment with a hash mark ("#") and the comment. Example:
-///
-/// This is {=the best answer#comment on the best answer ~75%a good
-/// answer#comment on the good answer ~a wrong one#comment on the bad answer}
-///
-////////////////////////////////////////////////////////////////////////////
-
-// Based on format.php, included by ../../import.php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Missing word question importer.
+ *
+ * @package qformat
+ * @subpackage missingword
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+
/**
- * @package questionbank
- * @subpackage importexport
+ * Missing word question importer.
+ *
+ * This Moodle class provides all functions necessary to import and export
+ * one-correct-answer multiple choice questions in this format:
+ *
+ * As soon as we begin to explore our body parts as infants
+ * we become students of {=anatomy and physiology ~reflexology
+ * ~science ~experiment}, and in a sense we remain students for life.
+ *
+ * Each answer is separated with a tilde ~, and the correct answer is
+ * prefixed with an equals sign =
+ *
+ * Percentage weights can be included by following the tilde with the
+ * desired percent. Comments can be included for each choice by following
+ * the comment with a hash mark ("#") and the comment. Example:
+ *
+ * This is {=the best answer#comment on the best answer ~75%a good
+ * answer#comment on the good answer ~a wrong one#comment on the bad answer}
+ *
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qformat_missingword extends qformat_default {
<?php
-// note: modified from the original filter/mediaplugin/filter.php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-// given a href for a movie or sound file, it returns an appropriate tag
/**
- * @package questionbank
- * @subpackage importexport
+ * Modified from the original filter/mediaplugin/filter.php
+ *
+ * @package qformat
+ * @subpackage qti_two
+ * @copyright 2005 brian@mediagonal.ch
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+
+/**
+ * Modified from the original filter/mediaplugin/filter.php
*/
function custom_mediaplugin_filter($text, $width = null, $height = null) {
global $CFG;
}
return $text;
}
-
-
-
-
<?php
-require_once("$CFG->dirroot/question/format/qti_two/qt_common.php");
-////////////////////////////////////////////////////////////////////////////
-/// IMS QTI 2.0 FORMAT
-///
-/// HISTORY: created 28.01.2005 brian@mediagonal.ch
-////////////////////////////////////////////////////////////////////////////
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-// Based on format.php, included by ../../import.php
/**
- * @package questionbank
- * @subpackage importexport
+ * Attempt at a QTI 2 question exporter.
+ *
+ * @package qformat
+ * @subpackage qti_two
+ * @copyright 2005 brian@mediagonal.ch
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+
+
+require_once("$CFG->dirroot/question/format/qti_two/qt_common.php");
+
define('CLOZE_TRAILING_TEXT_ID', 9999999);
+
+/**
+ * Attempt at a QTI 2 question exporter.
+ *
+ * Sadly, not very well maintained.
+ *
+ * @copyright 2005 brian@mediagonal.ch
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
class qformat_qti_two extends qformat_default {
var $lang;
<?php
-//***********************************
-// qt_common.php
-//***********************************
-// This contains code common to mediagonal-modified questions
+// This file is part of Moodle - http://moodle.org/
//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * This contains code common to mediagonal-modified questions.
+ *
+ * @package qformat
+ * @subpackage qti_two
+ * @copyright 2005 brian@mediagonal.ch
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
/**
* gets a list of all the media files for the given course
<?php
-///////////////////////////////////////////////////////////////////////////
-// //
-// WebCT FORMAT //
-// //
-///////////////////////////////////////////////////////////////////////////
-// //
-// NOTICE OF COPYRIGHT //
-// //
-// Part of Moodle - Modular Object-Oriented Dynamic Learning Environment //
-// http://moodle.com //
-// //
-// Copyright (C) 2004 ASP Consulting http://www.asp-consulting.net //
-// //
-// This program is free software; you can redistribute it and/or modify //
-// it under the terms of the GNU General Public License as published by //
-// the Free Software Foundation; either version 2 of the License, or //
-// (at your option) any later version. //
-// //
-// This program is distributed in the hope that it will be useful, //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
-// GNU General Public License for more details: //
-// //
-// http://www.gnu.org/copyleft/gpl.html //
-// //
-///////////////////////////////////////////////////////////////////////////
-
-// Based on format.php, included by ../../import.php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
/**
- * @package questionbank
- * @subpackage importexport
+ * Web CT question importer.
+ *
+ * @package qformat
+ * @subpackage webct
+ * @copyright 2004 ASP Consulting http://www.asp-consulting.net
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+
+/**
+ * Web CT question importer.
+ *
+ * @copyright 2004 ASP Consulting http://www.asp-consulting.net
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
function unhtmlentities($string){
$search = array ("'<script[?>]*?>.*?</script>'si", // remove javascript
"'<[\/\!]*?[^<?>]*?>'si", // remove HTML tags
<?php
-// Based on default.php, included by ../import.php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * XHTML question exporter.
+ *
+ * @package qformat
+ * @subpackage xhtml
+ * @copyright 2005 Howard Miller
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+
/**
- * @package questionbank
- * @subpackage importexport
+ * XHTML question exporter.
+ *
+ * Exports questions as static HTML.
+ *
+ * @copyright 2005 Howard Miller
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qformat_xhtml extends qformat_default {
<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
/**
- * Page for editing questions using the new form library.
+ * Page for editing questions.
*
- * @author T.J.Hunt@open.ac.uk
- * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
- * @package questionbank
- *//** */
+ * @package moodlecore
+ * @subpackage questionbank
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
-// Includes.
require_once(dirname(__FILE__) . '/../config.php');
require_once(dirname(__FILE__) . '/editlib.php');
require_once($CFG->libdir . '/filelib.php');
DONE question/category_form.php
DONE question/export_form.php
DONE question/flags.js
-question/format/aiken/format.php
-question/format/gift/examples.txt
-question/format/qti_two/templates/choice.tpl
-question/format/qti_two/templates/choiceMultiple.tpl
-question/format/qti_two/templates/composite.tpl
-question/format/qti_two/templates/extendedText.tpl
-question/format/qti_two/templates/extendedText_simpleEssay.tpl
-question/format/qti_two/templates/graphicGapMatch.tpl
-question/format/qti_two/templates/imsmanifest.tpl
-question/format/qti_two/templates/match.tpl
-question/format/qti_two/templates/mmchoiceMultiple.tpl
-question/format/qti_two/templates/notimplemented.tpl
-question/format/qti_two/templates/numerical.tpl
-question/format/qti_two/templates/textEntry.tpl
-DONE question/format/README.txt
-DONE question/format/webct/TODO.txt
+DONE question/format/aiken/format.php
DONE question/import_form.php
DONE question/qbank.js
DONE question/qengine.js
-question/type/calculated/datasetitems_form.php
-question/type/calculated/db/upgrade.php
-question/type/calculated/questiontype.php
-question/type/calculated/version.php
-question/type/calculatedmulti/questiontype.php
-question/type/calculatedsimple/questiontype.php
-question/type/ddwtos/version.php
+DONE question/type/calculated/datasetitems_form.php
+DONE question/type/calculated/db/upgrade.php
+DONE question/type/calculated/questiontype.php
+DONE question/type/calculated/version.php
+DONE question/type/calculatedmulti/questiontype.php
+DONE question/type/calculatedsimple/questiontype.php
+DONE question/type/ddwtos/version.php
DONE question/type/description/question.html
DONE question/type/essay/display.html
-question/type/essay/version.php
-question/type/gapselect/edit_form_base.php
-question/type/gapselect/rendererbase.php
-question/type/match/db/upgrade.php
-question/type/match/version.php
-question/type/multianswer/db/upgrade.php
-question/type/multianswer/version.php
-question/type/multichoice/db/upgrade.php
-question/type/multichoice/version.php
-question/type/numerical/db/upgrade.php
-question/type/numerical/display.html
-question/type/numerical/version.php
-question/type/opaque/lang/en/qtype_opaque.php
-question/type/opaque/settings.php
-question/type/randomsamatch/version.php
-question/type/truefalse/version.php
+DONE question/type/essay/version.php
+DONE question/type/gapselect/edit_form_base.php
+DONE question/type/gapselect/rendererbase.php
+DONE question/type/match/db/upgrade.php
+DONE question/type/match/version.php
+DONE question/type/multianswer/db/upgrade.php
+DONE question/type/multianswer/version.php
+DONE question/type/multichoice/db/upgrade.php
+DONE question/type/multichoice/version.php
+DONE question/type/numerical/db/upgrade.php
+DONE question/type/numerical/display.html
+DONE question/type/numerical/version.php
+DONE question/type/opaque/lang/en/qtype_opaque.php
+DONE question/type/opaque/settings.php
+DONE question/type/randomsamatch/version.php
+DONE question/type/truefalse/version.php
+
+Missing boiler-plate
+====================
+
+DONE question/addquestion.php
+DONE question/category.php
+DONE question/category_class.php
+DONE question/edit.php
+DONE question/export.php
+DONE question/format/blackboard/format.php
+DONE question/format/blackboard_six/format.php
+DONE question/format/examview/format.php
+DONE question/format/learnwise/format.php
+DONE question/format/missingword/format.php
+DONE question/format/qti_two/custommediafilter.php
+DONE question/format/qti_two/format.php
+DONE question/format/qti_two/qt_common.php
+DONE question/format/webct/format.php
+DONE question/format/xhtml/format.php
+DONE question/format.php
+DONE question/question.php
+DONE question/type/calculated/datasetdefinitions_form.php
+DONE question/type/calculatedmulti/edit_calculatedmulti_form.php
+DONE question/type/ddwtos/script.js
+DONE question/type/multianswer/edit_multianswer_form.php
+DONE question/type/multianswer/questiontype.php
+DONE question/type/numerical/display.html
+DONE question/type/randomsamatch/edit_randomsamatch_form.php
+DONE question/type/randomsamatch/questiontype.php
+DONE question/upgrade.php
+
<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
/**
- * @package questionbank
- * @subpackage questiontypes
+ * Defines the editing form for the calculated question data set definitions.
+ *
+ * @package qtype
+ * @subpackage calculated
+ * @copyright 2007 Jamie Pratt me@jamiep.org
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+
+/**
+ * Calculated question data set definitions editing form definition.
+ *
+ * @copyright 2007 Jamie Pratt me@jamiep.org
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
class question_dataset_dependent_definitions_form extends moodleform {
/**
* Question object with options and answers already loaded by get_question_options
<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Defines the editing form for the calculated question data set items.
+ *
+ * @package qtype
+ * @subpackage calculated
+ * @copyright 2007 Jamie Pratt me@jamiep.org
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+
+/**
+ * Calculated question data set items editing form definition.
+ *
+ * @copyright 2007 Jamie Pratt me@jamiep.org
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
class question_dataset_dependent_items_form extends moodleform {
/**
* Question object with options and answers already loaded by get_question_options
<?php
-// This file keeps track of upgrades to
-// the calculated qtype plugin
+// This file is part of Moodle - http://moodle.org/
//
-// Sometimes, changes between versions involve
-// alterations to database structures and other
-// major things that may break installations.
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
//
-// The upgrade function in this file will attempt
-// to perform all the necessary actions to upgrade
-// your older installation to the current version.
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
//
-// If there's something it cannot do itself, it
-// will tell you what you need to do.
-//
-// The commands in here will all be database-neutral,
-// using the methods of database_manager class
-//
-// Please do not forget to use upgrade_set_timeout()
-// before any action that may take longer time to finish.
-
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Calculated question type upgrade code.
+ *
+ * @package qtype
+ * @subpackage calculated
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+
+/**
+ * Upgrade code for the calculated question type.
+ * @param int $oldversion the version we are upgrading from.
+ */
function xmldb_qtype_calculated_upgrade($oldversion) {
global $CFG, $DB;
/**
- * Calculated editing form definition.
+ * Calculated question type editing form definition.
*
* @copyright 2007 Jamie Pratt me@jamiep.org
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-
-/////////////////
-// CALCULATED ///
-/////////////////
-
-/// QUESTION TYPE CLASS //////////////////
-
+/**
+ * Question type class for the calculated question type.
+ *
+ * @package qtype
+ * @subpackage calculated
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+
+/**
+ * The calculated question type.
+ *
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
class question_calculated_qtype extends default_questiontype {
public $fileoptionsa = array(
-<?PHP
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Version information for the calculated question type.
+ *
+ * @package qtype
+ * @subpackage calculated
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
$plugin->version = 2010090501;
$plugin->requires = 2010090501;
-
<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
/**
- * Defines the editing form for the calculated question type.
+ * Defines the editing form for calculated multiple-choice questions.
*
* @package qtype
- * @subpackage calculatedmult
+ * @subpackage calculatedmulti
* @copyright 2007 Jamie Pratt me@jamiep.org
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+
/**
- * calculated editing form definition.
+ * Calculated multiple-choice question editing form.
*
* @copyright 2007 Jamie Pratt me@jamiep.org
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-/////////////////
-// CALCULATED ///
-/////////////////
-
-/// QUESTION TYPE CLASS //////////////////
-
+/**
+ * Question type class for the calculated multiple-choice question type.
+ *
+ * @package qtype
+ * @subpackage calculatedmulti
+ * @copyright 2009 Pierre Pichet
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+
+/**
+ * The calculated multiple-choice question type.
+ *
+ * @copyright 2009 Pierre Pichet
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
class question_calculatedmulti_qtype extends question_calculated_qtype {
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-/////////////////
-// CALCULATED ///
-/////////////////
-
-/// QUESTION TYPE CLASS //////////////////
-
+/**
+ * Question type class for the simple calculated question type.
+ *
+ * @package qtype
+ * @subpackage calculatedsimple
+ * @copyright 2009 Pierre Pichet
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+
+/**
+ * The simple calculated question type.
+ *
+ * @copyright 2009 Pierre Pichet
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
class question_calculatedsimple_qtype extends question_calculated_qtype {
-
-
// Used by the function custom_generator_tools:
public $calcgenerateidhasbeenadded = false;
public $virtualqtype = false;
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
/**
* JavaScript objects, functions as well as usage of some YUI library for
* enabling drag and drop interaction for dran-anddrop words into sentences
* (ddwtos)
*
- * @package qtype_ddwtos
- * @copyright 2009 The Open University
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package qtype
+ * @subpackage ddwtos
+ * @copyright 2009 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
//global variables
<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Version information for the drag-and-drop words into sentences question type.
+ *
+ * @package qtype
+ * @subpackage ddwtos
+ * @copyright 2011 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
$plugin->version = 2011020100;
$plugin->requires = 2011011200;
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-
/**
* Question type class for the essay question type.
*
- * @package qtype
+ * @package qtype
* @subpackage essay
- * @copyright 2005 Mark Nielsen
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @copyright 2005 Mark Nielsen
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* The essay question type.
*
- * @copyright 2005 Mark Nielsen
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @copyright 2005 Mark Nielsen
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_essay extends question_type {
public function is_manual_graded() {
<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Version information for the essay question type.
+ *
+ * @package qtype
+ * @subpackage essay
+ * @copyright 2005 Mark Nielsen
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
$plugin->version = 2010090501;
$plugin->requires = 2010090501;
<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Base class for editing question types like this one.
+ *
+ * @package qtype
+ * @subpackage gapselect
+ * @copyright 2011 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
/**
* Elements embedded in question text editing form definition.
<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Base class for rendering question types like this one.
+ *
+ * @package qtype
+ * @subpackage gapselect
+ * @copyright 2011 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+
/**
* Generates the output for question types where the question includes embedded interactive elements in the
* question text.
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-
/**
* Version information for the select missing words question type.
*
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-
$plugin->version = 2011020100;
$plugin->requires = 2011011200;
<?php
-// This file keeps track of upgrades to
-// the match qtype plugin
+// This file is part of Moodle - http://moodle.org/
//
-// Sometimes, changes between versions involve
-// alterations to database structures and other
-// major things that may break installations.
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
//
-// The upgrade function in this file will attempt
-// to perform all the necessary actions to upgrade
-// your older installation to the current version.
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
//
-// If there's something it cannot do itself, it
-// will tell you what you need to do.
-//
-// The commands in here will all be database-neutral,
-// using the methods of database_manager class
-//
-// Please do not forget to use upgrade_set_timeout()
-// before any action that may take longer time to finish.
-
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Matching question type upgrade code.
+ *
+ * @package qtype
+ * @subpackage match
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+
+/**
+ * Upgrade code for the matching question type.
+ * @param int $oldversion the version we are upgrading from.
+ */
function xmldb_qtype_match_upgrade($oldversion) {
global $CFG, $DB;
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-
/**
- * True-false question definition class.
+ * Matching question definition class.
*
- * @package qtype_match
- * @copyright 2009 The Open University
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @package qtype
+ * @subpackage match
+ * @copyright 2009 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Represents a matching question.
*
- * @copyright 2009 The Open University
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @copyright 2009 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_match_question extends question_graded_automatically_with_countback {
/** @var boolean Whether the question stems should be shuffled. */
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-
/**
* Question type class for the matching question type.
*
- * @package qtype
+ * @package qtype
* @subpackage match
- * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+
require_once($CFG->libdir . '/questionlib.php');
require_once($CFG->dirroot . '/question/engine/lib.php');
+
/**
* The matching question type class.
*
- * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_match extends question_type {
<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Version information for the matching question type.
+ *
+ * @package qtype
+ * @subpackage match
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
$plugin->version = 2011011306;
$plugin->requires = 2010090501;
<?php
-// This file keeps track of upgrades to
-// the multianswer qtype plugin
+// This file is part of Moodle - http://moodle.org/
//
-// Sometimes, changes between versions involve
-// alterations to database structures and other
-// major things that may break installations.
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
//
-// The upgrade function in this file will attempt
-// to perform all the necessary actions to upgrade
-// your older installation to the current version.
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
//
-// If there's something it cannot do itself, it
-// will tell you what you need to do.
-//
-// The commands in here will all be database-neutral,
-// using the methods of database_manager class
-//
-// Please do not forget to use upgrade_set_timeout()
-// before any action that may take longer time to finish.
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Multi-answer question type upgrade code.
+ *
+ * @package qtype
+ * @subpackage multianswer
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+/**
+ * Upgrade code for the multi-answer question type.
+ * @param int $oldversion the version we are upgrading from.
+ */
function xmldb_qtype_multianswer_upgrade($oldversion) {
global $CFG, $DB;
<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
/**
- * Defines the editing form for the multianswer question type.
+ * Defines the editing form for the multi-answer question type.
*
* @package qtype
* @subpackage multianswer
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
+
/**
- * multianswer editing form definition.
+ * Form for editing multi-answer questions.
*
* @copyright 2007 Jamie Pratt me@jamiep.org
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
<?php
-///////////////////
-/// MULTIANSWER /// (Embedded - cloze)
-///////////////////
-
-///
-/// The multianswer question type is special in that it
-/// depends on a few other question types, i.e.
-/// 'multichoice', 'shortanswer' and 'numerical'.
-/// These question types have got a few special features that
-/// makes them useable by the 'multianswer' question type
-///
-
-/// QUESTION TYPE CLASS //////////////////
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Question type class for the multi-answer question type.
+ *
+ * @package qtype
+ * @subpackage multianswer
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+
/**
- * @package questionbank
- * @subpackage questiontypes
+ * The multi-answer question type class.
+ *
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class embedded_cloze_qtype extends default_questiontype {
<?php
-$plugin->version = 2010090501;
-$plugin->requires = 2010090501;
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Version information for the multi-answer question type.
+ *
+ * @package qtype
+ * @subpackage multianswer
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+$plugin->version = 2010090501;
+$plugin->requires = 2010090501;
<?php
-// This file keeps track of upgrades to
-// the multichoice qtype plugin
+// This file is part of Moodle - http://moodle.org/
//
-// Sometimes, changes between versions involve
-// alterations to database structures and other
-// major things that may break installations.
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
//
-// The upgrade function in this file will attempt
-// to perform all the necessary actions to upgrade
-// your older installation to the current version.
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
//
-// If there's something it cannot do itself, it
-// will tell you what you need to do.
-//
-// The commands in here will all be database-neutral,
-// using the methods of database_manager class
-//
-// Please do not forget to use upgrade_set_timeout()
-// before any action that may take longer time to finish.
-
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Multiple choice question type upgrade code.
+ *
+ * @package qtype
+ * @subpackage multichoice
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+
+/**
+ * Upgrade code for the multiple choice question type.
+ * @param int $oldversion the version we are upgrading from.
+ */
function xmldb_qtype_multichoice_upgrade($oldversion) {
global $CFG, $DB, $QTYPES;
/**
* The questiontype class for the multiple choice question type.
*
- * @package qtype
+ * @package qtype
* @subpackage multichoice
- * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Version information for the multiple choice question type.
+ *
+ * @package qtype
+ * @subpackage multichoice
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
$plugin->version = 2011011200;
$plugin->requires = 2010090501;
<?php
-// This file keeps track of upgrades to
-// the numerical qtype plugin
+// This file is part of Moodle - http://moodle.org/
//
-// Sometimes, changes between versions involve
-// alterations to database structures and other
-// major things that may break installations.
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
//
-// The upgrade function in this file will attempt
-// to perform all the necessary actions to upgrade
-// your older installation to the current version.
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
//
-// If there's something it cannot do itself, it
-// will tell you what you need to do.
-//
-// The commands in here will all be database-neutral,
-// using the methods of database_manager class
-//
-// Please do not forget to use upgrade_set_timeout()
-// before any action that may take longer time to finish.
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Numerical question type upgrade code.
+ *
+ * @package qtype
+ * @subpackage numerical
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+/**
+ * Upgrade code for the numerical question type.
+ * @param int $oldversion the version we are upgrading from.
+ */
function xmldb_qtype_numerical_upgrade($oldversion) {
global $CFG, $DB;
<?php
-$plugin->version = 2010090501;
-$plugin->requires = 2010090501;
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Version information for the numerical question type.
+ *
+ * @package qtype
+ * @subpackage numerical
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+$plugin->version = 2010090501;
+$plugin->requires = 2010090501;
<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Strings for component 'qtype_opaque', language 'en', branch 'MOODLE_20_STABLE'
+ *
+ * @package qtype
+ * @subpackage opaque
+ * @copyright 2006 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
$string['accessoutofsequence'] = 'You have accessed this page out of sequence. Please do not use the Back button when attempting quizzes.';
$string['addengine'] = 'Add another engine';
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+
require_once(dirname(__FILE__) . '/locallib.php');
+
/**
* The Opaque question type.
*
<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Admin settings for the Opaque question type.
+ *
+ * @package qtype
+ * @subpackage opaque
+ * @copyright 2011 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
$settings = new admin_externalpage('qtypesettingopaque',
get_string('pluginname', 'qtype_opaque'),
new moodle_url('/question/type/opaque/engines.php'),
<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
/**
* Defines the editing form for the randomsamatch question type.
*
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
+
/**
* randomsamatch editing form definition.
*
<?php
-/////////////////////
-/// RANDOMSAMATCH ///
-/////////////////////
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Question type class for the randomsamatch question type.
+ *
+ * @package qtype
+ * @subpackage randomsamatch
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
-/// TODO: Make sure short answer questions chosen by a randomsamatch question
-/// can not also be used by a random question
-/// QUESTION TYPE CLASS //////////////////
/**
- * @package questionbank
- * @subpackage questiontypes
-*/
+ * The randomsamatch question type class.
+ *
+ * TODO: Make sure short answer questions chosen by a randomsamatch question
+ * can not also be used by a random question
+ *
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
class question_randomsamatch_qtype extends qtype_match {
/// Extends 'match' as there are quite a few simularities...
<?php
-$plugin->version = 2010090501;
-$plugin->requires = 2010090501;
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Version information for the randomsamatch question type.
+ *
+ * @package qtype
+ * @subpackage randomsamatch
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+$plugin->version = 2010090501;
+$plugin->requires = 2010090501;
*
* @package qtype
* @subpackage shortanswer
- * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
<?php
-$plugin->version = 2010090501;
-$plugin->requires = 2010090501;
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Version information for the true/fales question type.
+ *
+ * @package qtype
+ * @subpackage truefalse
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+$plugin->version = 2010090501;
+$plugin->requires = 2010090501;
<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
/**
* This file contains datbase upgrade code that is called from lib/db/upgrade.php,
* and also check methods that can be used for pre-install checks via
* admin/environment.php and lib/environmentlib.php.
*
- * @copyright 2007 The Open University
- * @author T.J.Hunt@open.ac.uk
- * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
- * @package questionbank
+ * @package moodlecore
+ * @subpackage questionbank
+ * @copyright 2007 The Open University
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+
/**
* In Moodle, all random questions should have question.parent set to be the same
* as question.id. One effect of MDL-5482 is that this will not be true for questions that
$DB->execute("UPDATE {question} SET parent = id WHERE qtype = 'random' AND parent <> id");
return true;
}
-
-