public function get($recursive = 'false') { if ($recursive == 'false') { $results = DB::query("\n SELECT id, name\n FROM groups\n "); while ($res[] = mysqli_fetch_assoc($results)) { } if (!is_null($res) && end($res) == null) { array_pop($res); } } elseif ($recursive == 'true') { $results = DB::query("\n SELECT id, name\n FROM groups\n "); while ($groups[] = mysqli_fetch_assoc($results)) { } if (!is_null($groups) && end($groups) == null) { array_pop($groups); } $handle = new Handle(array()); foreach ($groups as $g) { $g['handles'] = $handle->get($g['id']); $res[] = $g; } } else { return array(); } return $res; }
public static function getHandles($group_id) { $handle = new Handle(array()); $handles = $handle->get($group_id); // true returns also handles; return $handles; }