Permalink
Browse files

Merge branch 'MDL-32649_ratings_sort_21' of git://github.com/andyjdav…

…is/moodle into MOODLE_21_STABLE
  • Loading branch information...
2 parents ceb3ce5 + 940e243 commit 1f0856d6bfb5e112d057a74c06028826896fec63 @stronk7 stronk7 committed Jun 5, 2012
Showing with 11 additions and 6 deletions.
  1. +11 −6 rating/index.php
View
17 rating/index.php
@@ -38,10 +38,16 @@
list($context, $course, $cm) = get_context_info_array($contextid);
require_login($course, false, $cm);
-$url = new moodle_url('/rating/index.php', array('contextid'=>$contextid,'itemid'=>$itemid,'scaleid'=>$scaleid));
-if ($sort !== 0) {
+$url = new moodle_url('/rating/index.php', array('contextid'=>$contextid,'component'=>$component,'itemid'=>$itemid,'scaleid'=>$scaleid));
+if (!empty($ratingarea)) {
+ $url->param('ratingarea', $ratingarea);
+}
+if (!empty($sort)) {
$url->param('sort', $sort);
}
+if (!empty($popup)) {
+ $url->param('popup', $popup);
+}
$PAGE->set_url($url);
$PAGE->set_context($context);
@@ -84,10 +90,9 @@
$msg = get_string('noratings','rating');
echo html_writer::tag('div', $msg, array('class'=>'mdl-align'));
} else {
- $sorturl = new moodle_url('/index.php', array('contextid' => $contextid, 'itemid' => $itemid, 'scaleid' => $scaleid));
- if ($popup) {
- $sorturl->param('popup', $popup);
- }
+ // To get the sort URL, copy the current URL and remove any previous sort
+ $sorturl = new moodle_url($url);
+ $sorturl->remove_params('sort');
$table = new html_table;
$table->cellpadding = 3;

0 comments on commit 1f0856d

Please sign in to comment.