<?php

/**
model class name  = Job
form-id  == job
*/

class DefaultController 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('index', 'fullScreen'),
            	'expression' => AccessManager::checkSessionPermission($this->module->name),
            		
            ),
            array('deny',  // deny all users
                'users' => array('*'),
            ),
        );
    }

    public function actionIndex()
    {
        $this->render('index',array());
    }
    
    public function actionFullScreen()
    {
        $this->layout = '//layouts/clean';
        $this->render('index', array());
    }

    public function getCurrentLogLevelTitle(){
        if(!isset($_COOKIE['PhonalisaActiveLogLevel'])){
            return __('SYSTEM_LOG_VIEWER_LOG_LEVEL_DEBUG');
        }

        switch($_COOKIE['PhonalisaActiveLogLevel']){
            case 0:
                return __('SYSTEM_LOG_VIEWER_LOG_LEVEL_DEBUG');
            case 1:
                return __('SYSTEM_LOG_VIEWER_LOG_LEVEL_VERBOSE');
            case 2:
                return __('SYSTEM_LOG_VIEWER_LOG_LEVEL_WARNING');
            case 3:
                return __('SYSTEM_LOG_VIEWER_LOG_LEVEL_ERROR');
            default:
                return __('SYSTEM_LOG_VIEWER_LOG_LEVEL_DEBUG');
        }

    }

}
