Пример #1
0
 if ($_GET['act'] === 'get_leads_data') {
     if (!isset($_GET['period'])) {
         $period = 'lifetime';
     } else {
         $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');
     if ($is_su) {
         echo json_encode($leads->getLeadsData());
     } else {
         echo json_encode($leads->getLeadsDataClient());
     }
     die;
     //non class based implementation
     $rangeArray = getDateRangeFromPeriod($period);
     $calls_date_from = $rangeArray['date_from'];
     $calls_date_to = $rangeArray['date_to'];
     header('Content-Type: application/json');
     if ($is_su) {
         echo json_encode(getLeadsData($calls_date_from, $calls_date_to));
     } else {
         echo json_encode(getLeadsDataClient($calls_date_from, $calls_date_to));
     }
     die;