69c4a6d3b1
Include and Exclude list updated to use the calculated path to their respective x_species_list.txt files Move play.php over to also use the new calculated paths to disk_check_exclude Spectrogram.php remove unused code & replace setting save code with new function Stats.php removed old code, update paths to use calculated path. Rename setSetting func to saveSetting Remove old code from other pages
158 lines
5.3 KiB
PHP
158 lines
5.3 KiB
PHP
<?php
|
|
if(file_exists('./scripts/common.php')){
|
|
include_once "./scripts/common.php";
|
|
}else{
|
|
include_once "./common.php";
|
|
}
|
|
|
|
if(isset($_GET['date'])){
|
|
$theDate = $_GET['date'];
|
|
} else {
|
|
$theDate = date('Y-m-d');
|
|
}
|
|
$chart = "Combo-$theDate.png";
|
|
$chart2 = "Combo2-$theDate.png";
|
|
|
|
$statement1 = getDetectionCountByDate($theDate);
|
|
if($statement1['success'] == False){
|
|
echo $statement1['message'];
|
|
header("refresh: 0;");
|
|
}
|
|
|
|
if(isset($_GET['blocation']) ) {
|
|
|
|
header("Content-type: text/csv");
|
|
header("Content-Disposition: attachment; filename=result_file.csv");
|
|
header("Pragma: no-cache");
|
|
header("Expires: 0");
|
|
|
|
|
|
//$sunrise = date_sunrise(time(), SUNFUNCS_RET_TIMESTAMP, $config["LATITUDE"], $config["LONGITUDE"]);
|
|
//$sunset = date_sunset(time(), SUNFUNCS_RET_TIMESTAMP, $config["LATITUDE"], $config["LONGITUDE"]);
|
|
|
|
$list = array ();
|
|
|
|
//$hrsinday = intval(($sunset-$sunrise)/60/60);
|
|
$hrsinday = 24;
|
|
for($i=0;$i<$hrsinday;$i++) {
|
|
$starttime = strtotime("12 AM") + (3600*$i);
|
|
$endtime = date("H:i",$starttime + 3600);
|
|
|
|
$statement1 = getDetectionBreakdownByTime($theDate,$starttime,$endtime);
|
|
if($statement1['success'] == False){
|
|
echo $statement1['message'];
|
|
header("refresh: 0;");
|
|
}
|
|
$result1 = $statement1['data'];
|
|
|
|
$detections = [];
|
|
foreach ($result1 as $detection)
|
|
{
|
|
$detections[$detection["Com_Name"]] = $detection["COUNT(*)"];
|
|
}
|
|
foreach($detections as $com_name=>$scount)
|
|
{
|
|
array_push($list, array($com_name,'','','1','',$_GET['blocation'],$config["LATITUDE"],$config["LONGITUDE"],date("m/d/Y", strtotime($theDate)), date("H:i", $starttime), $_GET['state'], $_GET['country'], $_GET['protocol'], $_GET['num_observers'], '60', 'Y', $_GET['dist_traveled'],'',$_GET['notes'] ) );
|
|
}
|
|
}
|
|
|
|
$output = fopen("php://output", "w");
|
|
foreach ($list as $row) {
|
|
fputcsv($output, $row);
|
|
}
|
|
fclose($output);
|
|
|
|
die();
|
|
}
|
|
|
|
?>
|
|
|
|
<head>
|
|
|
|
<style>
|
|
#attribution-dialog p {
|
|
display:inline;
|
|
}
|
|
#attribution-dialog {
|
|
text-align: left;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="history centered">
|
|
|
|
<dialog id="attribution-dialog">
|
|
<p style="display:none" id="filename"></p>
|
|
<h1 id="modalHeading">Enter Checklist Information</h1>
|
|
<p id="modalText">Location Name:</p> <input placeholder="My house" id="blocation"><br><br>
|
|
<p id="modalText">State (2 letter code):</p> <input maxlength="3" id="state"><br><br>
|
|
<p id="modalText">Country (2 letter code):</p> <input maxlength="2" id="country"><br><br>
|
|
<p id="modalText">Protocol:</p> <select id="protocol">
|
|
<option value="casual">casual</option>
|
|
<option value="stationary">stationary</option>
|
|
<option value="traveling">traveling</option>
|
|
<option value="area">area</option>
|
|
</select>
|
|
<br><br>
|
|
<p id="modalText">Number of observers:</p> <input type="number" id="num_observers"><br><br>
|
|
<p id="modalText">Distance traveled (miles):</p> <input type="number" id="dist_traveled"><br><br>
|
|
<p id="modalText">Notes:</p> <input id="notes"><br><br>
|
|
<button onclick="submitID()">Submit</button>
|
|
</dialog>
|
|
<script>
|
|
var dialog = document.querySelector('dialog');
|
|
dialogPolyfill.registerDialog(dialog);
|
|
|
|
function showDialog() {
|
|
document.getElementById('attribution-dialog').showModal();
|
|
}
|
|
|
|
function closeDialog() {
|
|
document.getElementById('attribution-dialog').close();
|
|
}
|
|
|
|
function submitID() {
|
|
blocation = document.getElementById("blocation").value;
|
|
state = document.getElementById("state").value;
|
|
country = document.getElementById("country").value;
|
|
protocol = document.getElementById("protocol").value;
|
|
num_observers = document.getElementById("num_observers").value;
|
|
dist_traveled = document.getElementById("dist_traveled").value;
|
|
notes = document.getElementById("notes").value;
|
|
|
|
window.open("history.php?blocation="+blocation+"&state="+state+"&country="+country+"&protocol="+protocol+"&num_observers="+num_observers+"&dist_traveled="+dist_traveled+"¬es="+notes+"&date="+"<?php echo $theDate; ?>");
|
|
|
|
document.getElementById('attribution-dialog').innerHTML = "<h3>Success!</h3><p>Your checklist will start downloading momentarily.<br><br>Refer to <a target='_blank' href='https://ebird.org/content/eBirdCommon/docs/ebird_import_data_process.pdf'>this guide</a> for information on how to import it in eBird. The checklist file format is: 'eBird Record Format (Extended)'.<br><br><span style='font-size:small'>Note: Only detections with a confidence > 0.75 were included, and entries have been limited to 1 detection per hour per species, to comply with eBird's data quality guidelines.<br>It's always good practice to manually verify your checklist before submitting, especially for nocturnal hours.</span></p><br><br><button onclick=\"closeDialog()\">Close</button>";
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<form action="" method="GET">
|
|
<input type="date" name="date" value="<?php echo $theDate;?>">
|
|
<button type="submit" name="view" value="Daily Charts">Submit Date</button>
|
|
</form>
|
|
<table>
|
|
<tr>
|
|
<th>Total Detections For The Day</th>
|
|
<td><?php echo $totalcount['COUNT(*)'];?></td>
|
|
</tr>
|
|
</table>
|
|
<?php // <br><button type="button" onclick="showDialog()">Export as CSV for eBird</button><br><br> ?>
|
|
<?php
|
|
$time = time();
|
|
|
|
if (file_exists('./Charts/'.$chart)) {
|
|
echo "<img src=\"/Charts/$chart?nocache=$time\" >";
|
|
} else {
|
|
echo "<p>No Charts for $theDate</p>";
|
|
}
|
|
echo "<hr>";
|
|
if (file_exists('./Charts/'.$chart2)) {
|
|
echo "<img src=\"/Charts/$chart2?nocache=$time\">";
|
|
} else {
|
|
echo "<p>No Charts For $theDate</p>";
|
|
}?>
|
|
</div>
|
|
</html>
|