Beispiel #1
0
 // Emails
 ////////////////////////////////////////////////////////////////////////////
 if ($_GET['act'] == 'get_emails_data') {
     if (!isset($_GET['period'])) {
         $period = 'lifetime';
     }
     $period = $_GET['period'];
     //class based implementation
     require '../classes/dashboard/Emails.php';
     $email = new Emails();
     $email->setPeriod($period);
     if ($period == 'custom') {
         $email->setCustomPeriod($_REQUEST['from'], $_REQUEST['to']);
     }
     header('Content-Type: application/json');
     echo json_encode($email->get_emails_data());
     die;
     //non-class based implementation
     $where = "";
     if (!$is_su) {
         $where = " AND client_id = '" . $client_unbouce_id . "' \n                ORDER BY email_date DESC";
     }
     $rangeArray = getDateRangeFromPeriod($period);
     $date_from = $rangeArray['date_from'];
     $date_to = $rangeArray['date_to'];
     $arr_dates = createDateRangeArray($date_from, $date_to);
     $json_array = array();
     foreach ($arr_dates as $arr_call) {
         $sql = "SELECT count(*) as total FROM emails ";
         $sql .= "WHERE email_date LIKE '%" . $arr_call . "%' {$where}";
         // echo $sql;