Files
wavelog/application/models/Stations.php
HB9HIL 2df091f891 Release v1.1 (#120)
* config file for directory userdata

* userdir for eqsl

* change name to userdata

* userdata for qsl

* fix name on comment

* add generic function file

* remove model class on view, use generic function

* Re-added forum link

* add stations_id to eqsl functions

* remove 'v' in Version Dialog

* Update README.md

added Link to demo instance

* Update index.php

* We should be MIT Conform

* [Debug] Added information about when files were last updated, and links to update

* Added custom data format

* Remove leftover-index

* Migration

* Check if index is there

* [LBA] Can disable maidenhead overlay

* paths libary

* Dev (#2)

* Added Windows, MariaDB and PHP-Versions

* Release 1.0

* Re-added forum link

* add stations_id to eqsl functions

* remove 'v' in Version Dialog

* Update README.md

added Link to demo instance

* Update index.php

* We should be MIT Conform

* [Debug] Added information about when files were last updated, and links to update

* Added custom data format

* Remove leftover-index

* Migration

* Check if index is there

* [LBA] Can disable maidenhead overlay

---------

Co-authored-by: int2001 <joerg@dj7nt.de>
Co-authored-by: Joerg (DJ7NT) <int2001@users.noreply.github.com>
Co-authored-by: Andreas <6977712+AndreasK79@users.noreply.github.com>
Co-authored-by: Christoph Kottke <dg0tm@darc.de>
Co-authored-by: Florian (DF2ET) <github@florian-wolters.de>

* [eQSL] only locations with a eQSL nickname should be displayed (#74)

* only locations with a eQSL nickname should be displayed in the dropdown under eQSL Import

* add proper error message

* improve usability

---------

Co-authored-by: Christoph Kottke <dg0tm@darc.de>

* html fixes

* show flashdata if no station has eqsl nick

* removed openssl check, not required

* accumulate stats language

* multilanguage support

* prettier

* Prevent leaking data out of other station_location

* moved qrg to first tab

* Fix a PHP 8.1 deprecated bug.

* [Contesting] Fix for table qso count

* Fixed error when data was empty. Also clear table before inserting again.

* Refactor to get the table to load

* Need to clear datatable when session is deleted

* Prevent Racecondition

* Fixed a few null-checks which will fail on fresh accounts

* Allow for longer gridsquare in station profile

* Show IOTA/SOTA ref on station location tab

* [LBA] Fixed mapping of selected QSOs

* Trying to convert the QSO-Post to an ajax call PHP/Part

* JS Part

* Dev (#3)

* Added Windows, MariaDB and PHP-Versions

* Release 1.0

* Re-added forum link

* add stations_id to eqsl functions

* remove 'v' in Version Dialog

* Update README.md

added Link to demo instance

* Update index.php

* We should be MIT Conform

* [Debug] Added information about when files were last updated, and links to update

* Added custom data format

* Remove leftover-index

* Migration

* Check if index is there

* [LBA] Can disable maidenhead overlay

* [eQSL] only locations with a eQSL nickname should be displayed (#74)

* only locations with a eQSL nickname should be displayed in the dropdown under eQSL Import

* add proper error message

* improve usability

---------

Co-authored-by: Christoph Kottke <dg0tm@darc.de>

* html fixes

* show flashdata if no station has eqsl nick

* removed openssl check, not required

* accumulate stats language

* multilanguage support

* prettier

* Prevent leaking data out of other station_location

* moved qrg to first tab

* Fix a PHP 8.1 deprecated bug.

* [Contesting] Fix for table qso count

* Fixed error when data was empty. Also clear table before inserting again.

* Refactor to get the table to load

* Need to clear datatable when session is deleted

* Prevent Racecondition

* Fixed a few null-checks which will fail on fresh accounts

* Allow for longer gridsquare in station profile

* Show IOTA/SOTA ref on station location tab

* [LBA] Fixed mapping of selected QSOs

---------

Co-authored-by: int2001 <joerg@dj7nt.de>
Co-authored-by: Joerg (DJ7NT) <int2001@users.noreply.github.com>
Co-authored-by: Andreas <6977712+AndreasK79@users.noreply.github.com>
Co-authored-by: Christoph Kottke <dg0tm@darc.de>
Co-authored-by: Florian (DF2ET) <github@florian-wolters.de>
Co-authored-by: dg0tm <schieberjunge@gmx.net>

* First POC

* Handling of AJAX result (started)

* Change qso-save to ajax-return

* Added notification and reloading of QSO-Table

* JS-Part

* Set Focus to qso after (successful) log

* Resetting timers (successful)

* Info is now shown / faded

* Small adjustments

* More Beauty

* Make consequent use of SIG-References from station_profile

* Delete application/views/welcome directory

Leftovers. Security Flaw!

* Update Dashboard.php

Remove redir to welcome

* Delete application/controllers/Welcome.php

security flaw

* Hint for 8.3. friendly Usertest

* Update config.sample.php

default should be commented out

* [LBA] Checkbox to turn on/off path lines in map

* Styling for pathlines-checkbox

* [LBA] Checkbox tweaks

* updated comment in config.php (sample and installer)

* Removed popup regarding unsaved changes (wasn't functional at all)

* Added locking for sending a qso twice

* added spinner to save button

* Also include SIG and SIG_INFO

* [Logbook] Removed profiler

* [LBA] Added fitbounds to map

* [LBA] Added CQ Zone overlay

* Make clearer that overview filters on logbook rather than locations

* baesURL has a trailing slash already

* active logbook hint

* Update .gitignore

added userdata

* [LBA] ITU zone overlay

* Minor wording

* [LBA] Added custom mapping icons

* [LBA] Path line follows icon color

* [LBA] Added icon anchoring

* [LBA] Added easyprint for easy map saving

* [LBA] Added default colors when icon settings does not exist in db

* Check refs before trimming them

* [LBA] Fixed another default issue with markers and colors

* Removed dangerous functions where User can accidently shift profiles

* Rmoeve more unused leftovers from 1.0 to 2.0.

* Header refactoring (#110)

* splitted up header

* resorted header menu

* main rebuild

* header behaviour hover

* dropdown toggle rotate

* fix case where landscape is small menu and portrait normal view

* submenu thirdparty services

* removed custom maps from the header

* matching search bar

* border

* matched border to themes

* [Custom Map] Removed code

* [Gridmap] Broke map by accident. Thanks @phl0 for poke.

* Optical support for SAT directions and elevation

* [LBA] Added coordinates at the bottom of the map

* Align numbers and arrows

* Reset RST after saving via AJAX

* Cfd export (#117)

* Added CFD Export for toplist.darc.de to Wavelog

---------

Co-authored-by: phl0 <github@florian-wolters.de>

* special thx to contributors

* tag 1.1

* typo

---------

Co-authored-by: abarrau <hesky378@gmail.com>
Co-authored-by: Andreas <6977712+AndreasK79@users.noreply.github.com>
Co-authored-by: Christoph Kottke <dg0tm@darc.de>
Co-authored-by: Joerg (DJ7NT) <int2001@users.noreply.github.com>
Co-authored-by: int2001 <joerg@dj7nt.de>
Co-authored-by: Florian (DF2ET) <github@florian-wolters.de>
Co-authored-by: dg0tm <schieberjunge@gmx.net>
2024-02-09 18:12:28 +01:00

515 lines
19 KiB
PHP

<?php
class Stations extends CI_Model {
function all_with_count() {
$this->db->select('station_profile.*, dxcc_entities.name as station_country, dxcc_entities.end as dxcc_end, count('.$this->config->item('table_name').'.station_id) as qso_total');
$this->db->from('station_profile');
$this->db->join($this->config->item('table_name'),'station_profile.station_id = '.$this->config->item('table_name').'.station_id','left');
$this->db->join('dxcc_entities','station_profile.station_dxcc = dxcc_entities.adif','left outer');
$this->db->group_by('station_profile.station_id');
$this->db->where('station_profile.user_id', $this->session->userdata('user_id'));
$this->db->or_where('station_profile.user_id =', NULL);
return $this->db->get();
}
// Returns ALL station profiles regardless of user logged in
// This is also used by LoTW sync so must not be changed.
function all() {
$this->db->select('station_profile.*, dxcc_entities.name as station_country');
$this->db->from('station_profile');
$this->db->join('dxcc_entities','station_profile.station_dxcc = dxcc_entities.adif','left outer');
return $this->db->get();
}
function all_of_user($userid = null) {
if ($userid == null) {
$userid=$this->session->userdata('user_id'); // Fallback to session-uid, if userid is omitted
}
$this->db->select('station_profile.*, dxcc_entities.name as station_country, dxcc_entities.end as dxcc_end');
$this->db->where('user_id', $userid);
$this->db->join('dxcc_entities','station_profile.station_dxcc = dxcc_entities.adif','left outer');
return $this->db->get('station_profile');
}
function callsigns_of_user($userid = null) {
if ($userid == null) {
$userid=$this->session->userdata('user_id'); // Fallback to session-uid, if userid is omitted
}
$this->db->select('distinct(station_profile.station_callsign) as callsign');
$this->db->where('user_id', $userid);
return $this->db->get('station_profile');
}
function profile($id) {
// Clean ID
$clean_id = $this->security->xss_clean($id);
$this->db->where('station_id', $clean_id);
return $this->db->get('station_profile');
}
function profile_clean($id) {
// Clean ID
$clean_id = $this->security->xss_clean($id);
$this->db->where('station_id', $clean_id);
$query = $this->db->get('station_profile');
$row = $query->row();
return $row;
}
/*
* Function: add
* Adds post material into the station profile table.
*/
function add() {
// check if user has no active station profile yet
$station_active = null;
if ($this->find_active() === '0') {
$station_active = 1;
}
// Check if the state is Canada and get the correct state
if ($this->input->post('dxcc') == 1 && $this->input->post('station_ca_state') !="") {
$state = $this->input->post('station_ca_state');
} else {
$state = $this->input->post('station_state');
}
// Create data array with field values
$data = array(
'user_id' => $this->session->userdata('user_id'),
'station_active' => $station_active,
'station_profile_name' => xss_clean($this->input->post('station_profile_name', true)),
'station_gridsquare' => xss_clean(strtoupper($this->input->post('gridsquare', true))),
'station_city' => xss_clean($this->input->post('city', true)),
'station_iota' => xss_clean(strtoupper($this->input->post('iota', true))),
'station_sota' => xss_clean(strtoupper($this->input->post('sota', true))),
'station_wwff' => xss_clean(strtoupper($this->input->post('wwff', true))),
'station_pota' => xss_clean(strtoupper($this->input->post('pota', true))),
'station_sig' => xss_clean(strtoupper($this->input->post('sig', true))),
'station_sig_info' => xss_clean(strtoupper($this->input->post('sig_info', true))),
'station_callsign' => xss_clean($this->input->post('station_callsign', true)),
'station_power' => is_numeric(xss_clean($this->input->post('station_power', true))) ? xss_clean($this->input->post('station_power', true)) : NULL,
'station_dxcc' => xss_clean($this->input->post('dxcc', true)),
'station_cnty' => xss_clean($this->input->post('station_cnty', true)),
'station_cq' => xss_clean($this->input->post('station_cq', true)),
'station_itu' => xss_clean($this->input->post('station_itu', true)),
'state' => $state,
'eqslqthnickname' => xss_clean($this->input->post('eqslnickname', true)),
'hrdlog_username' => xss_clean($this->input->post('hrdlog_username', true)),
'hrdlog_code' => xss_clean($this->input->post('hrdlog_code', true)),
'hrdlogrealtime' => xss_clean($this->input->post('hrdlogrealtime', true)),
'clublogrealtime' => xss_clean($this->input->post('clublogrealtime', true)),
'qrzapikey' => xss_clean($this->input->post('qrzapikey', true)),
'qrzrealtime' => xss_clean($this->input->post('qrzrealtime', true)),
'oqrs' => xss_clean($this->input->post('oqrs', true)),
'oqrs_email' => xss_clean($this->input->post('oqrsemail', true)),
'oqrs_text' => xss_clean($this->input->post('oqrstext', true)),
'webadifapikey' => xss_clean($this->input->post('webadifapikey', true)),
'webadifapiurl' => 'https://qo100dx.club/api',
'webadifrealtime' => xss_clean($this->input->post('webadifrealtime', true)),
);
// Insert Records & return insert id //
if ($this->db->insert('station_profile', $data)===true) {
$station_user_list = $this->all_of_user()->result();
if ((count($station_user_list)>0) && (isset($station_user_list[intval(count($station_user_list)-1)]->station_id))) {
return $station_user_list[intval(count($station_user_list)-1)]->station_id;
}
}
}
function edit() {
// Check if the state is Canada and get the correct state
if ($this->input->post('dxcc') == 1 && $this->input->post('station_ca_state') !="") {
$state = $this->input->post('station_ca_state');
} else {
$state = $this->input->post('station_state');
}
$data = array(
'station_profile_name' => xss_clean($this->input->post('station_profile_name', true)),
'station_gridsquare' => xss_clean($this->input->post('gridsquare', true)),
'station_city' => xss_clean($this->input->post('city', true)),
'station_iota' => xss_clean($this->input->post('iota', true)),
'station_sota' => xss_clean($this->input->post('sota', true)),
'station_wwff' => xss_clean($this->input->post('wwff', true)),
'station_pota' => xss_clean($this->input->post('pota', true)),
'station_sig' => xss_clean($this->input->post('sig', true)),
'station_sig_info' => xss_clean($this->input->post('sig_info', true)),
'station_callsign' => xss_clean($this->input->post('station_callsign', true)),
'station_power' => is_numeric(xss_clean($this->input->post('station_power', true))) ? xss_clean($this->input->post('station_power', true)) : NULL,
'station_dxcc' => xss_clean($this->input->post('dxcc', true)),
'station_cnty' => xss_clean($this->input->post('station_cnty', true)),
'station_cq' => xss_clean($this->input->post('station_cq', true)),
'station_itu' => xss_clean($this->input->post('station_itu', true)),
'state' => $state,
'eqslqthnickname' => xss_clean($this->input->post('eqslnickname', true)),
'hrdlog_username' => xss_clean($this->input->post('hrdlog_username', true)),
'hrdlog_code' => xss_clean($this->input->post('hrdlog_code', true)),
'hrdlogrealtime' => xss_clean($this->input->post('hrdlogrealtime', true)),
'clublogrealtime' => xss_clean($this->input->post('clublogrealtime', true)),
'qrzapikey' => xss_clean($this->input->post('qrzapikey', true)),
'qrzrealtime' => xss_clean($this->input->post('qrzrealtime', true)),
'oqrs' => xss_clean($this->input->post('oqrs', true)),
'oqrs_email' => xss_clean($this->input->post('oqrsemail', true)),
'oqrs_text' => xss_clean($this->input->post('oqrstext', true)),
'webadifapikey' => xss_clean($this->input->post('webadifapikey', true)),
'webadifapiurl' => 'https://qo100dx.club/api',
'webadifrealtime' => xss_clean($this->input->post('webadifrealtime', true)),
);
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->where('station_id', xss_clean($this->input->post('station_id', true)));
$this->db->update('station_profile', $data);
}
function delete($id) {
// Clean ID
$clean_id = $this->security->xss_clean($id);
// do not delete active station
if ($clean_id === $this->find_active()) {
return;
}
// Delete QSOs
$this->db->where('station_id', $id);
$this->db->delete($this->config->item('table_name'));
// Delete Station Profile
$this->db->delete('station_profile', array('station_id' => $clean_id));
}
function deletelog($id) {
// Delete QSOs
$this->db->where('station_id', $id);
$this->db->delete($this->config->item('table_name'));
}
function set_active($current, $new) {
// Clean inputs
$clean_current = $this->security->xss_clean($current);
$clean_new = $this->security->xss_clean($new);
// be sure that stations belong to user
if ($clean_current != 0) {
if (!$this->check_station_is_accessible($clean_current)) {
return;
}
}
if (!$this->check_station_is_accessible($clean_new)) {
return;
}
// Deselect current default
$current_default = array(
'station_active' => null,
);
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->update('station_profile', $current_default);
// Deselect current default
$newdefault = array(
'station_active' => 1,
);
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->where('station_id', $clean_new);
$this->db->update('station_profile', $newdefault);
}
public function find_active() {
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->where('station_active', 1);
$query = $this->db->get('station_profile');
if($query->num_rows() >= 1) {
foreach ($query->result() as $row)
{
return $row->station_id;
}
} else {
return "0";
}
}
public function gridsquare_from_station($station_id) {
$this->db->where('station_id', $station_id);
$query = $this->db->get('station_profile');
if($query->num_rows() >= 1) {
foreach ($query->result() as $row) {
return $row->station_gridsquare;
}
} else {
return null;
}
}
public function find_gridsquare() {
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->where('station_active', 1);
$query = $this->db->get('station_profile');
if($query->num_rows() >= 1) {
foreach ($query->result() as $row)
{
return $row->station_gridsquare;
}
} else {
return "0";
}
}
public function find_name() {
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->where('station_active', 1);
$query = $this->db->get('station_profile');
if($query->num_rows() >= 1) {
foreach ($query->result() as $row)
{
return $row->station_profile_name;
}
} else {
return "0";
}
}
public function reassign($id) {
// DANGEROUS Function. Do not let any User without Admin call this one!!
// Clean ID
$clean_id = $this->security->xss_clean($id);
$this->db->select('station_profile.*, dxcc_entities.name as station_country');
$this->db->where('station_id', $clean_id);
$this->db->join('dxcc_entities', 'station_profile.station_dxcc = dxcc_entities.adif', 'left outer');
$query = $this->db->get('station_profile');
$row = $query->row();
//print_r($row);
$data = array(
'station_id' => $id,
);
$this->db->where('COL_STATION_CALLSIGN', $row->station_callsign);
if($row->station_iota != "") {
$this->db->where('COL_MY_IOTA', $row->station_iota);
}
if($row->station_sota != "") {
$this->db->where('COL_MY_SOTA_REF', $row->station_sota);
}
if($row->station_wwff != "") {
$this->db->where('COL_MY_WWFF_REF', $row->station_wwff);
}
if($row->station_pota != "") {
$this->db->where('COL_MY_POTA_REF', $row->station_pota);
}
if($row->station_sig != "") {
$this->db->where('COL_MY_SIG', $row->station_sig);
}
if($row->station_sig_info != "") {
$this->db->where('COL_MY_SIG_INFO', $row->station_sig_info);
}
$this->db->where('COL_MY_COUNTRY', $row->station_country);
if( strpos($row->station_gridsquare, ',') !== false ) {
$this->db->where('COL_MY_VUCC_GRIDS', $row->station_gridsquare);
} else {
$this->db->where('COL_MY_GRIDSQUARE', $row->station_gridsquare);
}
$this->db->update($this->config->item('table_name'), $data);
$str = $this->db->last_query();
}
function profile_exists() {
$query = $this->db->get('station_profile');
if($query->num_rows() >= 1) {
return 1;
} else {
return 0;
}
}
function stations_with_hrdlog_code() {
$sql = "SELECT station_profile.station_id, station_profile.station_profile_name, station_profile.station_callsign, modc.modcount, notc.notcount, totc.totcount
FROM station_profile
LEFT OUTER JOIN (
SELECT count(*) modcount, station_id
FROM ". $this->config->item('table_name') .
" WHERE COL_HRDLOG_QSO_UPLOAD_STATUS = 'M'
group by station_id
) as modc on station_profile.station_id = modc.station_id
LEFT OUTER JOIN (
SELECT count(*) notcount, station_id
FROM " . $this->config->item('table_name') .
" WHERE (coalesce(COL_HRDLOG_QSO_UPLOAD_STATUS, '') = ''
or COL_HRDLOG_QSO_UPLOAD_STATUS = 'N')
group by station_id
) as notc on station_profile.station_id = notc.station_id
LEFT OUTER JOIN (
SELECT count(*) totcount, station_id
FROM " . $this->config->item('table_name') .
" WHERE COL_HRDLOG_QSO_UPLOAD_STATUS = 'Y'
group by station_id
) as totc on station_profile.station_id = totc.station_id
WHERE coalesce(station_profile.hrdlog_code, '') <> '' AND coalesce(station_profile.hrdlog_username, '') <> ''
AND station_profile.user_id = " . $this->session->userdata('user_id');
$query = $this->db->query($sql);
return $query;
}
function stations_with_qrz_api_key() {
$sql = "SELECT station_profile.station_id, station_profile.station_profile_name, station_profile.station_callsign, modc.modcount, notc.notcount, totc.totcount
FROM station_profile
LEFT OUTER JOIN (
SELECT count(*) modcount, station_id
FROM ". $this->config->item('table_name') .
" WHERE COL_QRZCOM_QSO_UPLOAD_STATUS = 'M'
group by station_id
) as modc on station_profile.station_id = modc.station_id
LEFT OUTER JOIN (
SELECT count(*) notcount, station_id
FROM " . $this->config->item('table_name') .
" WHERE (coalesce(COL_QRZCOM_QSO_UPLOAD_STATUS, '') = ''
or COL_QRZCOM_QSO_UPLOAD_STATUS = 'N')
group by station_id
) as notc on station_profile.station_id = notc.station_id
LEFT OUTER JOIN (
SELECT count(*) totcount, station_id
FROM " . $this->config->item('table_name') .
" WHERE COL_QRZCOM_QSO_UPLOAD_STATUS = 'Y'
group by station_id
) as totc on station_profile.station_id = totc.station_id
WHERE coalesce(station_profile.qrzapikey, '') <> ''
AND station_profile.user_id = " . $this->session->userdata('user_id');
$query = $this->db->query($sql);
return $query;
}
function stations_with_webadif_api_key() {
$sql="
SELECT station_profile.station_id, station_profile.station_profile_name, station_profile.station_callsign, notc.c notcount, totc.c totcount
FROM station_profile
LEFT OUTER JOIN (
SELECT qsos.station_id, COUNT(qsos.COL_PRIMARY_KEY) c
FROM %s qsos
LEFT JOIN webadif ON qsos.COL_PRIMARY_KEY = webadif.qso_id
WHERE webadif.qso_id IS NULL AND qsos.COL_SAT_NAME = 'QO-100'
GROUP BY qsos.station_id
) notc ON station_profile.station_id = notc.station_id
LEFT JOIN (
SELECT qsos.station_id, COUNT(qsos.COL_PRIMARY_KEY) c
FROM %s qsos
WHERE qsos.COL_SAT_NAME = 'QO-100'
GROUP BY qsos.station_id
) totc ON station_profile.station_id = totc.station_id
WHERE COALESCE(station_profile.webadifapikey, '') <> ''
AND COALESCE(station_profile.webadifapiurl, '') <> ''
AND station_profile.user_id = %d
";
$sql=sprintf(
$sql,
$this->config->item('table_name'),
$this->config->item('table_name'),
$this->session->userdata('user_id')
);
return $this->db->query($sql);
}
/*
* Function: are_eqsl_nicks_defined
* Description: Returns number of station profiles with eqslnicknames
*/
function are_eqsl_nicks_defined() {
$this->db->select('eqslqthnickname');
$this->db->where('eqslqthnickname IS NOT NULL');
$this->db->where('eqslqthnickname !=', '');
$this->db->from('station_profile');
$query = $this->db->get();
return $query->num_rows();
}
public function check_station_is_accessible($id) {
// check if station belongs to user
$this->db->select('station_id');
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->where('station_id', $id);
$query = $this->db->get('station_profile');
if ($query->num_rows() == 1) {
return true;
}
return false;
}
public function get_station_power($id) {
$this->db->select('station_power');
$this->db->where('user_id', $this->session->userdata('user_id'));
$this->db->where('station_id', $id);
$query = $this->db->get('station_profile');
if($query->num_rows() >= 1) {
foreach ($query->result() as $row)
{
return $row->station_power;
}
} else {
return null;
}
}
public function check_station_against_user($stationid, $userid) {
$this->db->select('station_id');
$this->db->where('user_id', $userid);
$this->db->where('station_id', $stationid);
$query = $this->db->get('station_profile');
if ($query->num_rows() == 1) {
return true;
}
return false;
}
public function check_station_against_callsign($stationid, $callsign) {
$this->db->select('station_id');
$this->db->where('station_callsign', $callsign);
$this->db->where('station_id', $stationid);
$query = $this->db->get('station_profile');
if ($query->num_rows() == 1) {
return true;
}
return false;
}
// [MAP Custom] get array for json structure (for map) about info's station //
public function get_station_array_for_map() {
$_jsonresult = array();
list($station_lat, $station_lng) = array(0,0);
$station_active = $this->profile($this->find_active())->row();
if (!empty($station_active)) { list($station_lat, $station_lng) = $this->qra->qra2latlong($station_active->station_gridsquare); }
if (($station_lat!=0)&&($station_lng!=0)) { $_jsonresult = array('lat'=>$station_lat,'lng'=>$station_lng,'html'=>$station_active->station_gridsquare,'label'=>$station_active->station_profile_name,'icon'=>'stationIcon'); }
return (count($_jsonresult)>0)?(array('station'=>$_jsonresult)):array();
}
}
?>