MDL-26647 (5) Support showuseridentity on course and activity completion reports

This commit is contained in:
sam marshall
2011-11-04 13:57:15 +00:00
parent 43aa295b95
commit 24e14bc7a6
4 changed files with 50 additions and 38 deletions
+11 -3
View File
@@ -1057,10 +1057,12 @@ class completion_info {
* @param string $sort Order by clause (optional)
* @param integer $limitfrom Result start (optional)
* @param integer $limitnum Result max size (optional)
* @param context $extracontext If set, includes extra user information fields
* as appropriate to display for current user in this context
* @return array
*/
function get_tracked_users($where = '', $where_params = array(), $groupid = 0,
$sort = '', $limitfrom = '', $limitnum = '') {
$sort = '', $limitfrom = '', $limitnum = '', context $extracontext = null) {
global $DB;
@@ -1074,6 +1076,9 @@ class completion_info {
u.lastname,
u.idnumber
";
if ($extracontext) {
$sql .= get_extra_user_fields_sql($extracontext, 'u', '', array('idnumber'));
}
$sql .= $tracked->sql;
@@ -1190,16 +1195,19 @@ class completion_info {
* @param int $groupid Group ID or 0 (default)/false for all groups
* @param int $pagesize Number of users to actually return (optional)
* @param int $start User to start at if paging (optional)
* @param context $extracontext If set, includes extra user information fields
* as appropriate to display for current user in this context
* @return Object with ->total and ->start (same as $start) and ->users;
* an array of user objects (like mdl_user id, firstname, lastname)
* containing an additional ->progress array of coursemoduleid => completionstate
*/
public function get_progress_all($where = '', $where_params = array(), $groupid = 0,
$sort = '', $pagesize = '', $start = '') {
$sort = '', $pagesize = '', $start = '', context $extracontext = null) {
global $CFG, $DB;
// Get list of applicable users
$users = $this->get_tracked_users($where, $where_params, $groupid, $sort, $start, $pagesize);
$users = $this->get_tracked_users($where, $where_params, $groupid, $sort,
$start, $pagesize, $extracontext);
// Get progress information for these users in groups of 1, 000 (if needed)
// to avoid making the SQL IN too long