return new moodle_url('/mod/quiz/edit.php', $params);
}
- public function display($tabname, $page, $perpage, $sortorder,
- $sortorderdecoded, $cat, $recurse, $showhidden, $showquestiontext) {
+ public function display($tabname, $page, $perpage, $cat,
+ $recurse, $showhidden, $showquestiontext) {
global $OUTPUT;
if ($this->process_actions_needing_ui()) {
return;
// continues with list of questions
$this->display_question_list($this->contexts->having_one_edit_tab_cap($tabname),
$this->baseurl, $cat, $this->cm, $recurse, $page,
- $perpage, $showhidden, $sortorder, $sortorderdecoded, $showquestiontext,
+ $perpage, $showhidden, $showquestiontext,
$this->contexts->having_cap('moodle/question:add'));
$this->display_options($recurse, $showhidden, $showquestiontext);
echo '</span></div></div>';
}
- protected function display_options($recurse = 1, $showhidden = false,
- $showquestiontext = false) {
+ protected function display_options($recurse, $showhidden, $showquestiontext) {
echo '<form method="get" action="edit.php" id="displayoptions">';
echo "<fieldset class='invisiblefieldset'>";
echo html_writer::input_hidden_params($this->baseurl,
array('recurse', 'showhidden', 'showquestiontext'));
- $this->display_category_form_checkbox('recurse',
+ $this->display_category_form_checkbox('recurse', $recurse,
get_string('includesubcategories', 'question'));
- $this->display_category_form_checkbox('showhidden',
+ $this->display_category_form_checkbox('showhidden', $showhidden,
get_string('showhidden', 'question'));
echo '<noscript><div class="centerpara"><input type="submit" value="' .
get_string('go') . '" />';
/**
* Output the column header cell.
- * @param int $currentsort 0 for none. 1 for normal sort, -1 for reverse sort.
*/
public function display_header() {
echo '<th class="header ' . $this->get_classes() . '" scope="col">';
* category Chooses the category
* displayoptions Sets display options
*/
- public function display($tabname, $page, $perpage, $sortorder,
- $sortorderdecoded, $cat, $recurse, $showhidden, $showquestiontext){
+ public function display($tabname, $page, $perpage, $cat,
+ $recurse, $showhidden, $showquestiontext) {
global $PAGE, $OUTPUT;
if ($this->process_actions_needing_ui()) {
$this->print_category_info($category);
// continues with list of questions
- $this->display_question_list($this->contexts->having_one_edit_tab_cap($tabname), $this->baseurl, $cat, $this->cm,
- $recurse, $page, $perpage, $showhidden, $sortorder, $sortorderdecoded, $showquestiontext,
+ $this->display_question_list($this->contexts->having_one_edit_tab_cap($tabname),
+ $this->baseurl, $cat, $this->cm,
+ $recurse, $page, $perpage, $showhidden, $showquestiontext,
$this->contexts->having_cap('moodle/question:add'));
}
echo "</div>\n";
}
- protected function display_options($recurse = 1, $showhidden = false, $showquestiontext = false) {
+ protected function display_options($recurse, $showhidden, $showquestiontext) {
echo '<form method="get" action="edit.php" id="displayoptions">';
echo "<fieldset class='invisiblefieldset'>";
echo html_writer::input_hidden_params($this->baseurl, array('recurse', 'showhidden', 'showquestiontext'));
- $this->display_category_form_checkbox('recurse', get_string('includesubcategories', 'question'));
- $this->display_category_form_checkbox('showhidden', get_string('showhidden', 'question'));
- $this->display_category_form_checkbox('qbshowtext', get_string('showquestiontext', 'question'));
+ $this->display_category_form_checkbox('recurse', $recurse, get_string('includesubcategories', 'question'));
+ $this->display_category_form_checkbox('showhidden', $showhidden, get_string('showhidden', 'question'));
+ $this->display_category_form_checkbox('qbshowtext', $showquestiontext, get_string('showquestiontext', 'question'));
echo '<noscript><div class="centerpara"><input type="submit" value="'. get_string('go') .'" />';
echo '</div></noscript></fieldset></form>';
}
/**
* Print a single option checkbox. Used by the preceeding.
*/
- protected function display_category_form_checkbox($name, $label) {
+ protected function display_category_form_checkbox($name, $value, $label) {
echo '<div><input type="hidden" id="' . $name . '_off" name="' . $name . '" value="0" />';
echo '<input type="checkbox" id="' . $name . '_on" name="' . $name . '" value="1"';
- if (optional_param($name, false, PARAM_BOOL)) {
+ if ($value) {
echo ' checked="checked"';
}
echo ' onchange="getElementById(\'displayoptions\').submit(); return true;" />';
*/
protected function display_question_list($contexts, $pageurl, $categoryandcontext,
$cm = null, $recurse=1, $page=0, $perpage=100, $showhidden=false,
- $sortorder='typename', $sortorderdecoded='qtype, name ASC',
$showquestiontext = false, $addcontexts = array()) {
global $CFG, $DB, $OUTPUT;
$pagevars['qperpage'] = DEFAULT_QUESTIONS_PER_PAGE;
}
- $sortoptions = array('alpha' => 'name, qtype ASC',
- 'typealpha' => 'qtype, name ASC',
- 'age' => 'id ASC');
-
- if ($sortorder = optional_param('qsortorder', '', PARAM_ALPHA)) {
- $pagevars['qsortorderdecoded'] = $sortoptions[$sortorder];
- $pagevars['qsortorder'] = $sortorder;
- $thispageurl->param('qsortorder', $sortorder);
- } else {
- $pagevars['qsortorderdecoded'] = $sortoptions['typealpha'];
- $pagevars['qsortorder'] = 'typealpha';
+ for ($i = 1; $i <= question_bank_view::MAX_SORTS; $i++) {
+ $param = 'qbs' . $i;
+ if (!$sort = optional_param($param, '', PARAM_ALPHAEXT)) {
+ break;
+ }
+ $thispageurl->param($param, $sort);
}
$defaultcategory = question_make_default_categories($contexts->all());