예제 #1
0
파일: ajax2.php 프로젝트: mrimran/dashboard
     }
     header('Content-Type: application/json');
     echo json_encode($json_array);
     die;
 }
 if ($_GET['act'] == 'get_sms_table_data') {
     if (!isset($_GET['period'])) {
         $period = 'lifetime';
     }
     $period = $_GET['period'];
     //class based implementation
     require '../classes/dashboard/SMS.php';
     $sms = new SMS();
     $sms->setPeriod($period);
     if ($period == 'custom') {
         $sms->setCustomPeriod($_REQUEST['from'], $_REQUEST['to']);
     }
     header('Content-Type: application/json');
     echo json_encode($sms->get_sms_table_data());
     die;
     //non-class based implementation
     $where = " WHERE 1 ";
     if (!$is_su) {
         $where .= " AND gsm_number IN( " . $client_id . " ) \n                {$sms_data_limit_clause} ";
     }
     $rangeArray = getDateRangeFromPeriod($period);
     $calls_date_from = $rangeArray['date_from'];
     $calls_date_to = $rangeArray['date_to'];
     $where .= " AND sms_dt>='{$calls_date_from}' AND sms_dt<='{$calls_date_to}' ";
     $json_array = array();
     $sql = "SELECT * FROM sms {$where} ORDER BY sms_dt DESC ";