$task) { $task->load_admin($db); $task->load_tdcs($db, false); } header("Content-Type: application/json"); // TODO: this should probably use tasks->to_json instead so as to not serialize more than needed echo json_encode($tasks); //var_dump($tasks); } $mapping = array( "get_all_tasks_simple" => "\mcoop\get_all_tasks_simple" ); if (isset($_GET["action"])) { $action = $_GET["action"]; if (array_key_exists($action, $mapping)) { $funcname = $mapping[$action]; $funcname($db); } } ?>