POST Each QSO to clublog seperately and if successful mark as sent.
这个提交包含在:
父节点
0c74ac5605
当前提交
5560e5005e
共有 2 个文件被更改,包括 45 次插入 和 26 次删除
|
|
@ -166,33 +166,42 @@ class Clublog extends CI_Controller {
|
||||||
{
|
{
|
||||||
$data['qso'] = $qso;
|
$data['qso'] = $qso;
|
||||||
$adif_string = $this->load->view('adif/data/clublog_realtime', $data, true);
|
$adif_string = $this->load->view('adif/data/clublog_realtime', $data, true);
|
||||||
|
|
||||||
|
// initialise the curl request
|
||||||
|
$request = curl_init('https://clublog.org/realtime.php');
|
||||||
|
|
||||||
|
curl_setopt($request, CURLOPT_POST, true);
|
||||||
|
curl_setopt(
|
||||||
|
$request,
|
||||||
|
CURLOPT_POSTFIELDS,
|
||||||
|
array(
|
||||||
|
'email' => $clublog_info['user_clublog_name'],
|
||||||
|
'password' => $clublog_info['user_clublog_password'],
|
||||||
|
'callsign' => $station_row->station_callsign,
|
||||||
|
'adif' => $adif_string,
|
||||||
|
'api' => "a11c3235cd74b88212ce726857056939d52372bd",
|
||||||
|
));
|
||||||
|
|
||||||
|
// output the response
|
||||||
|
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
$response = curl_exec($request);
|
||||||
|
$info = curl_getinfo($request);
|
||||||
|
|
||||||
|
if(curl_errno($request)) {
|
||||||
|
echo curl_error($request);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If Clublog Accepts mark the QSOs
|
||||||
|
if (preg_match('/\baccepted\b/', $response)) {
|
||||||
|
echo "QSOs uploaded and Logbook QSOs marked as sent to Clublog";
|
||||||
|
|
||||||
|
$this->clublog_model->mark_qso_sent($qso->COL_PRIMARY_KEY);
|
||||||
|
echo "Clublog upload for ".$station_row->station_callsign;
|
||||||
|
} else {
|
||||||
|
echo "Error ".$response;
|
||||||
|
}
|
||||||
|
curl_close ($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialise the curl request
|
|
||||||
$request = curl_init('https://clublog.org/realtime.php');
|
|
||||||
|
|
||||||
curl_setopt($request, CURLOPT_POST, true);
|
|
||||||
curl_setopt(
|
|
||||||
$request,
|
|
||||||
CURLOPT_POSTFIELDS,
|
|
||||||
array(
|
|
||||||
'email' => $clublog_info['user_clublog_name'],
|
|
||||||
'password' => $clublog_info['user_clublog_password'],
|
|
||||||
'callsign' => $station_row->station_callsign,
|
|
||||||
'adif' => $adif_string,
|
|
||||||
'api' => "a11c3235cd74b88212ce726857056939d52372bd",
|
|
||||||
));
|
|
||||||
|
|
||||||
// output the response
|
|
||||||
curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
|
|
||||||
$response = curl_exec($request);
|
|
||||||
$info = curl_getinfo($request);
|
|
||||||
|
|
||||||
if(curl_errno($request)) {
|
|
||||||
echo curl_error($request);
|
|
||||||
}
|
|
||||||
curl_close ($request);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,16 @@ class Clublog_model extends CI_Model {
|
||||||
$this->db->update($this->config->item('table_name'), $data);
|
$this->db->update($this->config->item('table_name'), $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function mark_qso_sent($qso_id) {
|
||||||
|
$data = array(
|
||||||
|
'COL_CLUBLOG_QSO_UPLOAD_DATE' => date('Y-m-d'),
|
||||||
|
'COL_CLUBLOG_QSO_UPLOAD_STATUS' => "Y",
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->db->where("COL_PRIMARY_KEY", $qso_id);
|
||||||
|
$this->db->update($this->config->item('table_name'), $data);
|
||||||
|
}
|
||||||
|
|
||||||
function get_last_five($station_id) {
|
function get_last_five($station_id) {
|
||||||
$this->db->where('station_id', $station_id);
|
$this->db->where('station_id', $station_id);
|
||||||
$this->db->where("COL_CLUBLOG_QSO_UPLOAD_STATUS", null);
|
$this->db->where("COL_CLUBLOG_QSO_UPLOAD_STATUS", null);
|
||||||
|
|
|
||||||
正在加载…
在新工单中引用