Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
<?php

include_once '../../config/symbini.php';
include_once $serverRoot . '/classes/DwcArchiverOccurrence.php';
header("Content-Type: text/html; charset=" . $charset);
$collId = array_key_exists("collid", $_REQUEST) ? $_REQUEST["collid"] : 0;
$emode = array_key_exists("emode", $_REQUEST) ? $_REQUEST["emode"] : 0;
$action = array_key_exists("formsubmit", $_REQUEST) ? $_REQUEST["formsubmit"] : '';
$cSet = array_key_exists("cset", $_REQUEST) ? $_REQUEST["cset"] : '';
$schema = array_key_exists("schema", $_REQUEST) ? $_REQUEST["schema"] : 1;
$dwcaManager = new DwcArchiverOccurrence();
$includeDets = 1;
$includeImgs = 1;
$redactLocalities = 1;
if ($action) {
    if (!array_key_exists('dets', $_POST)) {
        $includeDets = 0;
        $dwcaManager->setIncludeDets(0);
    }
    if (!array_key_exists('imgs', $_POST)) {
        $includeImgs = 0;
        $dwcaManager->setIncludeImgs(0);
    }
    if (!array_key_exists('redact', $_POST)) {
        $redactLocalities = 0;
        $dwcaManager->setRedactLocalities(0);
    }
    $dwcaManager->setTargetPath($serverRoot . (substr($serverRoot, -1) == '/' ? '' : '/') . 'collections/datasets/dwc/');
}
$isEditor = 0;
if ($isAdmin || array_key_exists("CollAdmin", $userRights) && in_array($collId, $userRights["CollAdmin"])) {
Exemplo n.º 3
0
 public function writeEmlFile()
 {
     global $clientRoot, $defaultTitle, $adminEmail;
     $this->logOrEcho("Creating eml.xml (" . date('h:i:s A') . ")... ");
     $urlPathPrefix = 'http://' . $_SERVER["SERVER_NAME"] . $clientRoot . (substr($clientRoot, -1) == '/' ? '' : '/');
     $emlArr = array();
     $emlArr['alternateIdentifier'][] = UuidFactory::getUuidV4();
     $emlArr['title'] = $this->title;
     $emlArr['creator'][0]['organizationName'] = $defaultTitle;
     $emlArr['creator'][0]['electronicMailAddress'] = $adminEmail;
     $emlArr['creator'][0]['onlineUrl'] = $urlPathPrefix . 'index.php';
     $emlArr['metadataProvider'][0]['organizationName'] = $defaultTitle;
     $emlArr['metadataProvider'][0]['electronicMailAddress'] = $adminEmail;
     $emlArr['metadataProvider'][0]['onlineUrl'] = $urlPathPrefix . 'index.php';
     $emlArr['pubDate'] = date("Y-m-d");
     $emlArr['language'] = 'eng';
     $emlArr['description'] = $this->description;
     //Get EML string
     $dwcaHandler = new DwcArchiverOccurrence();
     $emlDoc = $dwcaHandler->getEmlDom($emlArr);
     $tempFileName = $this->targetPath . $this->ts . '-eml.xml';
     $emlDoc->save($tempFileName);
     $this->zipArchive->addFile($tempFileName);
     $this->zipArchive->renameName($tempFileName, 'eml.xml');
     $this->logOrEcho("Done!! (" . date('h:i:s A') . ")\n");
 }
Exemplo n.º 4
0
include_once $SERVER_ROOT . '/classes/DwcArchiverOccurrence.php';
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Content-Type: text/html; charset=" . $charset);
$collid = $_REQUEST["collid"];
$cntStr = '';
if ($collid && is_numeric($collid)) {
    $isEditor = false;
    if ($IS_ADMIN || array_key_exists("CollAdmin", $USER_RIGHTS) && in_array($collid, $USER_RIGHTS["CollAdmin"])) {
        $isEditor = true;
    }
    if ($isEditor) {
        $processingStatus = array_key_exists('ps', $_REQUEST) ? $_REQUEST['ps'] : '';
        $customField1 = array_key_exists('cf1', $_POST) ? $_POST['cf1'] : '';
        $customField2 = array_key_exists('cf2', $_POST) ? $_POST['cf2'] : '';
        $dwcaHandler = new DwcArchiverOccurrence();
        $dwcaHandler->setCollArr($collid);
        $dwcaHandler->setVerbose(0);
        $dwcaHandler->addCondition('decimallatitude', 'NULL');
        $dwcaHandler->addCondition('decimallongitude', 'NULL');
        $dwcaHandler->addCondition('catalognumber', 'NOTNULL');
        $dwcaHandler->addCondition('locality', 'NOTNULL');
        if ($processingStatus) {
            $dwcaHandler->addCondition('processingstatus', 'EQUALS', $processingStatus);
        }
        if ($customField1) {
            $dwcaHandler->addCondition($customField1, $_POST['ct1'], $_POST['cv1']);
        }
        if ($customField2) {
            $dwcaHandler->addCondition($customField2, $_POST['ct2'], $_POST['cv2']);
        }
Exemplo n.º 5
0
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Content-Type: text/html; charset=" . $charset);
$collid = $_REQUEST["collid"];
$archiveFile = '';
$retArr = array();
if ($collid && is_numeric($collid)) {
    $isEditor = false;
    if ($IS_ADMIN || array_key_exists("CollAdmin", $USER_RIGHTS) && in_array($collid, $USER_RIGHTS["CollAdmin"])) {
        $isEditor = true;
    }
    if ($isEditor) {
        $processingStatus = array_key_exists('ps', $_REQUEST) ? $_REQUEST['ps'] : '';
        $customField1 = array_key_exists('cf1', $_POST) ? $_POST['cf1'] : '';
        $customField2 = array_key_exists('cf2', $_POST) ? $_POST['cf2'] : '';
        $dwcaHandler = new DwcArchiverOccurrence();
        $dwcaHandler->setCollArr($collid);
        $dwcaHandler->setCharSetOut('UTF-8');
        $dwcaHandler->setSchemaType('coge');
        $dwcaHandler->setExtended(false);
        $dwcaHandler->setDelimiter('csv');
        $dwcaHandler->setVerbose(0);
        $dwcaHandler->setRedactLocalities(0);
        $dwcaHandler->setIncludeDets(0);
        $dwcaHandler->setIncludeImgs(0);
        $dwcaHandler->addCondition('decimallatitude', 'NULL');
        $dwcaHandler->addCondition('decimallongitude', 'NULL');
        $dwcaHandler->addCondition('catalognumber', 'NOTNULL');
        $dwcaHandler->addCondition('locality', 'NOTNULL');
        if ($processingStatus) {
            $dwcaHandler->addCondition('processingstatus', 'EQUALS', $processingStatus);
Exemplo n.º 6
0
<?php

include_once '../../config/symbini.php';
include_once $serverRoot . '/classes/DwcArchiverOccurrence.php';
$collId = $_REQUEST["collid"];
if ($collId && is_numeric($collId)) {
    $dwcaManager = new DwcArchiverOccurrence();
    $dwcaManager->setCollArr($collId);
    $collArr = $dwcaManager->getCollArr();
    header('Content-Description: ' . $collArr[$collId]['collname'] . ' EML');
    header('Content-Type: text/xml');
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    header("Cache-Control: no-cache");
    header("Pragma: no-cache");
    $xmlDom = $dwcaManager->getEmlDom();
    echo $xmlDom->saveXML();
}
Exemplo n.º 7
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']));
    }
}
//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);
}
$mapManager = new MapInterfaceManager();
if ($type == 'selection' || $type == 'dsselectionquery') {
    $selections = preg_match('#\\[(.*?)\\]#', $selections, $match);
    $selections = $match[1];
    $mapWhere = 'WHERE o.occid IN(' . $selections . ') ';
}
Exemplo n.º 8
0
<?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);
Exemplo n.º 9
0
        Header("Content-Type: text/turtle; charset=" . $CHARSET);
        $dwcManager = new DwcArchiverOccurrence();
        $dwcManager->setCustomWhereSql(" o.occid = {$occid} ");
        echo $dwcManager->getAsTurtle();
        $done = TRUE;
    }
    if ($mediarange == 'application/rdf+xml' || $format == 'rdf') {
        Header("Content-Type: application/rdf+xml; charset=" . $CHARSET);
        $dwcManager = new DwcArchiverOccurrence();
        $dwcManager->setCustomWhereSql(" o.occid = {$occid} ");
        echo $dwcManager->getAsRdfXml();
        $done = TRUE;
    }
    if ($mediarange == 'application/json' || $format == 'json') {
        Header("Content-Type: application/json; charset=" . $CHARSET);
        $dwcManager = new DwcArchiverOccurrence();
        $dwcManager->setCustomWhereSql(" o.occid = {$occid} ");
        echo $dwcManager->getAsJson();
        $done = TRUE;
    }
}
if ($done) {
    die;
}
if ($SYMB_UID) {
    //Check editing status
    if ($IS_ADMIN || array_key_exists('CollAdmin', $USER_RIGHTS) && in_array($collId, $USER_RIGHTS['CollAdmin'])) {
        $isEditor = true;
    } elseif (array_key_exists('CollEditor', $USER_RIGHTS) && in_array($collId, $USER_RIGHTS['CollEditor'])) {
        $isEditor = true;
    } elseif ($occArr['observeruid'] == $SYMB_UID) {
Exemplo n.º 10
0
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Content-Type: text/html; charset=" . $charset);
$collid = $_REQUEST["collid"];
$archiveFile = '';
$retArr = array();
if ($collid && is_numeric($collid)) {
    $isEditor = false;
    if ($IS_ADMIN || array_key_exists("CollAdmin", $USER_RIGHTS) && in_array($collid, $USER_RIGHTS["CollAdmin"])) {
        $isEditor = true;
    }
    if ($isEditor) {
        $processingStatus = array_key_exists('ps', $_REQUEST) ? $_REQUEST['ps'] : '';
        $customField1 = array_key_exists('cf1', $_POST) ? $_POST['cf1'] : '';
        $customField2 = array_key_exists('cf2', $_POST) ? $_POST['cf2'] : '';
        $dwcaHandler = new DwcArchiverOccurrence();
        $dwcaHandler->setCollArr($collid);
        $dwcaHandler->setCharSetOut('UTF-8');
        $dwcaHandler->setSchemaType('coge');
        $dwcaHandler->setExtended(false);
        $dwcaHandler->setDelimiter('csv');
        $dwcaHandler->setVerbose(0);
        $dwcaHandler->setRedactLocalities(0);
        $dwcaHandler->setIncludeDets(0);
        $dwcaHandler->setIncludeImgs(0);
        $dwcaHandler->addCondition('decimallatitude', 'NULL');
        $dwcaHandler->addCondition('decimallongitude', 'NULL');
        $dwcaHandler->addCondition('locality', 'NOTNULL');
        if ($processingStatus) {
            $dwcaHandler->addCondition('processingstatus', 'EQUALS', $processingStatus);
        }
Exemplo n.º 11
0
<?php

include_once '../../config/symbini.php';
include_once $serverRoot . '/classes/DwcArchiverOccurrence.php';
$action = array_key_exists("action", $_REQUEST) ? $_REQUEST["action"] : '';
$collid = array_key_exists("collid", $_REQUEST) ? $_REQUEST["collid"] : 0;
$cond = array_key_exists("cond", $_REQUEST) ? $_REQUEST["cond"] : '';
$collType = array_key_exists("colltype", $_REQUEST) ? $_REQUEST["colltype"] : 'specimens';
$includeDets = array_key_exists("dets", $_REQUEST) ? $_REQUEST["dets"] : 1;
$includeImgs = array_key_exists("imgs", $_REQUEST) ? $_REQUEST["imgs"] : 1;
if ($collid) {
    $dwcaHandler = new DwcArchiverOccurrence();
    $dwcaHandler->setVerbose(0);
    $dwcaHandler->setCollArr($collid, $collType);
    if ($cond) {
        //String of cond-key/value pairs (e.g. country:USA,United States;stateprovince:Arizona,New Mexico;county-start:Pima,Eddy
        $cArr = explode(';', $cond);
        foreach ($cArr as $rawV) {
            $tok = explode(':', $rawV);
            if ($tok) {
                $field = $tok[0];
                $cond = 'EQUALS';
                $valueArr = array();
                if ($p = strpos($tok[0], '-')) {
                    $field = substr($tok[0], 0, $p);
                    $cond = strtoupper(substr($tok[0], $p + 1));
                }
                if (isset($tok[1]) && $tok[1]) {
                    $valueArr = explode(',', $tok[1]);
                }
                if ($valueArr) {
Exemplo n.º 12
0
												</select>
												<input name="customvalue2" type="text" value="<?php 
            echo $customValue2;
            ?>
" style="width:200px;" onchange="cogeUpdateCount(this)" />
											</div> 
										</td>
									</tr>
									<tr>
										<td colspan="2">
											<fieldset style="margin:10px;padding:20px;">
												<legend><b>CoGe Status</b></legend>
												<div>
													<b>Match Count:</b> 
													<?php 
            $dwcaHandler = new DwcArchiverOccurrence();
            $dwcaHandler->setCollArr($collid);
            $dwcaHandler->setVerbose(0);
            $dwcaHandler->addCondition('decimallatitude', 'NULL');
            $dwcaHandler->addCondition('decimallongitude', 'NULL');
            $dwcaHandler->addCondition('locality', 'NOTNULL');
            $dwcaHandler->addCondition('catalognumber', 'NOTNULL');
            echo '<span id="countdiv">' . $dwcaHandler->getOccurrenceCnt() . '</span> records';
            ?>
													<span id="recalspan" style="color:orange;display:none;">recalculating... <img src="../../images/workingcircle.gif" style="width:13px;" /></span>
												</div>
												<div>
													<b>CoGe Authentication:</b>
													<span id="coge-status" style="width:150px;color:red;">Disconnected</span>
													<span style="margin-left:40px"><input type="button" name="cogeCheckStatusButton" value="Check Status" onclick="cogeCheckAuthentication()" /></span>
													<span style="margin-left:40px"><a href="https://www.museum.tulane.edu/coge/" target="_blank" onclick="startAuthMonitoring()">Login to CoGe</a></span>
Exemplo n.º 13
0
<?php

include_once '../../config/symbini.php';
include_once $serverRoot . '/classes/DwcArchiverOccurrence.php';
$collStr = $argv[1];
$serverDomain = $argv[2];
$includeDets = 1;
$includeImgs = 1;
$redactLocalities = 1;
if ($argc > 3 && is_numeric($argv[3])) {
    $includeDets = $argv[3];
    if ($argc > 4 && is_numeric($argv[4])) {
        $includeImgs = $argv[4];
        if ($argc > 5 && is_numeric($argv[5])) {
            $redactLocalities = $argv[5];
        }
    }
}
if ($collStr) {
    $dwcaManager = new DwcArchiverOccurrence();
    $dwcaManager->setIncludeDets($includeDets);
    $dwcaManager->setIncludeImgs($includeImgs);
    $dwcaManager->setRedactLocalities($redactLocalities);
    $dwcaManager->setServerDomain($serverDomain);
    $dwcaManager->setTargetPath($serverRoot . (substr($serverRoot, -1) == '/' ? '' : '/') . 'collections/datasets/dwc/');
    $dwcaManager->setVerbose(0);
    $collArr = explode(',', $collStr);
    $dwcaManager->batchCreateDwca($collArr);
}