diff --git a/application/controllers/Edit.php b/application/controllers/Edit.php new file mode 100644 index 0000000..842c58b --- /dev/null +++ b/application/controllers/Edit.php @@ -0,0 +1,58 @@ +session->userdata('validated')){ + redirect(base_url('/login')); + } + if (! ($this->session->admin == '1' OR $this->session->superadmin == '1')) { + redirect(base_url('/dashboard')); + } + } + + public function index() + { + $data['page'] = 'edit'; + + // Get data + $this->load->model('Edit_model'); + $lijsten = $this->Edit_model->get_lijst(); + + // Prepare data + $data['lijsten'] = $lijsten; + + // Header + $this->load->view('header', $data); + + // lijst list page + $this->load->view('edit_lijst', $data); + + // Footer + $this->load->view('footer'); + } + + public function enable($lijstid) + { + $this->load->model('Edit_model'); + $this->Edit_model->change_lijst($lijstid, '1'); + + redirect(base_url('edit/')); + } + + public function disable($lijstid) + { + $this->load->model('Edit_model'); + $this->Edit_model->change_lijst($lijstid, '0'); + + redirect(base_url('edit/')); + } + +} \ No newline at end of file diff --git a/application/models/Edit_model.php b/application/models/Edit_model.php new file mode 100644 index 0000000..1fc4c7d --- /dev/null +++ b/application/models/Edit_model.php @@ -0,0 +1,39 @@ +db->select('id, naam, actief'); + $this->db->from('lijst'); + $this->db->where('jaar', date('Y')); + $this->db->where('regioid', $this->session->regio); + $this->db->order_by('naam', 'ASC'); + + $query = $this->db->get(); + + return $query->result_array(); + } + + public function change_lijst($id, $val) + { + $data = array( + 'actief' => $val + ); + $this->db->where('id', $id); + $this->db->where('regioid', $this->session->regio); + $this->db->where('jaar', date('Y')); + $this->db->update('lijst', $data); + } + +} \ No newline at end of file diff --git a/application/views/edit_lijst.php b/application/views/edit_lijst.php new file mode 100644 index 0000000..7881b48 --- /dev/null +++ b/application/views/edit_lijst.php @@ -0,0 +1,30 @@ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
NaamAanpassenActief
+
+
\ No newline at end of file diff --git a/application/views/header.php b/application/views/header.php index 0277185..b8efcc6 100644 --- a/application/views/header.php +++ b/application/views/header.php @@ -29,6 +29,7 @@
  • class="active" >Beoordelen
  • session->admin == '1' OR $this->session->superadmin == '1') { ?>
  • class="active" >Uitslag
  • +
  • class="active" >Aanpassen
  • class="active" >Informatie
  • session->admin == '1' OR $this->session->superadmin == '1') { ?>