public function exportDataset($dsid) { //Get occurrence records $zip = array_key_exists('zip', $_POST) ? $_POST['zip'] : 0; $format = $_POST['format']; $extended = array_key_exists('extended', $_POST) ? $_POST['extended'] : 0; $redactLocalities = 1; $rareReaderArr = array(); if ($IS_ADMIN || array_key_exists("CollAdmin", $userRights)) { $redactLocalities = 0; } elseif (array_key_exists("RareSppAdmin", $userRights) || array_key_exists("RareSppReadAll", $userRights)) { $redactLocalities = 0; } else { if (array_key_exists('CollEditor', $userRights)) { $rareReaderArr = $userRights['CollEditor']; } if (array_key_exists('RareSppReader', $userRights)) { $rareReaderArr = array_unique(array_merge($rareReaderArr, $userRights['RareSppReader'])); } } $dwcaHandler = new DwcArchiverOccurrence(); $dwcaHandler->setCharSetOut($cSet); $dwcaHandler->setSchemaType($schema); $dwcaHandler->setExtended($extended); $dwcaHandler->setDelimiter($format); $dwcaHandler->setVerbose(0); $dwcaHandler->setRedactLocalities($redactLocalities); if ($rareReaderArr) { $dwcaHandler->setRareReaderArr($rareReaderArr); } $occurManager = new OccurrenceManager(); $dwcaHandler->setCustomWhereSql($occurManager->getSqlWhere()); $outputFile = null; if ($zip) { //Ouput file is a zip file $includeIdent = array_key_exists('identifications', $_POST) ? 1 : 0; $dwcaHandler->setIncludeDets($includeIdent); $images = array_key_exists('images', $_POST) ? 1 : 0; $dwcaHandler->setIncludeImgs($images); $outputFile = $dwcaHandler->createDwcArchive('webreq'); } else { //Output file is a flat occurrence file (not a zip file) $outputFile = $dwcaHandler->getOccurrenceFile(); } //ob_start(); $contentDesc = ''; if ($schema == 'dwc') { $contentDesc = 'Darwin Core '; } else { $contentDesc = 'Symbiota '; } $contentDesc .= 'Occurrence '; if ($zip) { $contentDesc .= 'Archive '; } $contentDesc .= 'File'; header('Content-Description: ' . $contentDesc); if ($zip) { header('Content-Type: application/zip'); } elseif ($format == 'csv') { header('Content-Type: text/csv; charset=' . $charset); } else { header('Content-Type: text/html; charset=' . $charset); } header('Content-Disposition: attachment; filename=' . basename($outputFile)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header('Content-Length: ' . filesize($outputFile)); ob_clean(); flush(); //od_end_clean(); readfile($outputFile); unlink($outputFile); }
<?php include_once '../config/symbini.php'; include_once $serverRoot . '/classes/OccurrenceManager.php'; header("Content-Type: text/html; charset=" . $charset); header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past $collManager = new OccurrenceManager(); $collArray = $collManager->getSearchTerms(); $collManager->reset(); ?> <html xmlns="http://www.w3.org/1999/html"> <head> <title><?php echo $defaultTitle; ?> Collection Search Parameters</title> <link href="../css/base.css?<?php echo $CSS_VERSION; ?> " type="text/css" rel="stylesheet" /> <link href="../css/main.css?<?php echo $CSS_VERSION; ?> " type="text/css" rel="stylesheet" /> <link href="../css/jquery-ui.css" type="text/css" rel="Stylesheet" /> <script type="text/javascript" src="../js/jquery.js"></script> <script type="text/javascript" src="../js/jquery-ui.js"></script>
public function __destruct() { parent::__destruct(); }
<?php include_once '../../config/symbini.php'; include_once $serverRoot . '/classes/OccurrenceDownload.php'; include_once $serverRoot . '/classes/OccurrenceManager.php'; include_once $serverRoot . '/classes/DwcArchiverOccurrence.php'; header("Cache-Control: no-cache, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); $schema = array_key_exists("schema", $_POST) ? $_POST["schema"] : "symbiota"; $cSet = array_key_exists("cset", $_POST) ? $_POST["cset"] : ''; $stArrCollJson = array_key_exists("jsoncollstarr", $_REQUEST) ? $_REQUEST["jsoncollstarr"] : ''; $stArrSearchJson = array_key_exists("starr", $_REQUEST) ? $_REQUEST["starr"] : ''; $dlManager = new OccurrenceDownload(); $dwcaHandler = new DwcArchiverOccurrence(); $occurManager = new OccurrenceManager(); if ($stArrCollJson && $stArrSearchJson) { $stArrSearchJson = str_replace("%apos;", "'", $stArrSearchJson); $collStArr = json_decode($stArrCollJson, true); $searchStArr = json_decode($stArrSearchJson, true); $stArr = array_merge($searchStArr, $collStArr); $occurManager->setSearchTermsArr($stArr); } if ($schema == "backup") { $collid = $_POST["collid"]; if ($collid && is_numeric($collid)) { //check permissions due to sensitive localities not being redacted if ($isAdmin || array_key_exists("CollAdmin", $userRights) && in_array($collid, $userRights["CollAdmin"])) { $dwcaHandler->setSchemaType('backup'); $dwcaHandler->setCharSetOut($cSet); $dwcaHandler->setVerbose(0); $dwcaHandler->setIncludeDets(1);
<?php include_once '../config/symbini.php'; include_once $SERVER_ROOT . '/content/lang/collections/harvestparams.' . $LANG_TAG . '.php'; include_once $SERVER_ROOT . '/classes/OccurrenceManager.php'; header("Content-Type: text/html; charset=" . $charset); header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past $clid = array_key_exists('clid', $_REQUEST) ? $_REQUEST['clid'] : 0; $db = array_key_exists('db', $_REQUEST) ? $_REQUEST['db'] : 0; $cat = array_key_exists('cat', $_REQUEST) ? $_REQUEST['cat'] : 0; $stArrCollJson = array_key_exists("jsoncollstarr", $_REQUEST) ? $_REQUEST["jsoncollstarr"] : ''; $stArrSearchJson = array_key_exists("starr", $_REQUEST) ? $_REQUEST["starr"] : ''; $collManager = new OccurrenceManager(); if ($stArrSearchJson) { $stArrSearchJson = str_replace("%apos;", "'", $stArrSearchJson); $stArr = json_decode($stArrSearchJson, true); $collManager->setSearchTermsArr($stArr); } $collArray = $collManager->getSearchTerms(); if (!$stArrCollJson) { $stArrCollJson = json_encode($collArray); } $collManager->reset(); ?> <html> <head> <title><?php
<?php include_once '../config/symbini.php'; include_once $SERVER_ROOT . '/content/lang/collections/index.' . $LANG_TAG . '.php'; include_once $SERVER_ROOT . '/classes/OccurrenceManager.php'; header("Content-Type: text/html; charset=" . $CHARSET); $catId = array_key_exists("catid", $_REQUEST) ? $_REQUEST["catid"] : 0; if (!is_numeric($catId)) { $catId = 0; } if (!$catId && isset($DEFAULTCATID) && $DEFAULTCATID) { $catId = $DEFAULTCATID; } $collManager = new OccurrenceManager(); //$collManager->reset(); $collList = $collManager->getFullCollectionList($catId); $specArr = isset($collList['spec']) ? $collList['spec'] : null; $obsArr = isset($collList['obs']) ? $collList['obs'] : null; $otherCatArr = $collManager->getOccurVoucherProjects(); ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $CHARSET; ?> "> <title><?php echo $DEFAULT_TITLE . ' ' . $LANG['PAGE_TITLE']; ?> </title>
$dlManager->setTaxonFilter($taxonFilterCode); $dlManager->downloadData(); } else { //Is an occurrence download $dwcaHandler = new DwcArchiverOccurrence(); $dwcaHandler->setCharSetOut($cSet); $dwcaHandler->setSchemaType($schema); $dwcaHandler->setExtended($extended); $dwcaHandler->setDelimiter($format); $dwcaHandler->setVerbose(0); $dwcaHandler->setRedactLocalities($redactLocalities); if ($rareReaderArr) { $dwcaHandler->setRareReaderArr($rareReaderArr); } if (array_key_exists("publicsearch", $_POST) && $_POST["publicsearch"]) { $occurManager = new OccurrenceManager(); $dwcaHandler->setCustomWhereSql($occurManager->getSqlWhere()); } else { //Request is coming from exporter.php for collection manager tools $dwcaHandler->setCollArr($_POST['targetcollid']); if (array_key_exists('processingstatus', $_POST) && $_POST['processingstatus']) { $dwcaHandler->addCondition('processingstatus', 'EQUALS', $_POST['processingstatus']); } if (array_key_exists('customfield1', $_POST) && $_POST['customfield1']) { $dwcaHandler->addCondition($_POST['customfield1'], $_POST['customtype1'], $_POST['customvalue1']); } if (array_key_exists('customfield2', $_POST) && $_POST['customfield2']) { $dwcaHandler->addCondition($_POST['customfield2'], $_POST['customtype2'], $_POST['customvalue2']); } if (array_key_exists('customfield3', $_POST) && $_POST['customfield3']) { $dwcaHandler->addCondition($_POST['customfield3'], $_POST['customtype3'], $_POST['customvalue3']);