35 lines
921 B
PHP
35 lines
921 B
PHP
<?php
|
|
defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
class Dashboard extends CI_Controller
|
|
{
|
|
|
|
function __construct()
|
|
{
|
|
parent::__construct();
|
|
|
|
$this->load->model('M_dashboard');
|
|
|
|
if ($this->session->userdata('status') != "login") {
|
|
redirect(base_url("Auth"));
|
|
}
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
$tgl = date('Y-m-d');
|
|
$bulan = date('m');
|
|
$tahun = date('Y');
|
|
|
|
$blnInt = (int)$bulan;
|
|
$thnInt = (int)$tahun;
|
|
$blnLalu = ($blnInt-1) > 0 ? ($blnInt-1) : '12';
|
|
$thnLalu = ($blnInt-1) > 0 ? $thnInt : ($thnInt-1);
|
|
|
|
$data['total_pengunjung'] = $this->M_dashboard->total_pengunjung('', '', '')->row_array()['jml'];
|
|
$data['pengunjung_bln_ini'] = $this->M_dashboard->total_pengunjung('', $bulan, $tahun)->row_array()['jml'];
|
|
$data['pengunjung_bln_lalu'] = $this->M_dashboard->total_pengunjung('', $blnLalu, $thnLalu)->row_array()['jml'];
|
|
$this->load->view('dashboard', $data);
|
|
}
|
|
}
|