Improved isTrue() function and its usage to streamline code.
[timetracker.git] / WEB-INF / lib / ttAdmin.class.php
index 30c78f9..ef55ae5 100644 (file)
@@ -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.
@@ -166,7 +176,7 @@ class ttAdmin {
     //
     // 1) Users may mark some of them deleted during their work.
     // If we mark all of them deleted here, we can't recover nicely
-    // as we'll lose track of what was deleted by user.
+    // as we'll lose track of what was accidentally deleted by user.
     //
     // 2) DB maintenance script (Clean up DB from inactive groups) should
     // get rid of these items permanently eventually.