kopia lustrzana https://github.com/magicbug/Cloudlog
Merge pull request #1154 from AndreasK79/dok_station_logbooks
[DOK Award] Updated code to support station logbookspull/1168/head
commit
ff29a60ca9
|
@ -27,7 +27,6 @@ class Awards extends CI_Controller {
|
||||||
|
|
||||||
public function dok ()
|
public function dok ()
|
||||||
{
|
{
|
||||||
//echo "Needs Developed";
|
|
||||||
$this->load->model('dok');
|
$this->load->model('dok');
|
||||||
$data['doks'] = $this->dok->show_stats();
|
$data['doks'] = $this->dok->show_stats();
|
||||||
$data['worked_bands'] = $this->dok->get_worked_bands();
|
$data['worked_bands'] = $this->dok->get_worked_bands();
|
||||||
|
@ -226,7 +225,7 @@ class Awards extends CI_Controller {
|
||||||
$this->load->view('interface_assets/footer');
|
$this->load->view('interface_assets/footer');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cq(){
|
public function cq() {
|
||||||
$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'));
|
||||||
|
|
|
@ -31,12 +31,14 @@ class DOK extends CI_Model {
|
||||||
|
|
||||||
function get_worked_bands() {
|
function get_worked_bands() {
|
||||||
$CI =& get_instance();
|
$CI =& get_instance();
|
||||||
$CI->load->model('Stations');
|
$CI->load->model('logbooks_model');
|
||||||
$station_id = $CI->Stations->find_active();
|
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||||
|
|
||||||
|
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||||
|
|
||||||
// get all worked slots from database
|
// get all worked slots from database
|
||||||
$data = $this->db->query(
|
$data = $this->db->query(
|
||||||
"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `".$this->config->item('table_name')."` WHERE station_id = ".$station_id." AND COL_DARC_DOK IS NOT NULL AND COL_DARC_DOK != '' AND COL_DXCC = 230 "
|
"SELECT distinct LOWER(`COL_BAND`) as `COL_BAND` FROM `".$this->config->item('table_name')."` WHERE station_id in (" . $location_list . ") AND COL_DARC_DOK IS NOT NULL AND COL_DARC_DOK != '' AND COL_DXCC = 230 "
|
||||||
);
|
);
|
||||||
$worked_slots = array();
|
$worked_slots = array();
|
||||||
foreach($data->result() as $row){
|
foreach($data->result() as $row){
|
||||||
|
@ -54,14 +56,16 @@ class DOK extends CI_Model {
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_stats(){
|
function show_stats() {
|
||||||
$CI =& get_instance();
|
$CI =& get_instance();
|
||||||
$CI->load->model('Stations');
|
$CI->load->model('logbooks_model');
|
||||||
$station_id = $CI->Stations->find_active();
|
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||||
|
|
||||||
|
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||||
|
|
||||||
$data = $this->db->query(
|
$data = $this->db->query(
|
||||||
"select upper(COL_DARC_DOK) as COL_DARC_DOK, COL_MODE, lcase(COL_BAND) as COL_BAND, count(COL_DARC_DOK) as cnt
|
"select upper(COL_DARC_DOK) as COL_DARC_DOK, COL_MODE, lcase(COL_BAND) as COL_BAND, count(COL_DARC_DOK) as cnt
|
||||||
from ".$this->config->item('table_name')." WHERE station_id = ".$station_id." AND COL_DARC_DOK IS NOT NULL AND COL_DARC_DOK != '' AND COL_DXCC = 230
|
from ".$this->config->item('table_name')." WHERE station_id in (" . $location_list . ") AND COL_DARC_DOK IS NOT NULL AND COL_DARC_DOK != '' AND COL_DXCC = 230
|
||||||
group by COL_DARC_DOK, COL_MODE, COL_BAND"
|
group by COL_DARC_DOK, COL_MODE, COL_BAND"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue