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']); } $cntStr = $dwcaHandler->getOccurrenceCnt(); } }
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) { foreach ($valueArr as $v) { $dwcaHandler->addCondition($field, $cond, $v); } } else { $dwcaHandler->addCondition($field, $cond); } } } } $dwcaHandler->setIncludeDets($includeDets); $dwcaHandler->setIncludeImgs($includeImgs); $archiveFile = $dwcaHandler->createDwcArchive('webreq'); if ($archiveFile) { //ob_start(); header('Content-Description: DwC-A File Transfer'); header('Content-Type: application/zip'); header('Content-Disposition: attachment; filename=' . basename($archiveFile));
$dlManager->setZipFile($zip); $taxonFilterCode = array_key_exists("taxonFilterCode", $_POST) ? $_POST["taxonFilterCode"] : 0; $dlManager->setTaxonFilter($taxonFilterCode); $dlManager->downloadData(); } else { $dwcaHandler->setVerbose(0); if ($schema == "coge") { $dwcaHandler->setCollArr($_POST["collid"]); $dwcaHandler->setCharSetOut('UTF-8'); $dwcaHandler->setSchemaType('coge'); $dwcaHandler->setExtended(false); $dwcaHandler->setDelimiter('csv'); $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 (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']); } } else { //Is an occurrence download $dwcaHandler->setCharSetOut($cSet);
?> " 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> </div> </fieldset> <fieldset id="coge-communities" style="margin:10px;padding:10px;">