// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-
/**
* 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) {
* 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() {
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-
/**
* 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');
/**
*
* 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;
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-
/**
* 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 '';
// 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 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() {
// 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 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
*/
* 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 {
/**
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-
/**
* 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.
*
* 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;
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-
/**
- * 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(
// 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 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() {
* 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
*/
* 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;
// 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 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 {
}
// 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 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() {
* 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
*/
* 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;
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-
/**
- * 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);
// 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 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() {
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-
/**
* 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
*/
* 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;
// 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 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);
* 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() {
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-
/**
* 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
*/
* 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 {
// 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 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) {
// 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 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() {
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-
/**
* 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
*/
* 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;
* 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) {
// 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 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() {
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-
/**
* 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.
*
* 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;
// 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 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');
* 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
// 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 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() {
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-
/**
* 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
*/
* 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;
// 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 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
+}
// 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 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() {
* 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
*/
* 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() {
// 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 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',
// 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 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
*/
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);
* 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 */
// 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 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()) {
// 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 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
*/
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
// 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 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
*/
* 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 {
/**
* @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';
}
}
+
+/**
+ * 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;
/**
- * 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 {
var $newtable;
var $tab;
var $tabsize = 3;
-//------------------------------------------------------
+
/**
* @var moodle_url Object representing url for this page
*/
$this->pageurl = $pageurl;
$this->initialize($page, $contexts, $currentcat, $defaultcategory, $todelete, $addcontexts);
-
}
-
-
/**
* Initializes this classes general category-related variables
*/
$this->catform->set_data(array('parent'=>$defaultcategory));
}
}
+
/**
* Displays the user interface
*
echo $list->display_page_numbers();
}
-
-
/**
* gets all the courseids for the given categories
*
return $courseids;
}
-
-
public function edit_single_category($categoryid) {
/// Interface for adding a new category
global $COURSE, $DB;
}
}
-
/**
* Sets the viable parents
*
* 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
*/
*
* 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. */
/**
* 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
*/
* 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 {
/**
* 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. */
* 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 {
* 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. */
* 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;
/**
* 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
*/
* 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. */
* 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. */
* 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 {
/**
*
* 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 {
/**
* 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. */
* 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 {
/**
* 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 {
/**
* 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. */
* 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() {
* 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. */
* 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 . */
/**
* 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) {
* {@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() {
* 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. */
* 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() {
* 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 {
/**
/**
* 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
*/
* {@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 {
/**
* 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
*/
/**
* 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) {#
* 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!';
}
+/**
+ * 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);
}
+/**
+ * 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);
}
+/**
+ * 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;
// 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 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(
* 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;
/**
- * 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;
}
+/**
+ * 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(
// 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 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
*/
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();
// 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 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();
}
+/**
+ * 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(
// 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 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
*/
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;
// 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 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);
// 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 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() {
// 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 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());
// 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 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
*/
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() {
// 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 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(
/**
* 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
*/
*
* 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 {
/**#@+
* 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() {
* 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
*/
* 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;
+++ /dev/null
-<?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 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??
-}
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-
/**
* 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;
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-
/**
* This page displays a preview of a question
*
* 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');
/**
* 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');
/**
* 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) {
/**
* 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() {
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-
/**
* 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
*/