Merge branch 'MDL-47869-master' of git://github.com/lameze/moodle

This commit is contained in:
Marina Glancy 2014-11-07 15:03:32 +08:00
commit 293f1b4d85
3 changed files with 6 additions and 5 deletions

View file

@ -214,9 +214,9 @@ class rules extends \table_sql implements \renderable {
if ($numcourses > COURSE_MAX_COURSES_PER_DROPDOWN) {
return false;
}
$orderby = 'visible DESC, sortorder ASC';
$options = array(0 => get_string('site'));
if ($courses = get_user_capability_course('tool/monitor:subscribe', null, true, 'fullname')) {
if ($courses = get_user_capability_course('tool/monitor:subscribe', null, true, 'fullname', $orderby)) {
foreach ($courses as $course) {
$options[$course->id] = format_string($course->fullname, true,
array('context' => \context_course::instance($course->id)));

View file

@ -222,8 +222,9 @@ class rule_manager {
public static function get_rules_by_courseid($courseid, $limitfrom = 0, $limitto = 0) {
global $DB;
$select = "courseid = ? OR courseid = ?";
return self::get_instances($DB->get_records_select('tool_monitor_rules', $select, array(0, $courseid), null, '*',
$limitfrom, $limitto));
$orderby = "courseid DESC, name ASC";
return self::get_instances($DB->get_records_select('tool_monitor_rules', $select, array(0, $courseid), $orderby,
'*', $limitfrom, $limitto));
}
/**

View file

@ -280,7 +280,7 @@ class subscription_manager {
* @return array list of subscriptions
*/
public static function get_user_subscriptions($limitfrom = 0, $limitto = 0, $userid = 0,
$order = 's.timecreated DESC' ) {
$order = 's.courseid ASC, r.name' ) {
global $DB, $USER;
if ($userid == 0) {
$userid = $USER->id;