Skip to content
Browse files

Merge branch 'MDL-29558_2_1' of git://github.com/jamiepratt/moodle in…

…to MOODLE_21_STABLE
  • Loading branch information...
2 parents e438ff9 + fc15f08 commit bf49e4404ce1e2c89e42397168639fc6ccf0a2eb Sam Hemelryk committed Oct 3, 2011
Showing with 8 additions and 1 deletion.
  1. +8 −1 question/preview.php
View
9 question/preview.php
@@ -34,6 +34,13 @@
require_once($CFG->libdir . '/questionlib.php');
require_once(dirname(__FILE__) . '/previewlib.php');
+/**
+ * The maximum number of variants previewable. If there are more variants than this for a question
+ * then we only allow the selection of the first x variants.
+ * @var integer
+ */
+define('QUESTION_PREVIEW_MAX_VARIANTS', 100);
+
// Get and validate question id.
$id = required_param('id', PARAM_INT);
$question = question_bank::load_question($id);
@@ -61,7 +68,7 @@
$PAGE->set_pagelayout('popup');
// Get and validate display options.
-$maxvariant = $question->get_num_variants();
+$maxvariant = min($question->get_num_variants(), QUESTION_PREVIEW_MAX_VARIANTS);
$options = new question_preview_options($question);
$options->load_user_defaults();
$options->set_from_request();

0 comments on commit bf49e44

Please sign in to comment.
Something went wrong with that request. Please try again.