<?php

class Dashboard extends CI_Controller {

    public $layout = 'full';
    public $module = 'dashboard';
    public $model = 'users';

    public function __construct()
    {
        // $this->load does not exist until after you call this
        parent::__construct(); // Construct CI's core so that you can use it

//        $this->load->database();
//        $this->load->helper('language');
//        $this->load->library('session');
        $this->load->model('at-admin/Security','security_model');
         //require_once(APPPATH.'controllers/admin/Security.php'); //include controller
            //$security = new Security();  //create object 
            //$security->permission(); //call function    

        //check user have login or not
        $this->security_model->admin($this->session->userdata('session_id'),$this->session->userdata('user_id'),$this->session->userdata('username'));
        //end check user have login or not

        $this->load->model('at-admin/Landingcontentmultistyle_Model','landingontentmultistyle_model');
        $this->load->model('at-admin/Formsubmit_Model','formsubmit_model');
        $this->load->model('at-admin/Blog_list_Model','blog_list_model');
    }

    public function index() {


        

        $user_id=$this->session->userdata('user_id');
        // echo "user id";
        // echo $user_id;
         // if (!$this->session->userdata('user_id')){
         //    redirect('admin/login');
         // }
            


        //$this->permission();
        $data['users'] = $this->db->get('_users')->num_rows();
        $data['selectedmenu']="";
        // $data['categories'] = $this->db->get('categories')->num_rows();
        // $data['services'] = $this->db->get('services')->num_rows();
        // $data['projects'] = $this->db->get('projects')->num_rows();
        // $data['blog'] = $this->db->get('blog')->num_rows();
        // $data['testimonials'] = $this->db->get('testimonials')->num_rows();
        // $data['visitors'] = config('visitors');
        $data['countLandingPage']=$this->landingontentmultistyle_model->countNumOfLandingContent();
        $data['countMainPage']=$this->landingontentmultistyle_model->countNumOfMainContent();
        $data['countFormsubmit']=$this->formsubmit_model->countNumOfFormsubmit();
        $data['countBlog']=$this->blog_list_model->countNumOfBlog();
        $this->load->view('at-admin/'.$this->module, $data);
    }

}

?>