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

	function simpan_misi(){
		$misi=strip_tags($this->input->post('xmisi'));
		$this->m_misi->simpan_misi($misi);
		echo $this->session->set_flashdata('msg','success');
		redirect('admin/misi');
	}

	function update_misi(){
		$kode=strip_tags($this->input->post('kode'));;
		$misi=strip_tags($this->input->post('xmisi'));
		$this->m_misi->update_misi($kode,$misi);
		echo $this->session->set_flashdata('msg','info');
		redirect('admin/misi');
	}
	function hapus_misi(){
		$kode=strip_tags($this->input->post('kode'));
		$this->m_misi->hapus_misi($kode);
		echo $this->session->set_flashdata('msg','success-hapus');
		redirect('admin/misi');
	}

}