Reformatted the code

pull/3018/head
Peter Goodhall 2024-03-18 14:45:08 +00:00
rodzic 6dde203bf5
commit 7f48eb7140
1 zmienionych plików z 44 dodań i 36 usunięć

Wyświetl plik

@ -1,7 +1,9 @@
<?php <?php
class Qsl_model extends CI_Model { class Qsl_model extends CI_Model
function getQsoWithQslList() { {
$CI =& get_instance(); function getQsoWithQslList()
{
$CI = &get_instance();
$CI->load->model('logbooks_model'); $CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
@ -11,19 +13,20 @@ class Qsl_model extends CI_Model {
$this->db->join('qsl_images', 'qsl_images.qsoid = ' . $this->config->item('table_name') . '.col_primary_key'); $this->db->join('qsl_images', 'qsl_images.qsoid = ' . $this->config->item('table_name') . '.col_primary_key');
$this->db->where_in('station_id', $logbooks_locations_array); $this->db->where_in('station_id', $logbooks_locations_array);
$this->db->order_by("id", "desc"); $this->db->order_by("id", "desc");
return $this->db->get(); return $this->db->get();
} else { } else {
return false; return false;
} }
} }
function getQslForQsoId($id) { function getQslForQsoId($id)
{
// Clean ID // Clean ID
$clean_id = $this->security->xss_clean($id); $clean_id = $this->security->xss_clean($id);
// be sure that QSO belongs to user // be sure that QSO belongs to user
$CI =& get_instance(); $CI = &get_instance();
$CI->load->model('logbook_model'); $CI->load->model('logbook_model');
if (!$CI->logbook_model->check_qso_is_accessible($clean_id)) { if (!$CI->logbook_model->check_qso_is_accessible($clean_id)) {
return; return;
@ -36,12 +39,13 @@ class Qsl_model extends CI_Model {
return $this->db->get()->result(); return $this->db->get()->result();
} }
function saveQsl($qsoid, $filename) { function saveQsl($qsoid, $filename)
{
// Clean ID // Clean ID
$clean_id = $this->security->xss_clean($qsoid); $clean_id = $this->security->xss_clean($qsoid);
// be sure that QSO belongs to user // be sure that QSO belongs to user
$CI =& get_instance(); $CI = &get_instance();
$CI->load->model('logbook_model'); $CI->load->model('logbook_model');
if (!$CI->logbook_model->check_qso_is_accessible($clean_id)) { if (!$CI->logbook_model->check_qso_is_accessible($clean_id)) {
return; return;
@ -57,12 +61,13 @@ class Qsl_model extends CI_Model {
return $this->db->insert_id(); return $this->db->insert_id();
} }
function deleteQsl($id) { function deleteQsl($id)
{
// Clean ID // Clean ID
$clean_id = $this->security->xss_clean($id); $clean_id = $this->security->xss_clean($id);
// be sure that QSO belongs to user // be sure that QSO belongs to user
$CI =& get_instance(); $CI = &get_instance();
$CI->load->model('logbook_model'); $CI->load->model('logbook_model');
$this->db->select('qsoid'); $this->db->select('qsoid');
$this->db->from('qsl_images'); $this->db->from('qsl_images');
@ -76,12 +81,13 @@ class Qsl_model extends CI_Model {
$this->db->delete('qsl_images', array('id' => $clean_id)); $this->db->delete('qsl_images', array('id' => $clean_id));
} }
function getFilename($id) { function getFilename($id)
{
// Clean ID // Clean ID
$clean_id = $this->security->xss_clean($id); $clean_id = $this->security->xss_clean($id);
// be sure that QSO belongs to user // be sure that QSO belongs to user
$CI =& get_instance(); $CI = &get_instance();
$CI->load->model('logbook_model'); $CI->load->model('logbook_model');
$this->db->select('qsoid'); $this->db->select('qsoid');
$this->db->from('qsl_images'); $this->db->from('qsl_images');
@ -98,37 +104,39 @@ class Qsl_model extends CI_Model {
return $this->db->get(); return $this->db->get();
} }
function searchQsos($callsign) { function searchQsos($callsign)
$CI =& get_instance(); {
$CI = &get_instance();
$CI->load->model('logbooks_model'); $CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->db->select('*'); $this->db->select('*');
$this->db->from($this->config->item('table_name')); $this->db->from($this->config->item('table_name'));
$this->db->where_in('station_id', $logbooks_locations_array); $this->db->where_in('station_id', $logbooks_locations_array);
$this->db->where('col_call', $callsign); $this->db->where('col_call', $callsign);
return $this->db->get(); return $this->db->get();
} }
function addQsotoQsl($qsoid, $filename) { function addQsotoQsl($qsoid, $filename)
$clean_qsoid = $this->security->xss_clean($qsoid); {
$clean_filename = $this->security->xss_clean($filename); $clean_qsoid = $this->security->xss_clean($qsoid);
$clean_filename = $this->security->xss_clean($filename);
// be sure that QSO belongs to user // be sure that QSO belongs to user
$CI =& get_instance(); $CI = &get_instance();
$CI->load->model('logbook_model'); $CI->load->model('logbook_model');
if (!$CI->logbook_model->check_qso_is_accessible($clean_qsoid)) { if (!$CI->logbook_model->check_qso_is_accessible($clean_qsoid)) {
return; return;
} }
$data = array( $data = array(
'qsoid' => $clean_qsoid, 'qsoid' => $clean_qsoid,
'filename' => $filename 'filename' => $filename
); );
$this->db->insert('qsl_images', $data); $this->db->insert('qsl_images', $data);
return $this->db->insert_id(); return $this->db->insert_id();
} }
} }