X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2FttUser.class.php;h=86174547eeedc0104a37e27ee029e6cbb6fca22b;hb=80d8ba7ca7444b575edc4930ee45e46dca66144b;hp=469345b75c2c7621e0a8f900f8801df4363bc360;hpb=5e861d92d6d758ba4888e35109cc6df4ab5e2df1;p=timetracker.git diff --git a/WEB-INF/lib/ttUser.class.php b/WEB-INF/lib/ttUser.class.php index 469345b7..86174547 100644 --- a/WEB-INF/lib/ttUser.class.php +++ b/WEB-INF/lib/ttUser.class.php @@ -192,10 +192,11 @@ class ttUser { $result = array(); $mdb2 = getConnection(); + $group_id = $this->behalf_group_id ? $this->behalf_group_id : $this->group_id; // Do a query with inner join to get assigned projects. $sql = "select p.id, p.name, p.description, p.tasks, upb.rate from tt_projects p inner join tt_user_project_binds upb on (upb.user_id = ".$this->getActiveUser()." and upb.project_id = p.id and upb.status = 1) - where p.group_id = $this->group_id and p.status = 1 order by p.name"; + where p.group_id = $group_id and p.status = 1 order by p.name"; $res = $mdb2->query($sql); if (!is_a($res, 'PEAR_Error')) { while ($val = $res->fetchRow()) { @@ -409,6 +410,20 @@ class ttUser { return $groups; } + // getSubgroups obtains a list of immediate subgroups. + function getSubgroups() { + $mdb2 = getConnection(); + + $sql = "select id, name from tt_groups where org_id = $this->org_id and parent_id = ".$this->getActiveGroup();; + $res = $mdb2->query($sql); + if (!is_a($res, 'PEAR_Error')) { + while ($val = $res->fetchRow()) { + $groups[] = array('id'=>$val['id'],'name'=>$val['name']); + } + } + return $groups; + } + // getUser function is used to manage users in group and returns user details. // At the moment, the function is used for user edits and deletes. function getUser($user_id) {