<?php

class Lp_data_master extends CI_Controller {
    
//-----------start variables for check action access----------//
    public $vartambah   = null;
    public $varedit     = null;
    public $vardelete   = null;
    public $varview     = null;

    public $parent      = 'DATA MASTER';
    //public $title       = 'REPORT';
    public $link        = 'Lp_data_master';
    public $index       = 'index.php/Lp_data_master';
    public $maincontent = 'datamaster/';
    public $idmenu      = '25';

//-----------start variables for check action access----------//
    
    function __construct(){
		parent::__construct();
		$this->check_isvalidated();
        $this->load->helper(array('form', 'date'));        
	}
    private function check_isvalidated(){
	   if(! $this->session->userdata('validated')){
	       redirect('index.php/ps_login');
        }
//--------------start check access this form page-------------//
        $this->db->where('am_fk_rolegroup_id', $this->session->userdata('s_IDRoleGroup'));
        $this->db->where('am_fk_menu_id', $this->idmenu);
        $this->db->where('am_access', 1);
        $cekMenu = $this->db->get('access_menu');
        $rowcount = $cekMenu->num_rows();
        if($rowcount==0){
            redirect('index.php');
        }else{
            foreach ($cekMenu->result() as $cm)
                {
                    $this->vartambah= $cm->am_create;
                    $this->varedit  = $cm->am_edit;
                    $this->vardelete= $cm->am_delete;
                    $this->varview  = $cm->am_view;
                }
        }
//--------------end check access this form page-------------//
    }

//----------------------------------------------------------------ORGANISASI
    public function organisasi(){
        $data['title']          = "ORGANISASI";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link."/organisasi";
        $data['main_content']   = $this->maincontent."/organisasi/v_organisasi";
        
        $this->load->model('m_satu_data_master');
        $organisasi = $this->m_satu_data_master->organisasigr1();
        $this->load->vars('org1', $organisasi);

        $this->load->model('m_satu_data_master');
        $organisasi = $this->m_satu_data_master->organisasigr2();
        $this->load->vars('org2', $organisasi);

        $this->load->view('includes/template', $data);
    }

    public function lokasi_ruang(){
        $data['title']          = "LOKASI RUANG";
        $data['parent']         = $this->parent;
        $data['link']           = $this->link."/lokasi_ruang";
        $data['main_content']   = $this->maincontent."/lokasi_ruang/v_lokasi_ruang";
        
        $this->load->model('m_satu_data_master');
        $lokasiruang = $this->m_satu_data_master->lokasiruang();
        $this->load->vars('lrgr', $lokasiruang);

        $this->load->model('m_satu_data_master');
        $lokasiruang = $this->m_satu_data_master->lokasiruanggr1();
        $this->load->vars('lrgr1', $lokasiruang);

        $this->load->model('m_satu_data_master');
        $lokasiruang = $this->m_satu_data_master->lokasiruanggr2();
        $this->load->vars('lrgr2', $lokasiruang);

        $this->load->model('m_satu_data_master');
        $lokasiruang = $this->m_satu_data_master->lokasiruanggr3();
        $this->load->vars('lrgr3', $lokasiruang);

        $this->load->model('m_satu_data_master');
        $lokasiruang = $this->m_satu_data_master->lokasiruanggr4();
        $this->load->vars('lrgr4', $lokasiruang);

        $this->load->model('m_satu_data_master');
        $lokasiruang = $this->m_satu_data_master->lokasiruanggr5();
        $this->load->vars('lrgr5', $lokasiruang);

        $this->load->view('includes/template', $data);
    }
}

?>