Ejemplo n.º 1
0
/**
 * Get all the users the current user has permissions to see
 *
 * @param boolean $includegroups (optional - default: false)
 * @param integer $start (optional - default: 0)
 * @param integer $max (optional - default: 20)
 * @param string $orderby (optional, either 'date', 'name' or 'moddate' - default: 'date')
 * @param string $sort (optional, either 'ASC' or 'DESC' - default: 'DESC')
 * @param string $style (optional - default 'long') may be 'short' or 'long'  - how much of a user's details to load (long includes: tags and groups).
 * @param string $q the query term(s)
 * @return UserSet or Error
 */
function getUsersByGlobal($includegroups = false, $start = 0, $max = 20, $orderby = 'date', $sort = 'DESC', $style = 'long', $q = '')
{
    global $CFG, $HUB_SQL;
    $params = array();
    $params[0] = $CFG->defaultUserID;
    $sql = $HUB_SQL->APILIB_USERS_BY_GLOBAL_SELECT;
    if ($includegroups == false) {
        $sql .= $HUB_SQL->APILIB_USERS_BY_GLOBAL_FILTER_GROUPS;
    }
    if ($q != "") {
        $querySQL = getSearchQueryString($params, $q, true, false);
        if ($querySQL != "") {
            $sql .= $HUB_SQL->AND;
            $sql .= $querySQL;
        }
    }
    $us = new UserSet();
    return $us->load($sql, $params, $start, $max, $orderby, $sort, $style);
}
Ejemplo n.º 2
0
/**
 * Return a list of users who have requested the email digest of Recent Activity.
 * @return a UserSet of users found.
 */
function getRecentActivityEmailUsers()
{
    global $CFG, $DB, $HUB_SQL;
    $params = array();
    $params[0] = $CFG->defaultUserID;
    $sql = $HUB_SQL->UTILLIB_RECENT_ACTIVITY_EMAIL_USERS;
    $us = new UserSet();
    $us->load($sql, $params, 0, -1, 'date', 'DESC', 'long');
    return $us;
}