<?php
/**
 * IMPORTANT NOTE
 * The code of this system is closed and a private proprietary of Flex Solutions.
 * A written authorization/license from Flex Solutions is required before using or modifying this code.
 * Email: sales@flexsolution.biz, Phone: +962795342585, Website: http://www.flexsolutions.biz
 */

/**
 * Backup
 * 
 * Yii module to backup, restore databse
 * 
 * @version 1.0
 * @author Shiv Charan Panjeta <shiv@toxsl.com> <shivcharan.panjeta@outlook.com>
 */
class DashboardController extends Controller
{


    /**
     * @var string the default layout for the views. Defaults to '//layouts/column2', meaning
     * using two-column layout. See 'protected/views/layouts/column2.php'.
     */
    public $layout = '//layouts/column2';

    /**
     * @return array action filters
     */
    public function filters()
    {
        return array(
            'accessControl', // perform access control for CRUD operations
        );
    }

    /**
     * Specifies the access control rules.
     * This method is used by the 'accessControl' filter.
     * @return array access control rules
     */
    public function accessRules()
    {
        return array(
            array('allow', // allow all users to perform 'index' and 'view' actions
                'actions' => array('organization', 'poss', 'configuration'),
                'roles' => array('System Admin', 'Super Admin', 'Facility Admin'),
            ),
            array('allow', // allow all users to perform 'index' and 'view' actions
                'actions' => array('reports','requests'),
                'roles' => array('System Admin', 'Super Admin', 'Finance', 'Facility Admin', 'Food Manager'),
            ),
            array('allow', // allow all users to perform 'index' and 'view' actions
                'actions' => array('help'),
                'roles' => array('System Admin', 'Super Admin', 'Finance', 'Facility Admin', 'Food Manager', 'POS Admin'),
            ),
            array('deny', // deny all users
//                 'deniedCallback' => function(){Yii::app()->getRequest()->redirect(Yii::app()->createUrl('/user/changepassword'));},
                'users' => array('*'),
            ),
        );
    }

    public function redirectToLogin()
    {
        $this->redirect('/site/login');
    }

    public function actionOrganization()
    {
        $this->render('organization', array(
        ));
    }

    public function actionConfiguration()
    {
        $this->render('configuration', array(
        ));
    }

    public function actionPoss()
    {
        $this->render('poss', array(
        ));
    }

    public function actionRequests()
    {
        $this->render('requests', array(
        ));
    }

    public function actionReports()
    {
        $this->render('reports', array(
        ));
    }

    public function actionHelp()
    {
        $this->render('help', array(
        ));
    }

}