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

class Pengaturan extends CI_Controller 
{
	public function __construct() 
	{
        parent::__construct();
		$this->load->model('M_admin');
		$this->load->model('M_daftar');
    }
	
	public function index()
	{
		if($this->session->userdata('admin'))
		{
			$data['act1']		= "";
			$data['act2']		= "";
			$data['act3']		= "";
			$data['act4']		= "";
			$data['act5']		= "active";
			$data['act6']		= "";
			$data['pengaturan']	= $this->M_daftar->getTenggat();
			// print_r($data['calon_siswa']);die();
			$this->load->view('header',$data);
			$this->load->view('pengaturan',$data);
			$this->load->view('footer');
		}
		else
		{
			$this->session->set_flashdata('msg', 
					'<div class="alert alert-danger">
						<center>
							<h4>Maaf!</h4>
							<p>Anda belum login. Silakan login terlebih dahulu!</p>
						</center>
					</div>');	
			redirect('admin/Login');
		}
	}
	
	public function edit()
	{
		if($this->session->userdata('admin'))
		{
			$data['tenggat']		= $this->input->post('tenggat');
			$data['ppdb']		= $this->input->post('ppdb');
			$this->M_daftar->updateTenggat($data);
			redirect('admin/Pengaturan','refresh');
		}
		else
		{
			$this->session->set_flashdata('msg', 
					'<div class="alert alert-danger">
						<center>
							<h4>Maaf!</h4>
							<p>Anda belum login. Silakan login terlebih dahulu!</p>
						</center>
					</div>');	
			redirect('admin/Login');
		}
	}
}
