Optimize memory footprint by making use of CI's "double load class"-preventer

This commit is contained in:
int2001
2024-01-14 11:30:26 +00:00
parent 39c0d0ec22
commit c8898093fb

View File

@@ -248,14 +248,12 @@ class Logbook_model extends CI_Model {
$station_id = $this->input->post('station_profile');
if($station_id == "" || $station_id == "0") {
$CI =& get_instance();
$CI->load->model('stations');
$station_id = $CI->stations->find_active();
$this->load->model('stations');
$station_id = $this->stations->find_active();
}
$CI =& get_instance();
$CI->load->model('stations');
if (!$CI->stations->check_station_is_accessible($station_id)) { // Hard Exit if station_profile not accessible
$this->load->model('stations');
if (!$this->stations->check_station_is_accessible($station_id)) { // Hard Exit if station_profile not accessible
return 'Station not accessible<br>';
}
@@ -348,9 +346,8 @@ class Logbook_model extends CI_Model {
* Used to fetch QSOs from the logbook in the awards
*/
public function qso_details($searchphrase, $band, $mode, $type, $qsl, $searchmode = null){
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
$this->db->join('dxcc_entities', 'dxcc_entities.adif = '.$this->config->item('table_name').'.COL_DXCC', 'left outer');
@@ -465,9 +462,8 @@ class Logbook_model extends CI_Model {
}
public function activated_grids_qso_details($searchphrase, $band, $mode){
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$sql = 'SELECT COL_FREQ, COL_SOTA_REF, COL_OPERATOR, COL_IOTA, COL_VUCC_GRIDS, COL_STATE, COL_GRIDSQUARE, COL_PRIMARY_KEY, COL_CALL, COL_TIME_ON, COL_BAND, COL_SAT_NAME, COL_MODE, COL_SUBMODE, COL_RST_SENT, ';
$sql .= 'COL_RST_RCVD, COL_STX, COL_SRX, COL_STX_STRING, COL_SRX_STRING, COL_COUNTRY, COL_QSL_SENT, COL_QSL_SENT_VIA, ';
@@ -497,9 +493,8 @@ class Logbook_model extends CI_Model {
}
public function vucc_qso_details($gridsquare, $band) {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$location_list = "'".implode("','",$logbooks_locations_array)."'";
@@ -521,9 +516,8 @@ class Logbook_model extends CI_Model {
}
public function activator_details($call, $band, $leogeo){
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
$this->db->join('dxcc_entities', 'dxcc_entities.adif = '.$this->config->item('table_name').'.COL_DXCC', 'left outer');
@@ -594,11 +588,10 @@ class Logbook_model extends CI_Model {
$result = $this->exists_clublog_credentials($data['station_id']);
if (isset($result->ucp) && isset($result->ucn) && (($result->ucp ?? '') != '') && (($result->ucn ?? '') != '') && ($result->clublogrealtime == 1)) {
$CI =& get_instance();
$CI->load->library('AdifHelper');
$this->load->library('AdifHelper');
$qso = $this->get_qso($last_id,true)->result();
$adif = $CI->adifhelper->getAdifLine($qso[0]);
$adif = $this->adifhelper->getAdifLine($qso[0]);
$result = $this->push_qso_to_clublog($result->ucn, $result->ucp, $data['COL_STATION_CALLSIGN'], $adif);
if ( ($result['status'] == 'OK') || ( ($result['status'] == 'error') || ($result['status'] == 'duplicate') || ($result['status'] == 'auth_error') )){
$this->mark_clublog_qsos_sent($last_id);
@@ -609,11 +602,10 @@ class Logbook_model extends CI_Model {
$result = $this->exists_hrdlog_credentials($data['station_id']);
// Push qso to hrdlog if code is set, and realtime upload is enabled, and we're not importing an adif-file
if (isset($result->hrdlog_code) && isset($result->hrdlog_username) && $result->hrdlogrealtime == 1) {
$CI =& get_instance();
$CI->load->library('AdifHelper');
$this->load->library('AdifHelper');
$qso = $this->get_qso($last_id,true)->result();
$adif = $CI->adifhelper->getAdifLine($qso[0]);
$adif = $this->adifhelper->getAdifLine($qso[0]);
$result = $this->push_qso_to_hrdlog($result->hrdlog_username, $result->hrdlog_code, $adif);
if ( ($result['status'] == 'OK') || ( ($result['status'] == 'error') || ($result['status'] == 'duplicate') || ($result['status'] == 'auth_error') )){
$this->mark_hrdlog_qsos_sent($last_id);
@@ -623,11 +615,10 @@ class Logbook_model extends CI_Model {
$result = $this->exists_qrz_api_key($data['station_id']);
// Push qso to qrz if apikey is set, and realtime upload is enabled, and we're not importing an adif-file
if (isset($result->qrzapikey) && $result->qrzrealtime == 1) {
$CI =& get_instance();
$CI->load->library('AdifHelper');
$this->load->library('AdifHelper');
$qso = $this->get_qso($last_id,true)->result();
$adif = $CI->adifhelper->getAdifLine($qso[0]);
$adif = $this->adifhelper->getAdifLine($qso[0]);
$result = $this->push_qso_to_qrz($result->qrzapikey, $adif);
if ( ($result['status'] == 'OK') || ( ($result['status'] == 'error') && ($result['message'] == 'STATUS=FAIL&REASON=Unable to add QSO to database: duplicate&EXTENDED=')) ){
$this->mark_qrz_qsos_sent($last_id);
@@ -637,11 +628,10 @@ class Logbook_model extends CI_Model {
$result = $this->exists_webadif_api_key($data['station_id']);
// Push qso to webadif if apikey is set, and realtime upload is enabled, and we're not importing an adif-file
if (isset($result->webadifapikey) && $result->webadifrealtime == 1) {
$CI =& get_instance();
$CI->load->library('AdifHelper');
$this->load->library('AdifHelper');
$qso = $this->get_qso($last_id,true)->result();
$adif = $CI->adifhelper->getAdifLine($qso[0]);
$adif = $this->adifhelper->getAdifLine($qso[0]);
$result = $this->push_qso_to_webadif(
$result->webadifapiurl,
$result->webadifapikey,
@@ -1030,9 +1020,8 @@ class Logbook_model extends CI_Model {
$country = ucwords(strtolower($entity['name']), "- (/");
// be sure that station belongs to user
$CI =& get_instance();
$CI->load->model('stations');
if (!$CI->stations->check_station_is_accessible($stationId)) {
$this->load->model('stations');
if (!$this->stations->check_station_is_accessible($stationId)) {
return;
}
@@ -1040,7 +1029,7 @@ class Logbook_model extends CI_Model {
return;
}
$station_profile=$CI->stations->profile_clean($stationId);
$station_profile=$this->stations->profile_clean($stationId);
$stationCallsign=$station_profile->station_callsign;
$mode = $this->get_main_mode_if_submode($this->input->post('mode'));
@@ -1249,9 +1238,8 @@ class Logbook_model extends CI_Model {
/* Return last 10 QSOs */
function last_ten() {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->db->select('COL_CALL, COL_BAND, COL_FREQ, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_SUBMODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME');
$this->db->where_in('station_id', $logbooks_locations_array);
@@ -1263,9 +1251,8 @@ class Logbook_model extends CI_Model {
/* Show custom number of qsos */
function last_custom($num) {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if(!empty($logbooks_locations_array)) {
$this->db->select('COL_CALL, COL_BAND, COL_FREQ, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_SUBMODE, COL_NAME, COL_COUNTRY, COL_DXCC, COL_PRIMARY_KEY, COL_SAT_NAME, COL_SRX, COL_SRX_STRING, COL_STX, COL_STX_STRING, COL_VUCC_GRIDS, COL_GRIDSQUARE, COL_MY_GRIDSQUARE, COL_OPERATOR, COL_IOTA, COL_WWFF_REF, COL_POTA_REF, COL_STATE, COL_CNTY, COL_DISTANCE, COL_SOTA_REF, COL_CONTEST_ID, dxcc_entities.end AS end');
@@ -1577,9 +1564,8 @@ class Logbook_model extends CI_Model {
function get_qsos_for_printing($station_id2 = null) {
$CI =& get_instance();
$CI->load->model('stations');
$station_id = $CI->stations->find_active();
$this->load->model('stations');
$station_id = $this->stations->find_active();
$sql = 'SELECT
STATION_CALLSIGN,
@@ -1621,9 +1607,8 @@ class Logbook_model extends CI_Model {
function get_qsos($num, $offset, $StationLocationsArray = null) {
if($StationLocationsArray == null) {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
} else {
$logbooks_locations_array = $StationLocationsArray;
}
@@ -1689,9 +1674,8 @@ class Logbook_model extends CI_Model {
* Function returns the QSOs from the logbook, which have not been either marked as uploaded to qrz, or has been modified with an edit
*/
function get_qrz_qsos($station_id, $trusted = false){
$CI =& get_instance();
$CI->load->model('stations');
if ((!$trusted) && (!$CI->stations->check_station_is_accessible($station_id))) {
$this->load->model('stations');
if ((!$trusted) && (!$this->stations->check_station_is_accessible($station_id))) {
return;
}
$sql = 'select *, dxcc_entities.name as station_country from ' . $this->config->item('table_name') . ' thcv ' .
@@ -1711,9 +1695,8 @@ class Logbook_model extends CI_Model {
* Function returns the QSOs from the logbook, which have not been either marked as uploaded to webADIF
*/
function get_webadif_qsos($station_id,$from = null, $to = null,$trusted = false){
$CI =& get_instance();
$CI->load->model('stations');
if ((!$trusted) && (!$CI->stations->check_station_is_accessible($station_id))) {
$this->load->model('stations');
if ((!$trusted) && (!$this->stations->check_station_is_accessible($station_id))) {
return;
}
$sql = "
@@ -1837,9 +1820,8 @@ class Logbook_model extends CI_Model {
function get_last_qsos($num, $StationLocationsArray = null) {
if($StationLocationsArray == null) {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
} else {
$logbooks_locations_array = $StationLocationsArray;
}
@@ -1869,9 +1851,8 @@ class Logbook_model extends CI_Model {
$user_default_confirmation = $this->session->userdata('user_default_confirmation');
if($StationLocationsArray == null) {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
} else {
$logbooks_locations_array = $StationLocationsArray;
}
@@ -1926,9 +1907,8 @@ class Logbook_model extends CI_Model {
function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray = null, $band = null) {
if($StationLocationsArray == null) {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
} else {
$logbooks_locations_array = $StationLocationsArray;
}
@@ -1953,9 +1933,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
function check_if_grid_worked_in_logbook($grid, $StationLocationsArray = null, $band = null) {
if($StationLocationsArray == null) {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
} else {
$logbooks_locations_array = $StationLocationsArray;
}
@@ -1983,9 +1962,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
/* Get all QSOs with a valid grid for use in the KML export */
function kml_get_all_qsos($band, $mode, $dxcc, $cqz, $propagation, $fromdate, $todate) {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->db->select('COL_CALL, COL_BAND, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_SUBMODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME, COL_GRIDSQUARE');
$this->db->where_in('station_id', $logbooks_locations_array);
@@ -2031,9 +2009,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
function totals_year() {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if (!$logbooks_locations_array) {
return null;
@@ -2052,20 +2029,19 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
/* Return total number of qsos */
function total_qsos($StationLocationsArray = null, $api_key = null) {
if($StationLocationsArray == null) {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$this->load->model('logbooks_model');
if ($api_key != null) {
$CI->load->model('api_model');
$this->load->model('api_model');
if (strpos($this->api_model->access($api_key), 'r') !== false) {
$this->api_model->update_last_used($api_key);
$user_id = $this->api_model->key_userid($api_key);
$active_station_logbook = $CI->logbooks_model->find_active_station_logbook_from_userid($user_id);
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($active_station_logbook);
$active_station_logbook = $this->logbooks_model->find_active_station_logbook_from_userid($user_id);
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($active_station_logbook);
} else {
$logbooks_locations_array = [];
}
} else {
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
}
} else {
$logbooks_locations_array = $StationLocationsArray;
@@ -2091,20 +2067,19 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
/* Return number of QSOs had today */
function todays_qsos($StationLocationsArray = null, $api_key = null) {
if($StationLocationsArray == null) {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$this->load->model('logbooks_model');
if ($api_key != null) {
$CI->load->model('api_model');
$this->load->model('api_model');
if (strpos($this->api_model->access($api_key), 'r') !== false) {
$this->api_model->update_last_used($api_key);
$user_id = $this->api_model->key_userid($api_key);
$active_station_logbook = $CI->logbooks_model->find_active_station_logbook_from_userid($user_id);
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($active_station_logbook);
$active_station_logbook = $this->logbooks_model->find_active_station_logbook_from_userid($user_id);
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($active_station_logbook);
} else {
$logbooks_locations_array = [];
}
} else {
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
}
} else {
$logbooks_locations_array = $StationLocationsArray;
@@ -2135,9 +2110,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
/* Return QSOs over a period of days */
function map_week_qsos($start, $end) {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->db->where("COL_TIME_ON BETWEEN '".$start."' AND '".$end."'");
$this->db->where_in('station_id', $logbooks_locations_array);
@@ -2149,9 +2123,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
/* used to return custom qsos requires start, end date plus a band */
function map_custom_qsos($start, $end, $band, $mode, $propagation) {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if (!$logbooks_locations_array) {
return null;
@@ -2188,9 +2161,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
/* Returns QSOs for the date sent eg 2011-09-30 */
function map_day($date) {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$start = $date." 00:00:00";
$end = $date." 23:59:59";
@@ -2206,20 +2178,19 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
// Return QSOs made during the current month
function month_qsos($StationLocationsArray = null, $api_key = null) {
if($StationLocationsArray == null) {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$this->load->model('logbooks_model');
if ($api_key != null) {
$CI->load->model('api_model');
$this->load->model('api_model');
if (strpos($this->api_model->access($api_key), 'r') !== false) {
$this->api_model->update_last_used($api_key);
$user_id = $this->api_model->key_userid($api_key);
$active_station_logbook = $CI->logbooks_model->find_active_station_logbook_from_userid($user_id);
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($active_station_logbook);
$active_station_logbook = $this->logbooks_model->find_active_station_logbook_from_userid($user_id);
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($active_station_logbook);
} else {
$logbooks_locations_array = [];
}
} else {
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
}
} else {
$logbooks_locations_array = $StationLocationsArray;
@@ -2256,20 +2227,19 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
function year_qsos($StationLocationsArray = null, $api_key = null) {
if($StationLocationsArray == null) {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$this->load->model('logbooks_model');
if ($api_key != null) {
$CI->load->model('api_model');
$this->load->model('api_model');
if (strpos($this->api_model->access($api_key), 'r') !== false) {
$this->api_model->update_last_used($api_key);
$user_id = $this->api_model->key_userid($api_key);
$active_station_logbook = $CI->logbooks_model->find_active_station_logbook_from_userid($user_id);
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($active_station_logbook);
$active_station_logbook = $this->logbooks_model->find_active_station_logbook_from_userid($user_id);
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($active_station_logbook);
} else {
$logbooks_locations_array = [];
}
} else {
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
}
} else {
$logbooks_locations_array = $StationLocationsArray;
@@ -2301,9 +2271,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
/* Return total amount of SSB QSOs logged */
function total_ssb() {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if (!$logbooks_locations_array) {
return null;
@@ -2330,9 +2299,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
/* Return total number of satellite QSOs */
function total_sat() {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if (!$logbooks_locations_array) {
return null;
@@ -2352,9 +2320,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
/* Return total number of QSOs per continent */
function total_continents($searchCriteria) {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if (!$logbooks_locations_array) {
return null;
@@ -2391,9 +2358,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
/* Return total number of CW QSOs */
function total_cw() {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if (!$logbooks_locations_array) {
return null;
@@ -2416,9 +2382,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
/* Return total number of FM QSOs */
function total_fm() {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if (!$logbooks_locations_array) {
return null;
@@ -2441,9 +2406,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
/* Return total number of Digital QSOs */
function total_digi() {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if (!$logbooks_locations_array) {
return null;
@@ -2477,9 +2441,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
/* Return total number of QSOs per band */
function total_bands() {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if (!$logbooks_locations_array) {
return null;
@@ -2498,9 +2461,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
function get_QSLStats($StationLocationsArray = null) {
if($StationLocationsArray == null) {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
} else {
$logbooks_locations_array = $StationLocationsArray;
}
@@ -2600,9 +2562,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
/* Return total number of QSL Cards sent */
function total_qsl_sent() {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if(!empty($logbooks_locations_array)) {
$this->db->select('count(COL_QSL_SENT) AS count');
@@ -2625,9 +2586,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
/* Return total number of QSL Cards requested for printing - that means "requested" or "queued" */
function total_qsl_requested() {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if(!empty($logbooks_locations_array)) {
$this->db->select('count(COL_QSL_SENT) AS count');
@@ -2650,9 +2610,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
/* Return total number of QSL Cards received */
function total_qsl_rcvd() {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if(!empty($logbooks_locations_array)) {
$this->db->select('count(COL_QSL_RCVD) AS count');
@@ -2675,9 +2634,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
/* Return total number of eQSL Cards sent */
function total_eqsl_sent() {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if(!empty($logbooks_locations_array)) {
$this->db->select('count(COL_EQSL_QSL_SENT) AS count');
@@ -2700,9 +2658,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
/* Return total number of eQSL Cards received */
function total_eqsl_rcvd() {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if(!empty($logbooks_locations_array)) {
$this->db->select('count(COL_EQSL_QSL_RCVD) AS count');
@@ -2725,9 +2682,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
/* Return total number of LoTW sent */
function total_lotw_sent() {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if(!empty($logbooks_locations_array)) {
$this->db->select('count(COL_LOTW_QSL_SENT) AS count');
@@ -2750,9 +2706,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
/* Return total number of LoTW received */
function total_lotw_rcvd() {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if(!empty($logbooks_locations_array)) {
$this->db->select('count(COL_LOTW_QSL_RCVD) AS count');
@@ -2775,9 +2730,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
/* Return total number of countries worked */
function total_countries() {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if(!empty($logbooks_locations_array)) {
$this->db->select('DISTINCT (COL_COUNTRY)');
@@ -2795,9 +2749,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
/* Return total number of countries worked */
function total_countries_current($StationLocationsArray = null) {
if($StationLocationsArray == null) {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
} else {
$logbooks_locations_array = $StationLocationsArray;
}
@@ -2820,9 +2773,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
function total_countries_confirmed($StationLocationsArray = null) {
if($StationLocationsArray == null) {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
} else {
$logbooks_locations_array = $StationLocationsArray;
}
@@ -2867,9 +2819,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
/* Return total number of countries confirmed with paper QSL */
function total_countries_confirmed_paper() {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if(!empty($logbooks_locations_array)) {
$this->db->select('DISTINCT (COL_COUNTRY)');
@@ -2887,9 +2838,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
/* Return total number of countries confirmed with eQSL */
function total_countries_confirmed_eqsl() {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if(!empty($logbooks_locations_array)) {
$this->db->select('DISTINCT (COL_COUNTRY)');
@@ -2907,9 +2857,8 @@ function check_if_callsign_worked_in_logbook($callsign, $StationLocationsArray =
/* Return total number of countries confirmed with LoTW */
function total_countries_confirmed_lotw() {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if(!empty($logbooks_locations_array)) {
$this->db->select('DISTINCT (COL_COUNTRY)');
@@ -4524,9 +4473,8 @@ function lotw_last_qsl_date($user_id) {
}
function county_qso_details($state, $county) {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('logbooks_model');
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
$this->db->join('lotw_users', 'lotw_users.callsign = '.$this->config->item('table_name').'.col_call', 'left outer');