-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwarning.php
More file actions
174 lines (151 loc) · 4.67 KB
/
Copy pathwarning.php
File metadata and controls
174 lines (151 loc) · 4.67 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<?php
if(!defined('INITIALIZED'))
exit;
class Warning
{
private $notificationId = '';
private $notificationText = 'no text';
private $notificationType = Warnings::TYPE_ERROR;
private $notificationTitle = '';
private $notificationDismissable = 'false';
private $notificationVertical = Warnings::LOCATION_VERTICAL_BOTTOM;
private $notificationHorizontal = Warnings::LOCATION_HORIZONTAL_RIGHT;
private $notificationIcon = '';
private $notificationDelay = 0;
private $notificationTypeString = '';
public function __construct($id = null, $text = null, $type = null, $title = null, $Dismissable = null, $vertical = null, $horizontal = null, $delay = null)
{
if(isset($id))
$this->notificationId = $id;
if(isset($text))
$this->notificationText = $text;
if(isset($type)){
$this->notificationType = $type;
switch($type){
case Warnings::TYPE_ERROR:
$this->notificationIcon = "glyphicon glyphicon-remove";
$this->notificationTypeString = "danger";
break;
case Warnings::TYPE_SUCCESS:
$this->notificationIcon = "glyphicon glyphicon-ok";
$this->notificationTypeString = "success";
break;
case Warnings::TYPE_WARNING:
$this->notificationIcon = "glyphicon glyphicon-exclamation-sign";
$this->notificationTypeString = "warning";
break;
case Warnings::TYPE_NOTICE:
$this->notificationIcon = "glyphicon glyphicon-list";
$this->notificationTypeString = "info";
break;
}
if(!isset($title)){
switch($type){
case Warnings::TYPE_ERROR:
$this->notificationTitle = "Erro";
break;
case Warnings::TYPE_SUCCESS:
$this->notificationTitle = "Sucesso";
break;
case Warnings::TYPE_WARNING:
$this->notificationTitle = "Aviso";
break;
case Warnings::TYPE_NOTICE:
$this->notificationTitle = "Informação";
break;
}
}
}
if(isset($title))
$this->notificationTitle = $title;
if(isset($Dismissable))
$this->notificationDismissable = $Dismissable;
if(isset($vertical))
$this->notificationVertical = $vertical;
if(isset($horizontal))
$this->notificationHorizontal = $horizontal;
if(isset($delay))
$this->notificationDelay = $delay;
}
public function getId()
{
return $this->notificationId;
}
public function getText()
{
return addslashes($this->notificationText);
}
public function setDelay($notificationDelay)
{
$this->notificationDelay = $notificationDelay;
}
public function getDelay()
{
return $this->notificationDelay;
}
public function setIcon($notificationIcon)
{
$this->notificationIcon = $notificationIcon;
}
public function getIcon()
{
return $this->notificationIcon;
}
public function getType()
{
return $this->notificationType;
}
public function setTitle($notificationTitle)
{
$this->notificationTitle = $notificationTitle;
}
public function getTitle()
{
return addslashes($this->notificationTitle);
}
public function setDismissable($notificationDismissable)
{
$this->notificationDismissable = $notificationDismissable;
}
public function getDismissable()
{
return $this->notificationDismissable;
}
public function setVertical($notificationVertical)
{
$this->notificationVertical = $notificationVertical;
}
public function getVertical()
{
return $this->notificationVertical;
}
public function setHorizontal($notificationHorizontal)
{
$this->notificationHorizontal = $notificationHorizontal;
}
public function getHorizontal()
{
return $this->notificationHorizontal;
}
public function getFormattedText()
{
return "
$.growl( {
title: '".$this->getTitle()."',
icon: '".$this->getIcon()."',
message: '".$this->getText()."',
}, {
allow_dismiss: '".$this->getDismissable()."',
position: {
from: '".$this->getVertical()."',
align: '".$this->getHorizontal()."'
},
delay: ".$this->getDelay().",
type: '".$this->notificationTypeString."',
template: {
title_divider: \"<hr class='separator' />\"
},
});
";
}
}