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

class Identitas extends CI_Controller {
	function __construct() {
		parent::__construct();
		if($this->session->userdata('admin_valid') == FALSE && $this->session->userdata('admin_id') == ""){
          redirect("admin/login");
       }
	   $this->load->model('model_identitas');
	}
	
	function index(){
	$id	= addslashes($this->input->post('idp'));
	if (isset($_POST['submit'])){
		echo "id :".$id;exit;
			$this->model_identitas->list_update();
			redirect('identitas');
		} else {
			$a['data']		= $this->db->query("SELECT * FROM identitas WHERE id_identitas = '1' LIMIT 1")->row();
			$a['page']		= "pengguna/f_pengguna";
		}
		
		$this->load->view('admin/home_menu', $a);	
	}
	function update_(){
	$id	= $this->uri->segment(2);
	//ambil variabel URL
	$mau_ke					= $this->uri->segment(3);
	//ambil variabel Postingan
		$idp					= addslashes($this->input->post('idp'));
				$cari					= addslashes($this->input->post('q'));
		
		if ($mau_ke == "act_edt") {
			$this->model_identitas->list_update();
			$this->session->set_flashdata("k", "<div class=\"alert alert-success\" id=\"alert\">Data berhasil disimpan</div>");
			redirect('identitas');
		} else {
			$a['data']		= $this->db->query("SELECT * FROM identitas WHERE id_identitas = '1' LIMIT 1")->row();
			$a['page']		= "pengguna/f_pengguna";
		}
		
		$this->load->view('admin/home_menu', $a);
	}
	function visi_misi(){
	$id	= $this->uri->segment(2);
	//ambil variabel URL
	$mau_ke					= $this->uri->segment(3);
	//ambil variabel Postingan
		$idp					= addslashes($this->input->post('idp'));
		
		$cari					= addslashes($this->input->post('q'));
		
		if ($mau_ke == "act_edt") {
			$this->model_identitas->list_update();
			$this->session->set_flashdata("k", "<div class=\"alert alert-success\" id=\"alert\">Data berhasil disimpan</div>");
			redirect('identitas');
		} else {
			$a['data']		= $this->db->query("SELECT * FROM identitas WHERE id_identitas = '1' LIMIT 1")->row();
			$a['page']		= "pengguna/f_visimisi";
		}
		
		$this->load->view('admin/home_menu', $a);
	}
}
