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

class Home extends CI_Controller {
    private $isLoggedIn;
    function __construct(){
        parent::__construct();
        $this->load->model('global_model', 'global_m');
        $this->isLoggedIn = $this->session->userdata('is_logged_in');
    }

    function index(){
        if(!$this->isLoggedIn){
            redirect('login');
        }

        $this->load->view('homepage');
    }

    function getDataDashboardJson(){
        chekLoggedInAndAjaxReq();
        $response = $this->global_m->getDataForHompage();
        echo json_encode($response);
    }

}
