From 7eb7d6b78cd0bfa23ef3a4e5923056cef4d57da9 Mon Sep 17 00:00:00 2001 From: Rogier Neeleman Date: Mon, 14 Mar 2016 21:08:48 +0100 Subject: [PATCH] Subgroep info added --- application/controllers/Info.php | 67 +++++++++++++++++++++++++++ application/models/Info_model.php | 44 ++++++++++++++++++ application/views/info_subgroep.php | 29 ++++++++++++ application/views/info_subgroepen.php | 46 ++++++++++++++++++ 4 files changed, 186 insertions(+) create mode 100644 application/controllers/Info.php create mode 100644 application/models/Info_model.php create mode 100644 application/views/info_subgroep.php create mode 100644 application/views/info_subgroepen.php 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 @@
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
Nummernummer; ?>
Themanaamthemanaam; ?>
Naamnaam; ?>
Groepsnaamgroepsnaam; ?>
Plaatsplaats; ?>
+
+
\ 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 @@ +
+
+ + + + + +

+

+
+ +
+
+

+

+

+
+ +
+
+

+ + + + + +

+

+
+ Er zijn geen groepen te vinden. +
+
+

+

+

+
+ +
+
+

+ + + +
\ No newline at end of file