X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/7218f84ad58ed22a926b3ffa7a152ca7f93f0204..fdaf50116c208e78b6c4de6e6fe263541163c4af:/WEB-INF/lib/ttTeamHelper.class.php diff --git a/WEB-INF/lib/ttTeamHelper.class.php b/WEB-INF/lib/ttTeamHelper.class.php index 4e39628a..fec798a5 100644 --- a/WEB-INF/lib/ttTeamHelper.class.php +++ b/WEB-INF/lib/ttTeamHelper.class.php @@ -325,6 +325,28 @@ class ttTeamHelper { return $result; } + // getInactiveRolesForUser - returns an array of relevant active roles for user with rank less than self. + // "Relevant" means that client roles are filtered out if Client plugin is disabled. + static function getInactiveRolesForUser() + { + global $user; + $result = array(); + $mdb2 = getConnection(); + + $sql = "select id, name, description, rank, rights from tt_roles where team_id = $user->team_id and rank < $user->rank and status = 0 order by rank"; + $res = $mdb2->query($sql); + $result = array(); + if (!is_a($res, 'PEAR_Error')) { + while ($val = $res->fetchRow()) { + $val['is_client'] = in_array('track_own_time', explode(',', $val['rights'])) ? 0 : 1; // Clients do not have data entry right. + if ($val['is_client'] && !$user->isPluginEnabled('cl')) + continue; // Skip adding a client role. + $result[] = $val; + } + } + return $result; + } + // getAllRoles - obtains all roles defined for team. static function getAllRoles($team_id) { $mdb2 = getConnection(); @@ -699,7 +721,6 @@ class ttTeamHelper { $result = array(); $mdb2 = getConnection(); - $role_manager = ROLE_MANAGER; $sql = "select t.name as team_name, u.id as manager_id, u.name as manager_name, u.login as manager_login, u.email as manager_email from tt_teams t inner join tt_users u on (u.team_id = t.id)