static function savelog($camp_id, $device_id, $acc_id, $status, $log_text, $log_multicast_id) { $nl = new PushLoggerCaps(); $nl->log_camp_id = $camp_id; $nl->log_device_id = $device_id; $nl->log_macc_id = $acc_id; $nl->log_status = $status; $nl->log_text = $log_text; $nl->log_multicast_id = $log_multicast_id; $nl->log_date = leap_mysqldate(); $nl->log_active = 1; // $nl->log_app_id = $log_app_id; // $nl->log_client_id = $client_camp_id; return $nl->save(); }
function detail() { $id = addslashes($_GET['id']); // echo "in".$id; $nn = new PushLoggerCaps(); $arrLogs = $nn->getWhere("log_multicast_id = '{$id}' ORDER BY log_id ASC"); // pr($arrLogs); foreach ($arrLogs as $log) { $acc = new Account(); $acc->getByID($log->log_macc_id); ?> <div class="hasil"> ID : <?php echo $acc->admin_id; ?> <?php echo $acc->admin_nama_depan; ?> <br> Status : <?php echo $this->arrStatus[$log->log_status]; ?> <br> Message : <?php echo $log->log_text; ?> </div> <?php } }
static function simpanHasilGCM($arrhasil, $psn, $array_id, $arrDevs, $isTest = 0) { if ($_GET['test']) { pr($arrhasil); } echo "<h1>Results</h1>"; foreach ($arrhasil as $numw => $hasil) { //simpan hasil $gcm = new GCMResultCaps(); $gcm->multicast_id = $hasil->multicast_id; $gcm->success = $hasil->success; $gcm->failure = $hasil->failure; $gcm->results = serialize($hasil->results); $gcm->canonical_ids = $hasil->canonical_ids; $gcm->camp_id = $psn->camp_id; $gcm->gcm_date = leap_mysqldate(); $gcm->gcm_test = $isTest; $gcm->save(); echo "ID : " . $hasil->multicast_id . "<br>"; echo "Success : " . $hasil->success . "<br>"; echo "Failure : " . $hasil->failure . "<br>"; echo "<a target='_blank' href='" . _SPPATH . "PushNotResultsCaps/res?id={$psn->camp_id}&token=" . IMBAuth::createOAuth() . "' class='btn btn primary'>Complete Results</a><br><br>"; $page = 999 * $numw; foreach ($hasil->results as $num => $res) { if (isset($res->error)) { //error $status = 0; $log_text = $res->error; //delete device_id from table $dv = new DeviceModelCapsule(); global $db; // $q = "DELETE FROM {$dv->table_name} WHERE device_id = '".$array_id[$page+$num]."'"; $q = "UPDATE {$dv->table_name} SET dev_not_send = 1 WHERE device_id = '" . $array_id[$page + $num] . "'"; if ($_GET['test']) { echo "<br>query : " . $q . "<br>"; echo "delete succ :" . $db->query($q, 0); echo "<br>"; } } else { //success $status = 1; $log_text = $res->message_id; } PushLoggerCaps::savelog($psn->camp_id, $array_id[$page + $num], $arrDevs[$page + $num]->acc_id, $status, $log_text, $hasil->multicast_id); // PushLogger::savelog($psn->camp_id,$array_id[$page+$num],$arrDevs[$page+$num]->acc_id,$status,$log_text,$hasil->multicast_id); } } }
function deleteByLogID() { if (Efiwebsetting::getData('checkOAuth') == 'yes') { IMBAuth::checkOAuth(); } $macc_id = addslashes($_POST['acc_id']); $lid = addslashes($_POST['lid']); $psl = new PushLoggerCaps(); $psl->getByID($lid); $json['status_code'] = 0; if ($psl->log_macc_id == $macc_id) { //tidak active lagi $psl->log_active = 0; $psl->load = 1; if ($psl->save()) { $json['status_code'] = 1; } } echo json_encode($json); die; }