summaryrefslogtreecommitdiffstats
path: root/app/class/user.class.php
blob: 9a87b014e40836349db7187f347ff16117081b10 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php

require_once "class/object.class.php";

/*
 * Application users
 */
class User extends Object
{
    /*
     * Constructor
     */
    function __construct($guid = null)
    {
        $cols = array(
            "guid",
            "key",
            "salt",
            "alias",
            "admin",
            "email",
            "emailConf",
            "emailConfKey"
        );

        parent::__construct("user", $cols);
        $this->loadObj($guid);
    }

    /*
     * Get all users -- ordered by name, ascending
     */
    function getAllUsers_orderByName()
    {
        $query = "SELECT guid FROM `object` WHERE `type` = 'user' ORDER BY name";
        $result = $this->db->query($query);

        $users = array();

        foreach ($result as $u)
            $users[] = new User($u['guid']);

        return $users;
    }
}

?>