public function updateFB() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $fb_id = addslashes($_POST['macc_fb_id']); $macc_id = addslashes($_POST['macc_id']); //$fb_id = addslashes($_POST['macc_fb_id']); if ($fb_id == "" || $macc_id == "") { $json['status_code'] = 0; $json['status_message'] = "Invalid FB/LL ID"; echo json_encode($json); die; } //update di lokal saja $ll = new LL_Account(); $ll->getByID($macc_id); $ll->macc_fb_id = $fb_id; $ll->load = 1; if ($ll->save()) { $json['status_code'] = 1; $json['status_message'] = "FB ID From {$macc_id} updated to " . $fb_id; } else { $json['status_code'] = 0; $json['status_message'] = "Save Failed"; } echo json_encode($json); die; }
public function overwriteRead($return) { $return = parent::overwriteRead($return); $objs = $return['objs']; foreach ($objs as $obj) { if (isset($obj->testi_acc_id)) { $acc = new LL_Account(); $acc->getByID($obj->testi_acc_id); $obj->testi_acc_id = $acc->macc_first_name . " " . $acc->macc_last_name; } if (isset($obj->testi_product_id)) { $acc = new LL_Article_WImage(); $acc->getByID($obj->testi_product_id); $obj->testi_product_id = $acc->BaseArticleNameENG; } // if (isset($obj->testi_status)) { $obj->testi_status = $this->arrStatus[$obj->testi_status]; } } return $return; }
function detail() { $id = addslashes($_GET['id']); // echo "in".$id; $nn = new PushLogger(); $arrLogs = $nn->getWhere("log_multicast_id = '{$id}' ORDER BY log_id ASC"); // pr($arrLogs); foreach ($arrLogs as $log) { $acc = new LL_Account(); $acc->getByID($log->log_macc_id); ?> <div class="hasil"> ID : <?php echo $acc->macc_id; ?> <?php echo $acc->macc_first_name; ?> <?php echo $acc->macc_last_name; ?> <br> Status : <?php echo $this->arrStatus[$log->log_status]; ?> <br> Message : <?php echo $log->log_text; ?> </div> <?php } }
public static function parseToLLAccount($VRO) { $ll = new LL_Account(); $ll->macc_ll_customer_id = (string) $VRO->CustomerBody->CustomerID; $ll->macc_id = (string) $VRO->CustomerBody->CustomerID; if (!$ll->macc_id) { return 0; } /* * cek apa di database sudah ada */ $ll->getByID($ll->macc_id); if ($ll->macc_id != "" || $ll->macc_id != 0) { $ll->load = 0; } /* * cek if ada fb_id atau foto */ $macc_foto = addslashes($_POST['macc_foto']); $macc_fb_id = addslashes($_POST['macc_fb_id']); if ($macc_foto != "") { $ll->macc_foto = Crud::savePic($macc_foto); } if ($macc_fb_id != "") { $ll->macc_fb_id = $macc_fb_id; } //insert name $arrName = $VRO->CustomerBody->EntityInformation->Individual->Name; foreach ($arrName->Name as $obj) { $var = self::xml_attribute($obj, 'TypeCode'); //pr($obj); //echo "var : ".$var; if ($var == "FamilyName") { $ll->macc_last_name = (string) $obj; } if ($var == "GivenName") { $ll->macc_first_name = (string) $obj; } if ($var == "PreferredName") { $ll->macc_prefered_name = (string) $obj; } } if ($_GET['test']) { echo "names : "; pr($ll); } //insert dob $arrTelp = $VRO->CustomerBody->EntityInformation->Individual->ContactInformation->Telephone; foreach ($arrTelp as $obj) { $var = self::xml_attribute($obj, 'TypeCode'); if ($var == "Home") { $ll->macc_phone_home = (string) $obj->LocalNumber; } if ($var == "Mobile") { $ll->macc_phone = (string) $obj->LocalNumber; } if ($var == "Work") { $ll->macc_phone_work = (string) $obj->LocalNumber; } } if ($_GET['test']) { echo "telp : "; pr($ll); } //Address $arrAddress = $VRO->CustomerBody->EntityInformation->Individual->ContactInformation->Address; $ll->macc_address = (string) $arrAddress->AddressLine; $ll->macc_address_city = (string) $arrAddress->City; $ll->macc_address_territory = (string) $arrAddress->Territory; $ll->macc_address_postalcode = (string) $arrAddress->PostalCode; $ll->macc_address_country = (string) $arrAddress->Country; //email $arrEmail = $VRO->CustomerBody->EntityInformation->Individual->ContactInformation->EMail; foreach ($arrEmail as $obj) { $var = self::xml_attribute($obj, 'TypeCode'); if ($var == "Home") { $ll->macc_email = (string) $obj->EMailAddress; } } if ($_GET['test']) { echo "email : "; pr($ll); } //PersonalSummary $personalSum = $VRO->CustomerBody->EntityInformation->Individual->PersonalSummary; foreach ($personalSum->attributes() as $a => $b) { //echo $a,'="',$b,"\""; //echo "IN $a $b"; //echo "haloo ".$arrName->Name[$b]; if ($a == "GenderType") { $ll->macc_gender = (string) $b; } } if ($_GET['test']) { echo "gender : "; pr($ll); } //insert dob $dob = (string) $VRO->CustomerBody->EntityInformation->Individual->PersonalSummary->BirthDate; $exp = explode("+", $dob); $ll->macc_dob = date("Y-m-d", strtotime($exp[0])); $ll->macc_card_nr = (string) $VRO->CustomerBody->EntityInformation->Individual->PersonalSummary->LoyaltyTokenID; $ll->macc_card_barcode = (string) $VRO->CustomerBody->EntityInformation->Individual->PersonalSummary->LoyaltyTokenBarcode; $ll->macc_member_type = (string) $VRO->CustomerBody->EntityInformation->Individual->PersonalSummary->MemberType; $ll->macc_member_tier = (string) $VRO->CustomerBody->EntityInformation->Individual->PersonalSummary->MemberTier; //real tier n type $ll->macc_real_member_type = (string) $VRO->CustomerBody->EntityInformation->Individual->PersonalSummary->MemberType; $ll->macc_real_tier = (string) $VRO->CustomerBody->EntityInformation->Individual->PersonalSummary->MemberTier; $tkdate = (string) $VRO->CustomerBody->EntityInformation->Individual->PersonalSummary->TokenIssueDate; $ll->macc_token_issue_date = date("Y-m-d h:i:s", strtotime($tkdate)); $ll->macc_token_status = (string) $VRO->CustomerBody->EntityInformation->Individual->PersonalSummary->TokenStatus; if ($_GET['test']) { echo "members : "; pr($ll); } $ll->macc_member_mismatch = 0; //mismatch calculator if ($ll->macc_real_member_type == "STC" && $ll->macc_real_tier != "Stamp Card Member") { $ll->macc_member_mismatch = 1; } if ($ll->macc_real_member_type == "133") { if ($ll->macc_real_tier != "Fan" && $ll->macc_real_tier != "LYB Member") { $ll->macc_member_mismatch = 1; } } if ($ll->macc_real_member_type == "LYB") { if ($ll->macc_real_tier != "Fan" && $ll->macc_real_tier != "LYB Member") { $ll->macc_member_mismatch = 1; } } //converter member type Stamp card if ($ll->macc_member_tier == "Fan" || $ll->macc_member_tier == "LYB Member") { $ll->macc_member_type == "LYB"; } // if($ll->macc_member_tier == "Stamp Card Member") { // $ll->macc_member_type == "STC"; // } //converter member type Stamp card if ($ll->macc_member_type == "STC") { // $ll->macc_member_type = "STC"; $ll->macc_member_tier = "Stamp Card Member"; } //points $arrPoints = $VRO->CustomerBody->CustomerAccount->LoyaltyAccount->Points; //pr($arrPoints); $sem = array(); $pointsDetails = array(); foreach ($arrPoints as $obj) { $var = self::xml_attribute($obj, 'Type'); $sem[$var] = (string) $obj; foreach ($obj->attributes() as $a => $b) { $pointsDetails[$var][$a] = (string) $b; } } if ($_GET['test']) { echo "points : "; pr($ll); } //sementara pakai balance $ll->macc_points = $sem['Balance']; //sementara saja $ll->macc_point_details = serialize(array("points" => $sem, "details" => $pointsDetails)); //$this->points_details = $pointsDetails; return $ll; }
function main() { $mtrans = new MTranDetail(); // global $db; // $q = "SELECT SUM(detail_price_total) as total, COUNT(*) AS num FROM {$mtrans->table_name}"; // $arr = $db->query($q,1); // pr($arr); $arrOrder = $mtrans->getOrderBy(" detail_date DESC LIMIT 0,5"); // pr($arrOrder); ?> <h1 style="margin-top: 0;">Dashboard</h1> <div class="penjualan_container"> <?php BIPenjualan::graph(); ?> </div> <div class="row"> <div class="col-md-6" style="padding-top: 20px;"> <div class="penjualan_container"> <h2 class="penjualan_money_h2">Lifetime Sales</h2> <table class="table no-margin"> <thead> <tr> <th>Order ID</th> <th>Item</th> <th>Status</th> <th>Popularity</th> </tr> </thead> <tbody> <tr> <td><a href="pages/examples/invoice.html">OR9842</a></td> <td>Call of Duty IV</td> <td><span class="label label-success">Shipped</span></td> <td> <div class="sparkbar" data-color="#00a65a" data-height="20"><canvas width="34" height="20" style="display: inline-block; width: 34px; height: 20px; vertical-align: top;"></canvas></div> </td> </tr> <tr> <td><a href="pages/examples/invoice.html">OR1848</a></td> <td>Samsung Smart TV</td> <td><span class="label label-warning">Pending</span></td> <td> <div class="sparkbar" data-color="#f39c12" data-height="20"><canvas width="34" height="20" style="display: inline-block; width: 34px; height: 20px; vertical-align: top;"></canvas></div> </td> </tr> <tr> <td><a href="pages/examples/invoice.html">OR7429</a></td> <td>iPhone 6 Plus</td> <td><span class="label label-danger">Delivered</span></td> <td> <div class="sparkbar" data-color="#f56954" data-height="20"><canvas width="34" height="20" style="display: inline-block; width: 34px; height: 20px; vertical-align: top;"></canvas></div> </td> </tr> <tr> <td><a href="pages/examples/invoice.html">OR7429</a></td> <td>Samsung Smart TV</td> <td><span class="label label-info">Processing</span></td> <td> <div class="sparkbar" data-color="#00c0ef" data-height="20"><canvas width="34" height="20" style="display: inline-block; width: 34px; height: 20px; vertical-align: top;"></canvas></div> </td> </tr> <tr> <td><a href="pages/examples/invoice.html">OR1848</a></td> <td>Samsung Smart TV</td> <td><span class="label label-warning">Pending</span></td> <td> <div class="sparkbar" data-color="#f39c12" data-height="20"><canvas width="34" height="20" style="display: inline-block; width: 34px; height: 20px; vertical-align: top;"></canvas></div> </td> </tr> <tr> <td><a href="pages/examples/invoice.html">OR7429</a></td> <td>iPhone 6 Plus</td> <td><span class="label label-danger">Delivered</span></td> <td> <div class="sparkbar" data-color="#f56954" data-height="20"><canvas width="34" height="20" style="display: inline-block; width: 34px; height: 20px; vertical-align: top;"></canvas></div> </td> </tr> <tr> <td><a href="pages/examples/invoice.html">OR9842</a></td> <td>Call of Duty IV</td> <td><span class="label label-success">Shipped</span></td> <td> <div class="sparkbar" data-color="#00a65a" data-height="20"><canvas width="34" height="20" style="display: inline-block; width: 34px; height: 20px; vertical-align: top;"></canvas></div> </td> </tr> </tbody> </table> </div> </div> </div> <div class="row"> <div class="col-md-3"> <div class="penjualan_container"> <div class="penjualan"> <h2 class="penjualan_money_h2">Lifetime Sales</h2> <div class="penjualan_money" style="color: #e2007a;">IDR <?php echo idr($arr->total); ?> </div> </div> <div class="penjualan"> <h2 class="penjualan_money_h2">Average Order</h2> <div class="penjualan_money">IDR <?php echo idr($arr->total / $arr->num); ?> </div> </div> <hr> <div class="penjualan"> <h2 class="penjualan_money_h2" style="margin-bottom: 10px;">Latest Transactions</h2> <table class="table table-striped"> <thead> <tr> <th>Customer</th> <!-- <th>Qty</th>--> <th>Total</th> </tr> </thead> <tbody> <?php foreach ($arrOrder as $order) { ?> <tr> <td><?php if ($order->detail_macc_id > 0) { $llac = new LL_Account(); $llac->getByID($order->detail_macc_id); echo $llac->macc_first_name; } else { echo "unknown"; } ?> </td> <!-- <td>--><?php //=$order->detail_qty; ?> <!--</td>--> <td>IDR <?php echo idr($order->detail_price_total); ?> </td> </tr> <?php } ?> </tbody> </table> </div> <hr> <div class="penjualan"> <h2 class="penjualan_money_h2" style="margin-bottom: 20px;">Last Search Terms</h2> <?php $sL = new MSearchLog(); $arrSl = $sL->getOrderBy("slog_date DESC LIMIT 0,30"); if (count($arrSl) > 0) { $slsudah = array(); ?> <table class="table table-striped"><?php foreach ($arrSl as $sll) { if (!in_array($sll->slog_keyword, $slsudah)) { $slsudah[] = $sll->slog_keyword; ?> <tr> <td> <div class="searchkeyword"><?php echo $sll->slog_keyword; ?> </div> </td> </tr> <?php } } ?> </table><?php } else { ?> <p>We couldn't find any records.</p> <?php } ?> </div> <hr> <div class="penjualan"> <h2 class="penjualan_money_h2" style="margin-bottom: 20px;">Top Search Terms</h2> <?php $sL = new MSearchLog(); global $db; $q = "SELECT slog_keyword,COUNT(*) as count FROM {$sL->table_name} GROUP BY slog_keyword ORDER BY count DESC LIMIT 0,10"; $arrSl = $db->query($q, 2); // pr($arrSl); // $arrSl = $sL->getOrderBy("slog_date DESC LIMIT 0,30"); if (count($arrSl) > 0) { $slsudah = array(); ?> <table class="table table-striped"><?php foreach ($arrSl as $sll) { if (!in_array($sll->slog_keyword, $slsudah)) { $slsudah[] = $sll->slog_keyword; ?> <tr> <td> <div class="searchkeyword"><?php echo $sll->slog_keyword; ?> </div> </td> <td> <div class="searchkeyword"><?php echo $sll->count; ?> </div> </td> </tr> <?php } } ?> </table><?php } else { ?> <p>We couldn't find any records.</p> <?php } ?> </div> </div> </div> <style> .penjualan_container{ border: 1px solid #dedede; background-color: white; padding: 20px; } .penjualan_money_h2{ padding: 0; margin: 0; font-size: 20px; margin-bottom: 20px; color: #666666; } .penjualan_money{ font-size: 25px; } .penjualan{ margin-bottom: 20px; } </style> <div class="col-md-9"> <div class="penjualan_container" style="margin-bottom: 20px;"> </div> <div class="penjualan_container"> <div> <!-- Nav tabs --> <ul class="nav nav-tabs" role="tablist"> <li role="presentation" class="active"><a href="#home" aria-controls="home" role="tab" data-toggle="tab">Home</a></li> <li role="presentation"><a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">Profile</a></li> <li role="presentation"><a href="#messages" aria-controls="messages" role="tab" data-toggle="tab">Messages</a></li> <li role="presentation"><a href="#settings" aria-controls="settings" role="tab" data-toggle="tab">Settings</a></li> </ul> <!-- Tab panes --> <div class="tab-content"> <div role="tabpanel" class="tab-pane active" id="home">ss...</div> <div role="tabpanel" class="tab-pane" id="profile">.bb..</div> <div role="tabpanel" class="tab-pane" id="messages">..cc.</div> <div role="tabpanel" class="tab-pane" id="settings">..dd.</div> </div> <div class="clearfix"></div> </div> </div> </div> <div class="clearfix"></div> </div> <?php }
public function findMy() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $id = isset($_GET['id']) ? addslashes($_GET['id']) : 0; if (!$id) { $json['status_code'] = 0; $json['status_message'] = "No ID Found"; echo json_encode($json); die; } $acc = new LL_Account(); $acc->getByID($id); $rew = new LL_RewardCatalog(); //old masi pakai active // $arrReward = $rew->getWhere("rew_active = 1 ORDER BY rew_point DESC"); $arrReward = $rew->getWhere("CURDATE() between rew_start and rew_end ORDER BY rew_point DESC"); $arrStatus = $rew->arrStatus; $poin = (int) $acc->macc_points; $status = $acc->macc_lyb_status; // print_r($status); //echo "pts ".$poin." ".$status; $my_status = 0; foreach ($arrStatus as $statid => $val) { if ($val == $status) { $my_status = $statid; } } // pr($arrStatus); //pr($arrStatus); //echo "<br>mystatus ".$my_status; //expiry blom di consider krn nanti di cron job... $taruhbawah = array(); $taruhatas = array(); //urutkan sesuai yang bisa dan tidak bisa foreach ($arrReward as $rew) { if ($rew->rew_status > $my_status) { //kalau statusnya tidak cukup tinggi $taruhbawah[] = $rew; $rew->rew_problem = 3; //"gak_cukup_status"; } else { if ($rew->rew_point > $poin) { $rew->rew_problem = 2; //"gak_cukup_poin"; $taruhbawah[] = $rew; } else { $taruhatas[] = $rew; $rew->rew_problem = 1; //all clear } } } $json = array(); //masukan ke satu array dan kirim $json['status_code'] = 1; foreach ($taruhatas as $rew) { $arrbaru = array(); $arrbaru['id'] = $rew->rew_id; $arrbaru['pic'] = _PHOTOURL . $rew->rew_pic; $arrbaru['status'] = $rew->rew_problem; $arrbaru['point'] = $rew->rew_point; $arrbaru['member_type'] = $rew->rew_status; $arrbaru['aktif'] = $rew->rew_active; $arrbaru['rew_start'] = $rew->rew_start; $arrbaru['rew_end'] = $rew->rew_end; $json['results'][] = $arrbaru; } foreach ($taruhbawah as $rew) { $arrbaru = array(); $arrbaru['id'] = $rew->rew_id; $arrbaru['pic'] = _PHOTOURL . $rew->rew_pic; $arrbaru['status'] = $rew->rew_problem; $arrbaru['point'] = $rew->rew_point; $arrbaru['member_type'] = $rew->rew_status; $arrbaru['aktif'] = $rew->rew_active; $arrbaru['rew_start'] = $rew->rew_start; $arrbaru['rew_end'] = $rew->rew_end; $json['results'][] = $arrbaru; } echo json_encode($json); die; }