2019-08-13 20:22:06 +00:00
|
|
|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
Data lookup functions used within Cloudlog
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
class Lookup extends CI_Controller {
|
|
|
|
|
2019-10-05 18:35:55 +00:00
|
|
|
|
|
|
|
function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
|
|
|
|
$this->load->model('user_model');
|
|
|
|
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
|
|
|
|
}
|
2021-03-14 09:11:21 +00:00
|
|
|
|
2019-08-13 20:22:06 +00:00
|
|
|
public function index()
|
|
|
|
{
|
2021-03-14 09:11:21 +00:00
|
|
|
$data['page_title'] = "Quick Lookup";
|
|
|
|
$this->load->model('logbook_model');
|
|
|
|
$data['dxcc'] = $this->logbook_model->fetchDxcc();
|
|
|
|
$data['iota'] = $this->logbook_model->fetchIota();
|
|
|
|
$this->load->view('lookup/index', $data);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function search() {
|
|
|
|
$CI =& get_instance();
|
2021-09-10 21:13:25 +00:00
|
|
|
$CI->load->model('logbooks_model');
|
|
|
|
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
|
|
|
|
|
|
|
|
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
2019-08-13 20:22:06 +00:00
|
|
|
|
2021-03-14 09:11:21 +00:00
|
|
|
$this->load->model('lookup_model');
|
2021-11-13 14:55:17 +00:00
|
|
|
$this->load->model('bands');
|
2021-03-14 09:11:21 +00:00
|
|
|
|
2023-02-18 13:19:02 +00:00
|
|
|
$data['bands'] = $this->bands->get_worked_bands(xss_clean($this->input->post('type')));
|
2021-03-17 17:23:01 +00:00
|
|
|
|
2021-07-29 08:38:27 +00:00
|
|
|
$data['type'] = xss_clean($this->input->post('type'));
|
|
|
|
$data['dxcc'] = xss_clean($this->input->post('dxcc'));
|
|
|
|
$data['was'] = xss_clean($this->input->post('was'));
|
|
|
|
$data['sota'] = xss_clean($this->input->post('sota'));
|
|
|
|
$data['grid'] = xss_clean($this->input->post('grid'));
|
|
|
|
$data['iota'] = xss_clean($this->input->post('iota'));
|
|
|
|
$data['cqz'] = xss_clean($this->input->post('cqz'));
|
|
|
|
$data['wwff'] = xss_clean($this->input->post('wwff'));
|
2021-09-10 21:13:25 +00:00
|
|
|
$data['location_list'] = $location_list;
|
2021-07-29 08:38:27 +00:00
|
|
|
|
|
|
|
$data['result'] = $this->lookup_model->getSearchResult($data);
|
|
|
|
|
2021-03-14 09:11:21 +00:00
|
|
|
$this->load->view('lookup/result', $data);
|
2019-08-13 20:22:06 +00:00
|
|
|
}
|
|
|
|
|
2023-07-08 12:38:28 +00:00
|
|
|
public function scp() {
|
|
|
|
if($_POST['callsign']) {
|
|
|
|
$uppercase_callsign = strtoupper($_POST['callsign']);
|
2019-10-11 15:42:18 +00:00
|
|
|
}
|
|
|
|
|
2019-08-15 10:53:32 +00:00
|
|
|
// SCP results from logbook
|
|
|
|
$this->load->model('logbook_model');
|
|
|
|
|
2019-10-11 15:42:18 +00:00
|
|
|
$arCalls = array();
|
2019-08-15 10:53:32 +00:00
|
|
|
|
2019-10-11 15:42:18 +00:00
|
|
|
$query = $this->logbook_model->get_callsigns($uppercase_callsign);
|
2019-08-15 10:53:32 +00:00
|
|
|
|
2019-10-11 15:42:18 +00:00
|
|
|
foreach ($query->result() as $row)
|
|
|
|
{
|
|
|
|
if (in_array($row->COL_CALL, $arCalls) == false)
|
|
|
|
{
|
2023-09-18 06:28:32 +00:00
|
|
|
$arCalls[] = str_replace('0', 'Ø', $row->COL_CALL);
|
2019-10-11 15:42:18 +00:00
|
|
|
}
|
|
|
|
}
|
2019-10-11 12:58:43 +00:00
|
|
|
|
2019-08-15 10:53:32 +00:00
|
|
|
// SCP results from master scp db
|
2019-10-11 15:42:18 +00:00
|
|
|
$file = 'updates/clublog_scp.txt';
|
2019-08-13 20:22:06 +00:00
|
|
|
|
2019-08-15 11:00:57 +00:00
|
|
|
if (is_readable($file)) {
|
|
|
|
$lines = file($file, FILE_IGNORE_NEW_LINES);
|
2019-10-11 15:42:18 +00:00
|
|
|
$input = preg_quote($uppercase_callsign, '~');
|
2019-08-15 11:00:57 +00:00
|
|
|
$result = preg_grep('~' . $input . '~', $lines, 0);
|
2019-10-11 15:42:18 +00:00
|
|
|
foreach ($result as &$value) {
|
|
|
|
if (in_array($value, $arCalls) == false)
|
|
|
|
{
|
2023-09-18 06:28:32 +00:00
|
|
|
$arCalls[] = str_replace('0', 'Ø', $value);
|
2019-10-11 15:42:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$file = 'updates/masterscp.txt';
|
2019-08-13 20:22:06 +00:00
|
|
|
|
2019-10-11 15:42:18 +00:00
|
|
|
if (is_readable($file)) {
|
|
|
|
$lines = file($file, FILE_IGNORE_NEW_LINES);
|
|
|
|
$input = preg_quote($uppercase_callsign, '~');
|
|
|
|
$result = preg_grep('~' . $input . '~', $lines, 0);
|
2019-08-15 11:00:57 +00:00
|
|
|
foreach ($result as &$value) {
|
2019-10-11 15:42:18 +00:00
|
|
|
if (in_array($value, $arCalls) == false)
|
|
|
|
{
|
2023-09-18 06:30:47 +00:00
|
|
|
$arCalls[] = str_replace('0', 'Ø', $value);
|
2019-10-11 15:42:18 +00:00
|
|
|
}
|
2019-08-15 11:00:57 +00:00
|
|
|
}
|
2019-08-13 20:22:06 +00:00
|
|
|
}
|
2019-10-11 15:42:18 +00:00
|
|
|
|
|
|
|
sort($arCalls);
|
|
|
|
|
|
|
|
foreach ($arCalls as $strCall)
|
|
|
|
{
|
|
|
|
echo " " . $strCall . " ";
|
|
|
|
}
|
2021-03-14 09:11:21 +00:00
|
|
|
|
2019-10-09 12:54:07 +00:00
|
|
|
}
|
2019-10-11 12:58:43 +00:00
|
|
|
|
2022-04-14 21:24:37 +00:00
|
|
|
public function dok($call) {
|
|
|
|
|
|
|
|
if($call) {
|
|
|
|
$uppercase_callsign = strtoupper($call);
|
|
|
|
}
|
|
|
|
|
|
|
|
// DOK results from logbook
|
|
|
|
$this->load->model('logbook_model');
|
|
|
|
|
|
|
|
$query = $this->logbook_model->get_dok($uppercase_callsign);
|
|
|
|
|
|
|
|
if ($query->row()) {
|
|
|
|
echo $query->row()->COL_DARC_DOK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-15 10:54:18 +00:00
|
|
|
}
|