some metrics changes
This commit is contained in:
parent
bf15ea0160
commit
4bedd229e5
1
db/migrate/000128_chart.sql
Normal file
1
db/migrate/000128_chart.sql
Normal file
@ -0,0 +1 @@
|
||||
ALTER TABLE `chart` ADD `title` varchar(255) DEFAULT NULL;
|
||||
@ -34,19 +34,20 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
||||
$chart->processInterval( $info[ 'chart' ][ 'interval' ] );
|
||||
|
||||
$description = $this->chart->getChartDescription( $this->chartId );
|
||||
$title = $this->chart->getChartTitle( $this->chartId );
|
||||
|
||||
switch ( $type ) {
|
||||
case 'column':
|
||||
$params = array_merge( $chart->$method( true ), $info );
|
||||
$this->renderColumn( $params, $chart->getGroupedCharts( $info ), $description );
|
||||
$this->renderColumn( $params, $chart->getGroupedCharts( $info ), $description, $title );
|
||||
break;
|
||||
case 'area':
|
||||
$params = array_merge( $chart->$method( true ), $info );
|
||||
$this->renderArea( $params, $chart->getGroupedCharts( $info ), $description );
|
||||
$this->renderArea( $params, $chart->getGroupedCharts( $info ), $description, $title );
|
||||
break;
|
||||
case 'pie_communities':
|
||||
$params = array_merge( $chart->$method( true ), $info );
|
||||
$this->renderPieCommunities( $params, $chart->getGroupedCharts( $info ), $description );
|
||||
$this->renderPieCommunities( $params, $chart->getGroupedCharts( $info ), $description, $title );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -96,7 +97,15 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
||||
|
||||
}
|
||||
|
||||
private function renderPieCommunities( $params, $groups, $description ){
|
||||
private function renderPieCommunities( $params, $groups, $description, $title ){
|
||||
|
||||
$subtitle = $params[ 'title' ] . ' : ' . $groups[ $this->chartId ][ 'title' ];
|
||||
|
||||
if( !$title ){
|
||||
$title = $subtitle;
|
||||
$subtitle = '';
|
||||
}
|
||||
|
||||
c::view()->display('charts/pie_communities', ['set' => [
|
||||
'chartId' => $this->chartId,
|
||||
'data' => $params[ 'data' ],
|
||||
@ -109,9 +118,14 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
||||
]]);
|
||||
}
|
||||
|
||||
private function renderArea( $params, $groups, $description ){
|
||||
private function renderArea( $params, $groups, $description, $title ){
|
||||
|
||||
$title = $params[ 'title' ] . ' : ' . $groups[ $this->chartId ][ 'title' ];
|
||||
$subtitle = $params[ 'title' ] . ' : ' . $groups[ $this->chartId ][ 'title' ];
|
||||
|
||||
if( !$title ){
|
||||
$title = $subtitle;
|
||||
$subtitle = '';
|
||||
}
|
||||
|
||||
$interval = ( $params[ 'interval' ] ) ? $params[ 'interval' ] : 'week';
|
||||
|
||||
@ -132,6 +146,7 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
||||
'totalMonths' => $this->chart->totalMonths(),
|
||||
'totalDays' => $this->chart->totalDays(),
|
||||
'title' => $title,
|
||||
'subtitle' => $subtitle,
|
||||
'groups' => $groups,
|
||||
'info' => $params,
|
||||
'hideGroups' => $params[ 'hideGroups' ],
|
||||
@ -141,9 +156,14 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
||||
]]);
|
||||
}
|
||||
|
||||
private function renderColumn( $params, $groups, $description ){
|
||||
private function renderColumn( $params, $groups, $description, $title ){
|
||||
|
||||
$title = $params[ 'title' ] . ' : ' . $groups[ $this->chartId ][ 'title' ];
|
||||
$subtitle = $params[ 'title' ] . ' : ' . $groups[ $this->chartId ][ 'title' ];
|
||||
|
||||
if( !$title ){
|
||||
$title = $subtitle;
|
||||
$subtitle = '';
|
||||
}
|
||||
|
||||
$interval = ( $params[ 'interval' ] ) ? $params[ 'interval' ] : 'week';
|
||||
|
||||
@ -164,6 +184,7 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
||||
'totalMonths' => $this->chart->totalMonths(),
|
||||
'totalDays' => $this->chart->totalDays(),
|
||||
'title' => $title,
|
||||
'subtitle' => $subtitle,
|
||||
'groups' => $groups,
|
||||
'info' => $params,
|
||||
'divId' => $this->divId,
|
||||
|
||||
@ -191,6 +191,12 @@ class Crunchbutton_Chart extends Cana_Model {
|
||||
return $result->_items[0]->description;
|
||||
}
|
||||
|
||||
public function getChartTitle( $permalink ){
|
||||
$query = "SELECT * FROM chart WHERE permalink = '{$permalink}'";
|
||||
$result = c::db()->get( $query );
|
||||
return $result->_items[0]->title;
|
||||
}
|
||||
|
||||
public function weeks(){
|
||||
$query = "SELECT COUNT( DISTINCT( YEARWEEK( date ) ) ) AS weeks FROM `order`";
|
||||
$result = c::db()->get( $query );
|
||||
|
||||
@ -93,7 +93,10 @@
|
||||
|
||||
<?php if( $hasResults ){ ?>
|
||||
<div id="chart-<?=$chartId?>" style="min-width: 100%; height:250px; margin: 0 auto"></div>
|
||||
<center>
|
||||
<center style="height:60px;">
|
||||
<?php if( $subtitle != '' ){ ?>
|
||||
<div style="font-size:10px;"><?php echo $subtitle; ?></div>
|
||||
<?php } ?>
|
||||
<?php echo $description; ?>
|
||||
</center>
|
||||
<div id="options-<?=$divId?>" style="height:95px;background:#F5F5F5;width:98%;overflow-x:auto;overflow-y:hidden;<?php if( $hideSlider ) { echo 'display:none;'; } ?>">
|
||||
|
||||
@ -128,10 +128,13 @@ if( $isPopup ){
|
||||
</div>
|
||||
<?php if( $hasResults ){ ?>
|
||||
<div id="chart-<?=$chartId?>" style="min-width: 100%; <?php if( $isPopup ){ echo 'height:90%;'; }else{ echo 'height:250px;'; } ?> margin: 0 auto"></div>
|
||||
<center>
|
||||
<center style="height:60px;">
|
||||
<?php if( $subtitle != '' ){ ?>
|
||||
<div style="font-size:10px;"><?php echo $subtitle; ?></div>
|
||||
<?php } ?>
|
||||
<?php echo $description; ?>
|
||||
</center>
|
||||
<div id="options-<?=$divId?>" style="height:95px;background:#F5F5F5;width:98%;overflow-x:auto;overflow-y:hidden;<?php if( $isPopup ){ echo 'display:none'; } ?>">
|
||||
<div id="options-<?=$divId?>" style="height:110px;background:#F5F5F5;overflow-x:auto;width:99%;overflow-y:hidden;<?php if( $isPopup ){ echo 'display:none'; } ?>">
|
||||
<table>
|
||||
<tr>
|
||||
<?php
|
||||
@ -244,8 +247,8 @@ if( $isPopup ){
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="row-fluid" style="padding:0 20px; font-size:10px;">
|
||||
<div class="span3" id="week-<?=$chartId?>">
|
||||
<div class="row-fluid span11" style="padding:0 20px; font-size:10px;">
|
||||
<div class="span4" id="week-<?=$chartId?>">
|
||||
<?php
|
||||
if( $interval == 'week' ){
|
||||
$_slider_to = $to;
|
||||
@ -267,7 +270,7 @@ if( $isPopup ){
|
||||
<?php
|
||||
} ?>
|
||||
</div>
|
||||
<div class="span7">
|
||||
<div class="span6">
|
||||
<div id="slider-<?=$divId?>" data-from="<?php echo $_slider_from; ?>" data-to="<?php echo $_slider_to; ?>"></div>
|
||||
</div>
|
||||
<?php } else {
|
||||
|
||||
@ -19,9 +19,12 @@
|
||||
<h5 style="text-align:center;"><?php echo $group; ?></h5>
|
||||
</div>
|
||||
<div id="chart-<?=$chartId?><?php echo $count; ?>" style="min-width: 100%; height:250px; margin: 0 auto"></div>
|
||||
<center>
|
||||
<center style="height:60px;">
|
||||
<?php if( $subtitle != '' ){ ?>
|
||||
<div style="font-size:10px;"><?php echo $subtitle; ?></div>
|
||||
<?php } ?>
|
||||
<?php echo $description; ?>
|
||||
</center>
|
||||
</center>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
@ -131,7 +131,7 @@
|
||||
<?php
|
||||
$communities = Restaurant::getCommunities();
|
||||
?>
|
||||
<select name="filter-by-community" id="filter-by-community">
|
||||
<select name="filter-by-community" id="filter-by-community" class="span10">
|
||||
<option value="">Ignore filter</option>
|
||||
<option value="all">All</option>
|
||||
<?php
|
||||
|
||||
@ -242,7 +242,6 @@ html {
|
||||
padding-top: 7px;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* support stuff
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user