public function handle_get($data) { $profile = GroupBackend::fetch_group_profile($this->params["id"]); $data = []; $data["profile"] = $profile->toExternalForm(); $data["settings"] = GroupBackend::fetch_group_settings($profile); $data["permissions"] = GroupBackend::fetch_group_permissions($profile); $users = []; /** @var UserProfile $user */ foreach (GroupBackend::fetch_group_users($profile) as $user) { $users[] = $user->toExternalForm(); } $data["users"] = $users; return $data; }
public static function set_group_setting(GroupProfile $profile, $setting) { if (array_key_exists($setting->{"key"}, GroupBackend::fetch_group_settings($profile))) { $query = Database::generate_query("group_setting_update", [$profile->getGroupId()->toString(), $setting->{"key"}, $setting->{"value"}]); } else { $query = Database::generate_query("group_setting_set", [$profile->getGroupId()->toString(), $setting->{"key"}, $setting->{"value"}]); } $query->execute(); }
public function handle($data) { $profile = GroupBackend::fetch_group_profile($this->params["id"]); $settings = GroupBackend::fetch_group_settings($profile); return ["settings" => $settings]; }