$strshow = get_string("show", "quiz");
$streditcats = get_string("editcategories", "quiz");
- popup_form ("edit.php?".$pageurl->get_query_string()."&catchange=", $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="post" action="edit.php" id="displayoptions">';
echo "<fieldset class='invisiblefieldset'>";
* move Moves a question to a different category
* deleteselected Deletes the selected questions from the category
* Other actions:
- * catchange Chooses the category
+ * category Chooses the category
* displayoptions Sets display options
*
* @author Martin Dougiamas and many others. This has recently been extensively
$pagevars['qpage'] = optional_param('qpage', -1, PARAM_INT);
+
+ //pass 'cat' from page to page and when 'category' comes from a drop down menu
+ //then we also reset the qpage so we go to page 1 of
+ //a new cat.
+ $pagevars['cat'] = optional_param('cat', 0, PARAM_INT);
+ if ($category = optional_param('category', 0, PARAM_INT)){
+ $pagevars['cat'] = $category;
+ $pagevars['qpage'] = 0;
+ }
+ if ($pagevars['cat']){
+ $thispageurl->param('cat', $pagevars['cat']);
+ }
if ($pagevars['qpage'] > -1) {
$thispageurl->param('qpage', $pagevars['qpage']);
} else {
$pagevars['qsortorder'] = $sortorder;
$thispageurl->param('qsortorder', $sortorder);
} else {
- $pagevars['qsortorder'] = 'qtype, name ASC';
+ $pagevars['qsortorderdecoded'] = $sortoptions['typealpha'];
+ $pagevars['qsortorder'] = 'typealpha';
}
- //pass cat from page to page and catchange comes a drop down menu
- //on catchange then we also reset the qpage so we go to page 1 of
- //a new cat.
- $pagevars['cat'] = optional_param('cat', 0, PARAM_INT);
- if ($catchange = optional_param('catchange', 0, PARAM_INT)){
- $pagevars['cat'] = $catchange;
- $pagevars['qpage'] = 0;
- }
- if ($pagevars['cat']){
- $thispageurl->param('cat', $pagevars['cat']);
- }
if (empty($pagevars['cat']) or !count_records_select("question_categories", "id = '".$pagevars['cat']."' AND (course = '{$COURSE->id}' OR publish = '1')")) {
$category = get_default_question_category($COURSE->id);
}
return array($thispageurl, $courseid, $cmid, $cm, $module, $pagevars);
-
}
?>
list($thispageurl, $courseid, $cmid, $cm, $module, $pagevars) = question_edit_setup();
- $categoryid = optional_param('category',0, PARAM_INT);
$cattofile = optional_param('cattofile',0, PARAM_BOOL);
$exportfilename = optional_param('exportfilename','',PARAM_FILE );
error("Course does not exist!");
}
- if ($categoryid) { // update category in session variable
- $SESSION->questioncat = $categoryid;
- } else { // try to get category from session
- if (isset($SESSION->questioncat)) {
- $categoryid = $SESSION->questioncat;
- }
- }
- if (!$category = get_record("question_categories", "id", $categoryid)) {
+ if (!$category = get_record("question_categories", "id", $pagevars['cat'])) {
$category = get_default_question_category($courseid);
}
make_upload_directory( "$course->id" );
// check category is valid
- if (!empty($categoryid)) {
+ if (!empty($pagevars['cat'])) {
$validcats = question_category_options( $course->id, true, false );
- if (!array_key_exists( $categoryid, $validcats)) {
+ if (!array_key_exists( $pagevars['cat'], $validcats)) {
print_error( 'invalidcategory','quiz' );
}
}
$qformat->setCattofile( $cattofile );
if (! $qformat->exportpreprocess()) { // Do anything before that we need to
- error( $txt->exporterror, $thispageurl->out(false, array('category'=>$category->id)));
+ error( $txt->exporterror, $thispageurl->out());
}
if (! $qformat->exportprocess()) { // Process the export data
- error( $txt->exporterror, $thispageurl->out(false, array('category'=>$category->id)));
+ error( $txt->exporterror, $thispageurl->out());
}
if (! $qformat->exportpostprocess()) { // In case anything needs to be done after
- error( $txt->exporterror, $thispageurl->out(false, array('category'=>$category->id)));
+ error( $txt->exporterror, $thispageurl->out());
}
echo "<hr />";
// get parameters
$params = new stdClass;
$params->choosefile = optional_param('choosefile','',PARAM_PATH);
- $categoryid = optional_param('category', 0, PARAM_INT);
$catfromfile = optional_param('catfromfile', 0, PARAM_BOOL );
$format = optional_param('format','',PARAM_FILE);
$params->matchgrades = optional_param('matchgrades','',PARAM_ALPHA);
$matchgrades['error'] = $txt->matchgradeserror;
$matchgrades['nearest'] = $txt->matchgradesnearest;
- if ($categoryid) { // update category in session variable
- $SESSION->questioncat = $categoryid;
- } else { // try to get category from session
- if (isset($SESSION->questioncat)) {
- $categoryid = $SESSION->questioncat;
- }
- }
- if (!$category = get_record("question_categories", "id", $categoryid)) {
+
+ if ($category = get_record("question_categories", "id", $pagevars['cat'])) {
// if no valid category was given, use the default category
- if ($courseid) {
- $category = get_default_question_category($courseid);
- } else {
- print_error('nocategory','quiz');
- }
+ print_error('nocategory','quiz');
}
if (!$courseid) { // need to get the course from the chosen category