questlab/controllers/ErrorController.inc

51 lines
1.3 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* Questlab
*
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
* @copyright 2014 2016 Heinrich-Heine-Universität Düsseldorf
* @license http://www.gnu.org/licenses/gpl.html
* @link https://github.com/coderkun/questlab
*/
namespace hhu\z\controllers;
/**
* Controller of the Agent to show an error page.
*
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
*/
class ErrorController extends \hhu\z\Controller
{
/**
* Action: index.
*
* Set HTTP-header and print an error message.
*
* @param int $httpStatusCode HTTP-statuscode of the error that occurred
*/
public function index($httpStatusCode)
{
// Set HTTP-header
if(!array_key_exists($httpStatusCode, \nre\core\WebUtils::$httpStrings)) {
$httpStatusCode = 200;
}
$this->response->addHeader(\nre\core\WebUtils::getHttpHeader($httpStatusCode));
// Display statuscode and message
$this->set('code', $httpStatusCode);
$this->set('string', \nre\core\WebUtils::$httpStrings[$httpStatusCode]);
$this->set('userId', $this->Auth->getUserId());
}
}
?>