From 09090b1e746ce5c35963393695d9aadbc5f75e7c Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Sat, 23 Apr 2022 18:16:34 -0400 Subject: [PATCH] Adding legacy view to Today's Detections In the bottom right of the page there's now a button that lets you toggle legacy table view on or off - is quite useful (imo) for viewing all entries at once. --- scripts/todays_detections.php | 51 ++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/scripts/todays_detections.php b/scripts/todays_detections.php index 94002bf..2f25575 100644 --- a/scripts/todays_detections.php +++ b/scripts/todays_detections.php @@ -57,8 +57,13 @@ if($statement6 == False){ $result6 = $statement6->execute(); $totalspeciestally = $result6->fetchArray(SQLITE3_ASSOC); -if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" && isset($_GET['display_limit']) && is_numeric($_GET['display_limit']) ) { - $statement0 = $db->prepare('SELECT Time, Com_Name, Sci_Name, Confidence, File_Name FROM detections WHERE Date == Date(\'now\', \'localtime\') ORDER BY Time DESC LIMIT '.(intval($_GET['display_limit'])-40).',40'); +if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" ) { + if(isset($_GET['display_limit']) && is_numeric($_GET['display_limit'])){ + $statement0 = $db->prepare('SELECT Time, Com_Name, Sci_Name, Confidence, File_Name FROM detections WHERE Date == Date(\'now\', \'localtime\') ORDER BY Time DESC LIMIT '.(intval($_GET['display_limit'])-40).',40'); + } else { + // legacy mode + $statement0 = $db->prepare('SELECT Time, Com_Name, Sci_Name, Confidence, File_Name FROM detections WHERE Date == Date(\'now\', \'localtime\') ORDER BY Time DESC '); + } if($statement0 == False){ echo "Database is busy"; header("refresh: 0;"); @@ -77,20 +82,30 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" && isse $filename = "/By_Date/".date('Y-m-d')."/".$comname."/".$todaytable['File_Name']; $sciname = preg_replace('/ /', '_', $todaytable['Sci_Name']); ?> -