]> wagnertech.de Git - timetracker.git/blobdiff - WEB-INF/lib/ttTeamHelper.class.php
A bit more work in progress on roles.
[timetracker.git] / WEB-INF / lib / ttTeamHelper.class.php
index 3b01415ecd8740a00513723a47303ba325d3ee4f..2ae75923fd4be432a368f2efefb7379b3f9031de 100644 (file)
@@ -263,6 +263,41 @@ class ttTeamHelper {
     return false;
   }
 
+  // getActiveRoles - returns an array of active roles for team.
+  static function getActiveRoles($team_id)
+  {
+    $result = array();
+    $mdb2 = getConnection();
+
+    $sql = "select id, name, rights from tt_roles where team_id = $team_id and status = 1 order by upper(name)";
+    $res = $mdb2->query($sql);
+    $result = array();
+    if (!is_a($res, 'PEAR_Error')) {
+      while ($val = $res->fetchRow()) {
+        $result[] = $val;
+      }
+    }
+    return $result;
+  }
+
+  // getInactiveRoles - returns an array of inactive roles for team.
+  static function getInactiveRoles($team_id)
+  {
+    $result = array();
+    $mdb2 = getConnection();
+
+    $sql = "select id, name, rights from tt_roles
+      where team_id = $team_id and status = 0 order by upper(name)";
+    $res = $mdb2->query($sql);
+    $result = array();
+    if (!is_a($res, 'PEAR_Error')) {
+      while ($val = $res->fetchRow()) {
+        $result[] = $val;
+      }
+    }
+    return $result;
+  }
+
   // The getActiveClients returns an array of active clients for team.
   static function getActiveClients($team_id, $all_fields = false)
   {