$item = $items[$i]; echo "{ \"Category\": \"Members\", \"Item\": "; echo $item->ToJSON(); echo " }"; if ($i + $previousCount < $totalCount - 1) { echo ", "; } } }); } if ($availableTables["Groups"]) { $lookupTables[] = new LookupTable("Groups", "group_Name", function ($table, $totalCount, $previousCount) { $result = $table->Result; for ($i = 0; $i < $result->num_rows; $i++) { $values = $result->fetch_assoc(); $item = Group::GetByAssoc($values); echo "{ \"Category\": \"Groups\", \"Item\": "; echo $item->ToJSON(); echo " }"; if ($i + $previousCount < $totalCount - 1) { echo ", "; } } }); } if ($availableTables["Places"]) { $lookupTables[] = new LookupTable("Places", "place_Name", function ($table, $totalCount, $previousCount) { $result = $table->Result; for ($i = 0; $i < $result->num_rows; $i++) { $values = $result->fetch_assoc(); $item = Place::GetByAssoc($values);
public static function GetByUser($user = null, $max = null) { if ($user == null) { return array(); } global $MySQL; $query = "SELECT * FROM " . System::$Configuration["Database.TablePrefix"] . "Groups, " . System::$Configuration["Database.TablePrefix"] . "GroupMembers WHERE " . System::$Configuration["Database.TablePrefix"] . "Groups.group_ID = " . System::$Configuration["Database.TablePrefix"] . "GroupMembers.groupmember_GroupID AND " . System::$Configuration["Database.TablePrefix"] . "GroupMembers.groupmember_UserID = " . $user->ID . " ORDER BY group_Title"; if ($max != null && is_numeric($max)) { $query .= " LIMIT " . $max; } $result = $MySQL->query($query); $count = $result->num_rows; $retval = array(); for ($i = 0; $i < $count; $i++) { $values = $result->fetch_assoc(); $retval[] = Group::GetByAssoc($values); } return $retval; }