<?php
class Visi extends CI_Controller{
	function __construct(){
		parent::__construct();
		if($this->session->userdata('masuk') !=TRUE){
            $url=base_url('administrator');
            redirect($url);
        };
		$this->load->model('m_visi');
	}
	function index(){
		$x['data']=$this->m_visi->get_all_visi();
		$this->load->view('admin/v_visi',$x);
	}

	function simpan_visi(){
		$visi=strip_tags($this->input->post('xvisi'));
		$this->m_visi->simpan_visi($visi);
		echo $this->session->set_flashdata('msg','success');
		redirect('admin/visi');
	}

	function update_visi(){
		$kode=strip_tags($this->input->post('kode'));
		$visi=strip_tags($this->input->post('xvisi'));;
		$this->m_visi->update_visi($kode,$visi);
		echo $this->session->set_flashdata('msg','info');
		redirect('admin/visi');
	}
	function hapus_visi(){
		$kode=strip_tags($this->input->post('kode'));
		$this->m_visi->hapus_visi($kode);
		echo $this->session->set_flashdata('msg','success-hapus');
		redirect('admin/visi');
	}

}