Added logbook qsos to the scp lookup

pull/425/head
Peter Goodhall 2019-08-15 11:53:32 +01:00
rodzic 50fc45dd80
commit d6d0e588af
2 zmienionych plików z 36 dodań i 8 usunięć

Wyświetl plik

@ -13,22 +13,30 @@ class Lookup extends CI_Controller {
}
public function scp($string) {
public function scp($call) {
// SCP results from logbook
$this->load->model('logbook_model');
$log_calls = $this->logbook_model->get_callsigns($call);
if($log_calls != "") {
echo $log_calls."<br><br>";
}
// SCP results from master scp db
$file = 'updates/masterscp.txt';
$lines = file($file, FILE_IGNORE_NEW_LINES);
$input = preg_quote($string, '~');
$input = preg_quote($call, '~');
$result = preg_grep('~' . $input . '~', $lines, 0);
$copy = $result;
foreach ($result as &$value) {
echo $value;
if (next($copy )) {
echo ', '; // Add comma for all elements instead of last
}
echo " ".$value. " ";
}
}

Wyświetl plik

@ -222,6 +222,26 @@ class Logbook_model extends CI_Model {
}
}
public function get_callsigns($callsign){
$this->db->select('COL_CALL');
$this->db->distinct();
$this->db->like('COL_CALL', $callsign);
$query = $this->db->get($this->config->item('table_name'));
$result = "";
foreach ($query->result() as $row)
{
$result = $result." ".$row->COL_CALL;
}
return $result;
}
function add_qso($data) {
if ($data['COL_DXCC'] == "Not Found"){