public function get_tracked_users($where = '', $whereparams = array(), $groupid = 0,
             $sort = '', $limitfrom = '', $limitnum = '', context $extracontext = null) {

        global $DB;

        list($enrolledsql, $params) = get_enrolled_sql(
                context_course::instance($this->course->id),
                'moodle/course:isincompletionreports', $groupid, true);

        $allusernames = get_all_user_name_fields(true, 'u');
        $sql = 'SELECT u.id, u.idnumber, ' . $allusernames;
        if ($extracontext) {
            $sql .= get_extra_user_fields_sql($extracontext, 'u', '', array('idnumber'));
        }
        $sql .= ' FROM (' . $enrolledsql . ') eu JOIN {user} u ON u.id = eu.id';

        if ($where) {
            $sql .= " AND $where";
            $params = array_merge($params, $whereparams);
        }

        if ($sort) {
            $sql .= " ORDER BY $sort";
        }

        return $DB->get_records_sql($sql, $params, $limitfrom, $limitnum);
    }
public function get_tracked_users($where = '', $whereparams = array(), $groupid = 0,
             $sort = '', $limitfrom = '', $limitnum = '', context $extracontext = null) {

        global $DB;

        list($enrolledsql, $params) = get_enrolled_sql(
                context_course::instance($this->course->id),
                'moodle/course:isincompletionreports', $groupid, true);

        $allusernames = get_all_user_name_fields(true, 'u');
        $sql = 'SELECT u.id, u.idnumber, ' . $allusernames;
        if ($extracontext) {
            $sql .= get_extra_user_fields_sql($extracontext, 'u', '', array('idnumber'));
        }
        $sql .= ' FROM (' . $enrolledsql . ') eu JOIN {user} u ON u.id = eu.id';

        if ($where) {
            $sql .= " AND $where";
            $params = array_merge($params, $whereparams);
        }

        if ($sort) {
            $sql .= " ORDER BY $sort";
        }

        return $DB->get_records_sql($sql, $params, $limitfrom, $limitnum);
    }
public function get_tracked_users ( $ where = '' , $ whereparams = array ( ) , $ groupid = 0 , $ sort = '' , $ limitfrom = '' , $ limitnum = '' , context $ extracontext = null ) { global $ DB ; list ( $ enrolledsql , $ params ) = get_enrolled_sql ( context_course :: instance ( $ this -> course -> id ) , 'moodle/course:isincompletionreports' , $ groupid , true ) ; $ allusernames = get_all_user_name_fields ( true , 'u' ) ; $ sql = 'SELECT u.id, u.idnumber, ' . $ allusernames ; if ( $ extracontext ) { $ sql .= get_extra_user_fields_sql ( $ extracontext , 'u' , '' , array ( 'idnumber' ) ) ; } $ sql .= ' FROM (' . $ enrolledsql . ') eu JOIN {user} u ON u.id = eu.id' ; if ( $ where ) { $ sql .= " AND $where" ; $ params = array_merge ( $ params , $ whereparams ) ; } if ( $ sort ) { $ sql .= " ORDER BY $sort" ; } return $ DB -> get_records_sql ( $ sql , $ params , $ limitfrom , $ limitnum ) ; }
Return array of users whose progress is tracked in this course.

Optionally supply a search's where clause, group id, sorting, paging.

@param string $where Where clause sql, referring to 'u.' fields (optional)
@param array $whereparams Where clause params (optional)
@param int $groupid Group ID to restrict to (optional)
@param string $sort Order by clause (optional)
@param int $limitfrom Result start (optional)
@param int $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 Array of user objects with standard user fields
Return array of users whose progress is tracked in this course .