diff --git a/templates/webpanel/capture.php b/templates/webpanel/capture.php new file mode 100644 index 0000000..eaff403 --- /dev/null +++ b/templates/webpanel/capture.php @@ -0,0 +1,7 @@ + diff --git a/templates/webpanel/captures.php b/templates/webpanel/captures.php index 6968c3e..5024b0e 100644 --- a/templates/webpanel/captures.php +++ b/templates/webpanel/captures.php @@ -1,7 +1,7 @@ diff --git a/templates/webpanel/controllers/capture_controller.php b/templates/webpanel/controllers/capture_controller.php new file mode 100644 index 0000000..288fc9c --- /dev/null +++ b/templates/webpanel/controllers/capture_controller.php @@ -0,0 +1,9 @@ +db_dir); + if ($pass_id < 1) $pass_id = 1; + $enhancements = $db_conn->getEnhancements($pass_id); + $path = $db_conn->getImagePath($pass_id); + require('views/capture.php'); +?> diff --git a/templates/webpanel/controllers/captures_controller.php b/templates/webpanel/controllers/captures_controller.php index 4e2ce40..e67fbce 100644 --- a/templates/webpanel/controllers/captures_controller.php +++ b/templates/webpanel/controllers/captures_controller.php @@ -1,11 +1,15 @@ db_dir); $page_count = $db_conn->totalPages($img_per_page); + + # adjust for under/over paging if ($page < 1) $page = 1; if ($page > $page_count) $page = $page_count; + $images = $db_conn->getImages($page, $img_per_page); - require('views/all_images.php'); + require('views/all_captures.php'); ?> diff --git a/templates/webpanel/controllers/pass_controller.php b/templates/webpanel/controllers/pass_controller.php index b8c19cc..f3f14a9 100644 --- a/templates/webpanel/controllers/pass_controller.php +++ b/templates/webpanel/controllers/pass_controller.php @@ -1,4 +1,5 @@ db_dir); $passes = $db_conn->getPasses(); diff --git a/templates/webpanel/css/captures.css b/templates/webpanel/css/captures.css index 112f621..1937c33 100644 --- a/templates/webpanel/css/captures.css +++ b/templates/webpanel/css/captures.css @@ -1,6 +1,33 @@ +ul.pagination li.page-item { + width: 100%; + text-align: center; +} + +ul.pagination li.page-item a { + color: white; + background-color: #4CAF50; + opacity: 0.85; +} + +ul.pagination li.page-item.disabled a { + color: white; + background-color: #6c757d; +} + +div.page-count-summary { + text-align: center; +} + div.card-group.capture-image-cards div.image-card { display: block; text-align: center; + border: 1px solid rgba(0,0,0,.125); + border-radius: 0.25rem; +} + +div.card-group.capture-image-cards a { + display: block; + height: 180px; } div.card-group.capture-image-cards div.image-card img.card-img-top { diff --git a/templates/webpanel/css/header.css b/templates/webpanel/css/header.css index ef21a24..591d8db 100644 --- a/templates/webpanel/css/header.css +++ b/templates/webpanel/css/header.css @@ -15,3 +15,9 @@ header ul.navbar-nav li a { header ul.navbar-nav li.active a { border-bottom: 0.25rem solid white; } + +header span.navbar-text.timezone { + font-size: 0.75rem; + text-align: right; + line-height: 0.95rem; +} diff --git a/templates/webpanel/index.php b/templates/webpanel/index.php index f6cf762..92c2eda 100644 --- a/templates/webpanel/index.php +++ b/templates/webpanel/index.php @@ -1,5 +1,5 @@ con->querySingle("SELECT count() from decoded_passes;"); - return ceil($total_pages/$img_per_page); + $decoded_passes = $this->con->querySingle("SELECT count() + FROM decoded_passes;"); + return ceil($decoded_passes/$img_per_page); } # get a list of images for the given page and total number @@ -46,8 +47,8 @@ predict_passes.sat_name, predict_passes.max_elev FROM decoded_passes - INNER JOIN predict_passes - ON predict_passes.pass_start = decoded_passes.pass_start + INNER JOIN predict_passes + ON predict_passes.pass_start = decoded_passes.pass_start ORDER BY decoded_passes.pass_start DESC LIMIT ? OFFSET ?;"); $query->bindValue(1, $img_per_page); $query->bindValue(2, $img_per_page * ($page-1)); @@ -62,5 +63,48 @@ return $images; } + + # get the enhancements for the particular capture + public function getEnhancements($id) { + $query = $this->con->prepare('SELECT daylight_pass, + sat_type, + img_count + FROM decoded_passes + WHERE id = ?;'); + $query->bindValue(1, $id); + $result = $query->execute(); + $pass = $result->fetchArray(); + + # build enhancement paths based on satellite type + switch($pass['sat_type']) { + case 0: // Meteor-M2 + $enhancements = ['-122-rectified.jpg']; + break; + case 1: // NOAA + if ($pass['daylight_pass'] == 1) { + $enhancements = ['-ZA.jpg','-MCIR.jpg','-MCIR-precip.jpg','-MSA.jpg','-MSA-precip.jpg','-HVC.jpg','-HVC-precip.jpg','-HVCT.jpg','-HVCT-precip.jpg']; + } else { + $enhancements = ['-ZA.jpg','-MCIR.jpg','-MCIR-precip.jpg']; + } + break; + case 2: // ISS + for ($x = 0; $x <= $pass['img_count']-1; $x++) { + $enhancements[] = "-$x.png"; + } + break; + } + return $enhancements; + } + + # get the image path for the specific image + public function getImagePath($id) { + $query = $this->con->prepare('SELECT file_path + FROM decoded_passes + WHERE id = ?;'); + $query->bindValue(1, $id); + $result = $query->execute(); + $image = $result->fetchArray(); + return $image['file_path']; + } } ?> diff --git a/templates/webpanel/views/all_captures.php b/templates/webpanel/views/all_captures.php index 575c512..5ee4799 100644 --- a/templates/webpanel/views/all_captures.php +++ b/templates/webpanel/views/all_captures.php @@ -1,12 +1,12 @@ - + -
";
- echo " " . $lang['elev'] . ": " . $image['max_elev'] . "
";
+ echo " " . $lang['elev'] . ": " . $image['max_elev'] . "°
";
echo " " . $lang['pass_start'] . ": " . date('m/d/Y H:i:s', $image['pass_start']);
echo "
"; + echo " Enhancement: " . $enhancement_text; + echo "
"; + echo "