Beispiel #1
0
 function getRecords($from, $pageSize = 1000, $start = 0, $dataSource = 'AVH')
 {
     $ci =& get_instance();
     $ci->load->helper('curl');
     $ci->load->helper('ala_ws');
     $ci->load->model('mapmodel');
     $url = "http://biocache.ala.org.au/ws/occurrences/search";
     if ($from == 'all' || $from == '*') {
         $startDate = '*';
     } else {
         $startDate = $from . 'T00:00:00Z';
     }
     $intro = array(NULL => '-(establishment_means:"not native" OR establishment_means:cultivated OR establishment_means:"presumably cultivated" OR establishment_means:"possibly cultivated" OR establishment_means:"doubtfully native")', 'introduced' => '(establishment_means:"not native" OR establishment_means:"doubtfully native")', 'cultivated' => '(establishment_means:cultivated OR establishment_means:"presumably cultivated" OR establishment_means:"possibly cultivated")');
     $totalRecords = 0;
     foreach ($intro as $key => $value) {
         $startIndex = $start;
         $recordCount = $start + 1;
         while ($startIndex < $recordCount) {
             $params = array();
             $params['fq'] = array();
             $params['fq']['data_hub_uid'] = 'dh2';
             $params['fq']['state'] = 'Victoria';
             $params['fq']['latitude'] = '[* TO *]';
             $params['fq']['longitude'] = '[* TO *]';
             $params['fq'][] = $value;
             $params['fq']['last_load_date'] = '[' . $startDate . ' TO *]';
             $params['fl'] = array('id', 'taxon_concept_lsid', 'genus_guid', 'species_guid', 'rank', 'genus', 'species', 'raw_taxon_name', 'catalogue_number', 'taxon_name', 'latitude', 'longitude', 'kingdom', 'phylum', 'class', 'order', 'family');
             $params['facet'] = 'off';
             $params['pageSize'] = $pageSize;
             $params['startIndex'] = $startIndex;
             $query = createQueryString('biocache_search', $params);
             $result = doCurl($query, FALSE, TRUE);
             if ($result) {
                 $recordCount = $ci->mapmodel->loadAvhData($result, $key);
             }
             $startIndex += $pageSize;
             if ($ci->input->is_cli_request()) {
                 if ($startIndex < $recordCount) {
                     echo $startIndex . ' of ' . $recordCount . PHP_EOL;
                 } else {
                     echo $recordCount . ' of ' . $recordCount . PHP_EOL;
                 }
             }
         }
         $totalRecords += $recordCount;
     }
     return $totalRecords;
 }
 private function getTaxaForState($state)
 {
     $params = array();
     $params['fq'] = array();
     $params['fq']['data_hub_uid'] = 'dh2';
     $params['fq']['class'] = 'Equisetopsida';
     $params['fq']['state'] = '"' . $state . '"';
     $params['fq'][] = '(rank:species OR rank:subspecies OR rank:variety OR rank:form)';
     $params['pageSize'] = 1;
     $params['facets'] = 'taxon_name';
     $params['flimit'] = 100000;
     $query = createQueryString('biocache_search', $params);
     $result = doCurl($query, FALSE, TRUE);
     $data = json_decode($result);
     $facets = $data->facetResults;
     $taxa = array();
     foreach ($facets[0]->fieldResult as $facet) {
         $taxa[] = $facet->label;
     }
     return $taxa;
 }
 /** Tries to build a good URL for this entry. The URL should be absolute (better for the generated RSS) */
 function getURL()
 {
     if (defined('BIBTEXBROWSER_URL_BUILDER')) {
         $f = BIBTEXBROWSER_URL_BUILDER;
         return $f($this);
     }
     //     echo $this->filename;
     //     echo $this->getKey();
     return BIBTEXBROWSER_URL . '?' . createQueryString(array(Q_KEY => $this->getKey(), Q_FILE => $this->filename));
 }
Beispiel #4
0
<body>

<?php 
//set the timezone, otherwise mktime and friends have a hissy
date_default_timezone_set('UTC');
//set up some options, either from the passed in values, or if missing, their default values
$databaseFilename = '/var/www/monkeybot/monkey.db';
$search = isset($_GET['search']) ? $_GET['search'] : '';
$new = isset($_GET['new']) ? $_GET['new'] : '=0';
$added = isset($_GET['added']) ? $_GET['added'] : 'All';
$action = isset($_GET['action']) ? $_GET['action'] : 'All';
$remove = isset($_GET['remove']) ? $_GET['remove'] : '';
unset($_GET['remove']);
//we don't want this variable to persist past this one-time use
$thisPage = createQueryString();
//set up some filter options
$addedOptions = array('All', 'Today', 'Yesterday');
$newOptions = array('=0', '<5', '<10', '<100', 'All');
//some of the HTML generated, ick
$filterTableHeader = '<table class="filter">' . '<caption>Filter</caption>' . '<thead><tr>' . '<th>Added</th><th>Category</th><th>ShowCount</th><th>Search</th><th></th>' . '</tr></thead>' . '<tbody>';
$filterTableFooter = '</tbody>' . '</table>';
$resultTableHeader = '<table class="results">' . '<caption>Results</caption>' . '<thead><tr>' . '<th>ID</th><th>Added</th><th>Category</th><th>Contents</th><th>Delete</th><th>ShowCount</th>' . '</tr></thead>' . '<tbody>';
$resultTableFooter = '</tbody>' . '</table>';
function createQueryString($array = array(), $kvSep = '=', $varSep = '&')
{
    $get = array_merge($_GET, $array);
    $getVars = array();
    foreach ($get as $key => $value) {
        if (is_string($key)) {
            $getVars[] = implode($kvSep, array($key, $value));
Beispiel #5
0
 /** overrides */
 function getRSS()
 {
     return BIBTEXBROWSER_URL . '?' . createQueryString($this->filter) . '&amp;rss';
 }
Beispiel #6
0
 private function queryBiocache($startDate, $pageSize, $startIndex, $establishmentMeans)
 {
     $params = array();
     $params['fq'] = array();
     $params['fq']['data_hub_uid'] = 'dh2';
     $params['fq']['state'] = 'Victoria';
     $params['fq']['latitude'] = '[* TO *]';
     $params['fq']['longitude'] = '[* TO *]';
     $params['fq']['-raw_identification_qualifier'] = '[* TO *]';
     $params['fq'][] = $establishmentMeans;
     $params['fq']['last_load_date'] = '[' . $startDate . ' TO *]';
     $params['fl'] = array('id', 'taxon_concept_lsid', 'genus_guid', 'species_guid', 'rank', 'genus', 'species', 'raw_taxon_name', 'catalogue_number', 'taxon_name', 'latitude', 'longitude', 'kingdom', 'phylum', 'class', 'order', 'family');
     $params['facet'] = 'off';
     $params['pageSize'] = $pageSize;
     $params['startIndex'] = $startIndex;
     $query = createQueryString('biocache_search', $params);
     $result = doCurl($query, FALSE, TRUE);
     return $result;
 }