mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
course MDL-19794 Upgraded deprecate function calls
This commit is contained in:
parent
ec7c4f112b
commit
928d4738f1
@ -215,7 +215,7 @@ function build_mnet_logs_array($hostid, $course, $user=0, $date=0, $order="l.tim
|
||||
|
||||
function build_logs_array($course, $user=0, $date=0, $order="l.time ASC", $limitfrom='', $limitnum='',
|
||||
$modname="", $modid=0, $modaction="", $groupid=0) {
|
||||
global $DB;
|
||||
global $DB, $SESSION;
|
||||
// It is assumed that $date is the GMT time of midnight for that day,
|
||||
// and so the next 86400 seconds worth of logs are printed.
|
||||
|
||||
@ -224,7 +224,17 @@ function build_logs_array($course, $user=0, $date=0, $order="l.time ASC", $limit
|
||||
/// If the group mode is separate, and this user does not have editing privileges,
|
||||
/// then only the user's group can be viewed.
|
||||
if ($course->groupmode == SEPARATEGROUPS and !has_capability('moodle/course:managegroups', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
$groupid = get_current_group($course->id);
|
||||
if (isset($SESSION->currentgroup[$course->id])) {
|
||||
$groupid = $SESSION->currentgroup[$course->id];
|
||||
} else {
|
||||
$groupid = groups_get_all_groups($course->id, $USER->id);
|
||||
if (is_array($groupid)) {
|
||||
$groupid = array_shift(array_keys($groupid));
|
||||
$SESSION->currentgroup[$course->id] = $groupid;
|
||||
} else {
|
||||
$groupid = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// If this course doesn't have groups, no groupid can be specified.
|
||||
else if (!$course->groupmode) {
|
||||
|
@ -26,7 +26,7 @@
|
||||
function print_mnet_log_selector_form($hostid, $course, $selecteduser=0, $selecteddate='today',
|
||||
$modname="", $modid=0, $modaction='', $selectedgroup=-1, $showcourses=0, $showusers=0, $logformat='showashtml') {
|
||||
|
||||
global $USER, $CFG, $SITE, $DB, $OUTPUT;
|
||||
global $USER, $CFG, $SITE, $DB, $OUTPUT, $SESSION;
|
||||
require_once $CFG->dirroot.'/mnet/peer.php';
|
||||
|
||||
$mnet_peer = new mnet_peer();
|
||||
@ -51,18 +51,29 @@ function print_mnet_log_selector_form($hostid, $course, $selecteduser=0, $select
|
||||
|
||||
/// Setup for group handling.
|
||||
if ($course->groupmode == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', $context)) {
|
||||
$selectedgroup = get_current_group($course->id);
|
||||
$selectedgroup = -1;
|
||||
$showgroups = false;
|
||||
}
|
||||
else if ($course->groupmode) {
|
||||
$selectedgroup = ($selectedgroup == -1) ? get_current_group($course->id) : $selectedgroup;
|
||||
} else if ($course->groupmode) {
|
||||
$showgroups = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$selectedgroup = 0;
|
||||
$showgroups = false;
|
||||
}
|
||||
|
||||
if ($selectedgroup === -1) {
|
||||
if (isset($SESSION->currentgroup[$course->id])) {
|
||||
$selectedgroup = $SESSION->currentgroup[$course->id];
|
||||
} else {
|
||||
$selectedgroup = groups_get_all_groups($course->id, $USER->id);
|
||||
if (is_array($selectedgroup)) {
|
||||
$selectedgroup = array_shift(array_keys($selectedgroup));
|
||||
$SESSION->currentgroup[$course->id] = $selectedgroup;
|
||||
} else {
|
||||
$selectedgroup = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$context = $sitecontext;
|
||||
}
|
||||
@ -311,7 +322,7 @@ function print_mnet_log_selector_form($hostid, $course, $selecteduser=0, $select
|
||||
function print_log_selector_form($course, $selecteduser=0, $selecteddate='today',
|
||||
$modname="", $modid=0, $modaction='', $selectedgroup=-1, $showcourses=0, $showusers=0, $logformat='showashtml') {
|
||||
|
||||
global $USER, $CFG, $DB, $OUTPUT;
|
||||
global $USER, $CFG, $DB, $OUTPUT, $SESSION;
|
||||
|
||||
// first check to see if we can override showcourses and showusers
|
||||
$numcourses = $DB->count_records("course");
|
||||
@ -324,24 +335,35 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate='today'
|
||||
|
||||
/// Setup for group handling.
|
||||
if ($course->groupmode == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', $context)) {
|
||||
$selectedgroup = get_current_group($course->id);
|
||||
$selectedgroup = -1;
|
||||
$showgroups = false;
|
||||
}
|
||||
else if ($course->groupmode) {
|
||||
$selectedgroup = ($selectedgroup == -1) ? get_current_group($course->id) : $selectedgroup;
|
||||
} else if ($course->groupmode) {
|
||||
$showgroups = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$selectedgroup = 0;
|
||||
$showgroups = false;
|
||||
}
|
||||
|
||||
if ($selectedgroup === -1) {
|
||||
if (isset($SESSION->currentgroup[$course->id])) {
|
||||
$selectedgroup = $SESSION->currentgroup[$course->id];
|
||||
} else {
|
||||
$selectedgroup = groups_get_all_groups($course->id, $USER->id);
|
||||
if (is_array($selectedgroup)) {
|
||||
$selectedgroup = array_shift(array_keys($selectedgroup));
|
||||
$SESSION->currentgroup[$course->id] = $selectedgroup;
|
||||
} else {
|
||||
$selectedgroup = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get all the possible users
|
||||
$users = array();
|
||||
|
||||
if ($course->id != SITEID) {
|
||||
$courseusers = get_users_by_capability($context, 'moodle/course:view', 'u.id, u.firstname, u.lastname, u.idnumber', 'lastname ASC, firstname ASC', '','',$selectedgroup,null, false);
|
||||
} else {
|
||||
} else {
|
||||
// this may be a lot of users :-(
|
||||
$courseusers = $DB->get_records('user', array('deleted'=>0), 'lastaccess DESC', 'id, firstname, lastname, idnumber');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user