50 lines
1021 B
PHP
50 lines
1021 B
PHP
<?php
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class AktifAbsen extends CI_Controller {
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->model("UserModel");
|
|
$this->load->model("AbsenModel");
|
|
|
|
|
|
if($this->UserModel->isNotLogin()) {
|
|
redirect(site_url('login'));
|
|
} elseif(!($this->UserModel->isAdmin())) {
|
|
redirect(site_url('dashboard'));
|
|
}
|
|
|
|
$get = $this->input->get();
|
|
if($get['id_absen']==NULL){
|
|
redirect(site_url('admin/daftarabsen'));
|
|
}
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
|
|
|
|
$get = $this->input->get();
|
|
|
|
$count = $this->AbsenModel->getOpenAbsenCount();
|
|
|
|
if($count>0){
|
|
$daftaropenabsen = $this->AbsenModel->getOpenAbsen();
|
|
foreach($daftaropenabsen as $openabsen){
|
|
$this->AbsenModel->setCloseAbsen($openabsen->id_absen);
|
|
}
|
|
$this->AbsenModel->setOpenAbsen($get['id_absen']);
|
|
} else {
|
|
$this->AbsenModel->setOpenAbsen($get['id_absen']);
|
|
|
|
}
|
|
|
|
redirect(site_url('admin/absensi'));
|
|
|
|
}
|
|
|
|
|
|
}
|