Merge branch 'station_logbooks' into cloudlog8
这个提交包含在:
当前提交
109f40bc23
共有 5 个文件被更改,包括 129 次插入 和 69 次删除
|
|
@ -42,8 +42,13 @@ class API extends CI_Controller {
|
|||
function help()
|
||||
{
|
||||
$this->load->model('user_model');
|
||||
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
|
||||
|
||||
// Check if users logged in
|
||||
|
||||
if($this->user_model->validate_session() == 0) {
|
||||
// user is not logged in
|
||||
redirect('user/login');
|
||||
}
|
||||
|
||||
$this->load->model('api_model');
|
||||
|
||||
|
|
@ -60,7 +65,12 @@ class API extends CI_Controller {
|
|||
function edit($key) {
|
||||
$this->load->model('user_model');
|
||||
|
||||
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
|
||||
// Check if users logged in
|
||||
|
||||
if($this->user_model->validate_session() == 0) {
|
||||
// user is not logged in
|
||||
redirect('user/login');
|
||||
}
|
||||
|
||||
$this->load->model('api_model');
|
||||
|
||||
|
|
@ -96,7 +106,13 @@ class API extends CI_Controller {
|
|||
|
||||
function generate($rights) {
|
||||
$this->load->model('user_model');
|
||||
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
|
||||
|
||||
// Check if users logged in
|
||||
|
||||
if($this->user_model->validate_session() == 0) {
|
||||
// user is not logged in
|
||||
redirect('user/login');
|
||||
}
|
||||
|
||||
|
||||
$this->load->model('api_model');
|
||||
|
|
@ -108,7 +124,13 @@ class API extends CI_Controller {
|
|||
|
||||
function delete($key) {
|
||||
$this->load->model('user_model');
|
||||
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
|
||||
|
||||
// Check if users logged in
|
||||
|
||||
if($this->user_model->validate_session() == 0) {
|
||||
// user is not logged in
|
||||
redirect('user/login');
|
||||
}
|
||||
|
||||
|
||||
$this->load->model('api_model');
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ class Awards extends CI_Controller {
|
|||
$postdata['worked'] = 1;
|
||||
$postdata['confirmed'] = 1;
|
||||
$postdata['notworked'] = 1;
|
||||
$postdata['includedeleted'] = 1;
|
||||
$postdata['includedeleted'] = 0;
|
||||
$postdata['Africa'] = 1;
|
||||
$postdata['Asia'] = 1;
|
||||
$postdata['Europe'] = 1;
|
||||
|
|
@ -379,7 +379,7 @@ class Awards extends CI_Controller {
|
|||
$postdata['worked'] = 1;
|
||||
$postdata['confirmed'] = 1;
|
||||
$postdata['notworked'] = 1;
|
||||
$postdata['includedeleted'] = 1;
|
||||
$postdata['includedeleted'] = 0;
|
||||
$postdata['Africa'] = 1;
|
||||
$postdata['Asia'] = 1;
|
||||
$postdata['Europe'] = 1;
|
||||
|
|
|
|||
|
|
@ -1325,12 +1325,16 @@ class Logbook_model extends CI_Model {
|
|||
|
||||
/* Return total number of QSL Cards sent */
|
||||
function total_qsl_sent() {
|
||||
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
$query = $this->db->query('SELECT count(COL_QSL_SENT) AS count FROM '.$this->config->item('table_name').' WHERE station_id = '.$station_id.' AND COL_QSL_SENT = "Y"');
|
||||
if(!empty($logbooks_locations_array)) {
|
||||
$this->db->select('count(COL_QSL_SENT) AS count');
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->where('COL_QSL_SENT =', 'Y');
|
||||
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
$row = $query->row();
|
||||
|
||||
|
|
@ -1339,16 +1343,23 @@ class Logbook_model extends CI_Model {
|
|||
} else {
|
||||
return $row->count;
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return total number of QSL Cards requested for printing - that means "requested" or "queued" */
|
||||
function total_qsl_requested() {
|
||||
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
$query = $this->db->query('SELECT count(COL_QSL_SENT) AS count FROM '.$this->config->item('table_name').' WHERE station_id = '.$station_id.' AND COL_QSL_SENT in ("Q", "R")');
|
||||
if(!empty($logbooks_locations_array)) {
|
||||
$this->db->select('count(COL_QSL_SENT) AS count');
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->where_in('COL_QSL_SENT', array('Q', 'R'));
|
||||
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
$row = $query->row();
|
||||
|
||||
|
|
@ -1357,106 +1368,133 @@ class Logbook_model extends CI_Model {
|
|||
} else {
|
||||
return $row->count;
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return total number of QSL Cards received */
|
||||
function total_qsl_recv() {
|
||||
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
$query = $this->db->query('SELECT count(COL_QSL_RCVD) AS count FROM '.$this->config->item('table_name').' WHERE station_id = '.$station_id.' AND COL_QSL_RCVD = "Y"');
|
||||
if(!empty($logbooks_locations_array)) {
|
||||
$this->db->select('count(COL_QSL_RCVD) AS count');
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->where('COL_QSL_RCVD =', 'Y');
|
||||
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
$row = $query->row();
|
||||
|
||||
|
||||
if($row == null) {
|
||||
return 0;
|
||||
} else {
|
||||
return $row->count;
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return total number of countries worked */
|
||||
function total_countries() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
$sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').'
|
||||
WHERE COL_COUNTRY != "Invalid"
|
||||
AND col_dxcc > 0
|
||||
AND station_id = '.$station_id ;
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
|
||||
return $query->num_rows();
|
||||
if(!empty($logbooks_locations_array)) {
|
||||
$this->db->select('DISTINCT (COL_COUNTRY)');
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->where('COL_COUNTRY !=', 'Invalid');
|
||||
$this->db->where('COL_DXCC >', '0');
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
return $query->num_rows();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return total number of countries worked */
|
||||
function total_countries_current() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
$sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').' thcv
|
||||
join dxcc_entities on thcv.col_dxcc = dxcc_entities.adif
|
||||
WHERE COL_COUNTRY != "Invalid"
|
||||
AND dxcc_entities.end is null
|
||||
AND station_id = '.$station_id;
|
||||
if(!empty($logbooks_locations_array)) {
|
||||
$this->db->select('DISTINCT ('.$this->config->item('table_name').'.COL_COUNTRY)');
|
||||
$this->db->join('dxcc_entities', 'dxcc_entities.adif = '.$this->config->item('table_name').'.col_dxcc');
|
||||
$this->db->where_in($this->config->item('table_name').'.station_id', $logbooks_locations_array);
|
||||
$this->db->where($this->config->item('table_name').'.COL_COUNTRY !=', 'Invalid');
|
||||
$this->db->where('dxcc_entities.end is null');
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
|
||||
return $query->num_rows();
|
||||
return $query->num_rows();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return total number of countries confirmed with paper QSL */
|
||||
function total_countries_confirmed_paper() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
$sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').'
|
||||
WHERE COL_COUNTRY != "Invalid"
|
||||
AND COL_DXCC > 0
|
||||
AND station_id = '.$station_id.' AND COL_QSL_RCVD =\'Y\'';
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
if(!empty($logbooks_locations_array)) {
|
||||
$this->db->select('DISTINCT (COL_COUNTRY)');
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->where('COL_COUNTRY !=', 'Invalid');
|
||||
$this->db->where('COL_DXCC >', '0');
|
||||
$this->db->where('COL_QSL_RCVD =', 'Y');
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
return $query->num_rows();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return total number of countries confirmed with eQSL */
|
||||
function total_countries_confirmed_eqsl() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
$sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').'
|
||||
WHERE COL_COUNTRY != "Invalid"
|
||||
AND COL_DXCC > 0
|
||||
AND station_id = '.$station_id.' AND COL_EQSL_QSL_RCVD =\'Y\'';
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
if(!empty($logbooks_locations_array)) {
|
||||
$this->db->select('DISTINCT (COL_COUNTRY)');
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->where('COL_COUNTRY !=', 'Invalid');
|
||||
$this->db->where('COL_DXCC >', '0');
|
||||
$this->db->where('COL_EQSL_QSL_RCVD =', 'Y');
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
return $query->num_rows();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return total number of countries confirmed with LoTW */
|
||||
function total_countries_confirmed_lotw() {
|
||||
$CI =& get_instance();
|
||||
$CI->load->model('Stations');
|
||||
$station_id = $CI->Stations->find_active();
|
||||
$CI->load->model('logbooks_model');
|
||||
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
||||
|
||||
$sql = 'SELECT DISTINCT (COL_COUNTRY) FROM '.$this->config->item('table_name').'
|
||||
WHERE COL_COUNTRY != "Invalid"
|
||||
AND COL_DXCC > 0
|
||||
AND station_id = '.$station_id.'
|
||||
AND COL_LOTW_QSL_RCVD =\'Y\'';
|
||||
|
||||
$query = $this->db->query($sql);
|
||||
if(!empty($logbooks_locations_array)) {
|
||||
$this->db->select('DISTINCT (COL_COUNTRY)');
|
||||
$this->db->where_in('station_id', $logbooks_locations_array);
|
||||
$this->db->where('COL_COUNTRY !=', 'Invalid');
|
||||
$this->db->where('COL_DXCC >', '0');
|
||||
$this->db->where('COL_LOTW_QSL_RCVD =', 'Y');
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
return $query->num_rows();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
function api_search_query($query) {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
<div class="col-md-2 control-label" for="checkboxes">Deleted DXCC</div>
|
||||
<div class="col-md-10">
|
||||
<div class="form-check-inline">
|
||||
<input class="form-check-input" type="checkbox" name="includedeleted" id="includedeleted" value="1" <?php if ($this->input->post('includedeleted') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
|
||||
<input class="form-check-input" type="checkbox" name="includedeleted" id="includedeleted" value="1" <?php if ($this->input->post('includedeleted')) echo ' checked="checked"'; ?> >
|
||||
<label class="form-check-label" for="includedeleted">Include deleted</label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -138,7 +138,7 @@
|
|||
<td>#</td>
|
||||
<td>DXCC Name</td>
|
||||
<td>Prefix</td>';
|
||||
if ($this->input->post('includedeleted') || $this->input->method() !== 'post')
|
||||
if ($this->input->post('includedeleted'))
|
||||
echo '
|
||||
<td>Deleted</td>';
|
||||
foreach($bands as $band) {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
<div class="col-md-2 control-label" for="checkboxes">Deleted IOTA</div>
|
||||
<div class="col-md-10">
|
||||
<div class="form-check-inline">
|
||||
<input class="form-check-input" type="checkbox" name="includedeleted" id="includedeleted" value="1" <?php if ($this->input->post('includedeleted') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
|
||||
<input class="form-check-input" type="checkbox" name="includedeleted" id="includedeleted" value="1" <?php if ($this->input->post('includedeleted')) echo ' checked="checked"'; ?> >
|
||||
<label class="form-check-label" for="includedeleted">Include deleted</label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -125,7 +125,7 @@
|
|||
<td>IOTA</td>
|
||||
<td>Prefix</td>
|
||||
<td>Name</td>';
|
||||
if ($this->input->post('includedeleted') || $this->input->method() !== 'post')
|
||||
if ($this->input->post('includedeleted'))
|
||||
echo ' <td>Deleted</td>';
|
||||
|
||||
foreach($bands as $band) {
|
||||
|
|
|
|||
正在加载…
在新工单中引用