This is the API documentation for concrete5 version 5.6 and earlier. View Current API Documentation
 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 
<?php
defined('C5_EXECUTE') or die("Access Denied.");

class Concrete5_Controller_Dashboard_System_Environment_Logging extends DashboardBaseController{
    /**
    * Dasboard page view
    *
    * @param string $strStatus - Result of attempting to update logging settings
    * @return void
    */      
    public function view($strStatus = false){
        $strStatus = (string) $strStatus;
        $intLogErrors = Config::get('ENABLE_LOG_ERRORS') == 1 ? 1 : 0;
        $intLogEmails = Config::get('ENABLE_LOG_EMAILS') == 1 ? 1 : 0;
        
        $this->set('fh', Loader::helper('form'));
        $this->set('intLogErrors', $intLogErrors);
        $this->set('intLogEmails', $intLogEmails);
        
        if($strStatus == 'logging_saved'){
            $this->set('message', t('Logging configuration saved.'));
        }                   
    }
    
    
    /**
    * Updates logging settings
    *
    * @return void
    */      
    public function update_logging(){
        if($this->token->validate('update_logging')){
            if($this->isPost()){
                $intLogErrorsCurrent = Config::get('ENABLE_LOG_ERRORS') == 1 ? 1 : 0;
                $intLogEmailsCurrent = Config::get('ENABLE_LOG_EMAILS') == 1 ? 1 : 0;               
                
                $intLogErrorsPost = $this->post('ENABLE_LOG_ERRORS') == 1 ? 1 : 0;
                $intLogEmailsPost = $this->post('ENABLE_LOG_EMAILS') == 1 ? 1 : 0;
                
                // If there was no change simply reload this page
                if($intLogErrorsCurrent == $intLogErrorsPost && $intLogEmailsCurrent == $intLogEmailsPost){
                    $this->redirect('/dashboard/system/environment/logging');
                }
                                
                Config::save('ENABLE_LOG_ERRORS', $intLogErrorsPost);
                Config::save('ENABLE_LOG_EMAILS', $intLogEmailsPost);
                
                $this->redirect('/dashboard/system/environment/logging', 'logging_saved');
            }
        }else{
            $this->set('error', array($this->token->getErrorMessage()));
        }
    }   
}
?>