Permalink
Browse files

MDL-29558 question preview: limit variants drop-down to the first 100

In situations when question has many variants.
  • Loading branch information...
1 parent 3973662 commit fc15f0837a898dc886c2502657dd4c7042eb3d36 @jamiepratt jamiepratt committed Sep 29, 2011
Showing with 8 additions and 1 deletion.
  1. +8 −1 question/preview.php
View
@@ -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 fc15f08

Please sign in to comment.