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

class Main extends MY_Controller {

	public function __construct(){
		parent::__construct();
		$logged_in = $this->session->userdata("logged_in");
		$this->load->vars(array(
			"logged_in"=>$logged_in
		));
	}
	public function index(){
  		show_404();
  	}
	public function search(){
		$logged_in = $this->session->userdata("logged_in");
		if(!empty($logged_in)){
			$int = $this->load->database("other", TRUE);
			$datos['suc'] = $int->select('Nombre')->from('Sucursal')->where(['Sucursal' => $logged_in['sucursal_int'], 'Estatus' => 'ALTA'])->get()->row_array();
			$datos['suc'] = isset($datos['suc']) ? $datos['suc'] : 'N/A';
			$data['contenido'] = $this->load->view("buscador",'',true);
			$data['scripts'] = $this->load->view("scripts",'',true);
			$data['navbar'] = $this->load->view('navbar',$datos, true);
			$this->load->view("base", $data);
		}else{
			$data['contenido'] = $this->load->view("login",'',true);
			$data['scripts'] = $this->load->view('scripts','',true);
			$data['navbar'] = $this->load->view('navbar2','', true);
        	$this->load->view("base", $data);
		}
	}
	public function forbidden()
	{
		$this->load->view('forbidden');
	}
	
}
