|
|
|
<?php
|
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Logout Class
|
|
|
|
*/
|
|
|
|
class Dashboard extends CI_Controller
|
|
|
|
{
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
if(! $this->session->userdata('validated')){
|
|
|
|
redirect(base_url('/login'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function index()
|
|
|
|
{
|
|
|
|
if ($this->session->admin == '1' OR $this->session->superadmin == '1') {
|
|
|
|
redirect(base_url('/dashboard/admin'));
|
|
|
|
} else {
|
|
|
|
redirect(base_url('/dashboard/user'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function admin()
|
|
|
|
{
|
|
|
|
$data['page'] = 'home';
|
|
|
|
|
|
|
|
// Header
|
|
|
|
$this->load->view('header', $data);
|
|
|
|
|
|
|
|
// login page
|
|
|
|
//$this->load->view('dashboard_user', $data);
|
|
|
|
|
|
|
|
// Footer
|
|
|
|
$this->load->view('footer');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function user()
|
|
|
|
{
|
|
|
|
$data['page'] = 'home';
|
|
|
|
|
|
|
|
// Header
|
|
|
|
$this->load->view('header', $data);
|
|
|
|
|
|
|
|
// login page
|
|
|
|
$this->load->view('dashboard_user', $data);
|
|
|
|
|
|
|
|
// Footer
|
|
|
|
$this->load->view('footer');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function changeregio()
|
|
|
|
{
|
|
|
|
if (! $this->session->superadmin == '1') {
|
|
|
|
redirect(base_url('/dashboard'));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set new regionaam in session
|
|
|
|
if ($this->security->xss_clean($this->input->post('regioid'))) {
|
|
|
|
$this->session->set_userdata('regio', $this->security->xss_clean($this->input->post('regioid')));
|
|
|
|
// Load model
|
|
|
|
$this->load->model('Regio_model');
|
|
|
|
$regionaam = $this->Regio_model->get_regio($this->security->xss_clean($this->input->post('regioid')));
|
|
|
|
$this->session->set_userdata('regionaam', $regionaam);
|
|
|
|
redirect(base_url('/dashboard'));
|
|
|
|
}
|
|
|
|
|
|
|
|
$data['page'] = 'regio';
|
|
|
|
|
|
|
|
// Load model
|
|
|
|
$this->load->model('Regio_model');
|
|
|
|
$regios = $this->Regio_model->get_regio_list();
|
|
|
|
|
|
|
|
// Arrange data
|
|
|
|
foreach ($regios as $regio) {
|
|
|
|
$data['regio'][$regio['id']] = $regio['naam'];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Header
|
|
|
|
$this->load->view('header', $data);
|
|
|
|
|
|
|
|
// login page
|
|
|
|
$this->load->view('sa_changeregio', $data);
|
|
|
|
|
|
|
|
// Footer
|
|
|
|
$this->load->view('footer');
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|