echo json_encode(getLeadsDataClient($calls_date_from, $calls_date_to)); } die; } //////////////////////////////////////////////////////////////////////////// // Get leads chart data //////////////////////////////////////////////////////////////////////////// if ($_GET['act'] === 'get_leads_chart_data') { if (!isset($_GET['period'])) { $period = 'lifetime'; } $period = $_GET['period']; //class based implementation require '../classes/dashboard/Leads.php'; $leads = new Leads(); $leads->setPeriod($period); if ($period == 'custom') { $leads->setCustomPeriod($_REQUEST['from'], $_REQUEST['to']); } header('Content-Type: application/json'); echo json_encode($leads->getLeadsChartData($period)); die; //non class based implementation $rangeArray = getDateRangeFromPeriod($period); $leads_date_from = $rangeArray['date_from']; $leads_date_to = $rangeArray['date_to']; header('Content-Type: application/json'); echo json_encode(getLeadsChartData($leads_date_from, $leads_date_to, $period)); die; } ////////////////////////////////////////////////////////////////////////////