<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class DaftarAbsen extends CI_Controller {

	public function __construct()
    {
		
        parent::__construct();
        $this->load->model("UserModel");
        $this->load->model("AbsenModel");
        $this->load->model("AbsensiModel");
        $this->load->model("LaporanModel");

		if($this->UserModel->isNotLogin()) {
			redirect(site_url('login'));
		} elseif(!($this->UserModel->isAdmin())) {
			redirect(site_url('dashboard'));
		} 
			
		
    }

	public function index()
	{
			$data['tahun']= date('Y');
			if($this->input->get()){
				$get = $this->input->get();
				$data['del_msg']= $get['del_msg'];
				$data['del_absen']= $get['absen'];
				$data['tahun']= $get['tahunabsen'];
			}

			if($this->input->post()){
				$post = $this->input->post();
				$data['tahun']= $post['tahun'];
			} 

			$data['tahun_list']= $this->AbsenModel->getAbsenTahun();

			$data['data_absen'] = $this->AbsenModel->getAbsensByTahun($data['tahun']);
			$data['user_logged'] = $this->session->userdata('user_logged');

			$data['model'] = $this->AbsensiModel;
			$data['laporanmodel'] = $this->LaporanModel;
			
			$this->load->view('admin/daftarabsen',$data);
		
	}

	
}
