From: tjhunt Date: Mon, 19 Jan 2009 08:50:48 +0000 (+0000) Subject: question bank: MDL-17302 refactor question bank display code into a class. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=5b5e5ab20ca72805fd112dad5309352420446d3e;p=moodle.git question bank: MDL-17302 refactor question bank display code into a class. Step 2. Remove as many as possbile of the differences between the two classes. This is mostly whitespace and irrelevant code formatting issues, but there are also a few changes to the generated output, taking the best of both views. --- diff --git a/mod/quiz/editlib.php b/mod/quiz/editlib.php index 4bdd528996..c708dbd33c 100644 --- a/mod/quiz/editlib.php +++ b/mod/quiz/editlib.php @@ -1030,7 +1030,6 @@ class quiz_question_bank_view extends question_bank_view { /** * Shows the question bank editing interface. - * A changed copy of the function at question/editlib.php; to be refactored. * * The function also processes a number of actions: * @@ -1043,7 +1042,7 @@ class quiz_question_bank_view extends question_bank_view { */ function display($tabname, $contexts, $pageurl, $cm, $page, $perpage, $sortorder, $sortorderdecoded, $cat, $recurse, $showhidden, $showquestiontext){ - global $COURSE,$DB; + global $COURSE, $DB; if (optional_param('deleteselected', false, PARAM_BOOL)){ // teacher still has to confirm // make a list of all the questions that are selected @@ -1057,12 +1056,11 @@ class quiz_question_bank_view extends question_bank_view { $key = $matches[1]; $questionlist .= $key.','; question_require_capability_on($key, 'edit'); - if ($DB->record_exists('quiz_question_instances', array('question'=>$key))) { + if ($DB->record_exists('quiz_question_instances', array('question' => $key))) { $questionnames .= '* '; $inuse = true; } - $questionnames .= $DB->get_field('question', 'name', array('id'=>$key)). - '
'; + $questionnames .= $DB->get_field('question', 'name', array('id' => $key)) . '
'; } } if (!$questionlist) { // no questions were selected @@ -1075,81 +1073,68 @@ class quiz_question_bank_view extends question_bank_view { $questionnames .= '
'.get_string('questionsinuse', 'quiz'); } notice_yesno(get_string("deletequestionscheck", "quiz", $questionnames), - $pageurl->out_action(array('deleteselected'=>$questionlist, - 'confirm'=>md5($questionlist))), + $pageurl->out_action(array('deleteselected'=>$questionlist, 'confirm'=>md5($questionlist))), $pageurl->out_action()); - }else{ - //actual question bank - // starts with category selection form - list($categoryid, $contextid)= explode(',', $cat); - - if (!$categoryid) { - print_box_start('generalbox questionbank'); - $this->display_category_form($contexts->having_one_edit_tab_cap($tabname), $pageurl, $cat, $recurse, $showhidden, $showquestiontext); - echo "

"; - print_string("selectcategoryabove", "quiz"); - echo "

"; - print_box_end(); - return; - } - if (!$category = $DB->get_record('question_categories', - array('id' => $categoryid, 'contextid' => $contextid))) { - print_box_start('generalbox questionbank'); - notify('Category not found!'); - print_box_end(); - return; - } - $formatoptions = new stdClass; - $formatoptions->noclean = true; - $strcategory = get_string('category', 'quiz'); - echo '
'. - $strcategory; - echo ': '; - echo shorten_text(strip_tags(format_text($category->name, FORMAT_MOODLE, - $formatoptions, $COURSE->id)),60); - echo '
'; - echo shorten_text(strip_tags(format_text($category->info, FORMAT_MOODLE, - $formatoptions, $COURSE->id)),200); - echo '
'; + return; + } + // Category selection form + list($categoryid, $contextid) = explode(',', $cat); + if (!$categoryid) { print_box_start('generalbox questionbank'); - - $this->display_category_form($contexts->having_one_edit_tab_cap($tabname), - $pageurl, $cat, $recurse, $showhidden, $showquestiontext); - // continues with list of questions - - $this->display_question_list($contexts->having_one_edit_tab_cap($tabname), - $pageurl, - $cat, - isset($cm) ? $cm : null, - $recurse, - $page, - $perpage, - $showhidden, - $sortorder, - $sortorderdecoded, - $showquestiontext, - $contexts->having_cap('moodle/question:add')); - - echo '
'; - echo "
"; - echo $pageurl->hidden_params_out(array('recurse', 'showhidden', - 'showquestiontext')); - $this->display_category_form_checkbox('recurse', $recurse); - $this->display_category_form_checkbox('showhidden', $showhidden); - echo '
'; - + $this->display_category_form($contexts->having_one_edit_tab_cap($tabname), $pageurl, $cat, $recurse, $showhidden, $showquestiontext); + echo "

"; + print_string("selectcategoryabove", "quiz"); + echo "

"; print_box_end(); + return; } + if (!$category = $DB->get_record('question_categories', + array('id' => $categoryid, 'contextid' => $contextid))) { + print_box_start('generalbox questionbank'); + notify('Category not found!'); + return; + } + $formatoptions = new stdClass; + $formatoptions->noclean = true; + $strcategory = get_string('category', 'quiz'); + echo '
'. + $strcategory; + echo ': '; + echo shorten_text(strip_tags(format_text($category->name, FORMAT_MOODLE, + $formatoptions, $COURSE->id)),60); + echo '
'; + echo shorten_text(strip_tags(format_text($category->info, FORMAT_MOODLE, + $formatoptions, $COURSE->id)),200); + echo '
'; + + print_box_start('generalbox questionbank'); + + $this->display_category_form($contexts->having_one_edit_tab_cap($tabname), + $pageurl, $cat, $recurse, $showhidden, $showquestiontext); + + // continues with list of questions + $this->display_question_list($contexts->having_one_edit_tab_cap($tabname), $pageurl, $cat, isset($cm) ? $cm : null, + $recurse, $page, $perpage, $showhidden, $sortorder, $sortorderdecoded, $showquestiontext, + $contexts->having_cap('moodle/question:add')); + + echo '
'; + echo "
"; + echo $pageurl->hidden_params_out(array('recurse', 'showhidden', + 'showquestiontext')); + $this->display_category_form_checkbox('recurse', $recurse); + $this->display_category_form_checkbox('showhidden', $showhidden); + echo '
'; + + print_box_end(); } + /** * prints a form to choose categories - * A changed copy of the function at question/editlib.php; to be refactored. - * */ function display_category_form($contexts, $pageurl, $current, $recurse=1, $showhidden=false, $showquestiontext=false) { @@ -1163,14 +1148,13 @@ class quiz_question_bank_view extends question_bank_view { $strshow = get_string('show', 'quiz'); $streditcats = get_string('editcategories', 'quiz'); - popup_form ('edit.php?'.$pageurl->get_query_string().'&category=', + popup_form('edit.php?'.$pageurl->get_query_string().'&category=', $catmenu, 'catmenu', $current, '', '', '', false, 'self', $strselectcategory.":"); } /** * Prints the table of questions in a category with interactions - * A changed copy of the function at question/editlib.php; to be refactored. * * @param object $course The course object * @param int $categoryid The id of the question category to be displayed @@ -1186,8 +1170,12 @@ class quiz_question_bank_view extends question_bank_view { $sortorder='typename', $sortorderdecoded='qtype, name ASC', $showquestiontext = false, $addcontexts = array()) { global $USER, $CFG, $THEME, $COURSE, $DB; + list($categoryid, $contextid)= explode(',', $categoryandcontext); + $cmoptions = new stdClass; + $cmoptions->hasattempts = $this->quizhasattempts; + $qtypemenu = question_type_menu(); $strcategory = get_string("category", "quiz"); @@ -1237,11 +1225,8 @@ class quiz_question_bank_view extends question_bank_view { } else { $quizid = 0; } - //create the url of the new question page to forward to. return url is given - //as a parameter and automatically urlencoded. - - + // Create the url of the new question page to forward to. $returnurl = $pageurl->out(); $questionurl = new moodle_url("$CFG->wwwroot/question/question.php", array('returnurl' => $returnurl)); @@ -1258,38 +1243,34 @@ class quiz_question_bank_view extends question_bank_view { $questionmoveurl->param('courseid', $COURSE->id); } - - $categorylist = ($recurse) ? question_categorylist($category->id) : $category->id; - - // hide-feature - $showhidden = $showhidden ? '' : " AND hidden = '0'"; echo '
'; if ($canadd) { - popup_form ($questionurl->out(false, array('category' => $category->id)). - '&qtype=', $qtypemenu, "addquestion_$page", "", "choose", "", + popup_form($questionurl->out(false, array('category' => $category->id)). + '&qtype=', $qtypemenu, "addquestion", "", "choose", "", "", false, "self", "$strcreatenewquestion"); helpbutton("questiontypes", $strcreatenewquestion, "quiz"); - } - else { + } else { print_string('nopermissionadd', 'question'); } echo '
'; + $categorylist = ($recurse) ? question_categorylist($category->id) : $category->id; + $categorylist_array = explode(',', $categorylist); - $categorylist_array = explode(',', $categorylist); + $showhidden = $showhidden ? '' : " AND hidden = '0'"; list($usql, $params) = $DB->get_in_or_equal($categorylist_array); if (!$totalnumber = $DB->count_records_select('question', "category $usql AND parent = '0' $showhidden", $params)) { echo '
'; - print_string("noquestions", "quiz"); - echo "
"; + print_string('noquestions', 'quiz'); + echo ''; return; } if (!$questions = $DB->get_records_select('question', - "category $usql AND parent = '0' $showhidden", $params, $sortorderdecoded, - '*', $page*$perpage, $perpage)) { + "category $usql AND parent = '0' $showhidden", $params, $sortorderdecoded, + '*', $page*$perpage, $perpage)) { // There are no questions on the requested page. $page = 0; @@ -1298,17 +1279,16 @@ class quiz_question_bank_view extends question_bank_view { '*', 0, $perpage)) { // There are no questions at all echo '
'; - print_string("noquestions", "quiz"); - echo "
"; + print_string('noquestions', 'quiz'); + echo ''; return; } } - - echo '
'; $this->display_question_sort_options($pageurl, $sortorder); echo '
'; + echo '
'; print_paging_bar($totalnumber, $page, $perpage, $pageurl, 'qpage'); echo '
'; @@ -1343,13 +1323,9 @@ class quiz_question_bank_view extends question_bank_view { echo "\n\n"; - $canuseq = question_has_capability_on($question, 'use', - $question->category); + $canuseq = question_has_capability_on($question, 'use', $question->category); if (function_exists('module_specific_actions')) { - $cmoptions = new stdClass; - $cmoptions->hasattempts = $this->quizhasattempts; - echo module_specific_actions($pageurl, $question->id, $cm->id, - $canuseq, $cmoptions); + echo module_specific_actions($pageurl, $question->id, $cm->id, $canuseq, $cmoptions); } if ($caneditall || $canmoveall || $canuseall){ @@ -1358,38 +1334,33 @@ class quiz_question_bank_view extends question_bank_view { echo "\n"; echo "
"; - $questionstring=quiz_question_tostring($question,false,true,true); + $questionstring = quiz_question_tostring($question,false,true,true); echo ""; + echo "
\n"; + echo "\n"; - - echo "\n"; - echo ""; - // edit, hide, delete question, using question capabilities, not quiz capabilieies + // edit, hide, delete question, using question capabilities, not quiz capabilities if (question_has_capability_on($question, 'edit', $question->category) || - question_has_capability_on($question, 'move', - $question->category)) { - echo "out(false, - array('id'=>$question->id))."\"> pixpath/t/edit.gif\" alt=\"$stredit\" />"; - } elseif (question_has_capability_on($question, 'view', - $question->category)){ - - echo "out(false, - array('id'=>$question->id))."\">pixpath/i/info.gif\" alt=\"$strview\" />"; + question_has_capability_on($question, 'move', $question->category)) { + echo "out(false, array('id'=>$question->id))."\"> + pixpath/t/edit.gif\" alt=\"$stredit\" />"; + } elseif (question_has_capability_on($question, 'view', $question->category)) { + echo "out(false, array('id'=>$question->id))."\"> + pixpath/i/info.gif\" alt=\"$strview\" />"; } + // preview if ($canuseq) { $quizorcourseid = $quizid?('&quizid=' . $quizid):('&courseid=' .$COURSE->id); link_to_popup_window('/question/preview.php?id=' . $question->id . $quizorcourseid, 'questionpreview', - "pixpath/t/preview.gif\" class=\"iconsmall\" alt=\"$strpreview\" />", + " pixpath/t/preview.gif\" class=\"iconsmall\" alt=\"$strpreview\" />", 0, 0, $strpreview, QUESTION_PREVIEW_POPUP_OPTIONS); } - echo ""; + echo "\n"; echo "\n"; if($showquestiontext){ @@ -1397,20 +1368,15 @@ class quiz_question_bank_view extends question_bank_view { $formatoptions = new stdClass; $formatoptions->noclean = true; $formatoptions->para = false; - echo format_text($question->questiontext, - $question->questiontextformat, + echo format_text($question->questiontext, $question->questiontextformat, $formatoptions, $COURSE->id); echo "\n"; } } echo "\n"; - - - echo '
'; - $paging = print_paging_bar($totalnumber, $page, $perpage, - $pageurl, 'qpage', false, true); + $paging = print_paging_bar($totalnumber, $page, $perpage, $pageurl, 'qpage', false, true); if ($totalnumber > DEFAULT_QUESTIONS_PER_PAGE) { if ($perpage == DEFAULT_QUESTIONS_PER_PAGE) { $showall = ''.get_string('showall', 'moodle', $totalnumber).''; @@ -1426,6 +1392,7 @@ class quiz_question_bank_view extends question_bank_view { } echo $paging; echo '
'; + echo '
'; if ($caneditall || $canmoveall || $canuseall){ echo ''.$strselectall.' /'. @@ -1433,22 +1400,22 @@ class quiz_question_bank_view extends question_bank_view { echo '
'; } echo "
\n"; + echo '
'; if ($caneditall || $canmoveall || $canuseall){ echo ' '.get_string('withselected', 'quiz').':
'; + if (function_exists('module_specific_buttons')) { echo module_specific_buttons($cm->id,$cmoptions); } + // print delete and move selected question if ($caneditall) { - echo '\n"; + echo '\n"; } + if (function_exists('module_specific_controls') && $canuseall) { - $cmoptions = new stdClass; - $cmoptions->hasattempts = $this->quizhasattempts; - $modulespecific=module_specific_controls($totalnumber, $recurse, $category, - $cm->id,$cmoptions); + $modulespecific = module_specific_controls($totalnumber, $recurse, $category, $cm->id,$cmoptions); if(!empty($modulespecific)){ echo "
$modulespecific"; } diff --git a/question/editlib.php b/question/editlib.php index 96ff9698da..c21b1eabbb 100644 --- a/question/editlib.php +++ b/question/editlib.php @@ -160,8 +160,6 @@ class question_bank_view { * Other actions: * category Chooses the category * displayoptions Sets display options - * - * @param moodle_url $pageurl object representing this pages url. */ function display($tabname, $contexts, $pageurl, $cm, $page, $perpage, $sortorder, $sortorderdecoded, $cat, $recurse, $showhidden, $showquestiontext){ @@ -183,7 +181,7 @@ class question_bank_view { $questionnames .= '* '; $inuse = true; } - $questionnames .= $DB->get_field('question', 'name', array('id' => $key)).'
'; + $questionnames .= $DB->get_field('question', 'name', array('id' => $key)) . '
'; } } if (!$questionlist) { // no questions were selected @@ -199,17 +197,15 @@ class question_bank_view { $pageurl->out_action(array('deleteselected'=>$questionlist, 'confirm'=>md5($questionlist))), $pageurl->out_action()); - echo ''; - echo ''; - print_footer($COURSE); - exit; + return; } - - // starts with category selection form + // Category selection form print_box_start('generalbox questionbank'); print_heading(get_string('questionbank', 'question'), '', 2); - $this->display_category_form($contexts->having_one_edit_tab_cap($tabname), $pageurl, $cat, $recurse, $showhidden, $showquestiontext); + + $this->display_category_form($contexts->having_one_edit_tab_cap($tabname), + $pageurl, $cat, $recurse, $showhidden, $showquestiontext); // continues with list of questions $this->display_question_list($contexts->having_one_edit_tab_cap($tabname), $pageurl, $cat, isset($cm) ? $cm : null, @@ -222,10 +218,10 @@ class question_bank_view { /** * prints a form to choose categories */ - function display_category_form($contexts, $pageurl, $current, $recurse=1, $showhidden=false, $showquestiontext=false) { + function display_category_form($contexts, $pageurl, $current, $recurse=1, + $showhidden=false, $showquestiontext=false) { global $CFG; - /// Get all the existing categories now $catmenu = question_category_options($contexts, false, 0, true); @@ -233,7 +229,9 @@ class question_bank_view { $strshow = get_string('show', 'quiz'); $streditcats = get_string('editcategories', 'quiz'); - popup_form('edit.php?'.$pageurl->get_query_string().'&category=', $catmenu, 'catmenu', $current, '', '', '', false, 'self', "$strcategory"); + popup_form('edit.php?'.$pageurl->get_query_string().'&category=', + $catmenu, 'catmenu', $current, '', '', '', false, 'self', + "$strcategory"); echo '
'; echo "
"; @@ -272,8 +270,9 @@ class question_bank_view { * @param boolean $showhidden True if also hidden questions should be displayed * @param boolean $showquestiontext whether the text of each question should be shown in the list */ - function display_question_list($contexts, $pageurl, $categoryandcontext, $cm = null, - $recurse=1, $page=0, $perpage=100, $showhidden=false, $sortorder='typename', $sortorderdecoded='qtype, name ASC', + 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 $USER, $CFG, $THEME, $COURSE, $DB; @@ -286,12 +285,12 @@ class question_bank_view { $straddquestions = get_string("addquestions", "quiz"); $strimportquestions = get_string("importquestions", "quiz"); $strexportquestions = get_string("exportquestions", "quiz"); - $strnoquestions = get_string("noquestionsincategory", "quiz"); + $strnoquestions = get_string("noquestions", "quiz"); $strselect = get_string("select", "quiz"); $strselectall = get_string("selectall", "quiz"); $strselectnone = get_string("selectnone", "quiz"); $strcreatenewquestion = get_string("createnewquestion", "quiz"); - $strquestionname = get_string("questionname", "quiz"); + $strquestion = get_string("question", "quiz"); $strdelete = get_string("delete"); $stredit = get_string("edit"); $strmove = get_string('moveqtoanothercontext', 'question'); @@ -310,10 +309,12 @@ class question_bank_view { return; } - if (!$category = $DB->get_record('question_categories', array('id' => $categoryid, 'contextid' => $contextid))) { + if (!$category = $DB->get_record('question_categories', + array('id' => $categoryid, 'contextid' => $contextid))) { notify('Category not found!'); return; } + $catcontext = get_context_instance_by_id($contextid); $canadd = has_capability('moodle/question:add', $catcontext); //check for capabilities on all questions in category, will also apply to sub cats. @@ -326,6 +327,8 @@ class question_bank_view { } else { $quizid = 0; } + + // Create the url of the new question page to forward to. $returnurl = $pageurl->out(); $questionurl = new moodle_url("$CFG->wwwroot/question/question.php", array('returnurl' => $returnurl)); @@ -341,66 +344,73 @@ class question_bank_view { } else { $questionmoveurl->param('courseid', $COURSE->id); } + echo '
'; $formatoptions = new stdClass; $formatoptions->noclean = true; echo format_text($category->info, FORMAT_MOODLE, $formatoptions, $COURSE->id); + echo "
\n"; - echo ''; - + echo '
'; if ($canadd) { - echo '
'; - } - else { - echo ''; } - - echo '
'; - popup_form ($questionurl->out(false, array('category' => $category->id)).'&qtype=', $qtypemenu, "addquestion", "", "choose", "", "", false, "self", "$strcreatenewquestion"); - echo ''; + popup_form($questionurl->out(false, array('category' => $category->id)). + '&qtype=', $qtypemenu, "addquestion", "", "choose", "", + "", false, "self", "$strcreatenewquestion"); helpbutton("questiontypes", $strcreatenewquestion, "quiz"); - echo ''; + } else { print_string('nopermissionadd', 'question'); - echo '
'; echo '
'; $categorylist = ($recurse) ? question_categorylist($category->id) : $category->id; + $categorylist_array = explode(',', $categorylist); - // hide-feature $showhidden = $showhidden ? '' : " AND hidden = '0'"; - $categorylist_array = explode(',', $categorylist); + list($usql, $params) = $DB->get_in_or_equal($categorylist_array); - if (!$totalnumber = $DB->count_records_select('question', "category $usql AND parent = '0' $showhidden", $params)) { - echo "

"; - echo $strnoquestions; - echo "

"; + if (!$totalnumber = $DB->count_records_select('question', + "category $usql AND parent = '0' $showhidden", $params)) { + echo '
'; + print_string('noquestions', 'quiz'); + echo '
'; return; } - if (!$questions = $DB->get_records_select('question', "category $usql AND parent = '0' $showhidden", $params, $sortorderdecoded, '*', $page*$perpage, $perpage)) { + if (!$questions = $DB->get_records_select('question', + "category $usql AND parent = '0' $showhidden", $params, $sortorderdecoded, + '*', $page*$perpage, $perpage)) { + // There are no questions on the requested page. $page = 0; - if (!$questions = $DB->get_records_select('question', "category $usql AND parent = '0' $showhidden", $params, $sortorderdecoded, '*', 0, $perpage)) { + if (!$questions = $DB->get_records_select('question', + "category $usql AND parent = '0' $showhidden", $params, $sortorderdecoded, + '*', 0, $perpage)) { // There are no questions at all - echo "

"; - echo $strnoquestions; - echo "

"; + echo '
'; + print_string('noquestions', 'quiz'); + echo '
'; return; } } - print_paging_bar($totalnumber, $page, $perpage, $pageurl, 'qpage'); + echo '
'; $this->display_question_sort_options($pageurl, $sortorder); + echo '
'; + + echo '
'; + print_paging_bar($totalnumber, $page, $perpage, $pageurl, 'qpage'); + echo '
'; echo ''; echo '
'; echo ''; echo $pageurl->hidden_params_out(); - echo ''; + echo '
'; + echo '
'; echo ""; - echo " - "; + echo ""; + echo ""; echo "\n"; foreach ($questions as $question) { $nameclass = ''; @@ -426,46 +436,54 @@ class question_bank_view { echo module_specific_actions($pageurl, $question->id, $cm->id, $canuseq); } + if ($caneditall || $canmoveall || $canuseall){ + echo "id\" id=\"checkq$question->id\" value=\"1\" />"; + } + echo "\n"; + + echo "\n"; + + echo "\n"; - echo "\n"; - echo "\n"; echo "\n"; if($showquestiontext){ echo '\n"; } } - echo "
$straction$strquestionname$strtype$strquestion
"; + print_question_icon($question); + echo format_string($question->name); + echo "
\n"; + + // edit, hide, delete question, using question capabilities, not quiz capabilities + if (question_has_capability_on($question, 'edit', $question->category) || + question_has_capability_on($question, 'move', $question->category)) { + echo "out(false, array('id'=>$question->id))."\"> + pixpath/t/edit.gif\" alt=\"$stredit\" />"; + } elseif (question_has_capability_on($question, 'view', $question->category)) { + echo "out(false, array('id'=>$question->id))."\"> + pixpath/i/info.gif\" alt=\"$strview\" />"; + } + // preview if ($canuseq) { $quizorcourseid = $quizid?('&quizid=' . $quizid):('&courseid=' .$COURSE->id); - link_to_popup_window('/question/preview.php?id=' . $question->id . $quizorcourseid, 'questionpreview', - "pixpath/t/preview.gif\" class=\"iconsmall\" alt=\"$strpreview\" />", + link_to_popup_window('/question/preview.php?id=' . $question->id . + $quizorcourseid, 'questionpreview', + " pixpath/t/preview.gif\" class=\"iconsmall\" alt=\"$strpreview\" />", 0, 0, $strpreview, QUESTION_PREVIEW_POPUP_OPTIONS); } - // edit, hide, delete question, using question capabilities, not quiz capabilieies - if (question_has_capability_on($question, 'edit', $question->category) || question_has_capability_on($question, 'move', $question->category)) { - echo "out(false, array('id'=>$question->id))."\">pixpath/t/edit.gif\" alt=\"$stredit\" /> "; - } elseif (question_has_capability_on($question, 'view', $question->category)){ - echo "out(false, array('id'=>$question->id))."\">pixpath/i/info.gif\" alt=\"$strview\" /> "; - } if (question_has_capability_on($question, 'move', $question->category) && question_has_capability_on($question, 'view', $question->category)) { - echo "out(false, array('id'=>$question->id, 'movecontext'=>1))."\">pixpath/t/move.gif\" alt=\"$strmove\" /> "; + echo "out(false, array('id'=>$question->id, 'movecontext'=>1))."\"> + pixpath/t/move.gif\" alt=\"$strmove\" />"; } if (question_has_capability_on($question, 'edit', $question->category)) { // hide-feature if($question->hidden) { - echo "get_query_string()."&unhide=$question->id&sesskey=".sesskey()."\">pixpath/t/restore.gif\" alt=\"$strrestore\" />"; + echo "get_query_string()."&unhide=$question->id&sesskey=".sesskey()."\"> + pixpath/t/restore.gif\" alt=\"$strrestore\" />"; } else { - echo "get_query_string()."&deleteselected=$question->id&q$question->id=1\">pixpath/t/delete.gif\" alt=\"$strdelete\" />"; + echo "get_query_string()."&deleteselected=$question->id&q$question->id=1\"> + pixpath/t/delete.gif\" alt=\"$strdelete\" />"; } } - if ($caneditall || $canmoveall || $canuseall){ - echo " id\" value=\"1\" />"; - } echo "" . format_string($question->name) . "\n"; - print_question_icon($question); - echo "
'; @@ -477,8 +495,9 @@ class question_bank_view { echo "
\n"; + echo "\n"; + echo '
'; $paging = print_paging_bar($totalnumber, $page, $perpage, $pageurl, 'qpage', false, true); if ($totalnumber > DEFAULT_QUESTIONS_PER_PAGE) { if ($perpage == DEFAULT_QUESTIONS_PER_PAGE) { @@ -494,29 +513,43 @@ class question_bank_view { } } echo $paging; + echo '
'; + echo '
'; if ($caneditall || $canmoveall || $canuseall){ echo ''.$strselectall.' /'. ' '.$strselectnone.''; echo '
'; + } + echo "
\n"; + + echo '
'; + if ($caneditall || $canmoveall || $canuseall){ echo ' '.get_string('withselected', 'quiz').':
'; if (function_exists('module_specific_buttons')) { echo module_specific_buttons($cm->id); } + // print delete and move selected question if ($caneditall) { - echo '\n"; + echo '\n"; } + if ($canmoveall && count($addcontexts)) { echo '\n"; question_category_select_menu($addcontexts, false, 0, "$category->id,$category->contextid"); } if (function_exists('module_specific_controls') && $canuseall) { - echo module_specific_controls($totalnumber, $recurse, $category, $cm->id); + $modulespecific = module_specific_controls($totalnumber, $recurse, $category, $cm->id); + if(!empty($modulespecific)){ + echo "
$modulespecific"; + } } } + echo "
\n"; + echo '
'; echo "\n"; }