/**
* 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:
*
*/
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
$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)).
- '<br />';
+ $questionnames .= $DB->get_field('question', 'name', array('id' => $key)) . '<br />';
}
}
if (!$questionlist) { // no questions were selected
$questionnames .= '<br />'.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 "<p style=\"text-align:center;\"><b>";
- print_string("selectcategoryabove", "quiz");
- echo "</b></p>";
- 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 '<div class="categoryinfo"><div class="categorynamefieldcontainer">'.
- $strcategory;
- echo ': <span class="categorynamefield">';
- echo shorten_text(strip_tags(format_text($category->name, FORMAT_MOODLE,
- $formatoptions, $COURSE->id)),60);
- echo '</span></div><div class="categoryinfofieldcontainer"><span class="categoryinfofield">';
- echo shorten_text(strip_tags(format_text($category->info, FORMAT_MOODLE,
- $formatoptions, $COURSE->id)),200);
- echo '</span></div></div>';
+ 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 '<hr/><form method="get" action="edit.php" id="displayoptions">';
- echo "<fieldset class='invisiblefieldset'>";
- echo $pageurl->hidden_params_out(array('recurse', 'showhidden',
- 'showquestiontext'));
- $this->display_category_form_checkbox('recurse', $recurse);
- $this->display_category_form_checkbox('showhidden', $showhidden);
- echo '<noscript><div class="centerpara"><input type="submit" value="'.
- get_string('go') .'" />';
- echo '</div></noscript></fieldset></form>';
-
+ $this->display_category_form($contexts->having_one_edit_tab_cap($tabname), $pageurl, $cat, $recurse, $showhidden, $showquestiontext);
+ echo "<p style=\"text-align:center;\"><b>";
+ print_string("selectcategoryabove", "quiz");
+ echo "</b></p>";
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 '<div class="categoryinfo"><div class="categorynamefieldcontainer">'.
+ $strcategory;
+ echo ': <span class="categorynamefield">';
+ echo shorten_text(strip_tags(format_text($category->name, FORMAT_MOODLE,
+ $formatoptions, $COURSE->id)),60);
+ echo '</span></div><div class="categoryinfofieldcontainer"><span class="categoryinfofield">';
+ echo shorten_text(strip_tags(format_text($category->info, FORMAT_MOODLE,
+ $formatoptions, $COURSE->id)),200);
+ echo '</span></div></div>';
+
+ 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 '<hr/><form method="get" action="edit.php" id="displayoptions">';
+ echo "<fieldset class='invisiblefieldset'>";
+ echo $pageurl->hidden_params_out(array('recurse', 'showhidden',
+ 'showquestiontext'));
+ $this->display_category_form_checkbox('recurse', $recurse);
+ $this->display_category_form_checkbox('showhidden', $showhidden);
+ echo '<noscript><div class="centerpara"><input type="submit" value="'.
+ get_string('go') .'" />';
+ echo '</div></noscript></fieldset></form>';
+
+ 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) {
$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
$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");
} 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));
$questionmoveurl->param('courseid', $COURSE->id);
}
-
- $categorylist = ($recurse) ? question_categorylist($category->id) : $category->id;
-
- // hide-feature
- $showhidden = $showhidden ? '' : " AND hidden = '0'";
echo '<div class="createnewquestion">';
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", "<strong>$strcreatenewquestion</strong>");
helpbutton("questiontypes", $strcreatenewquestion, "quiz");
- }
- else {
+ } else {
print_string('nopermissionadd', 'question');
}
echo '</div>';
+ $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 '<div class="categoryquestionscontainer noquestionsincategory">';
- print_string("noquestions", "quiz");
- echo "</div>";
+ print_string('noquestions', 'quiz');
+ echo '</div>';
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;
'*', 0, $perpage)) {
// There are no questions at all
echo '<div class="categoryquestionscontainer noquestionsincategory">';
- print_string("noquestions", "quiz");
- echo "</div>";
+ print_string('noquestions', 'quiz');
+ echo '</div>';
return;
}
}
-
-
echo '<div class="categorysortopotionscontainer">';
$this->display_question_sort_options($pageurl, $sortorder);
echo '</div>';
+
echo '<div class="categorypagingbarcontainer">';
print_paging_bar($totalnumber, $page, $perpage, $pageurl, 'qpage');
echo '</div>';
echo "<tr>\n<td style=\"white-space:nowrap;\" $nameclass>\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){
echo "</td>\n";
echo "<td $nameclass><div>";
- $questionstring=quiz_question_tostring($question,false,true,true);
+ $questionstring = quiz_question_tostring($question,false,true,true);
echo "<label for=\"checkq$question->id\">";
print_question_icon($question);
echo " $questionstring</label>";
+ echo "</div></td>\n";
+ echo "<td>\n";
-
- echo "</div></td>\n";
- echo "<td>";
- // 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 "<a title=\"$stredit\" href=\"".$questionurl->out(false,
- array('id'=>$question->id))."\"> <img
- src=\"$CFG->pixpath/t/edit.gif\" alt=\"$stredit\" /></a>";
- } elseif (question_has_capability_on($question, 'view',
- $question->category)){
-
- echo "<a title=\"$strview\" href=\"".$questionurl->out(false,
- array('id'=>$question->id))."\"><img
- src=\"$CFG->pixpath/i/info.gif\" alt=\"$strview\" /></a>";
+ question_has_capability_on($question, 'move', $question->category)) {
+ echo "<a title=\"$stredit\" href=\"".$questionurl->out(false, array('id'=>$question->id))."\">
+ <img src=\"$CFG->pixpath/t/edit.gif\" alt=\"$stredit\" /></a>";
+ } elseif (question_has_capability_on($question, 'view', $question->category)) {
+ echo "<a title=\"$strview\" href=\"".$questionurl->out(false, array('id'=>$question->id))."\">
+ <img src=\"$CFG->pixpath/i/info.gif\" alt=\"$strview\" /></a>";
}
+
// preview
if ($canuseq) {
$quizorcourseid = $quizid?('&quizid=' . $quizid):('&courseid=' .$COURSE->id);
link_to_popup_window('/question/preview.php?id=' . $question->id .
$quizorcourseid, 'questionpreview',
- "<img src=\"$CFG->pixpath/t/preview.gif\" class=\"iconsmall\" alt=\"$strpreview\" />",
+ " <img src=\"$CFG->pixpath/t/preview.gif\" class=\"iconsmall\" alt=\"$strpreview\" />",
0, 0, $strpreview, QUESTION_PREVIEW_POPUP_OPTIONS);
}
- echo "</td>";
+ echo "</td>\n";
echo "</tr>\n";
if($showquestiontext){
$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 "</td></tr>\n";
}
}
echo "</table></div>\n";
-
-
-
echo '<div class="categorypagingbarcontainer pagingbottom">';
- $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 = '<a href="edit.php?'.$pageurl->get_query_string(array('qperpage'=>1000)).'">'.get_string('showall', 'moodle', $totalnumber).'</a>';
}
echo $paging;
echo '</div>';
+
echo '<div class="categoryselectallcontainer">';
if ($caneditall || $canmoveall || $canuseall){
echo '<a href="javascript:select_all_in(\'TABLE\',null,\'categoryquestions\');">'.$strselectall.'</a> /'.
echo '<br />';
}
echo "</div>\n";
+
echo '<div class="modulespecificbuttonscontainer">';
if ($caneditall || $canmoveall || $canuseall){
echo '<strong> '.get_string('withselected', 'quiz').':</strong><br />';
+
if (function_exists('module_specific_buttons')) {
echo module_specific_buttons($cm->id,$cmoptions);
}
+
// print delete and move selected question
if ($caneditall) {
- echo '<input type="submit" name="deleteselected" value="'.
- $strdelete."\" />\n";
+ echo '<input type="submit" name="deleteselected" value="' . $strdelete . "\" />\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 "<hr />$modulespecific";
}
* 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){
$questionnames .= '* ';
$inuse = true;
}
- $questionnames .= $DB->get_field('question', 'name', array('id' => $key)).'<br />';
+ $questionnames .= $DB->get_field('question', 'name', array('id' => $key)) . '<br />';
}
}
if (!$questionlist) { // no questions were selected
$pageurl->out_action(array('deleteselected'=>$questionlist, 'confirm'=>md5($questionlist))),
$pageurl->out_action());
- echo '</td></tr>';
- echo '</table>';
- 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,
/**
* 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);
$strshow = get_string('show', 'quiz');
$streditcats = get_string('editcategories', 'quiz');
- popup_form('edit.php?'.$pageurl->get_query_string().'&category=', $catmenu, 'catmenu', $current, '', '', '', false, 'self', "<strong>$strcategory</strong>");
+ popup_form('edit.php?'.$pageurl->get_query_string().'&category=',
+ $catmenu, 'catmenu', $current, '', '', '', false, 'self',
+ "<strong>$strcategory</strong>");
echo '<form method="get" action="edit.php" id="displayoptions">';
echo "<fieldset class='invisiblefieldset'>";
* @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;
$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');
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.
} 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));
} else {
$questionmoveurl->param('courseid', $COURSE->id);
}
+
echo '<div class="boxaligncenter">';
$formatoptions = new stdClass;
$formatoptions->noclean = true;
echo format_text($category->info, FORMAT_MOODLE, $formatoptions, $COURSE->id);
+ echo "</div>\n";
- echo '<table><tr>';
-
+ echo '<div class="createnewquestion">';
if ($canadd) {
- echo '<td valign="top" align="right">';
- popup_form ($questionurl->out(false, array('category' => $category->id)).'&qtype=', $qtypemenu, "addquestion", "", "choose", "", "", false, "self", "<strong>$strcreatenewquestion</strong>");
- echo '</td><td valign="top" align="right">';
+ popup_form($questionurl->out(false, array('category' => $category->id)).
+ '&qtype=', $qtypemenu, "addquestion", "", "choose", "",
+ "", false, "self", "<strong>$strcreatenewquestion</strong>");
helpbutton("questiontypes", $strcreatenewquestion, "quiz");
- echo '</td>';
- }
- else {
- echo '<td>';
+ } else {
print_string('nopermissionadd', 'question');
- echo '</td>';
}
-
- echo '</tr></table>';
echo '</div>';
$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 "<p style=\"text-align:center;\">";
- echo $strnoquestions;
- echo "</p>";
+ if (!$totalnumber = $DB->count_records_select('question',
+ "category $usql AND parent = '0' $showhidden", $params)) {
+ echo '<div class="categoryquestionscontainer noquestionsincategory">';
+ print_string('noquestions', 'quiz');
+ echo '</div>';
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 "<p style=\"text-align:center;\">";
- echo $strnoquestions;
- echo "</p>";
+ echo '<div class="categoryquestionscontainer noquestionsincategory">';
+ print_string('noquestions', 'quiz');
+ echo '</div>';
return;
}
}
- print_paging_bar($totalnumber, $page, $perpage, $pageurl, 'qpage');
+ echo '<div class="categorysortopotionscontainer">';
$this->display_question_sort_options($pageurl, $sortorder);
+ echo '</div>';
+
+ echo '<div class="categorypagingbarcontainer">';
+ print_paging_bar($totalnumber, $page, $perpage, $pageurl, 'qpage');
+ echo '</div>';
echo '<form method="post" action="edit.php">';
echo '<fieldset class="invisiblefieldset" style="display: block;">';
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
echo $pageurl->hidden_params_out();
- echo '<table id="categoryquestions" style="width: 100%"><tr>';
+ echo '<div class="categoryquestionscontainer">';
+ echo '<table id="categoryquestions" style="width: 100%"><colgroup><col id="qaction"></col><col id="qname"></col><col id="qextraactions"></col></colgroup><tr>';
echo "<th style=\"white-space:nowrap;\" class=\"header\" scope=\"col\">$straction</th>";
- echo "<th style=\"white-space:nowrap; text-align: left;\" class=\"header\" scope=\"col\">$strquestionname</th>
- <th style=\"white-space:nowrap; text-align: right;\" class=\"header\" scope=\"col\">$strtype</th>";
+ echo "<th style=\"white-space:nowrap; text-align: left;\" class=\"header\" scope=\"col\">$strquestion</th>";
+ echo "<th style=\"white-space:nowrap; text-align: left;\" class=\"header\" scope=\"col\"></th>";
echo "</tr>\n";
foreach ($questions as $question) {
$nameclass = '';
echo module_specific_actions($pageurl, $question->id, $cm->id, $canuseq);
}
+ if ($caneditall || $canmoveall || $canuseall){
+ echo "<input title=\"$strselect\" type=\"checkbox\" name=\"q$question->id\" id=\"checkq$question->id\" value=\"1\" />";
+ }
+ echo "</td>\n";
+
+ echo "<td $nameclass><div>";
+ print_question_icon($question);
+ echo format_string($question->name);
+ echo "</div></td>\n";
+
+ echo "<td>\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 "<a title=\"$stredit\" href=\"".$questionurl->out(false, array('id'=>$question->id))."\">
+ <img src=\"$CFG->pixpath/t/edit.gif\" alt=\"$stredit\" /></a>";
+ } elseif (question_has_capability_on($question, 'view', $question->category)) {
+ echo "<a title=\"$strview\" href=\"".$questionurl->out(false, array('id'=>$question->id))."\">
+ <img src=\"$CFG->pixpath/i/info.gif\" alt=\"$strview\" /></a>";
+ }
+
// preview
if ($canuseq) {
$quizorcourseid = $quizid?('&quizid=' . $quizid):('&courseid=' .$COURSE->id);
- link_to_popup_window('/question/preview.php?id=' . $question->id . $quizorcourseid, 'questionpreview',
- "<img src=\"$CFG->pixpath/t/preview.gif\" class=\"iconsmall\" alt=\"$strpreview\" />",
+ link_to_popup_window('/question/preview.php?id=' . $question->id .
+ $quizorcourseid, 'questionpreview',
+ " <img src=\"$CFG->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 "<a title=\"$stredit\" href=\"".$questionurl->out(false, array('id'=>$question->id))."\"><img
- src=\"$CFG->pixpath/t/edit.gif\" alt=\"$stredit\" /></a> ";
- } elseif (question_has_capability_on($question, 'view', $question->category)){
- echo "<a title=\"$strview\" href=\"".$questionurl->out(false, array('id'=>$question->id))."\"><img
- src=\"$CFG->pixpath/i/info.gif\" alt=\"$strview\" /></a> ";
- }
if (question_has_capability_on($question, 'move', $question->category) && question_has_capability_on($question, 'view', $question->category)) {
- echo "<a title=\"$strmove\" href=\"".$questionurl->out(false, array('id'=>$question->id, 'movecontext'=>1))."\"><img
- src=\"$CFG->pixpath/t/move.gif\" alt=\"$strmove\" /></a> ";
+ echo "<a title=\"$strmove\" href=\"".$questionurl->out(false, array('id'=>$question->id, 'movecontext'=>1))."\">
+ <img src=\"$CFG->pixpath/t/move.gif\" alt=\"$strmove\" /></a>";
}
if (question_has_capability_on($question, 'edit', $question->category)) {
// hide-feature
if($question->hidden) {
- echo "<a title=\"$strrestore\" href=\"edit.php?".$pageurl->get_query_string()."&unhide=$question->id&sesskey=".sesskey()."\"><img
- src=\"$CFG->pixpath/t/restore.gif\" alt=\"$strrestore\" /></a>";
+ echo "<a title=\"$strrestore\" href=\"edit.php?".$pageurl->get_query_string()."&unhide=$question->id&sesskey=".sesskey()."\">
+ <img src=\"$CFG->pixpath/t/restore.gif\" alt=\"$strrestore\" /></a>";
} else {
- echo "<a title=\"$strdelete\" href=\"edit.php?".$pageurl->get_query_string()."&deleteselected=$question->id&q$question->id=1\"><img
- src=\"$CFG->pixpath/t/delete.gif\" alt=\"$strdelete\" /></a>";
+ echo "<a title=\"$strdelete\" href=\"edit.php?".$pageurl->get_query_string()."&deleteselected=$question->id&q$question->id=1\">
+ <img src=\"$CFG->pixpath/t/delete.gif\" alt=\"$strdelete\" /></a>";
}
}
- if ($caneditall || $canmoveall || $canuseall){
- echo " <input title=\"$strselect\" type=\"checkbox\" name=\"q$question->id\" value=\"1\" />";
- }
echo "</td>\n";
- echo "<td $nameclass>" . format_string($question->name) . "</td>\n";
- echo "<td $nameclass style='text-align: right'>\n";
- print_question_icon($question);
- echo "</td>\n";
echo "</tr>\n";
if($showquestiontext){
echo '<tr><td colspan="3" ' . $textclass . '>';
echo "</td></tr>\n";
}
}
- echo "</table>\n";
+ echo "</table></div>\n";
+ echo '<div class="categorypagingbarcontainer pagingbottom">';
$paging = print_paging_bar($totalnumber, $page, $perpage, $pageurl, 'qpage', false, true);
if ($totalnumber > DEFAULT_QUESTIONS_PER_PAGE) {
if ($perpage == DEFAULT_QUESTIONS_PER_PAGE) {
}
}
echo $paging;
+ echo '</div>';
+ echo '<div class="categoryselectallcontainer">';
if ($caneditall || $canmoveall || $canuseall){
echo '<a href="javascript:select_all_in(\'TABLE\',null,\'categoryquestions\');">'.$strselectall.'</a> /'.
' <a href="javascript:deselect_all_in(\'TABLE\',null,\'categoryquestions\');">'.$strselectnone.'</a>';
echo '<br />';
+ }
+ echo "</div>\n";
+
+ echo '<div class="modulespecificbuttonscontainer">';
+ if ($caneditall || $canmoveall || $canuseall){
echo '<strong> '.get_string('withselected', 'quiz').':</strong><br />';
if (function_exists('module_specific_buttons')) {
echo module_specific_buttons($cm->id);
}
+
// print delete and move selected question
if ($caneditall) {
- echo '<input type="submit" name="deleteselected" value="'.$strdelete."\" />\n";
+ echo '<input type="submit" name="deleteselected" value="' . $strdelete . "\" />\n";
}
+
if ($canmoveall && count($addcontexts)) {
echo '<input type="submit" name="move" value="'.get_string('moveto', 'quiz')."\" />\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 "<hr />$modulespecific";
+ }
}
}
+ echo "</div>\n";
+
echo '</fieldset>';
echo "</form>\n";
}