X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2FttAdmin.class.php;h=23d8480d746e9691d22f10a8d08b2cadd9341646;hb=a4298d704504e90da27dfdae71aaf6cc2faa9844;hp=f9b12c86306643a022360dd82ca8482339c906c3;hpb=167e70e68597a70269edea5c5af9b186c489d57f;p=timetracker.git diff --git a/WEB-INF/lib/ttAdmin.class.php b/WEB-INF/lib/ttAdmin.class.php index f9b12c86..23d8480d 100644 --- a/WEB-INF/lib/ttAdmin.class.php +++ b/WEB-INF/lib/ttAdmin.class.php @@ -41,7 +41,17 @@ class ttAdmin { // getSubgroups rerurns an array of subgroups for a group. function getSubgroups($group_id) { - return array(); // TODO: not yet implemented. + $mdb2 = getConnection(); + + $subgroups = array(); + $sql = "select id from tt_groups where parent_id = $group_id"; + $res = $mdb2->query($sql); + if (!is_a($res, 'PEAR_Error')) { + while ($val = $res->fetchRow()) { + $subgroups[] = $val; + } + } + return $subgroups; } // getUsers obtains user ids in a group. @@ -168,7 +178,7 @@ class ttAdmin { // If we mark all of them deleted here, we can't recover nicely // as we'll lose track of what was deleted by user. // - // 2) DB maintenance script (Clean up DB from inactive teams) should + // 2) DB maintenance script (Clean up DB from inactive groups) should // get rid of these items permanently eventually. // Mark group deleted. @@ -332,4 +342,24 @@ class ttAdmin { return true; } + + // getGroupDetails obtains group name and its top manager details. + function getGroupDetails($group_id) { + $result = array(); + $mdb2 = getConnection(); + + $sql = "select g.name as group_name, u.id as manager_id, u.name as manager_name, u.login as manager_login, u.email as manager_email". + " from tt_groups g". + " inner join tt_users u on (u.group_id = g.id)". + " inner join tt_roles r on (r.id = u.role_id and r.rank = 512)". + " where g.id = $group_id"; + + $res = $mdb2->query($sql); + if (!is_a($res, 'PEAR_Error')) { + $val = $res->fetchRow(); + return $val; + } + + return false; + } }