diff --git a/include/controllers/default/cockpit/home/charts.php b/include/controllers/default/cockpit/home/charts.php index 0dc1d43a5..b7ab32ccd 100644 --- a/include/controllers/default/cockpit/home/charts.php +++ b/include/controllers/default/cockpit/home/charts.php @@ -3,7 +3,6 @@ class Controller_home_charts extends Crunchbutton_Controller_Account { public function process( $info, $chart ){ - $title = $info[ 'title' ]; $subTitle = $info['chart'][ 'title' ]; $type = $info['chart'][ 'type' ]; @@ -11,10 +10,12 @@ class Controller_home_charts extends Crunchbutton_Controller_Account { if( $_GET['filter'] ){ $filters = $info['chart'][ 'filters' ]; - foreach( $filters as $filter ){ - if( $filter[ 'type' ] == $_GET['filter'] ){ - $method = $filter[ 'method' ]; - $info[ 'filter' ] = $filter[ 'type' ]; + if( $filters ){ + foreach( $filters as $filter ){ + if( $filter[ 'type' ] == $_GET['filter'] ){ + $method = $filter[ 'method' ]; + $info[ 'filter' ] = $filter[ 'type' ]; + } } } } diff --git a/include/views/default/cockpit/charts/column.phtml b/include/views/default/cockpit/charts/column.phtml index ca998daaa..0e565a63c 100644 --- a/include/views/default/cockpit/charts/column.phtml +++ b/include/views/default/cockpit/charts/column.phtml @@ -75,11 +75,34 @@ if( $isPopup ){ } + $applyCommunityFilter = false; + + foreach ($ys as $k => $v) { + if( $_GET[ 'filter' ] && $_GET[ 'filter' ] == 'community' ){ + if( $_GET[ 'community' ] && $_GET[ 'community' ] != '' && strtolower( $_GET[ 'community' ] ) != 'all' ){ + if( strtolower( $_GET[ 'community' ] ) == strtolower( $k ) ){ + $applyCommunityFilter = true; + } + } + } + } + // remove assoc vals and add proper keys foreach ($ys as $k => $v) { $ys[$k] = array_values($ys[$k]); + $visible = true; + if( $applyCommunityFilter && $_GET[ 'filter' ] && $_GET[ 'filter' ] == 'community' ){ + if( $_GET[ 'community' ] && $_GET[ 'community' ] != '' && strtolower( $_GET[ 'community' ] ) != 'all' ){ + if( strtolower( $_GET[ 'community' ] ) == strtolower( $k ) ){ + $visible = true; + } else { + $visible = false; + } + } + } $ys[$k] = [ 'name' => $k, + 'visible' => $visible, 'data' => $ys[$k] ]; } @@ -219,26 +242,26 @@ if( $isPopup ){ -