diff --git a/application/controllers/Dayswithqso.php b/application/controllers/Dayswithqso.php new file mode 100644 index 00000000..32acd8d9 --- /dev/null +++ b/application/controllers/Dayswithqso.php @@ -0,0 +1,38 @@ +load->model('user_model'); + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + } + + public function index() + { + $this->load->model('dayswithqso_model'); + // Render Page + $data['page_title'] = "Number of days with QSOs each year"; + + $data['result'] = $this->dayswithqso_model->getDaysWithQso(); + + $this->load->view('interface_assets/header', $data); + $this->load->view('dayswithqso/index'); + $this->load->view('interface_assets/footer'); + } + + public function get_days(){ + + //load model + $this->load->model('dayswithqso_model'); + + // get data + $data = $this->dayswithqso_model->getDaysWithQso(); + header('Content-Type: application/json'); + echo json_encode($data); + } + +} \ No newline at end of file diff --git a/application/models/Dayswithqso_model.php b/application/models/Dayswithqso_model.php new file mode 100644 index 00000000..f5941ed5 --- /dev/null +++ b/application/models/Dayswithqso_model.php @@ -0,0 +1,27 @@ +load->model('Stations'); + $station_id = $CI->Stations->find_active(); + + $sql = "select year(col_qso_date) Year, count(distinct col_qso_date) Days from " + .$this->config->item('table_name'). " thcv + where station_id = " . $station_id . " and col_qso_date is not null group by year"; + + $query = $this->db->query($sql); + + return $query->result(); + } + +} \ No newline at end of file diff --git a/application/views/dayswithqso/index.php b/application/views/dayswithqso/index.php new file mode 100644 index 00000000..8f7bc49b --- /dev/null +++ b/application/views/dayswithqso/index.php @@ -0,0 +1,33 @@ +
+ +
+ +

+ + '; + + echo ''; + echo ''; + + foreach ($result as $master) { + echo ''; + } + + echo ''; + + echo ''; + echo ''; + + foreach ($result as $master) { + echo ''; + } + + echo ''; + + echo '
Year' . $master->Year . '
Days' . $master->Days . '
'; + } + ?> + + diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 51d09c3e..e817318e 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -1008,6 +1008,47 @@ $(document).ready(function(){ +uri->segment(1) == "dayswithqso") { ?> + + + + uri->segment(1) == "distances") { ?>