summaryrefslogtreecommitdiffstats
path: root/lib/api/kolab_user_types_actions.php
blob: e37ff90c5da908e45afc504e2744381b0639db3a (plain)
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
<?php

/**
 *
 */
class kolab_user_types_actions extends kolab_api_service
{
    public function capabilities($domain)
    {
        return array(
            'list' => 'r',
        );
    }

    public function user_types_list($get, $post)
    {
        $result = query("SELECT * FROM user_types");
        $user_types = array();

        while ($row = mysql_fetch_assoc($result)) {
            $user_types[$row['id']] = array();

            foreach ($row as $key => $value) {
                if ($key != "id") {
                    if ($key == "attributes") {
                        $user_types[$row['id']][$key] = json_decode(unserialize($value), true);
                    }
                    else {
                        $user_types[$row['id']][$key] = $value;
                    }
                }
            }
        }

        return $user_types;
    }
}