Ejemplo n.º 1
0
 $type = $params['type'];
 $query = $params['query'];
 $page = $params['page'];
 $limit = $params['limit'];
 $sort = $params['sort'];
 if ($action == "search") {
     $data = searchExperiments($query, $page, $limit, $sort);
 } else {
     if ($sort == "default" || $sort == "recent") {
         $data = browseExperimentsByRecent($page, $limit, true);
     } else {
         if ($sort == "popularity") {
             $data = browseExperimentsByPopular($page, $limit, true);
         } else {
             if ($sort == "activity") {
                 $data = browseExperimentsByActivity($page, $limit, true);
             } else {
                 if ($sort == "rating") {
                     $data = browseExperimentsByRating($page, $limit, true);
                 }
             }
         }
     }
 }
 if (count($data) > 0) {
     for ($i = 0; $i < count($data); $i++) {
         $imgs = getImagesForExperiment($data[$i]['meta']['experiment_id']);
         if (count($imgs) > 0) {
             $data[$i]['meta']['provider_url'] = $imgs[0]['provider_url'];
         } else {
             $data[$i]['meta']['provider_url'] = null;
Ejemplo n.º 2
0
            } 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);
                                $count = browseExperimentsByActivity(-1, $limit);
                            } else {
                                if ($sort == "rating") {
                                    $results = browseExperimentsByRating($page, $limit);
                                    $count = browseExperimentsByRating(-1, $limit);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
// Determine sort text
$sorttext = "by the date each was created";