Files
wavelog/application/models/Dcl_model.php
2025-04-24 16:10:44 +00:00

49 lines
1.6 KiB
PHP

<?php
class Dcl_model extends CI_Model {
/*
|--------------------------------------------------------------------------
| Function: lotw_certs
|--------------------------------------------------------------------------
|
| Returns all lotw_certs for a selected user via the $user_id parameter
|
*/
function dcl_keys($user_id) {
$this->load->model('user_options_model');
return $this->user_options_model->get_options('dcl', array('option_name'=>'dcl_key'), $user_id)->result();
}
function find_key($callsign, $user_id) {
$this->load->model('user_options_model');
return $this->user_options_model->get_options('dcl', array('option_name'=>'dcl_key','option_key'=>$callsign), $user_id)->result();
}
function store_key($user_id, $callsign, $date_created, $date_expires, $qso_start_date, $qso_end_date, $cert_key, $general_cert) {
}
function update_key($user_id, $callsign, $dxcc, $date_created, $date_expires, $qso_start_date, $qso_end_date, $cert_key, $general_cert) {
}
function delete_key($call) {
$this->user_options_model->del_option('dcl', 'dcl_key',array('option_key' => $call));
}
function last_upload($key, $message, $user_id) {
$this->load->model('user_options_model');
$dclrkey=$this->user_options_model->get_options('dcl', array('option_name'=>'dcl_key'), $user_id)->result();
$dclkey = json_decode($dclrkey[0]->option_value ?? '');
$dclkey->call = $dclrkey[0]->option_key ?? '';
$dclnewkey=$dclkey;
if ($message == "Success") {
$dclnewkey->last_sync=date("Y-m-d H:i:s");
$this->user_options_model->set_option('dcl', 'dcl_key', array($dclkey->call => json_encode($dclnewkey)), $user_id);
}
return "Updated";
}
}
?>