Fixed a range of errors

pull/1296/head
Peter Goodhall 2021-11-14 22:48:39 +00:00
rodzic 4f2fc64c01
commit e7902db33a
4 zmienionych plików z 87 dodań i 63 usunięć

Wyświetl plik

@ -198,26 +198,28 @@ class Logbook extends CI_Controller {
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if($type == "SAT") {
$this->db->where('COL_PROP_MODE', 'SAT');
} else {
$this->db->where('COL_MODE', $mode);
$this->db->where('COL_BAND', $band);
$this->db->where('COL_PROP_MODE !=','SAT');
if(!empty($logbooks_locations_array)) {
if($type == "SAT") {
$this->db->where('COL_PROP_MODE', 'SAT');
} else {
$this->db->where('COL_MODE', $mode);
$this->db->where('COL_BAND', $band);
$this->db->where('COL_PROP_MODE !=','SAT');
}
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->like('SUBSTRING(COL_GRIDSQUARE, 1, 4)', substr($gridsquare, 0, 4));
$this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "desc");
$this->db->limit(1);
}
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->like('SUBSTRING(COL_GRIDSQUARE, 1, 4)', substr($gridsquare, 0, 4));
$this->db->order_by($this->config->item('table_name').".COL_TIME_ON", "desc");
$this->db->limit(1);
$query = $this->db->get($this->config->item('table_name'));
$query = $this->db->get($this->config->item('table_name'));
foreach ($query->result() as $workedBeforeRow)
{
return true;
foreach ($query->result() as $workedBeforeRow)
{
return true;
}
}
return false;
}
@ -272,28 +274,36 @@ class Logbook extends CI_Controller {
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if($type == "SAT") {
$this->db->where('COL_PROP_MODE', 'SAT');
if(!empty($logbooks_locations_array)) {
if($type == "SAT") {
$this->db->where('COL_PROP_MODE', 'SAT');
} else {
$this->db->where('COL_MODE', $mode);
$this->db->where('COL_BAND', $band);
$this->db->where('COL_PROP_MODE !=','SAT');
}
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->where('COL_COUNTRY', urldecode($country));
$query = $this->db->get($this->config->item('table_name'), 1, 0);
foreach ($query->result() as $workedBeforeRow)
{
$return['workedBefore'] = true;
}
header('Content-Type: application/json');
echo json_encode($return, JSON_PRETTY_PRINT);
return;
} else {
$this->db->where('COL_MODE', $mode);
$this->db->where('COL_BAND', $band);
$this->db->where('COL_PROP_MODE !=','SAT');
$return['workedBefore'] = false;
header('Content-Type: application/json');
echo json_encode($return, JSON_PRETTY_PRINT);
return;
}
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->where('COL_COUNTRY', urldecode($country));
$query = $this->db->get($this->config->item('table_name'), 1, 0);
foreach ($query->result() as $workedBeforeRow)
{
$return['workedBefore'] = true;
}
header('Content-Type: application/json');
echo json_encode($return, JSON_PRETTY_PRINT);
return;
}
function jsonlookupcallsign($callsign, $type, $band, $mode) {
@ -309,28 +319,34 @@ class Logbook extends CI_Controller {
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if($type == "SAT") {
$this->db->where('COL_PROP_MODE', 'SAT');
if(!empty($logbooks_locations_array)) {
if($type == "SAT") {
$this->db->where('COL_PROP_MODE', 'SAT');
} else {
$this->db->where('COL_MODE', $mode);
$this->db->where('COL_BAND', $band);
$this->db->where('COL_PROP_MODE !=','SAT');
}
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->where('COL_CALL', strtoupper($callsign));
$query = $this->db->get($this->config->item('table_name'), 1, 0);
foreach ($query->result() as $workedBeforeRow)
{
$return['workedBefore'] = true;
}
header('Content-Type: application/json');
echo json_encode($return, JSON_PRETTY_PRINT);
return;
} else {
$this->db->where('COL_MODE', $mode);
$this->db->where('COL_BAND', $band);
$this->db->where('COL_PROP_MODE !=','SAT');
$return['workedBefore'] = false;
header('Content-Type: application/json');
echo json_encode($return, JSON_PRETTY_PRINT);
return;
}
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->where('COL_CALL', strtoupper($callsign));
$query = $this->db->get($this->config->item('table_name'), 1, 0);
foreach ($query->result() as $workedBeforeRow)
{
$return['workedBefore'] = true;
}
header('Content-Type: application/json');
echo json_encode($return, JSON_PRETTY_PRINT);
return;
}
@ -416,6 +432,7 @@ class Logbook extends CI_Controller {
$html = "";
if(!empty($logbooks_locations_array)) {
$this->db->select(''.$this->config->item('table_name').'.COL_CALL, '.$this->config->item('table_name').'.COL_BAND, '.$this->config->item('table_name').'.COL_TIME_ON, '.$this->config->item('table_name').'.COL_RST_RCVD, '.$this->config->item('table_name').'.COL_RST_SENT, '.$this->config->item('table_name').'.COL_MODE, '.$this->config->item('table_name').'.COL_SUBMODE, '.$this->config->item('table_name').'.COL_PRIMARY_KEY, '.$this->config->item('table_name').'.COL_SAT_NAME, '.$this->config->item('table_name').'.COL_GRIDSQUARE, '.$this->config->item('table_name').'.COL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_RCVD, '.$this->config->item('table_name').'.COL_EQSL_QSL_SENT, '.$this->config->item('table_name').'.COL_QSL_SENT, '.$this->config->item('table_name').'.COL_STX, '.$this->config->item('table_name').'.COL_STX_STRING, '.$this->config->item('table_name').'.COL_SRX, '.$this->config->item('table_name').'.COL_SRX_STRING, '.$this->config->item('table_name').'.COL_LOTW_QSL_SENT, '.$this->config->item('table_name').'.COL_LOTW_QSL_RCVD, '.$this->config->item('table_name').'.COL_VUCC_GRIDS, station_profile.*');
$this->db->from($this->config->item('table_name'));
@ -428,8 +445,9 @@ class Logbook extends CI_Controller {
$this->db->limit(5);
$query = $this->db->get();
}
if ($query->num_rows() > 0)
if (!empty($logbooks_locations_array) && $query->num_rows() > 0)
{
$html .= "<div class=\"table-responsive\">";
$html .= "<table class=\"table\">";

Wyświetl plik

@ -595,12 +595,16 @@ class Logbook_model extends CI_Model {
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->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');
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->order_by("COL_TIME_ON", "desc");
$this->db->limit($num);
if(!empty($logbooks_locations_array)) {
$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');
$this->db->where_in('station_id', $logbooks_locations_array);
$this->db->order_by("COL_TIME_ON", "desc");
$this->db->limit($num);
return $this->db->get($this->config->item('table_name'));
return $this->db->get($this->config->item('table_name'));
} else {
return false;
}
}
/*

Wyświetl plik

@ -82,6 +82,7 @@ function echo_table_col($row, $name) {
<?php
$i = 0;
if(!empty($last_five_qsos) > 0) {
foreach ($last_five_qsos->result() as $row) { ?>
<?php echo '<tr class="tr'.($i & 1).'">'; ?>
@ -113,7 +114,7 @@ function echo_table_col($row, $name) {
echo_table_col($row, $this->session->userdata('user_column4')==""?'Band':$this->session->userdata('user_column4'));
?>
</tr>
<?php $i++; } ?>
<?php $i++; } } ?>
</table>
</div>
</div>

Wyświetl plik

@ -525,7 +525,8 @@
}
$i = 0;
foreach ($query->result() as $row) {
if($query != false) {
foreach ($query->result() as $row) {
echo '<tr class="tr'.($i & 1).'">';
echo '<td>';
$timestamp = strtotime($row->COL_TIME_ON);
@ -545,7 +546,7 @@
<td><?php echo $row->COL_BAND; ?></td>
<?php } ?>
</tr>
<?php $i++; } ?>
<?php $i++; } } ?>
</table>
</div>
</div>