better navigation / fixes
This commit is contained in:
+1
-1
@@ -39,7 +39,7 @@ footer {
|
|||||||
}
|
}
|
||||||
button {
|
button {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
text-size:large;
|
font-size:small;
|
||||||
border:none;
|
border:none;
|
||||||
cursor:pointer;
|
cursor:pointer;
|
||||||
}
|
}
|
||||||
|
|||||||
+97
-61
@@ -10,21 +10,41 @@ if($db == False){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(isset($_POST['bydate'])){
|
if(isset($_POST['bydate'])){
|
||||||
$statement = $db->prepare('SELECT DISTINCT(Date), Com_Name from detections GROUP BY Date');
|
$statement = $db->prepare('SELECT DISTINCT(Date), Com_Name from detections GROUP BY Date');
|
||||||
if($statement == False){
|
if($statement == False){
|
||||||
echo "Database is busy";
|
echo "Database is busy";
|
||||||
header("refresh: 0;");
|
header("refresh: 0;");
|
||||||
}
|
}
|
||||||
$result = $statement->execute();
|
$result = $statement->execute();
|
||||||
$view = "bydate";
|
$view = "bydate";
|
||||||
} else {
|
} elseif(isset($_POST['byspecies'])) {
|
||||||
$statement = $db->prepare('SELECT DISTINCT(Com_Name) from detections ORDER BY Com_Name');
|
$statement = $db->prepare('SELECT DISTINCT(Com_Name) from detections ORDER BY Com_Name');
|
||||||
if($statement == False){
|
if($statement == False){
|
||||||
echo "Database is busy";
|
echo "Database is busy";
|
||||||
header("refresh: 0;");
|
header("refresh: 0;");
|
||||||
}
|
}
|
||||||
$result = $statement->execute();
|
$result = $statement->execute();
|
||||||
$view = "byspecies";
|
$view = "byspecies";
|
||||||
|
} elseif(isset($_POST['date'])) {
|
||||||
|
$date = $_POST['date'];
|
||||||
|
$statement = $db->prepare("SELECT DISTINCT(Com_Name) from detections WHERE Date == \"$date\" ORDER BY Com_Name");
|
||||||
|
if($statement == False){
|
||||||
|
echo "Database is busy";
|
||||||
|
header("refresh: 0;");
|
||||||
|
}
|
||||||
|
$result = $statement->execute();
|
||||||
|
$view = "date";
|
||||||
|
} elseif(isset($_POST['species'])) {
|
||||||
|
$species = $_POST['species'];
|
||||||
|
$statement = $db->prepare("SELECT * from detections WHERE Com_Name == \"$species\" ORDER BY Com_Name");
|
||||||
|
$statement3 = $db->prepare("SELECT Date, Time, Com_Name, MAX(Confidence), File_Name from detections WHERE Com_Name == \"$species\" ORDER BY Com_Name");
|
||||||
|
if($statement == False || $statement3 == False){
|
||||||
|
echo "Database is busy";
|
||||||
|
header("refresh: 0;");
|
||||||
|
}
|
||||||
|
$result = $statement->execute();
|
||||||
|
$result3 = $statement3->execute();
|
||||||
|
$view = "species";
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -39,68 +59,84 @@ $view = "byspecies";
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="column left">
|
<div class="column left">
|
||||||
|
<table style="float:top;">
|
||||||
<?php
|
<?php
|
||||||
|
if(!isset($_POST['species'])){
|
||||||
while($results=$result->fetchArray(SQLITE3_ASSOC))
|
while($results=$result->fetchArray(SQLITE3_ASSOC))
|
||||||
{
|
{
|
||||||
$comname = preg_replace('/ /', '_', $results['Com_Name']);
|
|
||||||
$comlink = "/By_Date/".date('Y-m-d')."/".$comname;
|
|
||||||
?>
|
?>
|
||||||
<table>
|
|
||||||
<tr>
|
<tr>
|
||||||
<form action="" method="POST">
|
<form action="" method="POST">
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
if($view == "bydate"){
|
if($view == "bydate"){
|
||||||
$date = $results['Date'];
|
$date = $results['Date'];
|
||||||
echo "<button action=\"submit\" name=\"date\" value=\"$date\">$date</button>";}
|
echo "<button action=\"submit\" name=\"date\" value=\"$date\">$date</button>";
|
||||||
else {
|
} elseif($view == "byspecies") {
|
||||||
$name = $results['Com_Name'];
|
$name = $results['Com_Name'];
|
||||||
echo "<button action=\"submit\" name=\"species\" value=\"$name\">$name</button>";}?>
|
echo "<button action=\"submit\" name=\"species\" value=\"$name\">$name</button>";
|
||||||
|
} elseif($view == "date") {
|
||||||
|
$name = $results['Com_Name'];
|
||||||
|
echo "<button action=\"submit\" name=\"species\" value=\"$name\">$name</button>";
|
||||||
|
}; };} else {
|
||||||
|
while($results=$result3->fetchArray(SQLITE3_ASSOC)){
|
||||||
|
$maxconf = $results['MAX(Confidence)'];
|
||||||
|
$date = $results['Date'];
|
||||||
|
$time = $results['Time'];
|
||||||
|
$comname = preg_replace('/ /', '_', $results['Com_Name']);
|
||||||
|
$file = $results['File_Name'];
|
||||||
|
$filename = "/By_Date/".$date."/".$comname."/".$results['File_Name'];
|
||||||
|
echo "<table>
|
||||||
|
<tr>
|
||||||
|
<th>Max Confidence: $maxconf</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Most confident recording: <a href=\"$filename\" target=\"footer\">$file</a></td>
|
||||||
|
</tr></table>";
|
||||||
|
};};?>
|
||||||
</td>
|
</td>
|
||||||
</form>
|
</form>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<?php
|
|
||||||
}?>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="column right">
|
<div class="column right">
|
||||||
<?php
|
<?php
|
||||||
if(isset($_POST['species'])){
|
if(isset($_POST['species'])){
|
||||||
$name = $_POST['species'];
|
$name = $_POST['species'];
|
||||||
$statement2 = $db->prepare("SELECT * FROM detections where Com_Name == \"$name\" ORDER BY Date DESC, Time DESC");
|
$statement2 = $db->prepare("SELECT * FROM detections where Com_Name == \"$name\" ORDER BY Date DESC, Time DESC");
|
||||||
if($statement2 == False){
|
if($statement2 == False){
|
||||||
echo "Database is busy";
|
echo "Database is busy";
|
||||||
header("refresh: 0;");
|
header("refresh: 0;");
|
||||||
}
|
}
|
||||||
$result2 = $statement2->execute();
|
$result2 = $statement2->execute();
|
||||||
echo "<table>
|
echo "<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Date</th>
|
<th>Date</th>
|
||||||
<th>Time</th>
|
<th>Time</th>
|
||||||
<th>Scientific Name</th>
|
<th>Scientific Name</th>
|
||||||
<th>Common Name</th>
|
<th>Common Name</th>
|
||||||
<th>Confidence</th>
|
<th>Confidence</th>
|
||||||
</tr>";
|
</tr>";
|
||||||
while($results=$result2->fetchArray(SQLITE3_ASSOC))
|
while($results=$result2->fetchArray(SQLITE3_ASSOC))
|
||||||
{
|
{
|
||||||
$comname = preg_replace('/ /', '_', $results['Com_Name']);
|
$comname = preg_replace('/ /', '_', $results['Com_Name']);
|
||||||
$date = $results['Date'];
|
$date = $results['Date'];
|
||||||
$comlink = "/By_Date/".$date."/".$comname."/".$results['File_Name'];
|
$comlink = "/By_Date/".$date."/".$comname."/".$results['File_Name'];
|
||||||
$sciname = preg_replace('/ /', '_', $results['Sci_Name']);
|
$sciname = preg_replace('/ /', '_', $results['Sci_Name']);
|
||||||
$sci_name = $results['Sci_Name'];
|
$sci_name = $results['Sci_Name'];
|
||||||
$time = $results['Time'];
|
$time = $results['Time'];
|
||||||
$confidence = $results['Confidence'];
|
$confidence = $results['Confidence'];
|
||||||
echo "<tr>
|
echo "<tr>
|
||||||
<td>$date</td>
|
<td>$date</td>
|
||||||
<td><a href=\"$comlink\" target=\"footer\"/>$time</a></td>
|
<td><a href=\"$comlink\" target=\"footer\"/>$time</a></td>
|
||||||
<td><a href=\"https://wikipedia.org/wiki/$sciname\" target=\"top\">$sci_name</a></td>
|
<td><a href=\"https://wikipedia.org/wiki/$sciname\" target=\"top\">$sci_name</a></td>
|
||||||
<form action=\"/stats.php\" method=\"POST\">
|
<form action=\"/stats.php\" method=\"POST\">
|
||||||
<td><button type=\"submit\" name=\"species\" value=\"$name\">$name</button>
|
<td><button type=\"submit\" name=\"species\" value=\"$name\">$name</button>
|
||||||
</form></td>
|
</form></td>
|
||||||
<td>$confidence</td>
|
<td>$confidence</td>
|
||||||
</tr>";
|
</tr>";
|
||||||
|
|
||||||
}echo "</table>";}?>
|
}echo "</table>";}?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ $result2 = $statement2->execute();
|
|||||||
if(isset($_POST['species'])){
|
if(isset($_POST['species'])){
|
||||||
$selection = $_POST['species'];
|
$selection = $_POST['species'];
|
||||||
$statement3 = $db->prepare("SELECT Com_Name, Sci_Name, COUNT(*), MAX(Confidence) from detections
|
$statement3 = $db->prepare("SELECT Com_Name, Sci_Name, COUNT(*), MAX(Confidence) from detections
|
||||||
WHERE Com_Name = '$selection'");
|
WHERE Com_Name = \"$selection\"");
|
||||||
if($statement3 == False) {
|
if($statement3 == False) {
|
||||||
echo "Database busy";
|
echo "Database busy";
|
||||||
header("refresh: 0;");
|
header("refresh: 0;");
|
||||||
|
|||||||
Reference in New Issue
Block a user