diff --git a/question/behaviour/adaptive/renderer.php b/question/behaviour/adaptive/renderer.php index 547426224ef72..c643ef69cc6ca 100644 --- a/question/behaviour/adaptive/renderer.php +++ b/question/behaviour/adaptive/renderer.php @@ -15,16 +15,24 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * Renderer for outputting parts of a question belonging to the legacy * adaptive behaviour. * - * @package qbehaviour_adaptive - * @copyright 2009 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage adaptive + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ + +/** + * Renderer for outputting parts of a question belonging to the legacy + * adaptive behaviour. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class qbehaviour_adaptive_renderer extends qbehaviour_renderer { protected function get_graded_step(question_attempt $qa) { foreach ($qa->get_reverse_step_iterator() as $step) { diff --git a/question/behaviour/adaptive/simpletest/testwalkthrough.php b/question/behaviour/adaptive/simpletest/testwalkthrough.php index c097f3d189485..e9b2f13d5ac32 100644 --- a/question/behaviour/adaptive/simpletest/testwalkthrough.php +++ b/question/behaviour/adaptive/simpletest/testwalkthrough.php @@ -20,15 +20,23 @@ * This file contains tests that walks a question through the adaptive * behaviour. * - * @package qbehaviour_adaptive - * @copyright 2009 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage adaptive + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once(dirname(__FILE__) . '/../../../engine/lib.php'); require_once(dirname(__FILE__) . '/../../../engine/simpletest/helpers.php'); + +/** + * Unit tests for the adaptive behaviour. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class qbehaviour_adaptive_walkthrough_test extends qbehaviour_walkthrough_test_base { public function test_adaptive_multichoice() { diff --git a/question/behaviour/adaptivenopenalty/behaviour.php b/question/behaviour/adaptivenopenalty/behaviour.php index 9a6dee296c162..d2db72ff4df94 100644 --- a/question/behaviour/adaptivenopenalty/behaviour.php +++ b/question/behaviour/adaptivenopenalty/behaviour.php @@ -15,15 +15,16 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * Question behaviour for the old adaptive mode, with no penalties. * - * @package qbehaviour_adaptivenopenalty - * @copyright 2009 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage adaptivenopenalty + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ + require_once(dirname(__FILE__) . '/../adaptive/behaviour.php'); /** @@ -31,8 +32,8 @@ * * This is the old version of interactive mode, without penalties. * - * @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 qbehaviour_adaptivenopenalty extends qbehaviour_adaptive { const IS_ARCHETYPAL = true; diff --git a/question/behaviour/adaptivenopenalty/renderer.php b/question/behaviour/adaptivenopenalty/renderer.php index cd02a101234ee..0212e5fbab7d8 100644 --- a/question/behaviour/adaptivenopenalty/renderer.php +++ b/question/behaviour/adaptivenopenalty/renderer.php @@ -15,18 +15,27 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * Renderer for outputting parts of a question belonging to the legacy * adaptive (no penalties) behaviour. * - * @package qbehaviour_adaptivenopenalty - * @copyright 2009 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage adaptivenopenalty + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ + require_once(dirname(__FILE__) . '/../adaptive/renderer.php'); + +/** + * Renderer for outputting parts of a question belonging to the legacy + * adaptive (no penalties) behaviour. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class qbehaviour_adaptivenopenalty_renderer extends qbehaviour_adaptive_renderer { protected function penalty_info($qa, $mark) { return ''; diff --git a/question/behaviour/adaptivenopenalty/simpletest/testwalkthrough.php b/question/behaviour/adaptivenopenalty/simpletest/testwalkthrough.php index fe9cdef76bdd9..d7e2c4b8c3739 100644 --- a/question/behaviour/adaptivenopenalty/simpletest/testwalkthrough.php +++ b/question/behaviour/adaptivenopenalty/simpletest/testwalkthrough.php @@ -15,20 +15,27 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * This file contains tests that walks a question through the adaptive (no penalties)k * behaviour. * - * @package qbehaviour_adaptivenopenalty - * @copyright 2009 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage adaptivenopenalty + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once(dirname(__FILE__) . '/../../../engine/lib.php'); require_once(dirname(__FILE__) . '/../../../engine/simpletest/helpers.php'); + +/** + * Unit tests for the adaptive (no penalties) behaviour. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class qbehaviour_adaptivenopenalty_walkthrough_test extends qbehaviour_walkthrough_test_base { public function test_multichoice() { diff --git a/question/behaviour/behaviourbase.php b/question/behaviour/behaviourbase.php index eaaa5947d9cc4..f8219d0d6a7cd 100644 --- a/question/behaviour/behaviourbase.php +++ b/question/behaviour/behaviourbase.php @@ -15,14 +15,13 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * Defines the quetsion behaviour base class * - * @package moodlecore + * @package moodlecore * @subpackage questionbehaviours - * @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 */ @@ -35,8 +34,8 @@ * In turn, the behaviour will delegate certain processing to the * relevant {@link question_definition}. * - * @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 */ abstract class question_behaviour { /** diff --git a/question/behaviour/deferredcbm/behaviour.php b/question/behaviour/deferredcbm/behaviour.php index 02c460031a3d6..9598cc7a0b306 100644 --- a/question/behaviour/deferredcbm/behaviour.php +++ b/question/behaviour/deferredcbm/behaviour.php @@ -15,20 +15,21 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * Question behaviour that is like the deferred feedback model, but with * certainly based marking. That is, in addition to the other controls, there are * where the student can indicate how certain they are that their answer is right. * - * @package qbehaviour_deferredcbm - * @copyright 2009 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage deferredcbm + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once(dirname(__FILE__) . '/../deferredfeedback/behaviour.php'); + /** * Question behaviour for deferred feedback with certainty based marking. * @@ -37,8 +38,8 @@ * when the whole attempt is finished, their answer is graded. Their degree * of certainty affects their score. * - * @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 qbehaviour_deferredcbm extends qbehaviour_deferredfeedback { const IS_ARCHETYPAL = true; diff --git a/question/behaviour/deferredcbm/renderer.php b/question/behaviour/deferredcbm/renderer.php index eef1afc81a557..4200808867249 100644 --- a/question/behaviour/deferredcbm/renderer.php +++ b/question/behaviour/deferredcbm/renderer.php @@ -15,17 +15,24 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** - * Renderer for outputting parts of a question belonging to the deferred - * feedback behaviour. + * Defines the renderer for the deferred feedback with certainty based marking + * behaviour. * - * @package qbehaviour_deferredcbm - * @copyright 2009 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage deferredcbm + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +/** + * Renderer for outputting parts of a question belonging to the deferred + * feedback with certainty based marking behaviour. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class qbehaviour_deferredcbm_renderer extends qbehaviour_renderer { protected function certainly_choices($controlname, $selected, $readonly) { $attributes = array( diff --git a/question/behaviour/deferredcbm/simpletest/testwalkthrough.php b/question/behaviour/deferredcbm/simpletest/testwalkthrough.php index 742911d68ba66..7d598ecc9edbe 100644 --- a/question/behaviour/deferredcbm/simpletest/testwalkthrough.php +++ b/question/behaviour/deferredcbm/simpletest/testwalkthrough.php @@ -15,20 +15,27 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * This file contains tests that walks a question through the deferred feedback - * behaviour. + * with certainty base marking behaviour. * - * @package qbehaviour_deferredcbm - * @copyright 2009 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage deferredcbm + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once(dirname(__FILE__) . '/../../../engine/lib.php'); require_once(dirname(__FILE__) . '/../../../engine/simpletest/helpers.php'); + +/** + * Unit tests for the deferred feedback with certainty base marking behaviour. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class qbehaviour_deferredcbm_walkthrough_test extends qbehaviour_walkthrough_test_base { public function test_deferred_cbm_truefalse_high_certainty() { diff --git a/question/behaviour/deferredfeedback/behaviour.php b/question/behaviour/deferredfeedback/behaviour.php index 937799aad6d54..a66877e9f68a3 100644 --- a/question/behaviour/deferredfeedback/behaviour.php +++ b/question/behaviour/deferredfeedback/behaviour.php @@ -20,9 +20,10 @@ * Question behaviour for the case when the student's answer is just * saved until they submit the whole attempt, and then it is graded. * - * @package qbehaviour_deferredfeedback - * @copyright 2009 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage deferredfeedback + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -32,8 +33,8 @@ * The student enters their response during the attempt, and it is saved. Later, * when the whole attempt is finished, their answer is graded. * - * @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 qbehaviour_deferredfeedback extends question_behaviour_with_save { const IS_ARCHETYPAL = true; diff --git a/question/behaviour/deferredfeedback/renderer.php b/question/behaviour/deferredfeedback/renderer.php index a3a2976c1fe9e..3e6f520978ee0 100644 --- a/question/behaviour/deferredfeedback/renderer.php +++ b/question/behaviour/deferredfeedback/renderer.php @@ -15,16 +15,22 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Defines the renderer for the deferred feedback behaviour. + * + * @package qbehaviour + * @subpackage deferredfeedback + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + /** * Renderer for outputting parts of a question belonging to the deferred * feedback behaviour. * - * @package qbehaviour_deferredfeedback - * @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 qbehaviour_deferredfeedback_renderer extends qbehaviour_renderer { } diff --git a/question/behaviour/deferredfeedback/simpletest/testwalkthrough.php b/question/behaviour/deferredfeedback/simpletest/testwalkthrough.php index 8f4eee1712b08..ceab102afa05d 100644 --- a/question/behaviour/deferredfeedback/simpletest/testwalkthrough.php +++ b/question/behaviour/deferredfeedback/simpletest/testwalkthrough.php @@ -15,20 +15,27 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * This file contains tests that walks a question through the deferred feedback * behaviour. * - * @package qbehaviour_deferredfeedback - * @copyright 2009 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage deferredfeedback + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once(dirname(__FILE__) . '/../../../engine/lib.php'); require_once(dirname(__FILE__) . '/../../../engine/simpletest/helpers.php'); + +/** + * Unit tests for the deferred feedback behaviour. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class qbehaviour_deferredfeedback_walkthrough_test extends qbehaviour_walkthrough_test_base { public function test_deferredfeedback_feedback_truefalse() { diff --git a/question/behaviour/immediatecbm/behaviour.php b/question/behaviour/immediatecbm/behaviour.php index ef8ac168d3114..ae64441c47dce 100644 --- a/question/behaviour/immediatecbm/behaviour.php +++ b/question/behaviour/immediatecbm/behaviour.php @@ -20,9 +20,10 @@ * Question behaviour where the student can submit questions one at a * time for immediate feedback, with certainty based marking. * - * @package qbehaviour_immediatecbm - * @copyright 2009 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage immediatecbm + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -37,8 +38,8 @@ * Once the qustion is submitted, it is not possible for the student to change * their answer any more. The student's degree of certainly affects their score. * - * @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 qbehaviour_immediatecbm extends qbehaviour_immediatefeedback { const IS_ARCHETYPAL = true; diff --git a/question/behaviour/immediatecbm/renderer.php b/question/behaviour/immediatecbm/renderer.php index c36a03ec6c6d8..3c943f85b347e 100644 --- a/question/behaviour/immediatecbm/renderer.php +++ b/question/behaviour/immediatecbm/renderer.php @@ -15,20 +15,26 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** - * Renderer for outputting parts of a question belonging to the immediate - * feedback with CBM behaviour. + * Defines the renderer for the immediate feedback with CBM behaviour. * - * @package qbehaviour_immediatecbm - * @copyright 2009 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage immediatecbm + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once(dirname(__FILE__) . '/../deferredcbm/renderer.php'); +/** + * Renderer for outputting parts of a question belonging to the immediate + * feedback with CBM behaviour. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class qbehaviour_immediatecbm_renderer extends qbehaviour_deferredcbm_renderer { public function controls(question_attempt $qa, question_display_options $options) { $output = parent::controls($qa, $options); diff --git a/question/behaviour/immediatecbm/simpletest/testwalkthrough.php b/question/behaviour/immediatecbm/simpletest/testwalkthrough.php index 425ec4efcfade..2729f5a789927 100644 --- a/question/behaviour/immediatecbm/simpletest/testwalkthrough.php +++ b/question/behaviour/immediatecbm/simpletest/testwalkthrough.php @@ -15,20 +15,27 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * This file contains tests that walks a question through the immediate cbm * behaviour. * - * @package qbehaviour_immediatecbm - * @copyright 2009 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage immediatecbm + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once(dirname(__FILE__) . '/../../../engine/lib.php'); require_once(dirname(__FILE__) . '/../../../engine/simpletest/helpers.php'); + +/** + * Unit tests for the immediate cbm behaviour. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class qbehaviour_immediatecbm_walkthrough_test extends qbehaviour_walkthrough_test_base { public function test_immediatecbm_feedback_multichoice_right() { diff --git a/question/behaviour/immediatefeedback/behaviour.php b/question/behaviour/immediatefeedback/behaviour.php index cf7b4c338f792..851a7ffde3a28 100644 --- a/question/behaviour/immediatefeedback/behaviour.php +++ b/question/behaviour/immediatefeedback/behaviour.php @@ -15,14 +15,14 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * Question behaviour where the student can submit questions one at a * time for immediate feedback. * - * @package qbehaviour_immediatefeedback - * @copyright 2009 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage immediatefeedback + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -34,8 +34,8 @@ * student to change their answer any more, but the student gets full feedback * straight away. * - * @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 qbehaviour_immediatefeedback extends question_behaviour_with_save { const IS_ARCHETYPAL = true; diff --git a/question/behaviour/immediatefeedback/renderer.php b/question/behaviour/immediatefeedback/renderer.php index 5189587c800fb..6074321d1fc79 100644 --- a/question/behaviour/immediatefeedback/renderer.php +++ b/question/behaviour/immediatefeedback/renderer.php @@ -15,17 +15,23 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Defines the renderer for the immediate feedback behaviour. + * + * @package qbehaviour + * @subpackage immediatefeedback + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + /** * Renderer for outputting parts of a question belonging to the immediate * feedback behaviour. * - * @package qbehaviour_immediatefeedback - * @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 qbehaviour_immediatefeedback_renderer extends qbehaviour_renderer { public function controls(question_attempt $qa, question_display_options $options) { return $this->submit_button($qa, $options); diff --git a/question/behaviour/immediatefeedback/simpletest/testwalkthrough.php b/question/behaviour/immediatefeedback/simpletest/testwalkthrough.php index 4523c1c8b80d1..9716773dfe191 100644 --- a/question/behaviour/immediatefeedback/simpletest/testwalkthrough.php +++ b/question/behaviour/immediatefeedback/simpletest/testwalkthrough.php @@ -20,15 +20,23 @@ * This file contains tests that walks a question through the immediate feedback * behaviour. * - * @package qbehaviour_immediatefeedback - * @copyright 2009 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage immediatefeedback + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once(dirname(__FILE__) . '/../../../engine/lib.php'); require_once(dirname(__FILE__) . '/../../../engine/simpletest/helpers.php'); + +/** + * Unit tests for the immediate feedback behaviour. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class qbehaviour_immediatefeedback_walkthrough_test extends qbehaviour_walkthrough_test_base { public function test_immediatefeedback_feedback_multichoice_right() { diff --git a/question/behaviour/informationitem/behaviour.php b/question/behaviour/informationitem/behaviour.php index a5b3c4c559582..cbfcfae7289a8 100644 --- a/question/behaviour/informationitem/behaviour.php +++ b/question/behaviour/informationitem/behaviour.php @@ -15,13 +15,13 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * This behaviour is for informaiton items. * - * @package qbehaviour_informationitem - * @copyright 2009 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage informationitem + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -32,8 +32,8 @@ * and the question type is marked complete the first time the user navigates * away from a page that contains that 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 qbehaviour_informationitem extends question_behaviour { diff --git a/question/behaviour/informationitem/renderer.php b/question/behaviour/informationitem/renderer.php index 9162e09b2c12d..06439d5fc3b56 100644 --- a/question/behaviour/informationitem/renderer.php +++ b/question/behaviour/informationitem/renderer.php @@ -15,17 +15,23 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Defines the renderer the information item behaviour. + * + * @package qbehaviour + * @subpackage informationitem + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + /** * Renderer for outputting parts of a question belonging to the information * item behaviour. * - * @package qbehaviour_deferredfeedback - * @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 qbehaviour_informationitem_renderer extends qbehaviour_renderer { public function controls(question_attempt $qa, question_display_options $options) { if ($qa->get_state() != question_state::$todo) { diff --git a/question/behaviour/informationitem/simpletest/testwalkthrough.php b/question/behaviour/informationitem/simpletest/testwalkthrough.php index bc01852beed3f..2268e29e2f994 100644 --- a/question/behaviour/informationitem/simpletest/testwalkthrough.php +++ b/question/behaviour/informationitem/simpletest/testwalkthrough.php @@ -15,20 +15,27 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * This file contains tests that walks a question through the information item * behaviour. * - * @package qbehaviour_informationitem - * @copyright 2009 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage informationitem + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once(dirname(__FILE__) . '/../../../engine/lib.php'); require_once(dirname(__FILE__) . '/../../../engine/simpletest/helpers.php'); + +/** + * Unit tests for the information item behaviour. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class qbehaviour_informationitem_walkthrough_test extends qbehaviour_walkthrough_test_base { public function test_informationitem_feedback_description() { diff --git a/question/behaviour/interactive/behaviour.php b/question/behaviour/interactive/behaviour.php index d9328d2d0102c..c8e818c668da4 100644 --- a/question/behaviour/interactive/behaviour.php +++ b/question/behaviour/interactive/behaviour.php @@ -15,14 +15,14 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * Question behaviour where the student can submit questions one at a * time for immediate feedback. * - * @package qbehaviour_interactive - * @copyright 2009 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage interactive + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -34,8 +34,8 @@ * student to change their answer any more, but the student gets full feedback * straight away. * - * @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 qbehaviour_interactive extends question_behaviour_with_save { const IS_ARCHETYPAL = true; diff --git a/question/behaviour/interactive/renderer.php b/question/behaviour/interactive/renderer.php index cfbf1b295d5a6..5dc177758a4f5 100644 --- a/question/behaviour/interactive/renderer.php +++ b/question/behaviour/interactive/renderer.php @@ -20,17 +20,18 @@ * Renderer for outputting parts of a question belonging to the interactive * behaviour. * - * @package qbehaviour_interactive - * @copyright 2009 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage interactive + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * Interactive behaviour renderer. * - * @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 qbehaviour_interactive_renderer extends qbehaviour_renderer { public function controls(question_attempt $qa, question_display_options $options) { diff --git a/question/behaviour/interactive/simpletest/testwalkthrough.php b/question/behaviour/interactive/simpletest/testwalkthrough.php index 1287dc197c3b7..66dcc2766f804 100644 --- a/question/behaviour/interactive/simpletest/testwalkthrough.php +++ b/question/behaviour/interactive/simpletest/testwalkthrough.php @@ -15,20 +15,27 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * This file contains tests that walks a question through the interactive * behaviour. * - * @package qbehaviour_interactive - * @copyright 2009 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage interactive + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once(dirname(__FILE__) . '/../../../engine/lib.php'); require_once(dirname(__FILE__) . '/../../../engine/simpletest/helpers.php'); + +/** + * Unit tests for the interactive behaviour. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class qbehaviour_interactive_walkthrough_test extends qbehaviour_walkthrough_test_base { public function test_interactive_feedback_multichoice_right() { diff --git a/question/behaviour/interactivecountback/behaviour.php b/question/behaviour/interactivecountback/behaviour.php index 8a54839d1f6fe..a5f7279fee4dd 100644 --- a/question/behaviour/interactivecountback/behaviour.php +++ b/question/behaviour/interactivecountback/behaviour.php @@ -15,19 +15,20 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * Question behaviour that is like the interactive behaviour, but where the * student is credited for parts of the question they got right on earlier tries. * - * @package qbehaviour_interactivecountback - * @copyright 2010 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage interactivecountback + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once(dirname(__FILE__) . '/../interactive/behaviour.php'); + /** * Question behaviour for interactive mode with count-back scoring. * @@ -56,8 +57,8 @@ * question type. The point is that the final grade can take into account all * of the tries the student made. * - * @copyright 2010 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 qbehaviour_interactivecountback extends qbehaviour_interactive { const IS_ARCHETYPAL = false; diff --git a/question/behaviour/interactivecountback/renderer.php b/question/behaviour/interactivecountback/renderer.php index cb6424ccef546..65234c055cc77 100644 --- a/question/behaviour/interactivecountback/renderer.php +++ b/question/behaviour/interactivecountback/renderer.php @@ -15,6 +15,15 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Defines the renderer for the interactive with countback behaviour. + * + * @package qbehaviour + * @subpackage interactivecountback + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + require_once(dirname(__FILE__) . '/../interactive/renderer.php'); @@ -26,11 +35,8 @@ * There are not differences from the interactive output. We just need a class * definition. * - * @package qbehaviour_interactivecountback - * @copyright 2010 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 qbehaviour_interactivecountback_renderer extends qbehaviour_interactive_renderer { } \ No newline at end of file diff --git a/question/behaviour/interactivecountback/simpletest/testwalkthrough.php b/question/behaviour/interactivecountback/simpletest/testwalkthrough.php index 815433dc93246..0774f4b4106d2 100644 --- a/question/behaviour/interactivecountback/simpletest/testwalkthrough.php +++ b/question/behaviour/interactivecountback/simpletest/testwalkthrough.php @@ -15,20 +15,27 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * This file contains tests that walks a question through the interactive with * countback behaviour. * - * @package qbehaviour_interactivecountback - * @copyright 2010 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage interactivecountback + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once(dirname(__FILE__) . '/../../../engine/lib.php'); require_once(dirname(__FILE__) . '/../../../engine/simpletest/helpers.php'); + +/** + * Unit tests for the interactive with countback behaviour. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class qbehaviour_interactivecountback_walkthrough_test extends qbehaviour_walkthrough_test_base { public function test_interactive_feedback_match_reset() { diff --git a/question/behaviour/manualgraded/behaviour.php b/question/behaviour/manualgraded/behaviour.php index ac81e832c6469..07173aadd1e65 100644 --- a/question/behaviour/manualgraded/behaviour.php +++ b/question/behaviour/manualgraded/behaviour.php @@ -15,13 +15,13 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * Question behaviour for questions that can only be graded manually. * - * @package qbehaviour_manualgraded - * @copyright 2009 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage manualgraded + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -32,8 +32,8 @@ * when the whole attempt is finished, the attempt goes into the NEEDS_GRADING * state, and the teacher must grade it manually. * - * @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 qbehaviour_manualgraded extends question_behaviour_with_save { const IS_ARCHETYPAL = true; diff --git a/question/behaviour/manualgraded/renderer.php b/question/behaviour/manualgraded/renderer.php index 7913beb36411d..725dc90e458af 100644 --- a/question/behaviour/manualgraded/renderer.php +++ b/question/behaviour/manualgraded/renderer.php @@ -15,17 +15,22 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Defines the renderer for the manual graded behaviour. + * + * @package qbehaviour + * @subpackage manualgraded + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + /** * Renderer for outputting parts of a question belonging to the manual * graded behaviour. * - * @package qbehaviour_manualgraded - * @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 qbehaviour_manualgraded_renderer extends qbehaviour_renderer { - -} \ No newline at end of file +} diff --git a/question/behaviour/manualgraded/simpletest/testwalkthrough.php b/question/behaviour/manualgraded/simpletest/testwalkthrough.php index 3221baec8efdc..1680b7f3e0447 100644 --- a/question/behaviour/manualgraded/simpletest/testwalkthrough.php +++ b/question/behaviour/manualgraded/simpletest/testwalkthrough.php @@ -15,20 +15,27 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * This file contains tests that walks a question through the manual graded * behaviour. * - * @package qbehaviour_manualgraded - * @copyright 2009 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage manualgraded + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once(dirname(__FILE__) . '/../../../engine/lib.php'); require_once(dirname(__FILE__) . '/../../../engine/simpletest/helpers.php'); + +/** + * Unit tests for the manual graded behaviour. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class qbehaviour_manualgraded_walkthrough_test extends qbehaviour_walkthrough_test_base { public function test_manual_graded_essay() { diff --git a/question/behaviour/missing/behaviour.php b/question/behaviour/missing/behaviour.php index edcc73ee95405..5173d4dc87491 100644 --- a/question/behaviour/missing/behaviour.php +++ b/question/behaviour/missing/behaviour.php @@ -20,9 +20,10 @@ * Fake question behaviour that is used when the actual qim was not * available. * - * @package qbehaviour_missing - * @copyright 2009 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage missing + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -39,8 +40,8 @@ * possible. A warning is shown that behaviour specific bits may be missing. * Any attempt to process anything causes an exception to be thrown. * - * @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 qbehaviour_missing extends question_behaviour { public function required_question_definition_type() { diff --git a/question/behaviour/missing/renderer.php b/question/behaviour/missing/renderer.php index 4174e408f22f8..b4681d3ca5bcb 100644 --- a/question/behaviour/missing/renderer.php +++ b/question/behaviour/missing/renderer.php @@ -15,17 +15,23 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Defines the renderer for when the actual behaviour used is not available. + * + * @package qbehaviour + * @subpackage missing + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + /** * Renderer for outputting parts of a question when the actual behaviour * used is not available. * - * @package qbehaviour_missing - * @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 qbehaviour_missing_renderer extends qbehaviour_renderer { public function controls(question_attempt $qa, question_display_options $options) { return html_writer::tag('div', diff --git a/question/behaviour/missing/simpletest/testmissingbehaviour.php b/question/behaviour/missing/simpletest/testmissingbehaviour.php index d205fbac7a422..fa3256f464953 100644 --- a/question/behaviour/missing/simpletest/testmissingbehaviour.php +++ b/question/behaviour/missing/simpletest/testmissingbehaviour.php @@ -15,13 +15,13 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * This file contains tests for the 'missing' behaviour. * - * @package qbehaviour_missing - * @copyright 2009 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage missing + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -29,6 +29,13 @@ require_once(dirname(__FILE__) . '/../../../engine/simpletest/helpers.php'); require_once(dirname(__FILE__) . '/../behaviour.php'); + +/** + * Unit tests for the 'missing' behaviour. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class qbehaviour_missing_test extends UnitTestCase { public function test_missing_cannot_start() { $qa = new question_attempt(test_question_maker::make_a_truefalse_question(), 0, 0); diff --git a/question/behaviour/opaque/behaviour.php b/question/behaviour/opaque/behaviour.php index 72513b13862b1..0b8a3ae7d1c88 100644 --- a/question/behaviour/opaque/behaviour.php +++ b/question/behaviour/opaque/behaviour.php @@ -20,18 +20,18 @@ * This behaviour that is used when the actual qim was not * available. * - * @package qbehaviour_opaque - * @copyright 2010 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage opaque + * @copyright 2010 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * This behaviour is specifically for use with the Opaque question type. * - * - * @copyright 2010 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright 2010 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class qbehaviour_opaque extends question_behaviour { /** @var string */ diff --git a/question/behaviour/opaque/renderer.php b/question/behaviour/opaque/renderer.php index afa2b753f5093..dcad9897525d0 100644 --- a/question/behaviour/opaque/renderer.php +++ b/question/behaviour/opaque/renderer.php @@ -15,17 +15,23 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +/** + * Defines the renderer for the Opaque behaviour. + * + * @package qbehaviour + * @subpackage opaque + * @copyright 2010 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + /** * Renderer for outputting parts of a question when the actual behaviour * used is not available. * - * @package qbehaviour_opaque - * @copyright 2009 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright 2010 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ - - class qbehaviour_opaque_renderer extends qbehaviour_renderer { public function controls(question_attempt $qa, question_display_options $options) { if ($qa->get_state()->is_gave_up()) { diff --git a/question/behaviour/opaque/simpletest/testopaquebehaviour.php b/question/behaviour/opaque/simpletest/testopaquebehaviour.php index a85544226dd51..c8f371233205f 100644 --- a/question/behaviour/opaque/simpletest/testopaquebehaviour.php +++ b/question/behaviour/opaque/simpletest/testopaquebehaviour.php @@ -15,13 +15,13 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * This file contains tests for the Opaque behaviour. * - * @package qbehaviour_opaque - * @copyright 2010 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @package qbehaviour + * @subpackage opaque + * @copyright 2010 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -29,6 +29,13 @@ require_once(dirname(__FILE__) . '/../../../engine/simpletest/helpers.php'); require_once(dirname(__FILE__) . '/../behaviour.php'); + +/** + * Unit tests for the Opaque behaviour. + * + * @copyright 2010 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class qbehaviour_opaque_test extends qbehaviour_walkthrough_test_base { /** * Makes an Opaque question that refers to one of the sample questions diff --git a/question/behaviour/rendererbase.php b/question/behaviour/rendererbase.php index caa146c0567eb..0a5eeb10d260a 100644 --- a/question/behaviour/rendererbase.php +++ b/question/behaviour/rendererbase.php @@ -15,14 +15,13 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * Defines the renderer base class for question behaviours. * - * @package moodlecore + * @package moodlecore * @subpackage questionbehaviours - * @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 */ @@ -32,8 +31,8 @@ * The methods in this class are mostly called from {@link core_question_renderer} * which coordinates the overall output of questions. * - * @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 */ abstract class qbehaviour_renderer extends plugin_renderer_base { /** diff --git a/question/category_class.php b/question/category_class.php index 08ad7c84d241d..40fc99d178e1c 100644 --- a/question/category_class.php +++ b/question/category_class.php @@ -24,20 +24,21 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -/** - * Class representing question categories - * - * @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); require_once($CFG->libdir . '/listlib.php'); require_once($CFG->dirroot . '/question/category_form.php'); -require_once('move_form.php'); +require_once($CFG->dirroot . '/question/move_form.php'); + +/** + * Class representing a list of question categories + * + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class question_category_list extends moodle_list { public $table = "question_categories"; public $listitemclassname = 'question_category_list_item'; @@ -63,6 +64,13 @@ public function get_records() { } } + +/** + * An item in a list of question categories. + * + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class question_category_list_item extends list_item { public function set_icon_html($first, $last, &$lastitem){ global $CFG; @@ -109,9 +117,10 @@ public function item_html($extraargs = array()){ /** - * Class representing question categories + * Class representing q question category * - * @package questionbank + * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class question_category_object { @@ -125,7 +134,7 @@ class question_category_object { var $newtable; var $tab; var $tabsize = 3; -//------------------------------------------------------ + /** * @var moodle_url Object representing url for this page */ @@ -170,11 +179,8 @@ public function question_category_object($page, $pageurl, $contexts, $currentcat $this->pageurl = $pageurl; $this->initialize($page, $contexts, $currentcat, $defaultcategory, $todelete, $addcontexts); - } - - /** * Initializes this classes general category-related variables */ @@ -199,6 +205,7 @@ public function initialize($page, $contexts, $currentcat, $defaultcategory, $tod $this->catform->set_data(array('parent'=>$defaultcategory)); } } + /** * Displays the user interface * @@ -246,8 +253,6 @@ public function output_edit_lists() { echo $list->display_page_numbers(); } - - /** * gets all the courseids for the given categories * @@ -265,8 +270,6 @@ public function get_course_ids($categories) { return $courseids; } - - public function edit_single_category($categoryid) { /// Interface for adding a new category global $COURSE, $DB; @@ -283,7 +286,6 @@ public function edit_single_category($categoryid) { } } - /** * Sets the viable parents * diff --git a/question/engine/bank.php b/question/engine/bank.php index a4bff1f50e9db..19372c23aad98 100644 --- a/question/engine/bank.php +++ b/question/engine/bank.php @@ -23,10 +23,10 @@ * fully object oriented structure, at which point this file can be a * starting point. * - * @package moodlecore + * @package moodlecore * @subpackage questionbank - * @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 */ @@ -35,8 +35,8 @@ * * It provides functions for managing question types and question definitions. * - * @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 */ abstract class question_bank { /** @var array question type name => question_type subclass. */ diff --git a/question/engine/datalib.php b/question/engine/datalib.php index c9e76fc463ac4..a8b952f063a5c 100644 --- a/question/engine/datalib.php +++ b/question/engine/datalib.php @@ -19,10 +19,10 @@ /** * Code for loading and saving quiz attempts to and from the database. * - * @package moodlecore + * @package moodlecore * @subpackage questionengine - * @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 */ @@ -30,8 +30,8 @@ * This class controls the loading and saving of question engine data to and from * the database. * - * @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 question_engine_data_mapper { /** @@ -822,8 +822,8 @@ public function questions_in_use(array $questionids) { * changes to a {@link question_usage_by_activity}, and its constituent parts, * so that the changes can be saved to the database when {@link save()} is called. * - * @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 question_engine_unit_of_work implements question_usage_observer { /** @var question_usage_by_activity the usage being tracked. */ @@ -937,7 +937,7 @@ public function save(question_engine_data_mapper $dm) { * WHERE $qubaids->where() AND qa.slot = 1 * * @copyright 2010 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ abstract class qubaid_condition { @@ -975,7 +975,7 @@ public abstract function usage_id_in_params(); * in a larger database query based on an explicit list of ids. * * @copyright 2010 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class qubaid_list extends qubaid_condition { /** @var array of ids. */ @@ -1045,7 +1045,7 @@ public function usage_id_in_params() { * where $from, $usageidcolumn and $where are the arguments to the constructor. * * @copyright 2010 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class qubaid_join extends qubaid_condition { public $from; diff --git a/question/engine/lib.php b/question/engine/lib.php index 0c7a2ca2c5b0f..35132fc181e98 100644 --- a/question/engine/lib.php +++ b/question/engine/lib.php @@ -18,10 +18,10 @@ /** * This defines the core classes of the Moodle question engine. * - * @package moodlecore + * @package moodlecore * @subpackage questionengine - * @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 */ @@ -44,8 +44,8 @@ * creating, loading, saving and deleting {@link question_usage_by_activity}s, * which is the main class that is used by other code that wants to use questions. * - * @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 */ abstract class question_engine { /** @var array behaviour name => 1. Records which behaviours have been loaded. */ @@ -333,8 +333,8 @@ public static function initialise_js() { * be shown read-only, and a question that has not been submitted will not have * any sort of feedback displayed. * - * @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 question_display_options { /**#@+ @var integer named constants for the values that most of the options take. */ @@ -493,7 +493,7 @@ public static function get_dp_options() { * Contains the logic for handling question flags. * * @copyright 2010 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ abstract class question_flags { /** @@ -611,8 +611,8 @@ function __construct($qubaid, $slot, $postdata) { * * Instances of this class correspond to rows in the question_usages table. * - * @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 question_usage_by_activity { /** @@ -1223,8 +1223,8 @@ public static function load_from_records(&$records, $qubaid) { * To create an instance of this class, use * {@link question_usage_by_activity::get_attempt_iterator()} * - * @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 question_attempt_iterator implements Iterator, ArrayAccess { /** @var question_usage_by_activity that we are iterating over. */ @@ -1289,8 +1289,8 @@ public function offsetUnset($slot) { * a collection of {@link question_attempt_steps}. Question inteaction models and * question types do work with question_attempt objects. * - * @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 question_attempt { /** @@ -2248,7 +2248,7 @@ public static function load_from_records(&$records, $questionattemptid, * All methods that try to modify the question_attempt throw exceptions. * * @copyright 2010 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class question_attempt_with_restricted_history extends question_attempt { /** @@ -2327,8 +2327,8 @@ public function set_usage_id($usageid) { * This is actively linked to question_attempt. If you add an new step * mid-iteration, then it will be included. * - * @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 question_attempt_step_iterator implements Iterator, ArrayAccess { /** @var question_attempt the question_attempt being iterated over. */ @@ -2386,8 +2386,8 @@ public function offsetUnset($offset) { * A variant of {@link question_attempt_step_iterator} that iterates through the * steps in reverse order. * - * @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 question_attempt_reverse_step_iterator extends question_attempt_step_iterator { public function next() { @@ -2433,8 +2433,8 @@ public function rewind() { * to check wether a varaible with a particular name is set, and {@link get_behaviour_data()} * to get all the behaviour data as an associative array. * - * @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 question_attempt_step { /** @var integer if this attempts is stored in the question_attempts table, the id of that row. */ @@ -2676,7 +2676,7 @@ public static function load_from_records(&$records, $attemptstepid) { * A subclass with a bit of additional funcitonality, for pending steps. * * @copyright 2010 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class question_attempt_pending_step extends question_attempt_step { /** @var string . */ @@ -2707,8 +2707,8 @@ public function response_summary_changed() { /** * A subclass of {@link question_attempt_step} that cannot be modified. * - * @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 question_attempt_step_read_only extends question_attempt_step { public function set_state($state) { @@ -2731,8 +2731,8 @@ public function set_behaviour_var($name, $value) { * {@link question_attempt::get_last_step()} etc. when a an attempt has just been * created and there is no acutal step. * - * @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 question_null_step { public function get_state() { @@ -2756,8 +2756,8 @@ public function get_fraction() { * A question behaviour controls the flow of actions a student can * take as they work through a question, and later, as a teacher manually grades it. * - * @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 */ interface question_usage_observer { /** Called when a field of the question_usage_by_activity is changed. */ @@ -2796,8 +2796,8 @@ public function notify_step_added(question_attempt_step $step, question_attempt * Null implmentation of the {@link question_usage_watcher} interface. * Does nothing. * - * @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 question_usage_null_observer implements question_usage_observer { public function notify_modified() { @@ -2817,7 +2817,7 @@ public function notify_step_added(question_attempt_step $step, question_attempt * Useful functions for writing question types and behaviours. * * @copyright 2010 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ abstract class question_utils { /** diff --git a/question/engine/renderer.php b/question/engine/renderer.php index 58d87b3e3ed64..25f8f41be2e25 100644 --- a/question/engine/renderer.php +++ b/question/engine/renderer.php @@ -19,10 +19,10 @@ /** * Renderers for outputting parts of the question engine. * - * @package moodlecore + * @package moodlecore * @subpackage questionengine - * @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 */ @@ -31,8 +31,8 @@ * {@link qbehaviour_renderer} and a {@link qtype_renderer} to output the * type-specific bits. The main entry point is the {@link question()} method. * - * @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 core_question_renderer extends plugin_renderer_base { diff --git a/question/engine/simpletest/helpers.php b/question/engine/simpletest/helpers.php index 94bb898838d11..b23238505571c 100644 --- a/question/engine/simpletest/helpers.php +++ b/question/engine/simpletest/helpers.php @@ -19,10 +19,10 @@ /** * This file contains helper classes for testing the question engine. * - * @package moodlecore + * @package moodlecore * @subpackage questionengine - * @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 */ @@ -32,8 +32,8 @@ /** * Makes some protected methods of question_attempt public to facilitate testing. * - * @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 testable_question_attempt extends question_attempt { public function add_step($step) {# @@ -52,8 +52,8 @@ public function set_behaviour(question_behaviour $behaviour) { * This class creates questions of various types, which can then be used when * testing. * - * @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 test_question_maker { const STANDARD_OVERALL_CORRECT_FEEDBACK = 'Well done!'; @@ -301,6 +301,12 @@ public static function set_standard_combined_feedback_fields($q) { } +/** + * Helper for tests that need to simulate records loaded from the database. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ abstract class testing_db_record_builder { public static function build_db_records(array $table) { $columns = array_shift($table); @@ -320,6 +326,13 @@ public static function build_db_records(array $table) { } +/** + * Helper base class for tests that need to simulate records loaded from the + * database. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class data_loading_method_test_base extends UnitTestCase { public function build_db_records(array $table) { return testing_db_record_builder::build_db_records($table); @@ -327,6 +340,13 @@ public function build_db_records(array $table) { } +/** + * Helper base class for tests that walk a question through a sequents of + * interactions under the control of a particular behaviour. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class qbehaviour_walkthrough_test_base extends UnitTestCase { /** @var question_display_options */ protected $displayoptions; diff --git a/question/engine/simpletest/testdatalib.php b/question/engine/simpletest/testdatalib.php index 0afa794edd0ba..a7b2865eb957e 100644 --- a/question/engine/simpletest/testdatalib.php +++ b/question/engine/simpletest/testdatalib.php @@ -15,19 +15,25 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** - * This file contains tests for the question_state class. + * This file contains tests for some of the code in ../datalib.php. * - * @package moodlecore + * @package moodlecore * @subpackage questionengine - * @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 */ require_once(dirname(__FILE__) . '/../lib.php'); + +/** + * Unit tests for some of the code in ../datalib.php. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class qubaid_condition_test extends UnitTestCase { protected function check_typical_question_attempts_query( diff --git a/question/engine/simpletest/testquestionattempt.php b/question/engine/simpletest/testquestionattempt.php index a5f76fe5044b5..c965dd2551826 100644 --- a/question/engine/simpletest/testquestionattempt.php +++ b/question/engine/simpletest/testquestionattempt.php @@ -20,18 +20,27 @@ * This file contains tests for the question_attempt class. * * Action methods like start, process_action and finish are assumed to be - * tested by testintegration.php. + * tested by walkthrough tests in the various behaviours. * - * @package moodlecore + * @package moodlecore * @subpackage questionengine - * @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 */ require_once(dirname(__FILE__) . '/../lib.php'); require_once(dirname(__FILE__) . '/helpers.php'); + +/** + * Unit tests for the {@link question_attempt} class. + * + * These are the tests that don't require any steps. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class question_attempt_test extends UnitTestCase { private $question; private $usageid; @@ -122,10 +131,10 @@ public function test_get_submitted_var_param_mark_invalid() { /** - * These tests use a standard fixture of a question_attempt with three steps. + * These tests use a standard fixture of a {@link question_attempt} with three steps. * - * @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 question_attempt_with_steps_test extends UnitTestCase { private $question; @@ -244,6 +253,12 @@ public function test_cannot_get_min_fraction_before_start() { } +/** + * Unit tests for loading data into the {@link question_attempt} class. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class question_attempt_db_test extends data_loading_method_test_base { public function test_load() { $records = testing_db_record_builder::build_db_records(array( diff --git a/question/engine/simpletest/testquestionattemptiterator.php b/question/engine/simpletest/testquestionattemptiterator.php index 79e46cd347dd6..0a0eb496958c4 100644 --- a/question/engine/simpletest/testquestionattemptiterator.php +++ b/question/engine/simpletest/testquestionattemptiterator.php @@ -15,14 +15,13 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * This file contains tests for the question_attempt_iterator class. * - * @package moodlecore + * @package moodlecore * @subpackage questionengine - * @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 */ @@ -30,6 +29,12 @@ require_once(dirname(__FILE__) . '/helpers.php'); +/** + * This file contains tests for the {@link question_attempt_iterator} class. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class question_attempt_iterator_test extends UnitTestCase { private $quba; private $qas = array(); diff --git a/question/engine/simpletest/testquestionattemptstep.php b/question/engine/simpletest/testquestionattemptstep.php index e9039879a2717..c07336c84fbd8 100644 --- a/question/engine/simpletest/testquestionattemptstep.php +++ b/question/engine/simpletest/testquestionattemptstep.php @@ -15,20 +15,26 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * This file contains tests for the question_attempt_step class. * - * @package moodlecore + * @package moodlecore * @subpackage questionengine - * @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 */ require_once(dirname(__FILE__) . '/../lib.php'); require_once(dirname(__FILE__) . '/helpers.php'); + +/** + * Unit tests for the {@link question_attempt_step} class. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class question_attempt_step_test extends UnitTestCase { public function test_initial_state_unprocessed() { $step = new question_attempt_step(); @@ -123,6 +129,12 @@ public function test_constructor_given_params() { } +/** + * Unit tests for the loading data into the {@link question_attempt_step} class. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class question_attempt_step_db_test extends data_loading_method_test_base { public function test_load_with_data() { $records = $this->build_db_records(array( diff --git a/question/engine/simpletest/testquestionattemptstepiterator.php b/question/engine/simpletest/testquestionattemptstepiterator.php index a3e2f0dea440d..70e4daee01113 100644 --- a/question/engine/simpletest/testquestionattemptstepiterator.php +++ b/question/engine/simpletest/testquestionattemptstepiterator.php @@ -15,14 +15,13 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * This file contains tests for the question_attempt_step_iterator class. * - * @package moodlecore + * @package moodlecore * @subpackage questionengine - * @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 */ @@ -30,6 +29,12 @@ require_once(dirname(__FILE__) . '/helpers.php'); +/** + * Unit tests for the {@link question_attempt_step_iterator} class. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class question_attempt_step_iterator_test extends UnitTestCase { private $qa; private $iterator; diff --git a/question/engine/simpletest/testquestioncbm.php b/question/engine/simpletest/testquestioncbm.php index 5274cc7c6b19f..622ef8dc345f8 100644 --- a/question/engine/simpletest/testquestioncbm.php +++ b/question/engine/simpletest/testquestioncbm.php @@ -15,19 +15,25 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * This file contains tests for the question_cbm class. * - * @package moodlecore + * @package moodlecore * @subpackage questionengine - * @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 */ require_once(dirname(__FILE__) . '/../lib.php'); + +/** + * Unit tests for the question_cbm class. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class question_cbm_test extends UnitTestCase { public function test_adjust_fraction() { $this->assertWithinMargin(0, question_cbm::adjust_fraction(0, question_cbm::LOW), 0.0000001); diff --git a/question/engine/simpletest/testquestionengine.php b/question/engine/simpletest/testquestionengine.php index 84ef20038c145..8f3a7e5c67bcb 100644 --- a/question/engine/simpletest/testquestionengine.php +++ b/question/engine/simpletest/testquestionengine.php @@ -15,19 +15,25 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * This file contains tests for the question_engine class. * - * @package moodlecore + * @package moodlecore * @subpackage questionengine - * @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 */ require_once(dirname(__FILE__) . '/../lib.php'); + +/** + *Unit tests for the question_engine class. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class question_engine_test extends UnitTestCase { public function setUp() { diff --git a/question/engine/simpletest/testquestionstate.php b/question/engine/simpletest/testquestionstate.php index eb0d0551e2720..a4a2c8b4c3c68 100644 --- a/question/engine/simpletest/testquestionstate.php +++ b/question/engine/simpletest/testquestionstate.php @@ -15,20 +15,26 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** - * This file contains tests for the question_state class. + * This file contains tests for the question_state class and subclasses. * - * @package moodlecore + * @package moodlecore * @subpackage questionengine - * @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 */ require_once(dirname(__FILE__) . '/../lib.php'); require_once($CFG->libdir . '/questionlib.php'); + +/** + * Unit tests for the {@link question_state} class and subclasses. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class question_state_test extends UnitTestCase { public function test_is_active() { $this->assertFalse(question_state::$notstarted->is_active()); diff --git a/question/engine/simpletest/testquestionusagebyactivity.php b/question/engine/simpletest/testquestionusagebyactivity.php index eb4261def0780..5b3cd0659eb46 100644 --- a/question/engine/simpletest/testquestionusagebyactivity.php +++ b/question/engine/simpletest/testquestionusagebyactivity.php @@ -15,14 +15,13 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * This file contains tests for the question_usage_by_activity class. * - * @package moodlecore + * @package moodlecore * @subpackage questionengine - * @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 */ @@ -30,6 +29,12 @@ require_once(dirname(__FILE__) . '/helpers.php'); +/** + * Unit tests for the question_usage_by_activity class. + * + * @copyright 2009 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class question_usage_by_activity_test extends UnitTestCase { public function test_set_get_preferred_model() { diff --git a/question/engine/simpletest/testquestionutils.php b/question/engine/simpletest/testquestionutils.php index 87ee68397b3d7..aa1d46b322b7e 100644 --- a/question/engine/simpletest/testquestionutils.php +++ b/question/engine/simpletest/testquestionutils.php @@ -15,19 +15,25 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * This file contains tests for the {@link question_utils} class. * - * @package moodlecore + * @package moodlecore * @subpackage questionengine - * @copyright 2010 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright 2010 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once(dirname(__FILE__) . '/../lib.php'); + +/** + * Unit tests for the {@link question_utils} class. + * + * @copyright 2010 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class question_utils_test extends UnitTestCase { public function test_arrays_have_same_keys_and_values() { $this->assertTrue(question_utils::arrays_have_same_keys_and_values( diff --git a/question/engine/states.php b/question/engine/states.php index 691679434a60a..69e414f3e0b46 100644 --- a/question/engine/states.php +++ b/question/engine/states.php @@ -19,10 +19,10 @@ /** * This defines the states a question can be in. * - * @package moodlecore + * @package moodlecore * @subpackage questionengine - * @copyright 2010 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright 2010 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -32,8 +32,8 @@ * * There are also some useful methods for testing and manipulating states. * - * @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 */ abstract class question_state { @@ -286,8 +286,8 @@ public function default_string($showcorrectness) { /**#@+ * Specific question_state subclasses. * - * @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 question_state_notstarted extends question_state { public function is_finished() { diff --git a/question/engine/upgradefromoldqe/upgrade.php b/question/engine/upgradefromoldqe/upgrade.php index 699d0dfcbb3b5..97ae2bdf0ec22 100644 --- a/question/engine/upgradefromoldqe/upgrade.php +++ b/question/engine/upgradefromoldqe/upgrade.php @@ -20,10 +20,10 @@ * This file contains the code required to upgrade all the attempt data from * old versions of Moodle into the tables used by the new question engine. * - * @package moodlecore + * @package moodlecore * @subpackage questionengine - * @copyright 2010 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright 2010 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -35,8 +35,8 @@ * This class serves to record all the assumptions that the code had to make * during the question engine database database upgrade, to facilitate reviewing them. * - * @copyright 2010 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright 2010 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class question_engine_assumption_logger { protected $handle; diff --git a/question/file.php b/question/file.php deleted file mode 100644 index ac9a133faed8b..0000000000000 --- a/question/file.php +++ /dev/null @@ -1,111 +0,0 @@ -. - - -/** - * This script fetches files from the dataroot/questionattempt directory - * It is based on the top-level file.php - * - * On a module-by-module basis (currently only implemented for quiz), it checks - * whether the user has permission to view the file. - * - * Syntax: question/file.php/attemptid/questionid/filename.ext - * Workaround: question/file.php?file=/attemptid/questionid/filename.ext - * - * @package moodlecore - * @subpackage questionengine - * @copyright 2007 Adriane Boyd - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - - -// disable moodle specific debug messages and any errors in output -define('NO_DEBUG_DISPLAY', true); - - -require_once('../config.php'); -require_once('../lib/filelib.php'); - -$relativepath = get_file_argument(); -// force download for any student-submitted files to prevent XSS attacks. -$forcedownload = 1; - -// relative path must start with '/', because of backup/restore!!! -if (!$relativepath) { - print_error('invalidarguments'); -} else if ($relativepath{0} != '/') { - print_error('pathdoesnotstartslash'); -} - -$pathname = $CFG->dataroot.'/questionattempt'.$relativepath; - -// extract relative path components -$args = explode('/', trim($relativepath, '/')); - -// check for the right number of directories in the path -if (count($args) != 3) { - print_error('invalidarguments'); -} - -// security: require login -require_login(); - -// security: do not return directory node! -if (is_dir($pathname)) { - question_attempt_not_found(); -} - -$lifetime = 0; // do not cache because students may reupload files - -// security: check that the user has permission to access this file -$haspermission = false; -if ($attempt = $DB->get_record("question_attempts", array("id" => $args[0]))) { - $modfile = $CFG->dirroot .'/mod/'. $attempt->modulename .'/lib.php'; - $modcheckfileaccess = $attempt->modulename .'_check_file_access'; - if (file_exists($modfile)) { - @require_once($modfile); - if (function_exists($modcheckfileaccess)) { - $haspermission = $modcheckfileaccess($args[0], $args[1]); - } - } -} else if ($args[0][0] == 0) { - global $USER; - $list = explode('_', $args[0]); - if ($list[1] == $USER->id) { - $haspermission = true; - } -} - -if ($haspermission) { - // check that file exists - if (!file_exists($pathname)) { - question_attempt_not_found(); - } - - // send the file - session_get_instance()->write_close(); // unlock session during fileserving - $filename = $args[count($args)-1]; - send_file($pathname, $filename, $lifetime, $CFG->filteruploadedfiles, false, $forcedownload); -} else { - question_attempt_not_found(); -} - -function question_attempt_not_found() { - global $CFG; - header('HTTP/1.0 404 not found'); - print_error('filenotfound', 'error', $CFG->wwwroot); //this is not displayed on IIS?? -} diff --git a/question/move_form.php b/question/move_form.php index f173004bba9cb..b8f3cf43b9483 100644 --- a/question/move_form.php +++ b/question/move_form.php @@ -15,22 +15,29 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * Form for moving questions between categories. * - * @package moodlecore + * @package moodlecore * @subpackage questionbank - * @copyright 2008 The Open University - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright 2008 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ + if (!defined('MOODLE_INTERNAL')) { die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page } -require_once($CFG->libdir.'/formslib.php'); +require_once($CFG->libdir . '/formslib.php'); + +/** + * Form for moving questions between categories. + * + * @copyright 2008 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ class question_move_form extends moodleform { function definition() { $mform = $this->_form; diff --git a/question/preview.php b/question/preview.php index 4376b1d787a41..fd7bc4900f7e7 100644 --- a/question/preview.php +++ b/question/preview.php @@ -15,7 +15,6 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * This page displays a preview of a question * @@ -24,13 +23,14 @@ * information is stored in the session as an array of subsequent states rather * than in the database. * - * @package moodlecore + * @package moodlecore * @subpackage questionbank - * @copyright Alex Smith {@link http://maths.york.ac.uk/serving_maths} and + * @copyright Alex Smith {@link http://maths.york.ac.uk/serving_maths} and * numerous contributors. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ + require_once(dirname(__FILE__) . '/../config.php'); require_once($CFG->libdir . '/questionlib.php'); require_once(dirname(__FILE__) . '/previewlib.php'); diff --git a/question/simpletest/testimportexport.php b/question/simpletest/testimportexport.php index 8a16c10f85630..fd5cf3bc5df80 100644 --- a/question/simpletest/testimportexport.php +++ b/question/simpletest/testimportexport.php @@ -19,10 +19,10 @@ /** * Unit tests for the question import and export system. * - * @package core + * @package moodlecore * @subpackage questionbank - * @copyright 2010 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 */ require_once($CFG->libdir . '/questionlib.php'); @@ -32,8 +32,8 @@ /** * Subclass to make it easier to test qformat_default. * - * @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 testable_qformat extends qformat_default { public function assemble_category_path($names) { @@ -49,8 +49,8 @@ public function split_category_path($names) { /** * Unit tests for the matching question definition class. * - * @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 qformat_default_test extends UnitTestCase { public function test_assemble_category_path() { diff --git a/question/toggleflag.php b/question/toggleflag.php index 24ceef975b346..cd2c74c19f051 100644 --- a/question/toggleflag.php +++ b/question/toggleflag.php @@ -15,14 +15,13 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . - /** * Used by ajax calls to toggle the flagged state of a question in an attempt. * - * @package moodlecore + * @package moodlecore * @subpackage questionengine - * @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 */