diff --git a/application/controllers/Info.php b/application/controllers/Info.php new file mode 100644 index 0000000..a5700b8 --- /dev/null +++ b/application/controllers/Info.php @@ -0,0 +1,67 @@ +session->userdata('validated')){ + redirect(base_url('/login')); + } + } + + public function index() + { + $data['page'] = 'info'; + + // Get data + $this->load->model('Info_model'); + $subgroepen = $this->Info_model->get_subgroep_list(); + + // Prepare data + $data['subgroepen'] = array(); + foreach ($subgroepen as $subgroep) + { + $data['subgroepen'][$subgroep['id']] = $subgroep['nummer'].': '.$subgroep['themanaam']; + } + + // Header + $this->load->view('header', $data); + + // login page + $this->load->view('info_subgroepen', $data); + + // Footer + $this->load->view('footer'); + } + + public function subgroep() + { + $data['page'] = 'info'; + + $subgroepid = $this->security->xss_clean($this->input->post('subgroepid')); + + // Get data + $this->load->model('Info_model'); + $data['subgroepinfo'] = $this->Info_model->get_subgroep_info($subgroepid); + + // Header + $this->load->view('header', $data); + + //echo "
"; + //print_r($data); + //echo ""; + + // login page + $this->load->view('info_subgroep', $data); + + // Footer + $this->load->view('footer'); + } + +} \ No newline at end of file diff --git a/application/models/Info_model.php b/application/models/Info_model.php new file mode 100644 index 0000000..0587895 --- /dev/null +++ b/application/models/Info_model.php @@ -0,0 +1,44 @@ +db->select('id, naam, themanaam, nummer'); + $this->db->from('subgroep'); + $this->db->where('regioid', $this->session->regio); + $this->db->where('jaar', date('Y')); + $this->db->order_by('nummer', 'ASC'); + + $query = $this->db->get(); + + return $query->result_array(); + } + + public function get_subgroep_info($id) + { + $this->db->select('subgroep.naam AS naam, themanaam, nummer, groep.naam AS groepsnaam, groep.plaats'); + $this->db->from('subgroep'); + $this->db->where('subgroep.regioid', $this->session->regio); + $this->db->where('jaar', date('Y')); + $this->db->where('subgroep.id', $id); + $this->db->join('groep', 'subgroep.groepid=groep.id'); + + $this->db->order_by('nummer', 'ASC'); + + $query = $this->db->get(); + + return $query->row(); + } + +} \ No newline at end of file diff --git a/application/views/info_subgroep.php b/application/views/info_subgroep.php new file mode 100644 index 0000000..3e7d2db --- /dev/null +++ b/application/views/info_subgroep.php @@ -0,0 +1,29 @@ ++
++\ No newline at end of file diff --git a/application/views/info_subgroepen.php b/application/views/info_subgroepen.php new file mode 100644 index 0000000..8266695 --- /dev/null +++ b/application/views/info_subgroepen.php @@ -0,0 +1,46 @@ ++++
++ +Nummer +nummer; ?> ++ +Themanaam +themanaam; ?> ++ +Naam +naam; ?> ++ +Groepsnaam +groepsnaam; ?> ++ +Plaats +plaats; ?> ++\ No newline at end of file
+ + + + + ++
++ ++ +++
++ + + + + + ++ +++
++ ++ Er zijn geen groepen te vinden. +++
++ + + + ++ ++