]> git.mjollnir.org Git - moodle.git/commitdiff
output MDL-19799 Fixed up some set_url calls as well as fixing some regressions cause...
authorsamhemelryk <samhemelryk>
Wed, 21 Oct 2009 04:23:35 +0000 (04:23 +0000)
committersamhemelryk <samhemelryk>
Wed, 21 Oct 2009 04:23:35 +0000 (04:23 +0000)
course/mod.php
course/report/log/index.php
course/report/outline/index.php
mod/quiz/locallib.php
mod/wiki/view.php
question/category.php
question/category_class.php

index 63fedd55802400046c6b84b008a9873820416e75..d4349c6240969341dfb26f4df77665dfd322a637 100644 (file)
@@ -45,7 +45,25 @@ $cancelcopy    = optional_param('cancelcopy', 0, PARAM_BOOL);
 $confirm       = optional_param('confirm', 0, PARAM_BOOL);
 
 // This page should always redirect
-$PAGE->set_url($FULLME);
+$url = new moodle_url($CFG->wwwroot.'/course/mod.php');
+foreach (compact('indent','update','hide','show','copy','moveto','movetosection','delete','course','cancelcopy','confirm') as $key=>$value) {
+    if ($value !== 0) {
+        $url->param($key, $value);
+    }
+}
+if ($sectionreturn !== '') {
+    $url->param('sr', $sectionreturn);
+}
+if ($add !== '') {
+    $url->param('add', $add);
+}
+if ($type !== '') {
+    $url->param('type', $type);
+}
+if ($groupmode !== '') {
+    $url->param('groupmode', $groupmode);
+}
+$PAGE->set_url($url);
 
 //check if we are adding / editing a module that has new forms using formslib
 if (!empty($add)) {
index 113db54b4513660fb95984725ca5d394382c7c92..2809042fcf5f209cd0c56d2b89dd37e56884f91c 100644 (file)
     $chooselog   = optional_param('chooselog', 0, PARAM_INT);
     $logformat   = optional_param('logformat', 'showashtml', PARAM_ALPHA);
 
-    $PAGE->set_url(new moodle_url($FULLME));
+    $params = array();
+    if ($group !== 0) $params['group'] = $group;
+    if ($user !== 0) $params['user'] = $user;
+    if ($date !== 0) $params['date'] = $date;
+    if ($modname !== 0) $params['modname'] = $modname;
+    if ($modid !== 0) $params['modid'] = $modid;
+    if ($modaction !== '') $params['modaction'] = $modaction;
+    if ($page !== '0') $params['page'] = $page;
+    if ($perpage !== '100') $params['perpage'] = $perpage;
+    if ($showcourses !== 0) $params['showcourses'] = $showcourses;
+    if ($showusers !== 0) $params['showusers'] = $showusers;
+    if ($chooselog !== 0) $params['chooselog'] = $chooselog;
+    if ($logformat !== 'showashtml') $params['logformat'] = $logformat;
+    $PAGE->set_url(new moodle_url($CFG->wwwroot.'/course/report/log/index.php', $params));
 
     if ($hostid == $CFG->mnet_localhost_id) {
         if (!$course = $DB->get_record('course', array('id'=>$id))) {
index d1d875d828b45c13e512241f1b11cdfa24071cc7..dd845717404d02a93bc65ad3f18ee3c4af902354 100644 (file)
@@ -1,4 +1,4 @@
-<?php // $Id$
+<?php
 
 // Display user activity reports for a course (totals)
 
@@ -11,7 +11,7 @@
         print_error('invalidcourseid');
     }
 
-    $PAGE->set_url(new moodle_url($FULLME));
+    $PAGE->set_url(new moodle_url($CFg->wwwroot.'/course/report/outline/index.php', array('id'=>$id)));
 
     require_login($course);
     $context = get_context_instance(CONTEXT_COURSE, $course->id);
index 13bf64cee3ffec5aa6910482e9cbca23c088fd74..fb44d52a5a07bfe9bd303f391eaf0d45f2eebba0 100644 (file)
@@ -788,7 +788,7 @@ function quiz_question_edit_button($cmid, $question, $returnurl, $contentbeforei
         $questionparams = array('returnurl' => $returnurl, 'cmid' => $cmid, 'id' => $question->id);
         $questionurl = new moodle_url("$CFG->wwwroot/question/question.php", $questionparams);
         return '<a title="' . $action . '" href="' . $questionurl->out() . '">' . $contentbeforeicon .
-                '<img src="' . $OUTPUT->old_icon_url($icon) . '.gif" alt="' . $action . '" /></a>';
+                '<img src="' . $OUTPUT->old_icon_url($icon) . '" alt="' . $action . '" /></a>';
     } else {
         return $contentbeforeicon;
     }
index 2563270e0374f688f1405839fe0fd9b1dbf6baec..e74900e48c2f17381f3a12dd6df25b42c214273d 100644 (file)
     // Only want to add edit log entries if we have made some changes ie submitted a form
     $editsave = optional_param('thankyou', '', PARAM_RAW);
 
-    $PAGE->set_url(new moodle_url($FULLME));
+    $url = new moodle_url($CFG->wwwroot.'/mod/wiki/view.php');
+    if ($ewiki_action !== '') {
+        $url->param('ewiki_action', $ewiki_action);
+    }
+    if ($id !== 0) {
+        $url->param('id', $id);
+    }
+    if ($wid !== 0) {
+        $url->param('wid', $wid);
+    }
+    if ($page !== false) {
+        $url->param('page', $page);
+    }
+    if ($q !== '') {
+        $url->param('q', $q);
+    }
+    if ($userid !== 0) {
+        $url->param('userid', $userid);
+    }
+    if ($groupid !== 0) {
+        $url->param('groupid', $groupid);
+    }
+    if ($canceledit !== '') {
+        $url->param('canceledit', $canceledit);
+    }
+    if ($cacheme !== 1) {
+        $url->param('allowcache', $cacheme);
+    }
+    $PAGE->set_url($url);
 
     if($page) {
         // Split page command into action and page
index 7c807d25d139e993647815cea8326563f23eac84..df43238814378fe3d1967efd844b45137135bcc3 100644 (file)
     $param->moveto = optional_param('moveto', 0, PARAM_INT);
     $param->edit = optional_param('edit', 0, PARAM_INT);
 
-    $PAGE->set_url(new moodle_url($FULLME));
+    $url = new moodle_url($thispageurl);
+    foreach ((array)$param as $key=>$value) {
+        if (($key !== 'cancel' && $value !== 0) || ($key === 'cancel' && $value !== '')) {
+            $url->param($key, $value);
+        }
+    }
+    $PAGE->set_url($url);
 
     $qcobject = new question_category_object($pagevars['cpage'], $thispageurl, $contexts->having_one_edit_tab_cap('categories'), $param->edit, $pagevars['cat'], $param->delete,
                                 $contexts->having_cap('moodle/question:add'));
index 190a3bcbe94c24452edde99d4d88195873b0e817..935120427d3c3c1d450fb5c091a9a9f8e5411240 100644 (file)
@@ -100,7 +100,7 @@ class question_category_list_item extends list_item {
 
         if (count($this->parentlist->records)!=1){ // don't allow delete if this is the last category in this context.
             $item .=  '<a title="' . $str->delete . '" href="'.$this->parentlist->pageurl->out_action(array('delete'=>$this->id)).'">
-                    <img src="' . $OUTPUT->old_icon_url('t/delete.gif') . '" class="iconsmall" alt="' .$str->delete. '" /></a>';
+                    <img src="' . $OUTPUT->old_icon_url('t/delete') . '" class="iconsmall" alt="' .$str->delete. '" /></a>';
         }
 
         return $item;