MDL-32649 rating: fixed the sorting in /rating/index.php

This commit is contained in:
Andrew Davis
2012-05-23 08:37:09 +07:00
parent 2ddb941b0a
commit 940e243547
+11 -6
View File
@@ -38,10 +38,16 @@ $popup = optional_param('popup', 0, PARAM_INT); //==1 if in a popup window?
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 @@ if (!$ratings) {
$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;