// Handle relative URLs
if (substr($output, 0, 4) != 'http' && substr($output, 0, 1) != '/') {
if (preg_match('/(.*)\/([A-Za-z0-9-_]*\.php)$/', $PAGE->url->out(true), $matches)) {
-
return $matches[1] . "/$output";
} else if ($output == '') {
return $PAGE->url->out(false, array(), false) . '#';
} else {
- throw new coding_exception('Your page uses bizarre relative URLs which Moodle cannot handle. Please use absolute URLs.');
+ throw new coding_exception('Unrecognied URL scheme. Please check the formatting of the URL passed to this function. Absolute URLs are the preferred scheme.');
}
}
- // Add wwwroot only if the URL does not already start with http:// or https://
- if (!preg_match('|https?://|', $output) ) {
- $output = $CFG->wwwroot . $output;
- }
-
return $output;
}
require_once("../config.php");
require_once("editlib.php");
+ $url = new moodle_url($CFG->wwwroot.'/question/edit.php');
+ if (($lastchanged = optional_param('lastchanged', 0, PARAM_INT)) !== 0) {
+ $url->param('lastchanged', $lastchanged);
+ }
+ if (($category = optional_param('category', 0, PARAM_TEXT)) !== 0) {
+ $url->param('category', $category);
+ }
+ if (($qpage = optional_param('qpage', 0, PARAM_INT)) !== 0) {
+ $url->param('qpage', $qpage);
+ }
+ if (($cat = optional_param('cat', 0, PARAM_TEXT)) !== 0) {
+ $url->param('cat', $cat);
+ }
+ if (($courseid = optional_param('courseid', 0, PARAM_INT)) !== 0) {
+ $url->param('courseid', $courseid);
+ }
+ if (($returnurl = optional_param('returnurl', 0, PARAM_INT)) !== 0) {
+ $url->param('returnurl', $returnurl);
+ }
+ $PAGE->set_url($url);
+
list($thispageurl, $contexts, $cmid, $cm, $module, $pagevars) = question_edit_setup('questions');
$questionbank = new question_bank_view($contexts, $thispageurl, $COURSE, $cm);
$questionbank->process_actions();
} else {
$showall = '<a href="edit.php?'.$pageurl->get_query_string(array('qperpage'=>DEFAULT_QUESTIONS_PER_PAGE)).'">'.get_string('showperpage', 'moodle', DEFAULT_QUESTIONS_PER_PAGE).'</a>';
}
- if ($paging) {
- $paging = substr($paging, 0, strrpos($paging, '</div>'));
- $paging .= "<br />$showall</div>";
- } else {
- $paging = "<div class='paging'>$showall</div>";
- }
- echo $paging;
+ echo "<div class='paging'>$showall</div>";
}
echo '</div>';
$appendqnumstring = optional_param('appendqnumstring', '', PARAM_ALPHA);
$inpopup = optional_param('inpopup', 0, PARAM_BOOL);
+$url = new moodle_url($CFG->wwwroot.'/question/question.php');
+if ($id !== 0) {
+ $url->param('id', $id);
+}
+if ($qtype !== '') {
+ $url->param('qtype', $qtype);
+}
+if ($categoryid !== 0) {
+ $url->param('category', $categoryid);
+}
+if ($cmid !== 0) {
+ $url->param('cmid', $cmid);
+}
+if ($courseid !== 0) {
+ $url->param('courseid', $courseid);
+}
+if ($wizardnow !== '') {
+ $url->param('wizardnow', $wizardnow);
+}
+if ($movecontext !== 0) {
+ $url->param('movecontext', $movecontext);
+}
+if ($returnurl !== 0) {
+ $url->param('returnurl', $returnurl);
+}
+if ($appendqnumstring !== '') {
+ $url->param('appendqnumstring', $appendqnumstring);
+}
+if ($inpopup !== 0) {
+ $url->param('inpopup', $inpopup);
+}
+$PAGE->set_url($url);
+
if ($movecontext && !$id){
print_error('questiondoesnotexist', 'question', $returnurl);
}