From 561c44ece2db3d05c9b85627ea37f4b1d9a3fa04 Mon Sep 17 00:00:00 2001 From: Andrew Bauer Date: Thu, 30 Jul 2020 16:14:41 -0500 Subject: [PATCH] add runtimeStatus function --- web/skins/classic/includes/functions.php | 56 +++++++++++------------- 1 file changed, 25 insertions(+), 31 deletions(-) diff --git a/web/skins/classic/includes/functions.php b/web/skins/classic/includes/functions.php index f746403ff..515e1b8ab 100644 --- a/web/skins/classic/includes/functions.php +++ b/web/skins/classic/includes/functions.php @@ -267,14 +267,7 @@ function getNavBarHTML($reload = null) { } if ( $reload === null ) { ob_start(); - if ( $running == null ) - $running = daemonCheck(); - if ( $running ) { - $state = dbFetchOne('SELECT Name FROM States WHERE isActive=1', 'Name'); - if ( $state == 'default' ) - $state = ''; - } - $status = $running ? ($state ? $state : translate('Running')) : translate('Stopped'); + $status = runtimeStatus($running); ?>
@@ -302,12 +295,12 @@ function getNavBarHTML($reload = null) { echo getOptionsHTML(); echo getLogHTML(); echo getDevicesHTML(); - echo getGroupsHTML(); - echo getFilterHTML(); - echo getCycleHTML(); - echo getMontageHTML(); - echo getMontageReviewHTML(); - echo getRprtEvntAuditHTML(); + echo getGroupsHTML($view); + echo getFilterHTML($view,$filterQuery,$sortQuery,$limitQuery); + echo getCycleHTML($view); + echo getMontageHTML($view); + echo getMontageReviewHTML($view); + echo getRprtEvntAuditHTML($view); echo getHeaderFlipHTML(); echo ''; @@ -507,26 +500,19 @@ function getDevicesHTML() { } // Returns the html representing the Groups menu item -function getGroupsHTML() { - global $view; +function getGroupsHTML($view) { $class = $view == 'groups' ? 'selected' : ''; echo ''.PHP_EOL; } // Returns the html representing the Filter menu item -function getFilterHTML() { - global $view; - global $filterQuery; - global $sortQuery; - global $limitQuery; - +function getFilterHTML($view,$filterQuery,$sortQuery,$limitQuery) { $class = $view == 'filter' ? 'selected' : ''; echo ''.PHP_EOL; } // Returns the html representing the Cycle menu item -function getCycleHTML() { - global $view; +function getCycleHTML($view) { if ( canView('Stream') ) { $class = $view == 'cycle' ? 'selected' : ''; echo ''.PHP_EOL; @@ -534,8 +520,7 @@ function getCycleHTML() { } // Returns the html representing the Montage menu item -function getMontageHTML() { - global $view; +function getMontageHTML($view) { if ( canView('Stream') ) { $class = $view == 'cycle' ? 'selected' : ''; echo ''.PHP_EOL; @@ -543,8 +528,7 @@ function getMontageHTML() { } // Returns the html representing the MontageReview menu item -function getMontageReviewHTML() { - global $view; +function getMontageReviewHTML($view) { if ( canView('Events') ) { if ( isset($_REQUEST['filter']['Query']['terms']['attr']) ) { $terms = $_REQUEST['filter']['Query']['terms']; @@ -567,8 +551,7 @@ function getMontageReviewHTML() { } // Returns the html representing the Audit Events Report menu item -function getRprtEvntAuditHTML() { - global $view; +function getRprtEvntAuditHTML($view) { if ( canView('Events') ) { $class = $view == 'report_event_audit' ? 'selected' : ''; echo ''.PHP_EOL; @@ -613,11 +596,22 @@ function getStatusBtnHTML($status) { } } +function runtimeStatus($running=null) { + if ( $running == null ) + $running = daemonCheck(); + if ( $running ) { + $state = dbFetchOne('SELECT Name FROM States WHERE isActive=1', 'Name'); + if ( $state == 'default' ) + $state = ''; + } + + return $running ? ($state ? $state : translate('Running')) : translate('Stopped'); +} + function xhtmlFooter() { global $cspNonce; global $view; global $skin; - global $running; if ( canEdit('System') ) { include("skins/$skin/views/state.php"); }