bbone/application/modules/Dashboard/controllers/Dashboard.php
2023-06-24 16:02:54 +05:30

84 lines
2.5 KiB
PHP

<?php defined('BASEPATH') or exit('No direct script access allowed');
/**
* AMS
*
* @package HMVC
* @author Venba
* @copyright 2022 Venba
* @license https://venbainfotech.com/licenses/MIT MIT License
* @link <URI> (description)
* @version GIT: $Id$
* @since Version 0.0.1
* @filesource
*
*/
class Dashboard extends Admin_Controller
{
/**
* [__construct description]
*
* @method __construct
*/
public function __construct()
{
// To inherit directly the attributes of the parent class.
parent::__construct();
### Syntax : $this->load->model('Model Path' , 'Alias name');
### The second parameter (optional) is used to call the method.
$this->load->model('Dashboard_model','Dashboard_model');
}
/**
* [index description]
*
* @method index
*
* @return [type] [description]
*/
public function index()
{
if(is_admin() || is_user())
{
$asset_count = $this->Dashboard_model->get_assets_count(user()->business_id);
$this->layout->set('asset_count', $asset_count);
$user_count = $this->Dashboard_model->get_users_count(user()->business_id);
$this->layout->set('user_count', $user_count);
$amc_count = $this->Dashboard_model->get_amc_count(user()->business_id);
$this->layout->set('amc_count', $amc_count);
$expired_amc_count = $this->Dashboard_model->get_expired_amc_count(user()->business_id);
$this->layout->set('expired_amc_count', $expired_amc_count);
$insurance_count = $this->Dashboard_model->get_insurance_count(user()->business_id);
$this->layout->set('insurance_count', $insurance_count);
$expired_insurance_count = $this->Dashboard_model->get_expired_insurance_count(user()->business_id);
$this->layout->set('expired_insurance_count', $expired_insurance_count);
$amc = $this->Dashboard_model->get_amc(user()->business_id);
$this->layout->set('amc', $amc);
$insurence = $this->Dashboard_model->get_insurence(user()->business_id);
$this->layout->set('insurence', $insurence);
}
else if(is_superadmin())
{
$user_count = $this->Dashboard_model->get_user_count_for_sadmin();
$this->layout->set('user_count', $user_count);
$business_count = $this->Dashboard_model->get_business_count();
$this->layout->set('business_count', $business_count);
}
$this->layout->buffer('main_content', 'Dashboard/dashboard');
$this->layout->render('default_layout');
}
}