-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathView.php
63 lines (56 loc) · 1.69 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
<?php
/**
* Bread PHP Framework (http://github.com/saiv/Bread)
* Copyright 2010-2012, SAIV Development Team <[email protected]>
*
* Licensed under a Creative Commons Attribution 3.0 Unported License.
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2010-2012, SAIV Development Team <[email protected]>
* @link http://github.com/saiv/Bread Bread PHP Framework
* @package Bread
* @since Bread PHP Framework
* @license http://creativecommons.org/licenses/by/3.0/
*/
namespace Bread;
use Bread\L10n\Locale;
use Bread\View\Helpers\HTML;
use Bread\Networking\HTTP\Request;
use Bread\Networking\HTTP\Response;
use Bread\Configuration;
abstract class View {
protected $request;
protected $response;
public function __construct(Request $request, Response $response) {
$this->request = $request;
$this->response = $response;
}
public function compose(HTML\Page $page) {
foreach ($page('[data-bread-block]') as $block) {
}
foreach ($this->response->messages as $severity => $messages) {
foreach ($messages as $message) {
switch ($severity) {
case LOG_INFO:
$class = 'alert.alert-info';
break;
case LOG_NOTICE:
$class = 'alert.alert-success';
break;
case LOG_WARNING:
$class = 'alert';
break;
case LOG_ERR:
$class = 'alert.alert-error';
break;
}
$page('[data-bread-messages]')->append("div.$class", $message);
}
}
return $page;
}
public static function get($key = null) {
$class = get_called_class();
return Configuration\Manager::get($class, $key);
}
}