kopia lustrzana https://github.com/magicbug/Cloudlog
POST Each QSO to clublog seperately and if successful mark as sent.
rodzic
0c74ac5605
commit
5560e5005e
|
@ -166,33 +166,42 @@ class Clublog extends CI_Controller {
|
|||
{
|
||||
$data['qso'] = $qso;
|
||||
$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);
|
||||
}
|
||||
|
||||
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) {
|
||||
$this->db->where('station_id', $station_id);
|
||||
$this->db->where("COL_CLUBLOG_QSO_UPLOAD_STATUS", null);
|
||||
|
|
Ładowanie…
Reference in New Issue