// Check to see if values are set, overwrite defaults if set foreach ($params as $k => $v) { if (isset($_REQUEST[$k])) { $params[$k] = strtolower(safeString($_REQUEST[$k])); } } $action = $params['action']; $type = $params['type']; $query = $params['query']; $page = $params['page']; $limit = $params['limit']; $sort = $params['sort']; if ($action == "search") { $data = searchPeople($query, $page, $limit, $sort); } else { $data = browsePeople($page, $limit); } $status = 200; break; case "getVisualizations": // Setup the default params $params = array("page" => 1, "limit" => 10, "query" => "", "sort" => "default", "action" => "browse", "type" => "people"); // Check to see if values are set, overwrite defaults if set foreach ($params as $k => $v) { if (isset($_REQUEST[$k])) { $params[$k] = strtolower(safeString($_REQUEST[$k])); } } $action = $params['action']; $type = $params['type']; $query = $params['query'];
$results = searchPeople($query, $page, $limit, $sort); $count = searchPeople($query, -1, $limit, $sort); } else { $results = searchExperiments($query, $page, $limit, $sort); $count = searchExperiments($query, -1, $limit, $sort); } } } else { if ($action == "browse") { if ($type == "visualizations") { $results = browseVisualizationsByTimeCreated($page, $limit); $count = browseVisualizationsByTimeCreated(-1, $limit); } else { if ($type == "people") { $results = browsePeople($page, $limit); $count = browsePeople(-1, $limit); } else { if ($type == "activities") { $results = browseActivities($page, $limit); $count = browseActivities(-1, $limit); } else { if ($sort == "default" || $sort == "recent") { $results = browseExperimentsByRecent($page, $limit); $count = browseExperimentsByRecent(-1, $limit); } else { if ($sort == "popularity") { $results = browseExperimentsByPopular($page, $limit); $count = browseExperimentsByPopular(-1, $limit); } else { if ($sort == "activity") { $results = browseExperimentsByActivity($page, $limit);