kopia lustrzana https://github.com/magicbug/Cloudlog
Reformatted the code
rodzic
6dde203bf5
commit
7f48eb7140
|
@ -1,7 +1,9 @@
|
|||
<?php
|
||||
class Qsl_model extends CI_Model {
|
||||
function getQsoWithQslList() {
|
||||
$CI =& get_instance();
|
||||
class Qsl_model extends CI_Model
|
||||
{
|
||||
function getQsoWithQslList()
|
||||
{
|
||||
$CI = &get_instance();
|
||||
$CI->load->model('logbooks_model');
|
||||
$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->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->order_by("id", "desc");
|
||||
|
||||
|
||||
return $this->db->get();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function getQslForQsoId($id) {
|
||||
function getQslForQsoId($id)
|
||||
{
|
||||
// Clean ID
|
||||
$clean_id = $this->security->xss_clean($id);
|
||||
|
||||
// be sure that QSO belongs to user
|
||||
$CI =& get_instance();
|
||||
$CI = &get_instance();
|
||||
$CI->load->model('logbook_model');
|
||||
if (!$CI->logbook_model->check_qso_is_accessible($clean_id)) {
|
||||
return;
|
||||
|
@ -36,12 +39,13 @@ class Qsl_model extends CI_Model {
|
|||
return $this->db->get()->result();
|
||||
}
|
||||
|
||||
function saveQsl($qsoid, $filename) {
|
||||
function saveQsl($qsoid, $filename)
|
||||
{
|
||||
// Clean ID
|
||||
$clean_id = $this->security->xss_clean($qsoid);
|
||||
|
||||
// be sure that QSO belongs to user
|
||||
$CI =& get_instance();
|
||||
$CI = &get_instance();
|
||||
$CI->load->model('logbook_model');
|
||||
if (!$CI->logbook_model->check_qso_is_accessible($clean_id)) {
|
||||
return;
|
||||
|
@ -57,12 +61,13 @@ class Qsl_model extends CI_Model {
|
|||
return $this->db->insert_id();
|
||||
}
|
||||
|
||||
function deleteQsl($id) {
|
||||
function deleteQsl($id)
|
||||
{
|
||||
// Clean ID
|
||||
$clean_id = $this->security->xss_clean($id);
|
||||
|
||||
// be sure that QSO belongs to user
|
||||
$CI =& get_instance();
|
||||
$CI = &get_instance();
|
||||
$CI->load->model('logbook_model');
|
||||
$this->db->select('qsoid');
|
||||
$this->db->from('qsl_images');
|
||||
|
@ -76,12 +81,13 @@ class Qsl_model extends CI_Model {
|
|||
$this->db->delete('qsl_images', array('id' => $clean_id));
|
||||
}
|
||||
|
||||
function getFilename($id) {
|
||||
function getFilename($id)
|
||||
{
|
||||
// Clean ID
|
||||
$clean_id = $this->security->xss_clean($id);
|
||||
|
||||
// be sure that QSO belongs to user
|
||||
$CI =& get_instance();
|
||||
$CI = &get_instance();
|
||||
$CI->load->model('logbook_model');
|
||||
$this->db->select('qsoid');
|
||||
$this->db->from('qsl_images');
|
||||
|
@ -98,37 +104,39 @@ class Qsl_model extends CI_Model {
|
|||
return $this->db->get();
|
||||
}
|
||||
|
||||
function searchQsos($callsign) {
|
||||
$CI =& get_instance();
|
||||
function searchQsos($callsign)
|
||||
{
|
||||
$CI = &get_instance();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
$this->db->select('*');
|
||||
$this->db->from($this->config->item('table_name'));
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->where('col_call', $callsign);
|
||||
$this->db->select('*');
|
||||
$this->db->from($this->config->item('table_name'));
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->where('col_call', $callsign);
|
||||
|
||||
return $this->db->get();
|
||||
}
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
function addQsotoQsl($qsoid, $filename) {
|
||||
$clean_qsoid = $this->security->xss_clean($qsoid);
|
||||
$clean_filename = $this->security->xss_clean($filename);
|
||||
function addQsotoQsl($qsoid, $filename)
|
||||
{
|
||||
$clean_qsoid = $this->security->xss_clean($qsoid);
|
||||
$clean_filename = $this->security->xss_clean($filename);
|
||||
|
||||
// be sure that QSO belongs to user
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('logbook_model');
|
||||
if (!$CI->logbook_model->check_qso_is_accessible($clean_qsoid)) {
|
||||
return;
|
||||
}
|
||||
// be sure that QSO belongs to user
|
||||
$CI = &get_instance();
|
||||
$CI->load->model('logbook_model');
|
||||
if (!$CI->logbook_model->check_qso_is_accessible($clean_qsoid)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'qsoid' => $clean_qsoid,
|
||||
'filename' => $filename
|
||||
);
|
||||
$data = array(
|
||||
'qsoid' => $clean_qsoid,
|
||||
'filename' => $filename
|
||||
);
|
||||
|
||||
$this->db->insert('qsl_images', $data);
|
||||
$this->db->insert('qsl_images', $data);
|
||||
|
||||
return $this->db->insert_id();
|
||||
}
|
||||
return $this->db->insert_id();
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue