[QSL Labels] Now sorts by dxcc

pull/2201/head
Andreas 2023-06-14 16:28:12 +02:00
rodzic 7fcf4d9f1d
commit 593e8dc1ed
2 zmienionych plików z 25 dodań i 3 usunięć

Wyświetl plik

@ -90,10 +90,9 @@ class Labels extends CI_Controller {
public function print($station_id) {
$clean_id = xss_clean($station_id);
$this->load->model('adif_data');
$result = $this->adif_data->export_printrequested($clean_id);
$this->load->model('labels_model');
$result = $this->labels_model->export_printrequested($clean_id);
$label = $this->labels_model->getDefaultLabel();
// require_once('fpdf.php');

Wyświetl plik

@ -104,4 +104,27 @@ class Labels_model extends CI_Model {
$sql = 'update label_types set useforprint = 1 where user_id = ' . $this->session->userdata('user_id') . ' and id = ' . $cleanid;
$this->db->query($sql);
}
function export_printrequested($station_id = NULL) {
$this->load->model('stations');
$active_station_id = $this->stations->find_active();
$this->db->select($this->config->item('table_name').'.*, station_profile.*, dxcc_entities.name as station_country');
if ($station_id == NULL) {
$this->db->where($this->config->item('table_name').'.station_id', $active_station_id);
} else if ($station_id != 'All') {
$this->db->where($this->config->item('table_name').'.station_id', $station_id);
}
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
$this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif');
// always filter user. this ensures that even if the station_id is from another user no inaccesible QSOs will be returned
$this->db->where('station_profile.user_id', $this->session->userdata('user_id'));
$this->db->where_in('COL_QSL_SENT', array('R', 'Q'));
$this->db->order_by("COL_DXCC", "ASC");
$query = $this->db->get($this->config->item('table_name'));
return $query;
}
}