X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2FttGroupHelper.class.php;h=6ddffaa8cf2289a896e237531e4bd1f8067e8817;hb=280d6ea0ee096843551d7734b23377ec06d42e81;hp=22362b5b901b2bc933c9b00dbeb101540072e7a7;hpb=948617a6a0f129ba4090934ee8f544009dbcd935;p=timetracker.git diff --git a/WEB-INF/lib/ttGroupHelper.class.php b/WEB-INF/lib/ttGroupHelper.class.php index 22362b5b..6ddffaa8 100644 --- a/WEB-INF/lib/ttGroupHelper.class.php +++ b/WEB-INF/lib/ttGroupHelper.class.php @@ -30,35 +30,32 @@ // This is a planned replacement for ttTeamHelper as we move forward with subgroups. class ttGroupHelper { - // The getTopGroups function returns an array of all active top groups on the server. - static function getTopGroups() { - $result = array(); + // The getGroupName function returns group name. + static function getGroupName($group_id) { $mdb2 = getConnection(); - $sql = "select id, name, created, lang from tt_groups". - " where status = 1 and org_id is NULL or org_id = id order by id desc"; + $sql = "select name from tt_groups where id = $group_id and (status = 1 or status = 0)"; $res = $mdb2->query($sql); - $result = array(); + if (!is_a($res, 'PEAR_Error')) { - while ($val = $res->fetchRow()) { - $val['date'] = substr($val['created'], 0, 10); // Strip the time. - $result[] = $val; - } - return $result; + $val = $res->fetchRow(); + return $val['name']; } return false; } - // The getGroupName function returns group name. - static function getGroupName($group_id) { + // The getParentGroup determines a parent group for a given group. + static function getParentGroup($group_id) { + global $user; + $mdb2 = getConnection(); - $sql = "select name from tt_groups where id = $group_id and (status = 1 or status = 0)"; + $sql = "select parent_id from tt_groups where id = $group_id and org_id = $user->org_id and status = 1"; $res = $mdb2->query($sql); if (!is_a($res, 'PEAR_Error')) { $val = $res->fetchRow(); - return $val['name']; + return $val['parent_id']; } return false; }