forked from maniaplanet/manialib
/
View.php
64 lines (52 loc) · 1.24 KB
/
View.php
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
56
57
58
59
60
61
62
63
64
<?php
/**
* ManiaLib - Lightweight PHP framework for Manialinks
*
* @see http://code.google.com/p/manialib/
* @copyright Copyright (c) 2009-2011 NADEO (http://www.nadeo.com)
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version $Revision$:
* @author $Author$:
* @date $Date$:
*/
namespace ManiaLib\Application;
abstract class View
{
/**
* @var \ManiaLib\Application\Request
*/
protected $request;
/**
* @var \ManiaLib\Application\Response
*/
protected $response;
/**
* @var \ManiaLib\Application\Session
*/
protected $session;
final function __construct()
{
$this->request = Request::getInstance();
$this->response = Response::getInstance();
$this->session = Session::getInstance();
$this->onConstruct();
}
final protected function renderSubView($viewName)
{
$className = get_class($this);
$className = explode('\\', $className);
array_pop($className);
array_push($className, ucfirst($viewName));
$className = implode('\\', $className);
Rendering\Manialink::render($className);
}
final protected function render($viewName)
{
Rendering\Manialink::render($viewName);
}
protected function onConstruct()
{
}
abstract function display();
}
?>