partial #1447
This commit is contained in:
parent
2bd9a6d438
commit
4d453bd39c
@ -3,7 +3,7 @@
|
|||||||
class Controller_home_charts extends Crunchbutton_Controller_Account {
|
class Controller_home_charts extends Crunchbutton_Controller_Account {
|
||||||
|
|
||||||
public $activeUsersInterval = 45; // Days
|
public $activeUsersInterval = 45; // Days
|
||||||
public $queryIncludeCommunties = 'AND c.id_community IN (1, 4)';
|
public $queryOnlyCommunties = 'AND c.id_community IN (1, 4)';
|
||||||
public $queryExcludeCommunties = "AND c.name != 'Testing' AND c.name IS NOT NULL";
|
public $queryExcludeCommunties = "AND c.name != 'Testing' AND c.name IS NOT NULL";
|
||||||
public $queryExcludeUsers = "AND o.name NOT LIKE '%test%' and o.name != 'Judd' and o.name != 'dave' and o.name != 'Nick' and o.name != 'Devin'";
|
public $queryExcludeUsers = "AND o.name NOT LIKE '%test%' and o.name != 'Judd' and o.name != 'dave' and o.name != 'Nick' and o.name != 'Devin'";
|
||||||
|
|
||||||
@ -11,6 +11,7 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
|||||||
|
|
||||||
$chart = c::getPagePiece(2);
|
$chart = c::getPagePiece(2);
|
||||||
$title = c::getPagePiece(3);
|
$title = c::getPagePiece(3);
|
||||||
|
$number = c::getPagePiece(4);
|
||||||
|
|
||||||
switch ( $chart ) {
|
switch ( $chart ) {
|
||||||
|
|
||||||
@ -54,6 +55,7 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
|||||||
'chartId' => $chart,
|
'chartId' => $chart,
|
||||||
'data' => c::db()->get( $query ),
|
'data' => c::db()->get( $query ),
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
|
'number' => $number,
|
||||||
'unit' => 'users',
|
'unit' => 'users',
|
||||||
'maxWeeks' => $maxWeeks,
|
'maxWeeks' => $maxWeeks,
|
||||||
'weeks' => $weeks,
|
'weeks' => $weeks,
|
||||||
@ -90,7 +92,7 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
|||||||
WHERE o.date <= STR_TO_DATE('{$week} Saturday', '%X%V %W')
|
WHERE o.date <= STR_TO_DATE('{$week} Saturday', '%X%V %W')
|
||||||
{$this->queryExcludeCommunties}
|
{$this->queryExcludeCommunties}
|
||||||
{$this->queryExcludeUsers}
|
{$this->queryExcludeUsers}
|
||||||
{$this->queryIncludeCommunties}
|
{$this->queryOnlyCommunties}
|
||||||
GROUP BY u.phone HAVING orders = 1) Orders
|
GROUP BY u.phone HAVING orders = 1) Orders
|
||||||
WHERE Orders.date BETWEEN STR_TO_DATE('{$week} Sunday', '%X%V %W') AND STR_TO_DATE('{$week} Saturday', '%X%V %W')
|
WHERE Orders.date BETWEEN STR_TO_DATE('{$week} Sunday', '%X%V %W') AND STR_TO_DATE('{$week} Saturday', '%X%V %W')
|
||||||
GROUP BY Orders.name";
|
GROUP BY Orders.name";
|
||||||
@ -101,6 +103,7 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
|||||||
'chartId' => $chart,
|
'chartId' => $chart,
|
||||||
'data' => c::db()->get( $query ),
|
'data' => c::db()->get( $query ),
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
|
'number' => $number,
|
||||||
'unit' => 'users',
|
'unit' => 'users',
|
||||||
'maxWeeks' => $maxWeeks,
|
'maxWeeks' => $maxWeeks,
|
||||||
'weeks' => $weeks,
|
'weeks' => $weeks,
|
||||||
@ -145,6 +148,7 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
|||||||
'chartId' => $chart,
|
'chartId' => $chart,
|
||||||
'data' => c::db()->get( $query ),
|
'data' => c::db()->get( $query ),
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
|
'number' => $number,
|
||||||
'unit' => 'users',
|
'unit' => 'users',
|
||||||
'maxWeeks' => $maxWeeks,
|
'maxWeeks' => $maxWeeks,
|
||||||
'weeks' => $weeks,
|
'weeks' => $weeks,
|
||||||
@ -212,6 +216,7 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
|||||||
'chartId' => $chart,
|
'chartId' => $chart,
|
||||||
'data' => c::db()->get( $query ),
|
'data' => c::db()->get( $query ),
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
|
'number' => $number,
|
||||||
'unit' => 'users',
|
'unit' => 'users',
|
||||||
'maxWeeks' => $maxWeeks,
|
'maxWeeks' => $maxWeeks,
|
||||||
'weeks' => $weeks,
|
'weeks' => $weeks,
|
||||||
@ -256,7 +261,7 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
|||||||
AND o.date >= STR_TO_DATE('{$week} Saturday', '%X%V %W') - INTERVAL {$this->activeUsersInterval} DAY
|
AND o.date >= STR_TO_DATE('{$week} Saturday', '%X%V %W') - INTERVAL {$this->activeUsersInterval} DAY
|
||||||
{$this->queryExcludeCommunties}
|
{$this->queryExcludeCommunties}
|
||||||
{$this->queryExcludeUsers}
|
{$this->queryExcludeUsers}
|
||||||
{$this->queryIncludeCommunties}
|
{$this->queryOnlyCommunties}
|
||||||
GROUP BY u.phone) ActiveUsers
|
GROUP BY u.phone) ActiveUsers
|
||||||
GROUP BY Community) ActiveUsers
|
GROUP BY Community) ActiveUsers
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
@ -275,7 +280,7 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
|||||||
WHERE o.date <= STR_TO_DATE('{$week} Saturday', '%X%V %W')
|
WHERE o.date <= STR_TO_DATE('{$week} Saturday', '%X%V %W')
|
||||||
{$this->queryExcludeCommunties}
|
{$this->queryExcludeCommunties}
|
||||||
{$this->queryExcludeUsers}
|
{$this->queryExcludeUsers}
|
||||||
{$this->queryIncludeCommunties}
|
{$this->queryOnlyCommunties}
|
||||||
GROUP BY u.phone HAVING orders = 1) Orders
|
GROUP BY u.phone HAVING orders = 1) Orders
|
||||||
WHERE Orders.date BETWEEN STR_TO_DATE('{$week} Sunday', '%X%V %W') AND STR_TO_DATE('{$week} Saturday', '%X%V %W')
|
WHERE Orders.date BETWEEN STR_TO_DATE('{$week} Sunday', '%X%V %W') AND STR_TO_DATE('{$week} Saturday', '%X%V %W')
|
||||||
GROUP BY Orders.name ) NewUsers ON NewUsers.Label = ActiveUsers.Label
|
GROUP BY Orders.name ) NewUsers ON NewUsers.Label = ActiveUsers.Label
|
||||||
@ -289,6 +294,7 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
|||||||
'chartId' => $chart,
|
'chartId' => $chart,
|
||||||
'data' => c::db()->get( $query ),
|
'data' => c::db()->get( $query ),
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
|
'number' => $number,
|
||||||
'unit' => 'users',
|
'unit' => 'users',
|
||||||
'maxWeeks' => $maxWeeks,
|
'maxWeeks' => $maxWeeks,
|
||||||
'weeks' => $weeks,
|
'weeks' => $weeks,
|
||||||
@ -325,7 +331,7 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
|||||||
AND o.date >= STR_TO_DATE('{$week} Saturday', '%X%V %W') - INTERVAL {$this->activeUsersInterval} DAY
|
AND o.date >= STR_TO_DATE('{$week} Saturday', '%X%V %W') - INTERVAL {$this->activeUsersInterval} DAY
|
||||||
{$this->queryExcludeCommunties}
|
{$this->queryExcludeCommunties}
|
||||||
{$this->queryExcludeUsers}
|
{$this->queryExcludeUsers}
|
||||||
{$this->queryIncludeCommunties}
|
{$this->queryOnlyCommunties}
|
||||||
GROUP BY u.phone) ActiveUsers
|
GROUP BY u.phone) ActiveUsers
|
||||||
GROUP BY ActiveUsers.name";
|
GROUP BY ActiveUsers.name";
|
||||||
$union = ' UNION ';
|
$union = ' UNION ';
|
||||||
@ -335,6 +341,7 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
|||||||
'chartId' => $chart,
|
'chartId' => $chart,
|
||||||
'data' => c::db()->get( $query ),
|
'data' => c::db()->get( $query ),
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
|
'number' => $number,
|
||||||
'unit' => 'users',
|
'unit' => 'users',
|
||||||
'maxWeeks' => $maxWeeks,
|
'maxWeeks' => $maxWeeks,
|
||||||
'weeks' => $weeks,
|
'weeks' => $weeks,
|
||||||
@ -371,7 +378,7 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
|||||||
AND o.date >= STR_TO_DATE('{$week} Saturday', '%X%V %W') - INTERVAL {$this->activeUsersInterval} DAY
|
AND o.date >= STR_TO_DATE('{$week} Saturday', '%X%V %W') - INTERVAL {$this->activeUsersInterval} DAY
|
||||||
{$this->queryExcludeCommunties}
|
{$this->queryExcludeCommunties}
|
||||||
{$this->queryExcludeUsers}
|
{$this->queryExcludeUsers}
|
||||||
{$this->queryIncludeCommunties}
|
{$this->queryOnlyCommunties}
|
||||||
GROUP BY u.phone) ActiveUsers";
|
GROUP BY u.phone) ActiveUsers";
|
||||||
$union = ' UNION ';
|
$union = ' UNION ';
|
||||||
$count++;
|
$count++;
|
||||||
@ -406,6 +413,7 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
|||||||
'chartId' => $chart,
|
'chartId' => $chart,
|
||||||
'data' => $data,
|
'data' => $data,
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
|
'number' => $number,
|
||||||
'unit' => 'active users lost',
|
'unit' => 'active users lost',
|
||||||
'maxWeeks' => $maxWeeks,
|
'maxWeeks' => $maxWeeks,
|
||||||
'weeks' => $weeks,
|
'weeks' => $weeks,
|
||||||
@ -422,13 +430,14 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
|||||||
WHERE o.date BETWEEN CURDATE() - INTERVAL {$this->activeUsersInterval} DAY AND CURDATE()
|
WHERE o.date BETWEEN CURDATE() - INTERVAL {$this->activeUsersInterval} DAY AND CURDATE()
|
||||||
{$this->queryExcludeCommunties}
|
{$this->queryExcludeCommunties}
|
||||||
{$this->queryExcludeUsers}
|
{$this->queryExcludeUsers}
|
||||||
{$this->queryIncludeCommunties}
|
{$this->queryOnlyCommunties}
|
||||||
GROUP BY o.id_community";
|
GROUP BY o.id_community";
|
||||||
|
|
||||||
c::view()->display('charts/pie', ['set' => [
|
c::view()->display('charts/pie', ['set' => [
|
||||||
'chartId' => $chart,
|
'chartId' => $chart,
|
||||||
'data' => c::db()->get( $query ),
|
'data' => c::db()->get( $query ),
|
||||||
'title' => 'Active users per community',
|
'title' => $title,
|
||||||
|
'number' => $number,
|
||||||
'unit' => 'users',
|
'unit' => 'users',
|
||||||
'maxWeeks' => $maxWeeks,
|
'maxWeeks' => $maxWeeks,
|
||||||
'weeks' => $weeks,
|
'weeks' => $weeks,
|
||||||
@ -449,7 +458,7 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
|||||||
WHERE YEARWEEK(o.date) >= {$actual}
|
WHERE YEARWEEK(o.date) >= {$actual}
|
||||||
{$this->queryExcludeCommunties}
|
{$this->queryExcludeCommunties}
|
||||||
{$this->queryExcludeUsers}
|
{$this->queryExcludeUsers}
|
||||||
{$this->queryIncludeCommunties}
|
{$this->queryOnlyCommunties}
|
||||||
GROUP BY YEARWEEK(o.date),
|
GROUP BY YEARWEEK(o.date),
|
||||||
o.id_community
|
o.id_community
|
||||||
ORDER BY YEARWEEK(o.date) DESC";
|
ORDER BY YEARWEEK(o.date) DESC";
|
||||||
@ -457,6 +466,7 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
|||||||
'chartId' => $chart,
|
'chartId' => $chart,
|
||||||
'data' => c::db()->get( $query ),
|
'data' => c::db()->get( $query ),
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
|
'number' => $number,
|
||||||
'unit' => 'users',
|
'unit' => 'users',
|
||||||
'maxWeeks' => $maxWeeks,
|
'maxWeeks' => $maxWeeks,
|
||||||
'ignoreWeekSum' => true,
|
'ignoreWeekSum' => true,
|
||||||
@ -483,7 +493,8 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
|||||||
c::view()->display('charts/column', ['set' => [
|
c::view()->display('charts/column', ['set' => [
|
||||||
'chartId' => $chart,
|
'chartId' => $chart,
|
||||||
'data' => c::db()->get( $query ),
|
'data' => c::db()->get( $query ),
|
||||||
'title' => 'Unique users per week',
|
'title' => $title,
|
||||||
|
'number' => $number,
|
||||||
'unit' => 'users',
|
'unit' => 'users',
|
||||||
'maxWeeks' => $maxWeeks,
|
'maxWeeks' => $maxWeeks,
|
||||||
'weeks' => $weeks,
|
'weeks' => $weeks,
|
||||||
@ -512,6 +523,7 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
|||||||
'chartId' => $chart,
|
'chartId' => $chart,
|
||||||
'data' => c::db()->get( $query ),
|
'data' => c::db()->get( $query ),
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
|
'number' => $number,
|
||||||
'unit' => 'orders',
|
'unit' => 'orders',
|
||||||
'ignoreWeekSum' => true,
|
'ignoreWeekSum' => true,
|
||||||
'maxWeeks' => $maxWeeks,
|
'maxWeeks' => $maxWeeks,
|
||||||
@ -540,6 +552,66 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
|||||||
'chartId' => $chart,
|
'chartId' => $chart,
|
||||||
'data' => c::db()->get( $query ),
|
'data' => c::db()->get( $query ),
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
|
'number' => $number,
|
||||||
|
'unit' => 'orders',
|
||||||
|
'maxWeeks' => $maxWeeks,
|
||||||
|
'ignoreWeekSum' => true,
|
||||||
|
'weeks' => $weeks,
|
||||||
|
]]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'orders-per-week-by-community':
|
||||||
|
$maxMinWeeks = $this->maxMinWeeks();
|
||||||
|
$maxWeeks = sizeof( $maxMinWeeks );
|
||||||
|
$weeks = ( $_REQUEST[ 'weeks' ] ? $_REQUEST[ 'weeks' ] : $maxWeeks );
|
||||||
|
$actual = $maxMinWeeks[ ( $weeks >= $maxWeek ? ( $weeks - 1 ) : $weeks ) ];
|
||||||
|
$query = "SELECT CONCAT('Week ', YEARWEEK(date)) AS `week`,
|
||||||
|
COUNT(*) AS Orders,
|
||||||
|
c.name AS 'Community'
|
||||||
|
FROM `order` o
|
||||||
|
INNER JOIN user u ON u.id_user = o.id_user
|
||||||
|
LEFT JOIN community c ON o.id_community = c.id_community
|
||||||
|
WHERE YEARWEEK(o.date) >= {$actual}
|
||||||
|
{$this->queryExcludeCommunties}
|
||||||
|
{$this->queryOnlyCommunties}
|
||||||
|
{$this->queryExcludeUsers}
|
||||||
|
GROUP BY YEARWEEK(date), c.name
|
||||||
|
ORDER BY YEARWEEK(date) DESC";
|
||||||
|
|
||||||
|
c::view()->display('charts/column', ['set' => [
|
||||||
|
'chartId' => $chart,
|
||||||
|
'data' => c::db()->get( $query ),
|
||||||
|
'title' => $title,
|
||||||
|
'number' => $number,
|
||||||
|
'unit' => 'orders',
|
||||||
|
'maxWeeks' => $maxWeeks,
|
||||||
|
'ignoreWeekSum' => true,
|
||||||
|
'weeks' => $weeks,
|
||||||
|
]]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'orders-using-giftcard-per-week':
|
||||||
|
$maxMinWeeks = $this->maxMinWeeks();
|
||||||
|
$maxWeeks = sizeof( $maxMinWeeks );
|
||||||
|
$weeks = ( $_REQUEST[ 'weeks' ] ? $_REQUEST[ 'weeks' ] : $maxWeeks );
|
||||||
|
$actual = $maxMinWeeks[ ( $weeks >= $maxWeek ? ( $weeks - 1 ) : $weeks ) ];
|
||||||
|
$query = "SELECT CONCAT('Week ', YEARWEEK(date)) AS `week`,
|
||||||
|
COUNT(*) AS Orders,
|
||||||
|
'Orders' AS label
|
||||||
|
FROM `order` o
|
||||||
|
INNER JOIN user u ON u.id_user = o.id_user
|
||||||
|
LEFT JOIN community c ON o.id_community = c.id_community
|
||||||
|
WHERE YEARWEEK(o.date) >= {$actual}
|
||||||
|
{$this->queryExcludeCommunties}
|
||||||
|
{$this->queryExcludeUsers}
|
||||||
|
GROUP BY YEARWEEK(date)
|
||||||
|
ORDER BY YEARWEEK(date) DESC";
|
||||||
|
echo $query ;exit;
|
||||||
|
c::view()->display('charts/column', ['set' => [
|
||||||
|
'chartId' => $chart,
|
||||||
|
'data' => c::db()->get( $query ),
|
||||||
|
'title' => $title,
|
||||||
|
'number' => $number,
|
||||||
'unit' => 'orders',
|
'unit' => 'orders',
|
||||||
'maxWeeks' => $maxWeeks,
|
'maxWeeks' => $maxWeeks,
|
||||||
'ignoreWeekSum' => true,
|
'ignoreWeekSum' => true,
|
||||||
@ -566,6 +638,7 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
|||||||
'chartId' => $chart,
|
'chartId' => $chart,
|
||||||
'data' => c::db()->get( $query ),
|
'data' => c::db()->get( $query ),
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
|
'number' => $number,
|
||||||
'unit' => '',
|
'unit' => '',
|
||||||
'maxWeeks' => $maxWeeks,
|
'maxWeeks' => $maxWeeks,
|
||||||
'ignoreWeekSum' => true,
|
'ignoreWeekSum' => true,
|
||||||
@ -591,6 +664,7 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
|||||||
'chartId' => $chart,
|
'chartId' => $chart,
|
||||||
'data' => c::db()->get( $query ),
|
'data' => c::db()->get( $query ),
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
|
'number' => $number,
|
||||||
'unit' => 'orders',
|
'unit' => 'orders',
|
||||||
]]);
|
]]);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -47,9 +47,16 @@ class Controller_home extends Crunchbutton_Controller_Account {
|
|||||||
'orders-by-user-week' => 'Orders by Users per Week',
|
'orders-by-user-week' => 'Orders by Users per Week',
|
||||||
'orders-per-week' => 'Orders per Week',
|
'orders-per-week' => 'Orders per Week',
|
||||||
'gross-revenue' => 'Gross Revenue',
|
'gross-revenue' => 'Gross Revenue',
|
||||||
'orders-by-weekday-by-community' => 'Orders by Weekday by Community',
|
|
||||||
'active-users-by-community' => 'Active users by community',
|
'active-users-by-community' => 'Active users by community',
|
||||||
),
|
),
|
||||||
|
'Tracking Marketing Efforts' => array(
|
||||||
|
'active-users-per-week' => 'Active Users per Week',
|
||||||
|
'active-users-by-community' => 'Active users by community',
|
||||||
|
'orders-by-weekday-by-community' => 'Orders by Weekday by Community',
|
||||||
|
'orders-per-week' => 'Orders per Week',
|
||||||
|
'orders-per-week-by-community' => 'Orders per Week by Community',
|
||||||
|
// 'orders-using-giftcard-per-week' => 'Orders using Gift Card per Week',
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
c::view()->graphs = $graphs;
|
c::view()->graphs = $graphs;
|
||||||
|
|||||||
@ -80,21 +80,21 @@
|
|||||||
<h4 style="text-align:center;"><?php echo $title; ?></h4>
|
<h4 style="text-align:center;"><?php echo $title; ?></h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="chart-<?=$chartId?>" style="min-width: 100%; height:300px; margin: 0 auto"></div>
|
<div id="chart-<?=$chartId?>-<?php echo $number; ?>" style="min-width: 100%; height:300px; margin: 0 auto"></div>
|
||||||
<br/>
|
<br/>
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span3" id="week-<?=$chartId?>">
|
<div class="span3" id="week-<?=$chartId?>-<?php echo $number; ?>">
|
||||||
<!-- Week <?php echo $weeks; ?> of <?php echo $maxWeeks; ?>: -->
|
<!-- Week <?php echo $weeks; ?> of <?php echo $maxWeeks; ?>: -->
|
||||||
</div>
|
</div>
|
||||||
<div class="span8">
|
<div class="span8">
|
||||||
<div id="slider-<?=$chartId?>"></div>
|
<div id="slider-<?=$chartId?>-<?php echo $number; ?>"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
var data = <?=json_encode($jsData, JSON_NUMERIC_CHECK)?>;
|
var data = <?=json_encode($jsData, JSON_NUMERIC_CHECK)?>;
|
||||||
$('#chart-<?=$chartId?>').highcharts({
|
$('#chart-<?=$chartId?>-<?php echo $number; ?>').highcharts({
|
||||||
chart: {
|
chart: {
|
||||||
type: 'column',
|
type: 'column',
|
||||||
backgroundColor:'rgba(255, 255, 255, 0.1)'
|
backgroundColor:'rgba(255, 255, 255, 0.1)'
|
||||||
@ -140,16 +140,15 @@ $(function () {
|
|||||||
},
|
},
|
||||||
series: data.ys
|
series: data.ys
|
||||||
});
|
});
|
||||||
$("#slider-<?=$chartId?>").slider({
|
$("#slider-<?=$chartId?>-<?php echo $number; ?>").slider({
|
||||||
range: "min",
|
range: "min",
|
||||||
min: 1,
|
min: 1,
|
||||||
max: <?php echo $maxWeeks; ?>,
|
max: <?php echo $maxWeeks; ?>,
|
||||||
value: <?php echo $weeks; ?>,
|
value: <?php echo $weeks; ?>,
|
||||||
change: function( event, ui ) {
|
change: function( event, ui ) {
|
||||||
$( '#week-<?=$chartId?>' ).html( '<i class="icon-spinner icon-spin"></i> Loading: <?php echo $title; ?>' );
|
$( '#week-<?=$chartId?>-<?php echo $number; ?>' ).html( '<i class="icon-spinner icon-spin"></i> Loading: <?php echo $title; ?>' );
|
||||||
var self = $( '#<?=$chartId?>' );
|
var self = $( '#<?=$chartId?>-<?php echo $number; ?>' );
|
||||||
var id = self.attr( 'id' );
|
var url = '/home/charts/<?=$chartId?>/<?php echo $title; ?>/<?php echo $number; ?>/?weeks=' + ui.value;
|
||||||
var url = '/home/charts/' + id + '/<?php echo $title; ?>?weeks=' + ui.value;
|
|
||||||
$.ajax( { url: url, }).done(function( data ) { self.html( data ); } );
|
$.ajax( { url: url, }).done(function( data ) { self.html( data ); } );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -128,20 +128,23 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="box-content padded">
|
<div class="box-content padded">
|
||||||
<?php
|
<?php
|
||||||
|
$chart_count_checkbox = 0;
|
||||||
|
$chart_count_div = 0;
|
||||||
foreach ($this->graphs as $category => $graphs ){
|
foreach ($this->graphs as $category => $graphs ){
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<h5><?php echo $category; ?></h5><?php
|
<h5><?php echo $category; ?></h5><?php
|
||||||
$count = 1;
|
$count = 1;
|
||||||
foreach ($graphs as $id => $graph ){
|
foreach ($graphs as $id => $graph ){
|
||||||
|
$chart_count_checkbox++;
|
||||||
if( $count == 1 ){
|
if( $count == 1 ){
|
||||||
echo '<div class="row-fluid">';
|
echo '<div class="row-fluid">';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<div class="span4">
|
<div class="span4">
|
||||||
<div>
|
<div>
|
||||||
<input type="checkbox" class="icheck" id="checkbox-<?php echo $id;?>" data-id="<?php echo $id;?>" data-title="<?php echo $graph;?>" name="checkbox-<?php echo $id;?>">
|
<input type="checkbox" class="icheck" id="checkbox-<?php echo $id;?>-<?php echo $chart_count_checkbox; ?>" data-id="<?php echo $id;?>" data-count="<?php echo $chart_count_checkbox; ?>" data-title="<?php echo $graph;?>" name="checkbox-<?php echo $id;?>">
|
||||||
<label for="checkbox-<?php echo $id;?>"><?php echo $graph; ?></label>
|
<label for="checkbox-<?php echo $id;?>-<?php echo $chart_count_checkbox; ?>"><?php echo $graph; ?></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?
|
<?
|
||||||
@ -158,7 +161,8 @@
|
|||||||
<hr/>
|
<hr/>
|
||||||
<?
|
<?
|
||||||
foreach ($graphs as $id => $graph ){
|
foreach ($graphs as $id => $graph ){
|
||||||
echo '<div id="' . $id . '" class="chart" style="display:none;"><i class="icon-spinner icon-spin"></i> Loading: ' . $graph . '</div>';
|
$chart_count_div++;
|
||||||
|
echo '<div id="' . $id . '-' . $chart_count_div .'" class="chart" style="display:none;"><i class="icon-spinner icon-spin"></i> Loading: ' . $graph . '</div>';
|
||||||
} ?>
|
} ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
@ -172,13 +176,14 @@
|
|||||||
$( '.icheck' ).on( 'ifChanged', function( event ){
|
$( '.icheck' ).on( 'ifChanged', function( event ){
|
||||||
var check = $(this);
|
var check = $(this);
|
||||||
var id = check.attr( 'data-id' );
|
var id = check.attr( 'data-id' );
|
||||||
var chart = $( '#' + id );
|
var count = check.attr( 'data-count' );
|
||||||
|
var chart = $( '#' + id + '-' + count );
|
||||||
var title = check.attr( 'data-title' );
|
var title = check.attr( 'data-title' );
|
||||||
if( check.is( ':checked' ) ){
|
if( check.is( ':checked' ) ){
|
||||||
chart.show();
|
chart.show();
|
||||||
if( !chart.attr( 'loaded' ) ){
|
if( !chart.attr( 'loaded' ) ){
|
||||||
chart.attr( 'loaded', true );
|
/*chart.attr( 'loaded', true ); */
|
||||||
var url = '/home/charts/' + id + '/' + title;
|
var url = '/home/charts/' + id + '/' + title + '/' + count;
|
||||||
$.ajax( { url: url, }).done( function( data ) { chart.html( data ); } );
|
$.ajax( { url: url, }).done( function( data ) { chart.html( data ); } );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user