예제 #1
0
 function testSpeciesExclude()
 {
     $t = new FilterQuery();
     $result = $t->with(["species_exclude" => [22, 23]])->fetch()->asArray();
     foreach ($result as $entry) {
         $this->assertTrue($entry['species'] != 22 || $entry['species'] != 23);
     }
 }
예제 #2
0
파일: csv.php 프로젝트: xdrop/MammalWebCS
        if (isset($params["page"])) {
            unset($params["page"]);
        }
        if (isset($params["limit"])) {
            unset($params["limit"]);
        }
        $filterQuery = new FilterQuery();
        header("Content-Type: text/csv");
        header("Content-Disposition: attachment; filename=output.csv");
        header("Cache-Control: no-cache, no-store, must-revalidate");
        // HTTP 1.1
        header("Pragma: no-cache");
        // HTTP 1.0
        header("Expires: 0");
        // Proxies
        $queryResults = $filterQuery->with($params)->fetch()->asCSV();
    } catch (Exception $e) {
        error("Invalid id");
        return;
    }
} else {
    error("No id provided");
}
function error($status)
{
    header('Content-Type: application/json');
    header('Access-Control-Allow-Origin: *');
    header('Access-Control-Allow-Methods: GET, POST');
    header("Access-Control-Allow-Headers: X-Requested-With");
    echo json_encode(["error" => $status]);
}
예제 #3
0
<?php

require '../../../core.php';
$query = new FilterQuery();
$query->with(['no_of_species' => 2])->fetch()->asArray();