Skip to content

Commit

Permalink
New layout
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbelgium authored Nov 26, 2024
1 parent 717702d commit e1dbefb
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions scripts/overview.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,10 @@ function setModalText(iter, title, text, authorlink, photolink, licenseurl) {
</div>
<?php
$statement = $db->prepare("
SELECT d_today.Com_Name, d_today.Sci_Name, d_today.Date, d_today.Time, d_today.Confidence, d_today.File_Name, MAX(d_today.Confidence) as MaxConfidence,
COUNT(d_today.Com_Name) as OccurrenceCount,
(SELECT MAX(Date) FROM detections d_prev WHERE d_prev.Com_Name = d_today.Com_Name AND d_prev.Date < DATE('now', 'localtime')) as LastSeenDate
SELECT d_today.Com_Name, d_today.Sci_Name, d_today.Date, d_today.Time, d_today.Confidence, d_today.File_Name,
MAX(d_today.Confidence) as MaxConfidence,
(SELECT MAX(Date) FROM detections d_prev WHERE d_prev.Com_Name = d_today.Com_Name AND d_prev.Date < DATE('now', 'localtime')) as LastSeenDate,
(SELECT COUNT(*) FROM detections d_occ WHERE d_occ.Com_Name = d_today.Com_Name AND d_occ.Date = DATE('now', 'localtime') AND d_occ.Time >= d_today.Time) as OccurrenceCount
FROM detections d_today
WHERE d_today.Date = DATE('now', 'localtime')
GROUP BY d_today.Com_Name
Expand Down Expand Up @@ -402,21 +403,21 @@ function display_species($species_list, $title, $show_last_seen=false) {
$days_ago = $todaytable['DaysAgo'];
if ($days_ago > 30) {
$months_ago = floor($days_ago / 30);
$last_seen_text = "{$todaytable['Time']}<br><i>Last seen: {$months_ago}mo ago</i>";
$last_seen_text = "<br><i>Last: {$months_ago}mo ago</i>";
} else {
$last_seen_text = "{$todaytable['Time']}<br><i>Last seen: {$days_ago}d ago</i>";
$last_seen_text = "<br><i>Last: {$days_ago}d ago</i>";
}
} else {
$last_seen_text = $todaytable['Time'];

}

// Get the occurrence count for this species
$occurrence_count = $todaytable['OccurrenceCount'];
$time_occurrence_text = "<br>{$todaytable['Time']}";
if (isset($todaytable['OccurrenceCount']) && $todaytable['OccurrenceCount'] > 1) {
$time_occurrence_text .= " ({$todaytable['OccurrenceCount']}x)";
}
?>
<tr class="relative" id="<?php echo $iterations; ?>">
<td><?php echo $last_seen_text; ?><br></td>
<td><?php if (!empty($image_url)): ?>
<img onclick='setModalText(<?php echo $iterations; ?>,"<?php echo urlencode($image[2]); ?>", "<?php echo $image[3]; ?>", "<?php echo $image[4]; ?>", "<?php echo $image[1]; ?>", "<?php echo $image[5]; ?>")' src="<?php echo $image_url; ?>" style="height: 50px; width: 50px; border-radius: 5px; cursor: pointer;" class="img1" title="Image from Flickr" />
<img onclick='setModalText(<?php echo $iterations; ?>,"<?php echo urlencode($image[2]); ?>", "<?php echo $image[3]; ?>", "<?php echo $image[4]; ?>", "<?php echo $image[1]; ?>", "<?php echo $image[5]; ?>")' src="<?php echo $image_url; ?>" style="max-width: none; height: 50px; width: 50px; border-radius: 5px; cursor: pointer;" class="img1" title="Image from Flickr" />
<?php endif; ?></td>
<td id="recent_detection_middle_td">
<div><form action="" method="GET">
Expand All @@ -429,9 +430,10 @@ function display_species($species_list, $title, $show_last_seen=false) {
<img style="height: 1em;cursor:pointer;float:unset;display:inline" title="View species stats" onclick="generateMiniGraph(this, '<?php echo $comnamegraph; ?>', 160)" width="25" src="images/chart.svg">
<?php endif; ?>
<a target="_blank" href="index.php?filename=<?php echo $todaytable['File_Name']; ?>"><img style="height: 1em;cursor:pointer;float:unset;display:inline" class="copyimage-mobile" title="Open in new tab" width="16" src="images/copy.png"></a>
</i><br></form></div>
</i>
</form></div>
</td>
<td><b>Confidence:</b> <?php echo round($todaytable['Confidence'] * 100 ) . '%'; ?><br><?php echo "{$todaytable['Time']} ({$occurrence_count}x)"; ?><br></td>
<td style="white-space: nowrap;">Confidence: <?php echo round($todaytable['Confidence'] * 100 ) . '%'; echo $last_seen_text; echo $time_occurrence_text; ?><br></td>
</tr>
<?php endforeach; ?>
</table>
Expand Down

0 comments on commit e1dbefb

Please sign in to comment.