-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWebPage.php
117 lines (100 loc) · 3.14 KB
/
WebPage.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
declare(strict_types=1);
/**
* This file is part of the EaseTWBootstrap3 package
*
* https://github.com/VitexSoftware/php-ease-twbootstrap
*
* (c) Vítězslav Dvořák <http://vitexsoftware.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Ease\TWB;
/**
* Stránka TwitterBootstrap.
*
* @author Vítězslav Dvořák <[email protected]>
* @copyright 2012-2018 [email protected] (G)
*
* @see http://twitter.github.com/bootstrap/index.html
*/
class WebPage extends \Ease\WebPage
{
/**
* Where to look for bootstrap stylesheet.
*
* @var string path or url
*/
public string $bootstrapCSS = 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css';
/**
* Where to look for bootstrap stylesheet theme.
*
* @var string path or url
*/
public string $bootstrapThemeCSS = 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css';
/**
* Where to look for bootstrap stylesheet scripts.
*
* @var string path or url
*/
public string $bootstrapJavaScript = 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js';
/**
* Stránka s podporou pro twitter bootstrap.
*
* @param string $pageTitle
*/
public function __construct($pageTitle = null)
{
parent::__construct($pageTitle);
Part::twBootstrapize();
$this->head->addItem(
'<meta name="viewport" content="width=device-width,initial-scale=1.0">',
);
}
/**
* Vrací zprávy uživatele.
*
* @param string $what info|warning|error|success
*
* @return string html of status messages
*/
public function getStatusMessagesAsHtml($what = null)
{
/*
* Session Singleton Problem hack
*/
if (empty(\Ease\Shared::singleton()->statusMessages)) {
return '';
}
$htmlFargment = '';
$allMessages = [];
foreach (\Ease\Shared::singleton()->statusMessages as $quee => $messages) {
foreach ($messages as $msgID => $message) {
$allMessages[$msgID][$quee] = $message;
}
}
foreach ($allMessages as $messages) {
$messageType = key($messages);
if (\is_array($what)) {
if (!\in_array($messageType, $what, true)) {
continue;
}
}
foreach ($messages as $message) {
if (\is_object($this->logger)) {
if (!isset($this->logger->logStyles[$messageType])) {
$messageType = 'notice';
}
if ($messageType === 'error') {
$messageType = 'danger';
}
$htmlFargment .= '<div class="alert alert-'.$messageType.'" >'.$message."</div>\n";
} else {
$htmlFargment .= '<div class="alert">'.$message."</div>\n";
}
}
}
return $htmlFargment;
}
}