Skip to content

Commit

Permalink
MDL-32649 rating: fixed the sorting in /rating/index.php
Browse files Browse the repository at this point in the history
  • Loading branch information
andyjdavis committed Jun 4, 2012
1 parent 4db0616 commit 94e4019
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions rating/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 94e4019

Please sign in to comment.