public function sendEmail($to, $arrReplace)
 {
     $this->setVar($arrReplace);
     $this->addTable();
     $lep = new Leapmail2();
     $hasil = $lep->sendHTMLEmail($to, $this->email_subject, $this->email_template_text, $this->email_template_html);
     $suc = $hasil->success();
     //should we log this ?
     $ml = new EmailLog();
     $ml->log_date = leap_mysqldate();
     $ml->log_email_id = $to;
     $ml->log_status = $suc;
     $ml->log_template = $this->email_id;
     $ml->save();
     return $suc;
 }
 /**
  * Prepare data for display.
  */
 function prepare_items()
 {
     global $wpdb;
     $table_name = $wpdb->prefix . EmailLog::TABLE_NAME;
     $this->_column_headers = $this->get_column_info();
     // Handle bulk actions
     $this->process_bulk_action();
     // get current page number
     $current_page = $this->get_pagenum();
     $query = "SELECT * FROM " . $table_name;
     if (isset($_GET['s'])) {
         $search_term = trim(esc_sql($_GET['s']));
         $query .= " WHERE to_email LIKE '%{$search_term}%' OR subject LIKE '%{$search_term}%' ";
     }
     // Ordering parameters
     $orderby = !empty($_GET["orderby"]) ? esc_sql($_GET["orderby"]) : 'sent_date';
     $order = !empty($_GET["order"]) ? esc_sql($_GET["order"]) : 'DESC';
     if (!empty($orderby) & !empty($order)) {
         $query .= ' ORDER BY ' . $orderby . ' ' . $order;
     }
     // Pagination parameters
     $total_items = $wpdb->query($query);
     //return the total number of affected rows
     //adjust the query to take pagination into account
     $per_page = EmailLog::get_per_page();
     if (!empty($current_page) && !empty($per_page)) {
         $offset = ($current_page - 1) * $per_page;
         $query .= ' LIMIT ' . (int) $offset . ',' . (int) $per_page;
     }
     // Fetch the items
     $this->items = $wpdb->get_results($query);
     // register pagination options & calculations.
     $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page, 'total_pages' => ceil($total_items / $per_page)));
 }
示例#3
0
 function testvp()
 {
     $str = 'O:22:"Veritrans_Notification":1:{s:8:"response";O:8:"stdClass":14:{s:11:"status_code";s:3:"200";s:14:"status_message";s:26:"Success, transaction found";s:14:"transaction_id";s:36:"a293ec21-9572-4333-9a41-640a6789b713";s:11:"masked_card";s:11:"518323-9790";s:8:"order_id";s:10:"1084599542";s:12:"gross_amount";s:8:"10000.00";s:12:"payment_type";s:11:"credit_card";s:16:"transaction_time";s:19:"2016-02-17 15:20:37";s:18:"transaction_status";s:10:"settlement";s:12:"fraud_status";s:6:"accept";s:13:"approval_code";s:6:"T08489";s:13:"signature_key";s:128:"12a2c1d52cdd03326727b1ee0cc8a9f658146dbaedac46490f269183291885772e5a31a121c94ebde9f501733c8e7802cf74c3bb839ad687188456c3bf0d45e0";s:4:"bank";s:3:"bni";s:3:"eci";s:2:"02";}} ||| {"status_code":"200","status_message":"Veritrans payment notification","transaction_id":"a293ec21-9572-4333-9a41-640a6789b713","masked_card":"518323-9790","order_id":"1084599542","gross_amount":"10000.00","payment_type":"credit_card","transaction_time":"2016-02-17 15:20:37","transaction_status":"settlement","fraud_status":"accept","approval_code":"T08489","signature_key":"12a2c1d52cdd03326727b1ee0cc8a9f658146dbaedac46490f269183291885772e5a31a121c94ebde9f501733c8e7802cf74c3bb839ad687188456c3bf0d45e0","bank":"bni","eci":"02"}';
     $exp = explode(" ||| ", $str);
     $obj = unserialize($exp[0]);
     pr($obj);
     pr($exp[1]);
     $vp = new VpData();
     $vp->printColumlistAsAttributes();
     $tt = new VpTransaction();
     $tt->printColumlistAsAttributes();
     $km = new KomisiModel();
     $km->printColumlistAsAttributes();
     $bk = new BonusKomisi();
     BonusKomisi::fillBK();
     $bg = new EmailLog();
     $bg->printColumlistAsAttributes();
 }
示例#4
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      EmailLog $value A EmailLog object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(EmailLog $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }