Exemplo n.º 1
0
                $IDPerc = $data['IDSpecimensPerCountry'] ? round(100 * ($data['IDSpecimensPerCountry'] / $data['CountryCount'])) : 0;
                $IDgeoRefPerc = $data['IDGeorefSpecimensPerCountry'] ? round(100 * ($data['IDGeorefSpecimensPerCountry'] / $data['CountryCount'])) : 0;
                array_push($outputArr, array($name, $specCnt, $geoRefCnt, $IDCnt, $IDGeoRefCnt, $geoRefPerc, $IDPerc, $IDgeoRefPerc));
            }
        }
    }
}
if ($action == 'Download CSV') {
    $fileName = 'year_stats.csv';
    $headerArr = $collManager->getYearStatsHeaderArr($collId);
    $dataArr = $collManager->getYearStatsDataArr($collId);
}
if ($action == 'Download Stats per Coll') {
    $header = array('Collection', 'Specimens', 'Georeferenced', 'Species ID', 'Families', 'Genera', 'Species', 'Total Taxa', 'Types');
    $fileName = 'stats_per_coll.csv';
    $resultsTemp = $collManager->runStatistics($collId);
    if ($resultsTemp) {
        unset($resultsTemp['familycnt']);
        unset($resultsTemp['genuscnt']);
        unset($resultsTemp['speciescnt']);
        unset($resultsTemp['TotalTaxaCount']);
        ksort($resultsTemp);
        $i = 0;
        foreach ($resultsTemp as $k => $collArr) {
            $dynPropTempArr = array();
            $outputArr[$i]['CollectionName'] = $collArr['CollectionName'];
            $outputArr[$i]['recordcnt'] = $collArr['recordcnt'];
            $outputArr[$i]['georefcnt'] = $collArr['georefcnt'];
            if ($collArr['dynamicProperties']) {
                $dynPropTempArr = json_decode($collArr['dynamicProperties'], true);
                if (is_array($dynPropTempArr)) {