mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
moved question sort order and paging params to be passed from page to page as get params instead of being saved in session var.
This commit is contained in:
parent
fcdb06c470
commit
b72ff47685
7 changed files with 268 additions and 248 deletions
|
@ -14,12 +14,13 @@
|
|||
require_once($CFG->libdir . '/uploadlib.php');
|
||||
require_once($CFG->libdir . '/questionlib.php');
|
||||
|
||||
list($thispageurl, $courseid, $cmid, $cm, $module, $pagevars) = question_edit_setup(false, false);
|
||||
|
||||
// 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 );
|
||||
$courseid = optional_param('courseid', 0, PARAM_INT);
|
||||
$format = optional_param('format','',PARAM_FILE);
|
||||
$params->matchgrades = optional_param('matchgrades','',PARAM_ALPHA);
|
||||
$params->stoponerror = optional_param('stoponerror', 0, PARAM_BOOL);
|
||||
|
@ -28,7 +29,6 @@
|
|||
$txt = new stdClass();
|
||||
$txt->category = get_string('category','quiz');
|
||||
$txt->choosefile = get_string('choosefile','quiz');
|
||||
$txt->editingquiz = get_string(isset($SESSION->modform->instance) ? "editingquiz" : "editquestions", "quiz");
|
||||
$txt->file = get_string('file');
|
||||
$txt->fileformat = get_string('fileformat','quiz');
|
||||
$txt->fromfile = get_string('fromfile','quiz');
|
||||
|
@ -58,7 +58,7 @@
|
|||
|
||||
if ($categoryid) { // update category in session variable
|
||||
$SESSION->questioncat = $categoryid;
|
||||
} else { // try to get category from modform
|
||||
} else { // try to get category from session
|
||||
if (isset($SESSION->questioncat)) {
|
||||
$categoryid = $SESSION->questioncat;
|
||||
}
|
||||
|
@ -94,20 +94,28 @@
|
|||
// PAGE HEADER
|
||||
//==========
|
||||
|
||||
if (isset($SESSION->modform->instance) and $quiz = get_record('quiz', 'id', $SESSION->modform->instance)) {
|
||||
$strupdatemodule = has_capability('moodle/course:manageactivities', $context)
|
||||
? update_module_button($SESSION->modform->cmid, $course->id, $txt->modulename)
|
||||
if ($cm!==null) {
|
||||
$strupdatemodule = has_capability('moodle/course:manageactivities', get_context_instance(CONTEXT_COURSE, $course->id))
|
||||
? update_module_button($cm->id, $course->id, get_string('modulename', $cm->modname))
|
||||
: "";
|
||||
print_header_simple($txt->importquestions, '',
|
||||
"<a href=\"$CFG->wwwroot/mod/quiz/index.php?id=$course->id\">".$txt->modulenameplural.'</a>'.
|
||||
" -> <a href=\"$CFG->wwwroot/mod/quiz/view.php?q=$quiz->id\">".format_string($quiz->name).'</a>'.
|
||||
' -> '.$txt->importquestions,
|
||||
"", "", true, $strupdatemodule);
|
||||
$crumbs = array();
|
||||
$crumbs[] = array('name' => get_string('modulenameplural', $cm->modname), 'link' => "$CFG->wwwroot/mod/{$cm->modname}/index.php?id=$course->id", 'type' => 'activity');
|
||||
$crumbs[] = array('name' => format_string($module->name), 'link' => "$CFG->wwwroot/mod/{$cm->modname}/view.php?cmid={$cm->id}", 'type' => 'title');
|
||||
$crumbs[] = array('name' => $txt->importquestions, 'link' => '', 'type' => 'title');
|
||||
$navigation = build_navigation($crumbs);
|
||||
print_header_simple($txt->importquestions, '', $navigation, "", "", true, $strupdatemodule);
|
||||
|
||||
$currenttab = 'edit';
|
||||
$mode = 'import';
|
||||
include($CFG->dirroot.'/mod/quiz/tabs.php');
|
||||
${$cm->modname} = $module;
|
||||
include($CFG->dirroot."/mod/$cm->modname/tabs.php");
|
||||
} else {
|
||||
print_header_simple($txt->importquestions, '', $txt->importquestions);
|
||||
// Print basic page layout.
|
||||
$crumbs = array();
|
||||
$crumbs[] = array('name' => $txt->importquestions, 'link' => '', 'type' => 'title');
|
||||
$navigation = build_navigation($crumbs);
|
||||
|
||||
print_header_simple($txt->importquestions, '', $navigation);
|
||||
// print tabs
|
||||
$currenttab = 'import';
|
||||
include('tabs.php');
|
||||
|
@ -130,8 +138,7 @@
|
|||
else {
|
||||
notify($txt->uploadproblem);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// must be upload file
|
||||
if (empty($_FILES['newfile'])) {
|
||||
notify( $txt->uploadproblem );
|
||||
|
@ -168,24 +175,21 @@
|
|||
|
||||
// Do anything before that we need to
|
||||
if (! $qformat->importpreprocess()) {
|
||||
error( $txt->importerror ,
|
||||
"$CFG->wwwroot/question/import.php?courseid={$course->id}&category=$category->id");
|
||||
error( $txt->importerror, $thispageurl->out(false, array('category'=>$category->id)));
|
||||
}
|
||||
|
||||
// Process the uploaded file
|
||||
if (! $qformat->importprocess() ) {
|
||||
error( $txt->importerror ,
|
||||
"$CFG->wwwroot/question/import.php?courseid={$course->id}&category=$category->id");
|
||||
error( $txt->importerror, $thispageurl->out(false, array('category'=>$category->id)));
|
||||
}
|
||||
|
||||
// In case anything needs to be done after
|
||||
if (! $qformat->importpostprocess()) {
|
||||
error( $txt->importerror ,
|
||||
"$CFG->wwwroot/question/import.php?courseid={$course->id}&category=$category->id");
|
||||
error( $txt->importerror, $thispageurl->out(false, array('category'=>$category->id)));
|
||||
}
|
||||
|
||||
echo "<hr />";
|
||||
print_continue("edit.php?courseid=$course->id");
|
||||
print_continue("edit.php?".$thispageurl->get_query_string());
|
||||
print_footer($course);
|
||||
exit;
|
||||
}
|
||||
|
@ -210,6 +214,7 @@
|
|||
<form id="form" enctype="multipart/form-data" method="post" action="import.php">
|
||||
<fieldset class="invisiblefieldset" style="display: block;">
|
||||
<input type="hidden" name="sesskey" value="<?php echo sesskey(); ?>" />
|
||||
<?php echo $thispageurl->hidden_params_out(array(), 3); ?>
|
||||
<?php print_simple_box_start("center"); ?>
|
||||
<table cellpadding="5">
|
||||
<tr>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue