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

class Sosialisasi extends CI_Controller {

	public function __construct()
	{
		parent::__construct();
		$this->load->model('setting_model');		
		//proteksi halaman
		$this->simple_login->check_login();

	}

	//Main page biodata
	public function index()
	{	 
		$sosialisasi = $this->setting_model->sosialisasi();

		$data = array(	'title'			=> 'Aplikasi PPDB MTD - Pengaturan Sosialisasi Tes Akademik & BTQ',
					  	'sosialisasi'	=> $sosialisasi,
						'content' 		=> 'sosialisasi/edit'
					);
		$this->load->view('layout/wrapper', $data, FALSE);	
	}

	//Edit Pengaturan
	public function edit()
	{
		
		//validasi input
		$valid = $this->form_validation;
		//check nama
		$valid->set_rules('tempat','Pilih Tombol','required',
			array( 'required'		=> '%s Edit Tempat'));
		
		//jika sudah dicek dan error
		if($valid->run()===FALSE) {
		//end validasi

			$data= array(	'title'		=> 'Edit Data Sosialisasi',
						  	'content' 	=> 'sosialisasi/edit'
						);
			$this->load->view('layout/wrapper', $data, FALSE);	
		//jika validasi oke, masuk database
		}else{
			$inp  = $this->input;
			$data = array(	
              				'tanggal'		=> date('Y-m-d',strtotime($inp->post('tanggal'))),
							'waktu'			=> $inp->post('waktu'),
							'tempat'		=> $inp->post('tempat')							
						);
			//proses oleh model
			$this->setting_model->edit6($data);

			//notifikasi dan redirect
			$this->session->set_flashdata('sukses', 'Pengaturan Sosialisasi Tes Berhasil di Update.');
			redirect(base_url('sosialisasi'),'refresh');
		}
		//end masuk database
	}
}

/* End of file biodata.php */
/* Location: ./application/controllers/biodata.php */