More refactoring for subgroups.
[timetracker.git] / WEB-INF / lib / ttGroupHelper.class.php
index 8298627..801793f 100644 (file)
@@ -484,4 +484,25 @@ class ttGroupHelper {
     }
     return $user_list;
   }
+
+  // getActiveTasks - returns an array of active tasks for a group.
+  static function getActiveTasks()
+  {
+    global $user;
+    $mdb2 = getConnection();
+
+    $group_id = $user->getGroup();
+    $org_id = $user->org_id;
+
+    $sql = "select id, name, description from tt_tasks".
+      " where group_id = $group_id and org_id = $org_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;
+  }
 }