|
| 1 | +<?php |
| 2 | + |
| 3 | +class Visitor_model extends CI_Model { |
| 4 | + |
| 5 | + function get_qsos($num, $StationLocationsArray, $band = '') { |
| 6 | + $this->db->select($this->config->item('table_name').'.*, station_profile.*'); |
| 7 | + $this->db->from($this->config->item('table_name')); |
| 8 | + |
| 9 | + $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); |
| 10 | + |
| 11 | + if ($band != '') { |
| 12 | + if ($band == 'SAT') { |
| 13 | + $this->db->where($this->config->item('table_name').'.col_prop_mode', 'SAT'); |
| 14 | + } else { |
| 15 | + $this->db->where($this->config->item('table_name').'.col_prop_mode !="SAT"'); |
| 16 | + $this->db->where($this->config->item('table_name').'.col_band', $band); |
| 17 | + } |
| 18 | + } |
| 19 | + |
| 20 | + $this->db->where_in($this->config->item('table_name').'.station_id', $StationLocationsArray); |
| 21 | + $this->db->order_by(''.$this->config->item('table_name').'.COL_TIME_ON', "desc"); |
| 22 | + |
| 23 | + $this->db->limit($num); |
| 24 | + |
| 25 | + return $this->db->get(); |
| 26 | + } |
| 27 | + |
| 28 | + function getlastqsodate ($slug) { |
| 29 | + $this->load->model('stationsetup_model'); |
| 30 | + $logbook_id = $this->stationsetup_model->public_slug_exists_logbook_id($slug); |
| 31 | + $userid = $this->stationsetup_model->public_slug_exists_userid($slug); |
| 32 | + $band = $this->user_options_model->get_options('ExportMapOptions',array('option_name'=>'band','option_key'=>$slug), $userid)->row()->option_value ?? ''; |
| 33 | + |
| 34 | + $sql = "select max(col_time_on) lastqso from " . $this->config->item('table_name') . |
| 35 | + " join station_profile on station_profile.station_id = " . $this->config->item('table_name') . ".station_id where 1 = 1"; |
| 36 | + |
| 37 | + if ($band != '') { |
| 38 | + if ($band == 'SAT') { |
| 39 | + $sql .= " and " . $this->config->item('table_name') . ".col_prop_mode = 'SAT'"; |
| 40 | + } else { |
| 41 | + $sql .= " and " . $this->config->item('table_name') . ".col_prop_mode != 'SAT'"; |
| 42 | + $sql .= " and " . $this->config->item('table_name') . ".col_band = '". $band . "'"; |
| 43 | + } |
| 44 | + } |
| 45 | + |
| 46 | + return $this->db->query($sql); |
| 47 | + } |
| 48 | +} |
0 commit comments