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

class dashboard extends CI_Controller
{

    public function __construct()
    {
        setlocale(LC_ALL, 'id_ID.utf8');
        parent::__construct();
        $this->load->library('form_validation');
        $this->load->model('Tambah_ruta_model', 'ruta', true);

        // $this->load->model('user_model', '', true);

        is_login();
        // is_admin();
    }
    public function index()
    {
        $data['pengguna'] = $this->db->get_where('dc_pengguna', ['email' => $this->session->userdata('email')])->row_array();
        // $data['pgn'] = $this->ruta->getpengguna();
        $data['countagt'] = $this->ruta->countagt();
        $data['countluas'] = $this->ruta->countluas10();
        $data['median'] = $this->ruta->calculate_median();
        // var_dump($data['countluas']);
        // var_dump($data['median']);
        $this->load->view('templates/main_header', $data);
        $this->load->view('templates/main_navbar', $data);
        $this->load->view('templates/main_sidebar', $data);
        $this->load->view('dashboard', $data);
        // $this->load->view('templates/main_footer', $data);
        $this->load->view('templates/script_dashboard', $data);
    }
}
