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

class Dashboard extends CI_Controller
{
	public $viewFolder = "";
    //public $user;

	public function __construct()
    {
        parent::__construct();
        $this->viewFolder = "dashboard_v";
        //$this->user = get_active_user();

        if (!get_active_user()){
            redirect(base_url("panel/login"));
        }
    }

    public function index()
	{
        $viewData = new stdClass();

        $this->load->model('dashboard_model');
        $urunsayisi = $this->dashboard_model->countRow("urunler");

        $this->load->model("products_model");
        $items = $this->products_model->get_all
        (
            array(), "rank ASC"
        );

        $viewData->viewFolder = $this->viewFolder;
        $viewData->viewTitle = "Ana Sayfa";
        $viewData->urunsayisi = $urunsayisi;
        $viewData->items = $items;
        //$viewData->subViewFolder = "list";

        $this->load->view("{$viewData->viewFolder}/index", $viewData);
	}
}
