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

class Dashboard extends MY_Controller {
	
	public function __construct()
     {
          parent::__construct();
          $this->load->library('session');
          $this->load->helper('form');
          $this->load->helper('url');
          $this->load->helper('html');
          $this->load->database();
          $this->load->library('form_validation');
          //load the models
		  $this->load->model('Xin_model');
		  $this->load->model('Dashboard_model');
     }
	
	/*Function to set JSON output*/
	public function output($Return=array()){
		/*Set response header*/
		header("Access-Control-Allow-Origin: *");
		header("Content-Type: application/json; charset=UTF-8");
		/*Final JSON response*/
		exit(json_encode($Return));
	} 
	
	public function index()
	{   
        $cookie_name = $this->Xin_model->get_cookie_name();
		$session = $this->session->userdata($cookie_name);
		
		if(!empty($session)){ 
			
		} else {
			redirect('');
		}
		
		$data = array(
			'title' => $this->Xin_model->site_title(),
			'breadcrumbs' => 'Dashboard',
			'path_url' => 'dashboard');
			$data['subview'] = $this->load->view('dashboard/index', $data, TRUE);
			$this->load->view('layout_main', $data); //page load
	}
    
}
