select("machines", ["machineid (id)"], ["AND" => ["clientid" => $VARS["clientid"], "deleted[!]" => true]]); $machines = []; foreach ($machinelist as $m) { $machines[] = (new Machine($m["id"]))->toArrayLite(); } $client = Clients::getClient($VARS["clientid"])->toArray(); exitWithJson([ "status" => "OK", "client" => $client, "machines" => $machines ]); } else { sendJsonResp("Client ID not found.", "ERROR"); } } else if ($VARS["action"] == "getclients") { $allclients = Clients::getAllAsIDNameArray(); exitWithJson([ "status" => "OK", "clients" => $allclients ]); } else if ($VARS["action"] == "searchclients") { $clients = Clients::search($VARS["q"]); exitWithJson([ "status" => "OK", "q" => $VARS["q"], "count" => count($clients), "clients" => $clients ]); }