partial #1466
This commit is contained in:
parent
85e1e5e866
commit
a4283ae28c
6
db/migrate/000118_chart_cohort.sql
Normal file
6
db/migrate/000118_chart_cohort.sql
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
CREATE TABLE `chart_cohort` (
|
||||||
|
`id_chart_cohort` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(40) DEFAULT NULL,
|
||||||
|
`data` text,
|
||||||
|
PRIMARY KEY (`id_chart_cohort`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
||||||
48
include/controllers/default/cockpit/charts/index.php
Normal file
48
include/controllers/default/cockpit/charts/index.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Controller_charts extends Crunchbutton_Controller_Account {
|
||||||
|
|
||||||
|
public function init() {
|
||||||
|
|
||||||
|
switch ( c::getPagePiece(1) ) {
|
||||||
|
|
||||||
|
case 'cohort':
|
||||||
|
switch ( c::getPagePiece(2) ) {
|
||||||
|
case 'new':
|
||||||
|
$this->cohort_new();
|
||||||
|
break;
|
||||||
|
case 'remove':
|
||||||
|
$this->cohort_remove();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$this->cohort();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
header( 'Location: /home' );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function cohort(){
|
||||||
|
c::view()->cohorts = Crunchbutton_Chart_Cohort::q( 'SELECT * FROM chart_cohort ORDER BY name DESC' );
|
||||||
|
c::view()->display( 'charts/cohort/index' );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function cohort_new(){
|
||||||
|
c::view()->display( 'charts/cohort/form' );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function cohort_remove(){
|
||||||
|
$id_chart_cohort = $_POST[ 'id_chart_cohort' ];
|
||||||
|
$cohort = Crunchbutton_Chart_Cohort::o( $id_chart_cohort );
|
||||||
|
if( $cohort->id_chart_cohort ){
|
||||||
|
$cohort->delete();
|
||||||
|
}
|
||||||
|
echo 'ok';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -40,12 +40,22 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
|||||||
|
|
||||||
public function init() {
|
public function init() {
|
||||||
|
|
||||||
|
$this->chart = new Crunchbutton_Chart;
|
||||||
|
|
||||||
|
if( c::getPagePiece(2) == 'weeks' ){
|
||||||
|
echo $this->chart->weeksToJson();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( c::getPagePiece(2) == 'cohort' ){
|
||||||
|
$this->cohort();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
$this->chartId = c::getPagePiece(2);
|
$this->chartId = c::getPagePiece(2);
|
||||||
|
|
||||||
$this->divId = c::getPagePiece(3);
|
$this->divId = c::getPagePiece(3);
|
||||||
|
|
||||||
$this->chart = new Crunchbutton_Chart;
|
|
||||||
|
|
||||||
// Check if it is an User chart
|
// Check if it is an User chart
|
||||||
$chart = new Crunchbutton_Chart_User();
|
$chart = new Crunchbutton_Chart_User();
|
||||||
$info = $chart->getChartInfo( $this->chartId );
|
$info = $chart->getChartInfo( $this->chartId );
|
||||||
@ -71,9 +81,7 @@ class Controller_home_charts extends Crunchbutton_Controller_Account {
|
|||||||
$info = $chart->getChartInfo( $this->chartId );
|
$info = $chart->getChartInfo( $this->chartId );
|
||||||
if( $info ){ $this->process( $info, $chart ); exit; }
|
if( $info ){ $this->process( $info, $chart ); exit; }
|
||||||
|
|
||||||
if( $this->chartId == 'weeks' ){
|
|
||||||
echo $this->chart->weeksToJson();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Controller_api_chart_cohort extends Crunchbutton_Controller_Rest {
|
||||||
|
public function init() {
|
||||||
|
|
||||||
|
switch ( $this->method() ) {
|
||||||
|
|
||||||
|
case 'post':
|
||||||
|
|
||||||
|
if ( $_SESSION['admin'] ) {
|
||||||
|
|
||||||
|
$name = $_REQUEST[ 'name' ];
|
||||||
|
$address_has = $_REQUEST[ 'address_has' ];
|
||||||
|
$name_has = $_REQUEST[ 'name_has' ];
|
||||||
|
$pay_type_is = $_REQUEST[ 'pay_type_is' ];
|
||||||
|
$delivery_type_is = $_REQUEST[ 'delivery_type_is' ];
|
||||||
|
|
||||||
|
$data = array( 'address_has' => $address_has, 'name_has' => $name_has, 'pay_type_is' => $pay_type_is, 'delivery_type_is' => $delivery_type_is );
|
||||||
|
|
||||||
|
$cohort = new Crunchbutton_Chart_Cohort();
|
||||||
|
$cohort->name = $name;
|
||||||
|
$cohort->data = $cohort->Form2Mysql( $data );
|
||||||
|
$cohort->save();
|
||||||
|
|
||||||
|
echo json_encode( ['success' => $cohort->id_chart_cohort ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
echo json_encode( [ 'error' => 'invalid object' ] );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -43,15 +43,11 @@ class Crunchbutton_Chart extends Cana_Model {
|
|||||||
$groups = [];
|
$groups = [];
|
||||||
foreach( $this->groups as $id_group => $group ){
|
foreach( $this->groups as $id_group => $group ){
|
||||||
$groups[ $id_group ] = array();
|
$groups[ $id_group ] = array();
|
||||||
$firstChart = false;
|
|
||||||
$groups[ $id_group ][ 'title' ] = $group[ 'title' ];
|
$groups[ $id_group ][ 'title' ] = $group[ 'title' ];
|
||||||
$charts = $group[ 'charts' ];
|
$charts = $group[ 'charts' ];
|
||||||
if( count( $charts ) > 0 ){
|
if( count( $charts ) > 0 ){
|
||||||
foreach ( $charts as $id_chart => $chart ) {
|
foreach ( $charts as $id_chart => $chart ) {
|
||||||
if( !$firstChart ){
|
$groups[ $id_group ][ 'url' ] = $id_chart;
|
||||||
$groups[ $id_group ][ 'url' ] = $id_chart;
|
|
||||||
$firstChart = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( !$groups[ $id_group ][ 'url' ] ){
|
if( !$groups[ $id_group ][ 'url' ] ){
|
||||||
|
|||||||
73
include/library/Crunchbutton/Chart/Cohort.php
Normal file
73
include/library/Crunchbutton/Chart/Cohort.php
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Crunchbutton_Chart_Cohort extends Cana_Table {
|
||||||
|
|
||||||
|
public function __construct($id = null) {
|
||||||
|
parent::__construct();
|
||||||
|
$this
|
||||||
|
->table('chart_cohort')
|
||||||
|
->idVar('id_chart_cohort')
|
||||||
|
->load($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function get( $id ){
|
||||||
|
return Crunchbutton_Chart_Cohort::o( $id );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toString(){
|
||||||
|
return $this->data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function Form2Mysql( $array ){
|
||||||
|
return json_encode( $array );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getAll(){
|
||||||
|
return Crunchbutton_Chart_Cohort::q( 'SELECT * FROM chart_cohort ORDER BY name DESC' );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toQuery(){
|
||||||
|
|
||||||
|
$query = '';
|
||||||
|
|
||||||
|
$data = json_decode( $this->data );
|
||||||
|
|
||||||
|
if( count( $data ) > 0 ){
|
||||||
|
|
||||||
|
foreach ( $data as $key => $value ) {
|
||||||
|
|
||||||
|
switch ( $key ) {
|
||||||
|
|
||||||
|
case 'address_has':
|
||||||
|
if( $value != '' ){
|
||||||
|
$query .= " AND o.address LIKE '%{$value}%' ";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'name_has':
|
||||||
|
if( $value != '' ){
|
||||||
|
$query .= " AND o.name LIKE '%{$value}%' ";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'delivery_type_is':
|
||||||
|
if( $value != '' ){
|
||||||
|
$query .= " AND o.delivery_type = '{$value}' ";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'pay_type_is':
|
||||||
|
if( $value != '' ){
|
||||||
|
$query .= " AND o.pay_type = '{$value}' ";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@ -8,9 +8,9 @@ class Crunchbutton_Chart_Order extends Crunchbutton_Chart {
|
|||||||
'group-orders' => array(
|
'group-orders' => array(
|
||||||
'title' => 'Orders',
|
'title' => 'Orders',
|
||||||
'charts' => array(
|
'charts' => array(
|
||||||
'orders-per-day' => array( 'title' => 'Day', 'interval' => 'day', 'type' => 'column', 'method' => 'byDay', 'filters' => array( array( 'title' => 'Community', 'type' => 'community', 'method' => 'byDayPerCommunity' ) ) ),
|
'orders-per-day' => array( 'title' => 'Day', 'interval' => 'day', 'type' => 'column', 'method' => 'byDay', 'filters' => array( array( 'title' => 'Community', 'type' => 'community', 'method' => 'byDayPerCommunity' ), array( 'title' => 'Cohort', 'type' => 'cohort', 'method' => 'byDayCohort' ) ) ),
|
||||||
'orders-per-week' => array( 'title' => 'Week', 'interval' => 'week', 'type' => 'column', 'method' => 'byWeek', 'filters' => array( array( 'title' => 'Community', 'type' => 'community', 'method' => 'byWeekPerCommunity' ) ) ),
|
'orders-per-week' => array( 'title' => 'Week', 'interval' => 'week', 'type' => 'column', 'method' => 'byWeek', 'filters' => array( array( 'title' => 'Community', 'type' => 'community', 'method' => 'byWeekPerCommunity' ), array( 'title' => 'Cohort', 'type' => 'cohort', 'method' => 'byWeekCohort' ) ) ),
|
||||||
'orders-per-month' => array( 'title' => 'Month', 'interval' => 'month', 'type' => 'column', 'method' => 'byMonth', 'filters' => array( array( 'title' => 'Community', 'type' => 'community', 'method' => 'byMonthPerCommunity' ) ) ),
|
'orders-per-month' => array( 'title' => 'Month', 'interval' => 'month', 'type' => 'column', 'method' => 'byMonth', 'filters' => array( array( 'title' => 'Community', 'type' => 'community', 'method' => 'byMonthPerCommunity') , array( 'title' => 'Cohort', 'type' => 'cohort', 'method' => 'byMonthCohort' ) ) ),
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'group-orders-by-user' => array(
|
'group-orders-by-user' => array(
|
||||||
@ -157,6 +157,82 @@ class Crunchbutton_Chart_Order extends Crunchbutton_Chart {
|
|||||||
return $parsedData;
|
return $parsedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function byDayCohort( $render = false ){
|
||||||
|
|
||||||
|
$id_chart_cohort = $_GET[ 'id_chart_cohort' ];
|
||||||
|
|
||||||
|
$cohort = Crunchbutton_Chart_Cohort::get( $id_chart_cohort );
|
||||||
|
|
||||||
|
$query = "SELECT DATE_FORMAT(o.date ,'%Y-%m-%d') AS Day,
|
||||||
|
COUNT(*) AS Total
|
||||||
|
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
|
||||||
|
1 = 1
|
||||||
|
{$cohort->toQuery()}
|
||||||
|
{$this->queryExcludeCommunties}
|
||||||
|
{$this->queryExcludeUsers}
|
||||||
|
GROUP BY DATE_FORMAT(o.date ,'%Y-%m-%d') HAVING Day BETWEEN '{$this->dayFrom}' AND '{$this->dayTo}'";
|
||||||
|
|
||||||
|
$parsedData = $this->parseDataDaysSimple( $query, $this->description );
|
||||||
|
if( $render ){
|
||||||
|
return array( 'data' => $parsedData, 'unit' => $this->unit, 'interval' => 'day' );
|
||||||
|
}
|
||||||
|
return $parsedData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function byMonthCohort( $render = false ){
|
||||||
|
|
||||||
|
$id_chart_cohort = $_GET[ 'id_chart_cohort' ];
|
||||||
|
|
||||||
|
$cohort = Crunchbutton_Chart_Cohort::get( $id_chart_cohort );
|
||||||
|
|
||||||
|
$query = "SELECT DATE_FORMAT( o.date ,'%Y-%m') AS Month,
|
||||||
|
COUNT(*) AS Total
|
||||||
|
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
|
||||||
|
o.date >= '{$this->monthFrom}-01' AND o.date <= LAST_DAY( STR_TO_DATE( '{$this->monthTo}', '%Y-%m' ) )
|
||||||
|
{$this->queryExcludeCommunties}
|
||||||
|
{$this->queryExcludeUsers}
|
||||||
|
{$cohort->toQuery()}
|
||||||
|
GROUP BY DATE_FORMAT(o.date ,'%Y-%m') HAVING Month BETWEEN '{$this->monthFrom}' AND '{$this->monthTo}'";
|
||||||
|
|
||||||
|
$parsedData = $this->parseDataMonthSimple( $query, $this->description );
|
||||||
|
if( $render ){
|
||||||
|
return array( 'data' => $parsedData, 'unit' => $this->unit, 'interval' => 'month' );
|
||||||
|
}
|
||||||
|
return $parsedData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function byWeekCohort( $render = false ){
|
||||||
|
|
||||||
|
$id_chart_cohort = $_GET[ 'id_chart_cohort' ];
|
||||||
|
|
||||||
|
$cohort = Crunchbutton_Chart_Cohort::get( $id_chart_cohort );
|
||||||
|
|
||||||
|
$query = "SELECT YEARWEEK(date) AS Week,
|
||||||
|
COUNT(*) AS Total
|
||||||
|
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) >= {$this->weekFrom} AND YEARWEEK(o.date) <= {$this->weekTo}
|
||||||
|
{$this->queryExcludeCommunties}
|
||||||
|
{$this->queryExcludeUsers}
|
||||||
|
{$cohort->toQuery()}
|
||||||
|
GROUP BY YEARWEEK(date)
|
||||||
|
ORDER BY YEARWEEK(date) ASC";
|
||||||
|
|
||||||
|
$parsedData = $this->parseDataWeeksSimple( $query, $this->description );
|
||||||
|
if( $render ){
|
||||||
|
return array( 'data' => $parsedData, 'unit' => $this->unit );
|
||||||
|
}
|
||||||
|
return $parsedData;
|
||||||
|
}
|
||||||
|
|
||||||
public function byDayPerCommunity( $render = false ){
|
public function byDayPerCommunity( $render = false ){
|
||||||
|
|
||||||
$query = "SELECT DATE_FORMAT( date ,'%Y-%m-%d') AS Day,
|
$query = "SELECT DATE_FORMAT( date ,'%Y-%m-%d') AS Day,
|
||||||
|
|||||||
@ -42,18 +42,18 @@ class Crunchbutton_Chart_User extends Crunchbutton_Chart {
|
|||||||
'group-new-users' => array(
|
'group-new-users' => array(
|
||||||
'title' => 'New Users',
|
'title' => 'New Users',
|
||||||
'charts' => array(
|
'charts' => array(
|
||||||
'users-new-per-day' => array( 'title' => 'Day', 'interval' => 'day', 'type' => 'column', 'method' => 'newByDay', 'filters' => array( array( 'title' => 'Community', 'type' => 'community', 'method' => 'newByDayByCommunity' ) ) ),
|
'users-new-per-day' => array( 'title' => 'Day', 'interval' => 'day', 'type' => 'column', 'method' => 'newByDay', 'filters' => array( array( 'title' => 'Community', 'type' => 'community', 'method' => 'newByDayByCommunity' ), array( 'title' => 'Cohort', 'type' => 'cohort', 'method' => 'newByDayCohort' ) ) ),
|
||||||
'users-new-per-week' => array( 'title' => 'Week', 'interval' => 'week', 'type' => 'column', 'method' => 'newByWeek', 'filters' => array( array( 'title' => 'Community', 'type' => 'community', 'method' => 'newByWeekByCommunity' ) ) ),
|
'users-new-per-week' => array( 'title' => 'Week', 'interval' => 'week', 'type' => 'column', 'method' => 'newByWeek', 'filters' => array( array( 'title' => 'Community', 'type' => 'community', 'method' => 'newByWeekByCommunity' ), array( 'title' => 'Cohort', 'type' => 'cohort', 'method' => 'newByWeekCohort' ) ) ),
|
||||||
'users-new-per-month' => array( 'title' => 'Month', 'interval' => 'month', 'type' => 'column', 'method' => 'newByMonth', 'filters' => array( array( 'title' => 'Community', 'type' => 'community', 'method' => 'newByMonthByCommunity' ) ) ),
|
'users-new-per-month' => array( 'title' => 'Month', 'interval' => 'month', 'type' => 'column', 'method' => 'newByMonth', 'filters' => array( array( 'title' => 'Community', 'type' => 'community', 'method' => 'newByMonthByCommunity' ), array( 'title' => 'Cohort', 'type' => 'cohort', 'method' => 'newByMonthCohort' ) ) ),
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
'group-active-users' => array(
|
'group-active-users' => array(
|
||||||
'title' => 'Active Users',
|
'title' => 'Active Users',
|
||||||
'charts' => array(
|
'charts' => array(
|
||||||
'users-active-per-day' => array( 'title' => 'Day', 'type' => 'column', 'interval' => 'day', 'method' => 'activeByDay' ),
|
'users-active-per-day' => array( 'title' => 'Day', 'type' => 'column', 'interval' => 'day', 'method' => 'activeByDay', 'filters' => array( array( 'title' => 'Cohort', 'type' => 'cohort', 'method' => 'activeByDayCohort' ) ) ),
|
||||||
'users-active-per-week' => array( 'title' => 'Week', 'type' => 'column', 'interval' => 'week', 'method' => 'activeByWeek', 'filters' => array( array( 'title' => 'Community', 'type' => 'community', 'method' => 'activeByWeekByCommunity' ) ) ),
|
'users-active-per-week' => array( 'title' => 'Week', 'type' => 'column', 'interval' => 'week', 'method' => 'activeByWeek', 'filters' => array( array( 'title' => 'Community', 'type' => 'community', 'method' => 'activeByWeekByCommunity' ), array( 'title' => 'Cohort', 'type' => 'cohort', 'method' => 'activeByWeekCohort' ) ) ),
|
||||||
'users-active-per-month' => array( 'title' => 'Month', 'type' => 'column', 'interval' => 'month', 'method' => 'activeByMonth', 'filters' => array( array( 'title' => 'Community', 'type' => 'community', 'method' => 'activeByMonthByCommunity' ) ) ),
|
'users-active-per-month' => array( 'title' => 'Month', 'type' => 'column', 'interval' => 'month', 'method' => 'activeByMonth', 'filters' => array( array( 'title' => 'Community', 'type' => 'community', 'method' => 'activeByMonthByCommunity' ), array( 'title' => 'Cohort', 'type' => 'cohort', 'method' => 'activeByMonthCohort' ) ) ),
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -97,6 +97,48 @@ class Crunchbutton_Chart_User extends Crunchbutton_Chart {
|
|||||||
return $parsedData;
|
return $parsedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function activeByDayCohort( $render = false ){
|
||||||
|
|
||||||
|
$query = '';
|
||||||
|
$union = '';
|
||||||
|
|
||||||
|
$id_chart_cohort = $_GET[ 'id_chart_cohort' ];
|
||||||
|
|
||||||
|
$cohort = Crunchbutton_Chart_Cohort::get( $id_chart_cohort );
|
||||||
|
|
||||||
|
$cohortQuery = $cohort->toQuery();
|
||||||
|
|
||||||
|
$allMonths = $this->allDays();
|
||||||
|
|
||||||
|
for( $i = $this->from_day -1 ; $i < $this->to_day; $i++ ){
|
||||||
|
$day = $allMonths[ $i ];
|
||||||
|
$query .= $union . "SELECT '{$day}' AS Day,
|
||||||
|
COUNT(*) AS Total
|
||||||
|
FROM
|
||||||
|
( SELECT u.phone,
|
||||||
|
o.date,
|
||||||
|
u.id_user,
|
||||||
|
c.name
|
||||||
|
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 o.date <= '{$day}'
|
||||||
|
AND o.date >= '{$day}' - INTERVAL {$this->activeUsersInterval} DAY
|
||||||
|
{$this->queryExcludeCommunties}
|
||||||
|
{$this->queryExcludeUsers}
|
||||||
|
{$this->queryOnlyCommunties}
|
||||||
|
{$cohortQuery}
|
||||||
|
GROUP BY u.phone ) ActiveUsers";
|
||||||
|
$union = ' UNION ';
|
||||||
|
}
|
||||||
|
|
||||||
|
$parsedData = $this->parseDataDaysSimple( $query, $this->description );
|
||||||
|
if( $render ){
|
||||||
|
return array( 'data' => $parsedData, 'unit' => $this->unit, 'interval' => 'day' );
|
||||||
|
}
|
||||||
|
return $parsedData;
|
||||||
|
}
|
||||||
|
|
||||||
public function activeByMonth( $render = false ){
|
public function activeByMonth( $render = false ){
|
||||||
|
|
||||||
$query = '';
|
$query = '';
|
||||||
@ -133,6 +175,49 @@ class Crunchbutton_Chart_User extends Crunchbutton_Chart {
|
|||||||
return $parsedData;
|
return $parsedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function activeByMonthCohort( $render = false ){
|
||||||
|
|
||||||
|
$query = '';
|
||||||
|
$union = '';
|
||||||
|
|
||||||
|
$id_chart_cohort = $_GET[ 'id_chart_cohort' ];
|
||||||
|
|
||||||
|
$cohort = Crunchbutton_Chart_Cohort::get( $id_chart_cohort );
|
||||||
|
|
||||||
|
$cohortQuery = $cohort->toQuery();
|
||||||
|
|
||||||
|
$allMonths = $this->allMonths();
|
||||||
|
|
||||||
|
for( $i = $this->from_month -1 ; $i < $this->to_month; $i++ ){
|
||||||
|
$month = $allMonths[ $i ];
|
||||||
|
$query .= $union . "SELECT '{$month}' AS Month,
|
||||||
|
COUNT(*) AS Total
|
||||||
|
FROM
|
||||||
|
( SELECT u.phone,
|
||||||
|
o.date,
|
||||||
|
u.id_user,
|
||||||
|
c.name
|
||||||
|
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 o.date <= LAST_DAY( STR_TO_DATE( '{$month}', '%Y-%m' ) )
|
||||||
|
AND o.date >= '{$month}-01' - INTERVAL {$this->activeUsersInterval} DAY
|
||||||
|
{$this->queryExcludeCommunties}
|
||||||
|
{$this->queryExcludeUsers}
|
||||||
|
{$this->queryOnlyCommunties}
|
||||||
|
{$cohortQuery}
|
||||||
|
GROUP BY u.phone ) ActiveUsers";
|
||||||
|
|
||||||
|
$union = ' UNION ';
|
||||||
|
}
|
||||||
|
|
||||||
|
$parsedData = $this->parseDataMonthSimple( $query, $this->description );
|
||||||
|
if( $render ){
|
||||||
|
return array( 'data' => $parsedData, 'unit' => $this->unit, 'interval' => 'month' );
|
||||||
|
}
|
||||||
|
return $parsedData;
|
||||||
|
}
|
||||||
|
|
||||||
public function reclaimedByDay( $render = false ){
|
public function reclaimedByDay( $render = false ){
|
||||||
|
|
||||||
$query = "SELECT day AS Day,
|
$query = "SELECT day AS Day,
|
||||||
@ -339,6 +424,48 @@ class Crunchbutton_Chart_User extends Crunchbutton_Chart {
|
|||||||
return $parsedData;
|
return $parsedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function activeByWeekCohort( $render = false ){
|
||||||
|
|
||||||
|
$allWeeks = $this->allWeeks();
|
||||||
|
|
||||||
|
$query = '';
|
||||||
|
$union = '';
|
||||||
|
|
||||||
|
$id_chart_cohort = $_GET[ 'id_chart_cohort' ];
|
||||||
|
|
||||||
|
$cohort = Crunchbutton_Chart_Cohort::get( $id_chart_cohort );
|
||||||
|
|
||||||
|
$cohortQuery = $cohort->toQuery();
|
||||||
|
|
||||||
|
for( $i = $this->from -1 ; $i < $this->to; $i++ ){
|
||||||
|
$week = $allWeeks[ $i ];
|
||||||
|
|
||||||
|
$query .= $union . "SELECT '{$week}' AS Week,
|
||||||
|
COUNT(*) AS Total
|
||||||
|
FROM
|
||||||
|
( SELECT u.phone,
|
||||||
|
o.date,
|
||||||
|
u.id_user,
|
||||||
|
c.name
|
||||||
|
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 o.date <= STR_TO_DATE('{$week} Saturday', '%X%V %W')
|
||||||
|
AND o.date >= STR_TO_DATE('{$week} Saturday', '%X%V %W') - INTERVAL {$this->activeUsersInterval} DAY
|
||||||
|
{$this->queryExcludeCommunties}
|
||||||
|
{$this->queryExcludeUsers}
|
||||||
|
{$cohortQuery}
|
||||||
|
GROUP BY u.phone) ActiveUsers";
|
||||||
|
$union = ' UNION ';
|
||||||
|
}
|
||||||
|
|
||||||
|
$parsedData = $this->parseDataWeeksSimple( $query, $this->description );
|
||||||
|
if( $render ){
|
||||||
|
return array( 'data' => $parsedData, 'unit' => $this->unit );
|
||||||
|
}
|
||||||
|
return $parsedData;
|
||||||
|
}
|
||||||
|
|
||||||
public function newPerActiveByWeekByCommunity( $render = false ){
|
public function newPerActiveByWeekByCommunity( $render = false ){
|
||||||
|
|
||||||
$query = '';
|
$query = '';
|
||||||
@ -976,6 +1103,93 @@ class Crunchbutton_Chart_User extends Crunchbutton_Chart {
|
|||||||
return $parsedData;
|
return $parsedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function newByMonthCohort( $render = false ){
|
||||||
|
|
||||||
|
$id_chart_cohort = $_GET[ 'id_chart_cohort' ];
|
||||||
|
|
||||||
|
$cohort = Crunchbutton_Chart_Cohort::get( $id_chart_cohort );
|
||||||
|
|
||||||
|
$query = "SELECT SUM(1) AS Total,
|
||||||
|
DATE_FORMAT(o.date ,'%Y-%m') AS Month
|
||||||
|
FROM `order` o
|
||||||
|
INNER JOIN
|
||||||
|
(SELECT min(id_order) id_order,
|
||||||
|
u.phone
|
||||||
|
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 1 = 1
|
||||||
|
{$this->queryExcludeCommunties}
|
||||||
|
{$this->queryExcludeUsers}
|
||||||
|
{$cohort->toQuery()}
|
||||||
|
GROUP BY u.phone) orders ON o.id_order = orders.id_order
|
||||||
|
GROUP BY DATE_FORMAT(o.date ,'%Y-%m') HAVING Month BETWEEN '{$this->monthFrom}' AND '{$this->monthTo}'";
|
||||||
|
|
||||||
|
$parsedData = $this->parseDataMonthSimple( $query, $this->description );
|
||||||
|
if( $render ){
|
||||||
|
return array( 'data' => $parsedData, 'unit' => $this->unit, 'interval' => 'month' );
|
||||||
|
}
|
||||||
|
return $parsedData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function newByDayCohort( $render = false ){
|
||||||
|
|
||||||
|
$id_chart_cohort = $_GET[ 'id_chart_cohort' ];
|
||||||
|
|
||||||
|
$cohort = Crunchbutton_Chart_Cohort::get( $id_chart_cohort );
|
||||||
|
|
||||||
|
$query = "SELECT SUM(1) AS Total,
|
||||||
|
DATE_FORMAT(o.date ,'%Y-%m-%d') AS Day
|
||||||
|
FROM `order` o
|
||||||
|
INNER JOIN
|
||||||
|
(SELECT min(id_order) id_order,
|
||||||
|
u.phone
|
||||||
|
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 1=1
|
||||||
|
{$this->queryExcludeCommunties}
|
||||||
|
{$this->queryExcludeUsers}
|
||||||
|
{$cohort->toQuery()}
|
||||||
|
GROUP BY u.phone) orders ON o.id_order = orders.id_order
|
||||||
|
GROUP BY DATE_FORMAT(o.date ,'%Y-%m-%d') HAVING Day BETWEEN '{$this->dayFrom}' AND '{$this->dayTo}'";
|
||||||
|
|
||||||
|
$parsedData = $this->parseDataDaysSimple( $query, $this->description );
|
||||||
|
if( $render ){
|
||||||
|
return array( 'data' => $parsedData, 'unit' => $this->unit, 'interval' => 'day' );
|
||||||
|
}
|
||||||
|
return $parsedData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function newByWeekCohort( $render = false ){
|
||||||
|
|
||||||
|
$id_chart_cohort = $_GET[ 'id_chart_cohort' ];
|
||||||
|
|
||||||
|
$cohort = Crunchbutton_Chart_Cohort::get( $id_chart_cohort );
|
||||||
|
|
||||||
|
$query = "SELECT SUM(1) AS Total,
|
||||||
|
YEARWEEK(o.date) AS Week
|
||||||
|
FROM `order` o
|
||||||
|
INNER JOIN
|
||||||
|
(SELECT min(id_order) id_order,
|
||||||
|
u.phone
|
||||||
|
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 1=1
|
||||||
|
{$this->queryExcludeCommunties}
|
||||||
|
{$this->queryExcludeUsers}
|
||||||
|
{$cohort->toQuery()}
|
||||||
|
GROUP BY u.phone) orders ON o.id_order = orders.id_order
|
||||||
|
GROUP BY YEARWEEK(o.date) HAVING Week BETWEEN '{$this->weekFrom}' AND '{$this->weekTo}'";
|
||||||
|
|
||||||
|
$parsedData = $this->parseDataWeeksSimple( $query, $this->description );
|
||||||
|
if( $render ){
|
||||||
|
return array( 'data' => $parsedData, 'unit' => $this->unit );
|
||||||
|
}
|
||||||
|
return $parsedData;
|
||||||
|
}
|
||||||
|
|
||||||
public function newByWeek( $render = false ){
|
public function newByWeek( $render = false ){
|
||||||
|
|
||||||
$query = "SELECT SUM(1) AS Total,
|
$query = "SELECT SUM(1) AS Total,
|
||||||
|
|||||||
119
include/views/default/cockpit/charts/cohort/form.phtml
Normal file
119
include/views/default/cockpit/charts/cohort/form.phtml
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
<?
|
||||||
|
$this->title = 'Chart Cohort';
|
||||||
|
$this->titleicon = 'group';
|
||||||
|
$cohorts = $this->cohorts;
|
||||||
|
|
||||||
|
$this->title2 = 'Create new';
|
||||||
|
$this->title2icon = 'group';
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div class="container-fluid padded">
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span6">
|
||||||
|
<div class="box">
|
||||||
|
<div class="box-header">
|
||||||
|
<span class="title">Cohort</span>
|
||||||
|
</div>
|
||||||
|
<div class="box-content ">
|
||||||
|
<ul class="box-list">
|
||||||
|
<li>
|
||||||
|
<span>Name</span>
|
||||||
|
<span class="pull-right span8">
|
||||||
|
<input type="text" class="span12" name="name" maxlength="40" id="name" value="" />
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<span>Address has</span>
|
||||||
|
<span class="pull-right span8">
|
||||||
|
<input type="text" class="span12" name="address_has" maxlength="100" id="address_has" value="" />
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<span>Name has</span>
|
||||||
|
<span class="pull-right span8">
|
||||||
|
<input type="text" class="span12" name="name_has" maxlength="100" id="name_has" value="" />
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<span>Pay type is</span>
|
||||||
|
<span class="pull-right span8">
|
||||||
|
<select name="pay_type_is" id="pay_type_is">
|
||||||
|
<option></option>
|
||||||
|
<option value="card">card</option>
|
||||||
|
<option value="cash">cash</option>
|
||||||
|
</select>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<span>Delivery type is</span>
|
||||||
|
<span class="pull-right span8">
|
||||||
|
<select name="delivery_type_is" id="delivery_type_is">
|
||||||
|
<option></option>
|
||||||
|
<option value="delivery">delivery</option>
|
||||||
|
<option value="takeout">takeout</option>
|
||||||
|
</select>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
<li class="input">
|
||||||
|
<button type="submit" class="btn btn-blue admin-cohort-save"><i class="icon-save"></i> Save </button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
$(document).on('click', '.admin-cohort-save', function() {
|
||||||
|
sendForm();
|
||||||
|
} );
|
||||||
|
});
|
||||||
|
|
||||||
|
var processing = false;
|
||||||
|
|
||||||
|
function sendForm(){
|
||||||
|
|
||||||
|
if( processing ){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var name = $.trim( $( '#name' ).val() );
|
||||||
|
var name_has = $.trim( $( '#name_has' ).val() );
|
||||||
|
var address_has = $.trim( $( '#address_has' ).val() );
|
||||||
|
var pay_type_is = $.trim( $('#pay_type_is option:selected').val() );
|
||||||
|
var delivery_type_is = $.trim( $('#delivery_type_is option:selected').val() );
|
||||||
|
if( name == '' ){
|
||||||
|
alert( 'Please type a name!' );
|
||||||
|
$( '#name' ).focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = { 'name' : name, 'address_has' : address_has, 'pay_type_is' : pay_type_is, 'name_has' : name_has, 'delivery_type_is' : delivery_type_is };
|
||||||
|
|
||||||
|
processing = true;
|
||||||
|
|
||||||
|
$( '.admin-cohort-save' ).html( '<i class="icon-spinner icon-spin"></i> Please wait' );
|
||||||
|
|
||||||
|
var url = App.service + 'chart/cohort/';
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
dataType: 'json',
|
||||||
|
data: data,
|
||||||
|
url: url,
|
||||||
|
success: function( json ) {
|
||||||
|
processing = false;
|
||||||
|
if( json.error ){
|
||||||
|
alert( 'Error at saving the cohort!' );
|
||||||
|
} else {
|
||||||
|
alert( 'Cohort saved!' );
|
||||||
|
location.href = '/charts/cohort/';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function( ){
|
||||||
|
processing = false;
|
||||||
|
alert( 'Error at saving the cohort!' );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
57
include/views/default/cockpit/charts/cohort/index.phtml
Normal file
57
include/views/default/cockpit/charts/cohort/index.phtml
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?
|
||||||
|
$this->title = 'Chart Cohort';
|
||||||
|
$this->titleicon = 'group';
|
||||||
|
$cohorts = $this->cohorts;
|
||||||
|
?>
|
||||||
|
<!-- content -->
|
||||||
|
<div class="container-fluid padded">
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="box">
|
||||||
|
<div class="box-content padded">
|
||||||
|
<a href="/charts/cohort/new" class="btn btn-green admin-giftcard-group-new"><i class="icon-group"></i> Create new </a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="box">
|
||||||
|
<div class="box-header"><span class="title">Cohorts</span></div>
|
||||||
|
<div class="box-content">
|
||||||
|
<?php if ( !$cohorts->count() ) { ?>
|
||||||
|
No results found
|
||||||
|
<?php } else { ?>
|
||||||
|
<table class="table table-normal">
|
||||||
|
<thead>
|
||||||
|
<td>Name</td>
|
||||||
|
<td>Data</td>
|
||||||
|
<td></td>
|
||||||
|
</thead>
|
||||||
|
<? foreach ( $cohorts as $cohort ) { ?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $cohort->name; ?></td>
|
||||||
|
<td><?php echo $cohort->toString(); ?></td>
|
||||||
|
<td><button data-id="<?php echo $cohort->id_chart_cohort; ?>" class="btn admin-cohort-remove btn-red"><i class="icon-trash"></i> Remove</button></td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</table>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function() {
|
||||||
|
$(document).on('click', '.admin-cohort-remove', function() {
|
||||||
|
var button = $( this );
|
||||||
|
if( confirm( 'Confirm remove cohort?' ) ){
|
||||||
|
var id_chart_cohort = button.attr( 'data-id' );
|
||||||
|
$.ajax({
|
||||||
|
url: '/charts/cohort/remove',
|
||||||
|
type: "POST",
|
||||||
|
data: { 'id_chart_cohort': id_chart_cohort } ,
|
||||||
|
complete: function() {
|
||||||
|
alert( 'Cohort removed!' );
|
||||||
|
location.href = '/charts/cohort/';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@ -92,7 +92,7 @@
|
|||||||
<h4 style="text-align:center;"><?php echo $title; ?></h4>
|
<h4 style="text-align:center;"><?php echo $title; ?></h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="options-<?=$divId?>">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<?php
|
<?php
|
||||||
@ -108,22 +108,53 @@
|
|||||||
</td>
|
</td>
|
||||||
<?php }
|
<?php }
|
||||||
if( $info['chart'][ 'filters' ] ){
|
if( $info['chart'][ 'filters' ] ){
|
||||||
|
|
||||||
$filters = $info['chart'][ 'filters' ];
|
$filters = $info['chart'][ 'filters' ];
|
||||||
|
|
||||||
|
$hasFilter = false;
|
||||||
|
|
||||||
foreach( $filters as $filter ){
|
foreach( $filters as $filter ){
|
||||||
$checked = ( $filter[ 'type' ] == $info[ 'filter' ] ) ? 'checked="checked"' : '';
|
|
||||||
?>
|
if( $filter[ 'type' ] == 'cohort' ){
|
||||||
<td class="padded">
|
$cohorts = Crunchbutton_Chart_Cohort::getAll();
|
||||||
<div>
|
foreach( $cohorts as $cohort ){
|
||||||
<input type="checkbox" class="icheck-<?=$chartId?>" <?php echo $checked; ?> value="<?php echo $filter[ 'type' ]; ?>" id="<?php echo $filter[ 'type' ]; ?>">
|
$checked = ( $_GET[ 'id_chart_cohort' ] == $cohort->id_chart_cohort ) ? 'checked="checked"' : '';
|
||||||
<label for="<?php echo $filter[ 'type' ]; ?>"><?php echo $filter[ 'title' ]; ?></label>
|
if( $checked != '' ){ $hasFilter = true; }
|
||||||
</div>
|
?>
|
||||||
</td>
|
<td class="padded" id="filter-cohort-<?php echo $cohort->id_chart_cohort; ?>">
|
||||||
<?php
|
<div>
|
||||||
|
<input type="radio" name="filter" class="icheck-<?=$chartId?>" <?php echo $checked; ?> value="cohort&id_chart_cohort=<?php echo $cohort->id_chart_cohort; ?>" id="cohort-<?php echo $cohort->id_chart_cohort; ?>">
|
||||||
|
<label for="cohort-<?php echo $cohort->id_chart_cohort; ?>"><?php echo $cohort->name; ?></label>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$checked = ( $filter[ 'type' ] == $info[ 'filter' ] ) ? 'checked="checked"' : '';
|
||||||
|
if( $checked != '' ){ $hasFilter = true; }
|
||||||
|
?>
|
||||||
|
<td class="padded" id="filter-<?php echo $filter[ 'type' ]; ?>">
|
||||||
|
<div>
|
||||||
|
<input type="radio" name="filter" class="icheck-<?=$chartId?>" <?php echo $checked; ?> value="<?php echo $filter[ 'type' ]; ?>" id="<?php echo $filter[ 'type' ]; ?>">
|
||||||
|
<label for="<?php echo $filter[ 'type' ]; ?>"><?php echo $filter[ 'title' ]; ?></label>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
|
<td class="padded" id="filter-no-filter">
|
||||||
|
<div>
|
||||||
|
<input type="radio" <?php if( !$hasFilter ){ echo 'checked="checked"'; } ?> name="filter" class="icheck-<?=$chartId?>" value="" id="no-filter">
|
||||||
|
<label for="no-filter">No filter</label>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
<?php if( $hasResults ){ ?>
|
<?php if( $hasResults ){ ?>
|
||||||
<div id="chart-<?=$chartId?>" style="min-width: 100%; height:300px; margin: 0 auto"></div>
|
<div id="chart-<?=$chartId?>" style="min-width: 100%; height:300px; margin: 0 auto"></div>
|
||||||
<br/>
|
<br/>
|
||||||
@ -249,12 +280,17 @@ $(function () {
|
|||||||
|
|
||||||
$( '.icheck-<?=$chartId?>' ).on( 'ifChanged', function( event ){
|
$( '.icheck-<?=$chartId?>' ).on( 'ifChanged', function( event ){
|
||||||
var check = $( this );
|
var check = $( this );
|
||||||
|
|
||||||
|
var id = check.attr( 'id' );
|
||||||
|
|
||||||
|
$( '#filter-' + id ).html( '<i class="icon-spinner icon-spin"></i>' );
|
||||||
|
|
||||||
if( check.is( ':checked' ) ){
|
if( check.is( ':checked' ) ){
|
||||||
var filter = check.val();
|
var filter = check.val();
|
||||||
} else {
|
} else {
|
||||||
var filter = '';
|
var filter = '';
|
||||||
}
|
}
|
||||||
loadChart( { 'divId' : '<?php echo $divId; ?>', 'permalink' : '<?php echo $chartId; ?>', 'filter' : filter } );
|
loadChart( { 'divId' : '<?php echo $divId; ?>', 'permalink' : '<?php echo $chartId; ?>', 'filter' : filter } );
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@ -3,8 +3,6 @@
|
|||||||
$this->subtitle = 'Crunchbutton overview';
|
$this->subtitle = 'Crunchbutton overview';
|
||||||
$this->titleicon = 'dashboard';
|
$this->titleicon = 'dashboard';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
<!-- content -->
|
<!-- content -->
|
||||||
<div class="container-fluid padded">
|
<div class="container-fluid padded">
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
@ -242,6 +240,8 @@
|
|||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
<h4>Cohorts</h4>
|
||||||
|
<a href="/charts/cohort/" class="btn btn-green"><i class="icon-group"></i> Manage cohorts </a>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button class="btn btn-default" data-dismiss="modal">Close</button>
|
<button class="btn btn-default" data-dismiss="modal">Close</button>
|
||||||
@ -371,6 +371,7 @@
|
|||||||
var url = '/home/charts/' + permalink + '/' + divId + '/' + strParams;
|
var url = '/home/charts/' + permalink + '/' + divId + '/' + strParams;
|
||||||
|
|
||||||
$.ajax( { url: url, }).done( function( data ) { chart.html( data ); } );
|
$.ajax( { url: url, }).done( function( data ) { chart.html( data ); } );
|
||||||
|
|
||||||
chart.attr( 'opened', true );
|
chart.attr( 'opened', true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user