From: nicolasconnault Date: Tue, 18 Aug 2009 00:13:28 +0000 (+0000) Subject: MDL-19820 Upgraded calls to choose_from_menu X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=44c64ad8570f609d8bfaa70d4ff2006ef6d7c768;p=moodle.git MDL-19820 Upgraded calls to choose_from_menu --- diff --git a/question/type/calculated/questiontype.php b/question/type/calculated/questiontype.php index 4cf8596c7e..cb4a73d719 100644 --- a/question/type/calculated/questiontype.php +++ b/question/type/calculated/questiontype.php @@ -779,6 +779,7 @@ class question_calculated_qtype extends default_questiontype { } function custom_generator_tools($datasetdef) { + global $OUTPUT; if (preg_match('~^(uniform|loguniform):([^:]*):([^:]*):([0-9]*)$~', $datasetdef->options, $regs)) { $defid = "$datasetdef->type-$datasetdef->category-$datasetdef->name"; @@ -787,20 +788,22 @@ class question_calculated_qtype extends default_questiontype { ? 'decimals' : 'significantfigures'), 'quiz', $i); } + $select1 = html_select::make($lengthoptions, 'calclength[]', $regs[4], false); + $select1->nothingvalue = ''; + $menu1 = $OUTPUT->select($select1); + + $select2 = html_select::make(array('uniform' => get_string('uniform', 'quiz'), + 'loguniform' => get_string('loguniform', 'quiz')), 'calcdistribution[]', $regs[1], false); + $select2->nothingvalue = ''; + $menu2 = $OUTPUT->select($select2); return '
' . ' & ' - . choose_from_menu($lengthoptions, 'calclength[]', - $regs[4], // Selected - '', '', '', true) . '
' - . choose_from_menu(array('uniform' => get_string('uniform', 'quiz'), - 'loguniform' => get_string('loguniform', 'quiz')), - 'calcdistribution[]', - $regs[1], // Selected - '', '', '', true); + . $menu1 . '
' + . $menu2; } else { return ''; } @@ -1138,22 +1141,21 @@ class question_calculated_qtype extends default_questiontype { function construct_dataset_menus($form, $mandatorydatasets, $optionaldatasets) { + global $OUTPUT; $datasetmenus = array(); foreach ($mandatorydatasets as $datasetname) { if (!isset($datasetmenus[$datasetname])) { list($options, $selected) = $this->dataset_options($form, $datasetname); unset($options['0']); // Mandatory... - $datasetmenus[$datasetname] = choose_from_menu ($options, - 'dataset[]', $selected, '', '', "0", true); + $datasetmenus[$datasetname] = $OUTPUT->select(html_select::make($options, 'dataset[]', $selected, false)); } } foreach ($optionaldatasets as $datasetname) { if (!isset($datasetmenus[$datasetname])) { list($options, $selected) = $this->dataset_options($form, $datasetname); - $datasetmenus[$datasetname] = choose_from_menu ($options, - 'dataset[]', $selected, '', '', "0", true); + $datasetmenus[$datasetname] = $OUTPUT->select(html_select::make($options, 'dataset[]', $selected, false)); } } return $datasetmenus; diff --git a/question/type/match/questiontype.php b/question/type/match/questiontype.php index 34a163fb71..73957b50c8 100644 --- a/question/type/match/questiontype.php +++ b/question/type/match/questiontype.php @@ -227,7 +227,7 @@ class question_match_qtype extends default_questiontype { } function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options) { - global $CFG; + global $CFG, $OUTPUT; $subquestions = $state->options->subquestions; $correctanswers = $this->get_correct_responses($question, $state); $nameprefix = $question->name_prefix; @@ -294,9 +294,10 @@ class question_match_qtype extends default_questiontype { $a->feedbackimg = question_get_feedback_image($correctresponse); } } - - $a->control = choose_from_menu($answers, $menuname, $response, 'choose', - '', 0, true, $options->readonly); + + $select = html_select::make($answers, $menuname, $response); + $select->disabled = $options->readonly; + $a->control = $OUTPUT->select($select); // Neither the editing interface or the database allow to provide // fedback for this question type.