Fixed a range of errors

这个提交包含在:
Peter Goodhall 2021-11-14 22:48:39 +00:00
父节点 4f2fc64c01
当前提交 e7902db33a
共有 4 个文件被更改,包括 87 次插入63 次删除

查看文件

@ -198,26 +198,28 @@ class Logbook extends CI_Controller {
$CI->load->model('logbooks_model'); $CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if($type == "SAT") { if(!empty($logbooks_locations_array)) {
$this->db->where('COL_PROP_MODE', 'SAT'); if($type == "SAT") {
} else { $this->db->where('COL_PROP_MODE', 'SAT');
$this->db->where('COL_MODE', $mode); } else {
$this->db->where('COL_BAND', $band); $this->db->where('COL_MODE', $mode);
$this->db->where('COL_PROP_MODE !=','SAT'); $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_in('station_id', $logbooks_locations_array);
$this->db->like('SUBSTRING(COL_GRIDSQUARE, 1, 4)', substr($gridsquare, 0, 4)); $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->order_by($this->config->item('table_name').".COL_TIME_ON", "desc");
$this->db->limit(1); $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) foreach ($query->result() as $workedBeforeRow)
{ {
return true; return true;
}
} }
return false; return false;
} }
@ -272,28 +274,36 @@ class Logbook extends CI_Controller {
$CI->load->model('logbooks_model'); $CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if($type == "SAT") { if(!empty($logbooks_locations_array)) {
$this->db->where('COL_PROP_MODE', 'SAT'); 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 { } else {
$this->db->where('COL_MODE', $mode); $return['workedBefore'] = false;
$this->db->where('COL_BAND', $band);
$this->db->where('COL_PROP_MODE !=','SAT');
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) { function jsonlookupcallsign($callsign, $type, $band, $mode) {
@ -309,28 +319,34 @@ class Logbook extends CI_Controller {
$CI->load->model('logbooks_model'); $CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
if($type == "SAT") { if(!empty($logbooks_locations_array)) {
$this->db->where('COL_PROP_MODE', 'SAT'); 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 { } else {
$this->db->where('COL_MODE', $mode); $return['workedBefore'] = false;
$this->db->where('COL_BAND', $band); header('Content-Type: application/json');
$this->db->where('COL_PROP_MODE !=','SAT'); 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 = ""; $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->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')); $this->db->from($this->config->item('table_name'));
@ -428,8 +445,9 @@ class Logbook extends CI_Controller {
$this->db->limit(5); $this->db->limit(5);
$query = $this->db->get(); $query = $this->db->get();
}
if ($query->num_rows() > 0) if (!empty($logbooks_locations_array) && $query->num_rows() > 0)
{ {
$html .= "<div class=\"table-responsive\">"; $html .= "<div class=\"table-responsive\">";
$html .= "<table class=\"table\">"; $html .= "<table class=\"table\">";

查看文件

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

查看文件

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

查看文件

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