add application Controller
This commit is contained in:
parent
3fca3cab9b
commit
24f97d7c94
3 changed files with 86 additions and 1 deletions
85
app/Controller.inc
Normal file
85
app/Controller.inc
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z;
|
||||
|
||||
|
||||
/**
|
||||
* Abstract class for implementing an application Controller.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
abstract class Controller extends \nre\core\Controller
|
||||
{
|
||||
/**
|
||||
* Linker instance
|
||||
*
|
||||
* @var Linker
|
||||
*/
|
||||
protected $linker = null;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new application Controller.
|
||||
*
|
||||
* @throws DriverNotFoundException
|
||||
* @throws DriverNotValidException
|
||||
* @throws ModelNotValidException
|
||||
* @throws ModelNotFoundException
|
||||
* @throws ViewNotFoundException
|
||||
* @param string $layoutName Name of the current Layout
|
||||
* @param string $action Current Action
|
||||
* @param Agent $agent Corresponding Agent
|
||||
*/
|
||||
public function __construct($layoutName, $action, $agent)
|
||||
{
|
||||
parent::__construct($layoutName, $action, $agent);
|
||||
|
||||
// Set timezone
|
||||
date_default_timezone_set(\nre\configs\AppConfig::$app['timeZone']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Prefilter that is executed before running the Controller.
|
||||
*
|
||||
* @param Request $request Current request
|
||||
* @param Response $response Current response
|
||||
*/
|
||||
public function preFilter(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
parent::preFilter($request, $response);
|
||||
|
||||
// Create linker
|
||||
$this->linker = new \nre\core\Linker($this->request);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prefilter that is executed after running the Controller.
|
||||
*
|
||||
* @param Request $request Current request
|
||||
* @param Response $response Current response
|
||||
*/
|
||||
public function postFilter(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
parent::postFilter($request, $response);
|
||||
|
||||
// Set title
|
||||
$this->set('title', $this->request->getParam(1, 'intermediate'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class ErrorController extends \nre\core\Controller
|
||||
class ErrorController extends \hhu\z\Controller
|
||||
{
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue