1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Alert.php - Interface for alert messages. |
5
|
|
|
* |
6
|
|
|
* @package jaxon-dialogs |
7
|
|
|
* @author Thierry Feuzeu <[email protected]> |
8
|
|
|
* @copyright 2016 Thierry Feuzeu <[email protected]> |
9
|
|
|
* @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License |
10
|
|
|
* @link https://github.com/jaxon-php/jaxon-core |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
namespace Jaxon\Dialog; |
14
|
|
|
|
15
|
|
|
class Alert implements Interfaces\Alert |
16
|
|
|
{ |
17
|
|
|
use Traits\Alert; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Print an alert message. |
21
|
|
|
* |
22
|
|
|
* @param string $message The text of the message |
23
|
|
|
* @param string $title The title of the message |
24
|
|
|
* |
25
|
|
|
* @return string|void |
26
|
|
|
*/ |
27
|
|
|
protected function alert($message, $title) |
|
|
|
|
28
|
|
|
{ |
29
|
|
|
if($this->getReturn()) |
30
|
|
|
{ |
31
|
|
|
return 'alert(' . $message . ')'; |
32
|
|
|
} |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Print a success message. |
37
|
|
|
* |
38
|
|
|
* It is a function of the Jaxon\Dialog\Interfaces\Alert interface. |
39
|
|
|
* |
40
|
|
|
* @param string $message The text of the message |
41
|
|
|
* @param string|null $title The title of the message |
42
|
|
|
* |
43
|
|
|
* @return string|void |
44
|
|
|
*/ |
45
|
|
|
public function success($message, $title = null) |
46
|
|
|
{ |
47
|
|
|
return $this->alert($message, $title); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Print an information message. |
52
|
|
|
* |
53
|
|
|
* It is a function of the Jaxon\Dialog\Interfaces\Alert interface. |
54
|
|
|
* |
55
|
|
|
* @param string $message The text of the message |
56
|
|
|
* @param string|null $title The title of the message |
57
|
|
|
* |
58
|
|
|
* @return string|void |
59
|
|
|
*/ |
60
|
|
|
public function info($message, $title = null) |
61
|
|
|
{ |
62
|
|
|
return $this->alert($message, $title); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Print a warning message. |
67
|
|
|
* |
68
|
|
|
* It is a function of the Jaxon\Dialog\Interfaces\Alert interface. |
69
|
|
|
* |
70
|
|
|
* @param string $message The text of the message |
71
|
|
|
* @param string|null $title The title of the message |
72
|
|
|
* |
73
|
|
|
* @return string|void |
74
|
|
|
*/ |
75
|
|
|
public function warning($message, $title = null) |
76
|
|
|
{ |
77
|
|
|
return $this->alert($message, $title); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Print an error message. |
82
|
|
|
* |
83
|
|
|
* It is a function of the Jaxon\Dialog\Interfaces\Alert interface. |
84
|
|
|
* |
85
|
|
|
* @param string $message The text of the message |
86
|
|
|
* @param string|null $title The title of the message |
87
|
|
|
* |
88
|
|
|
* @return string|void |
89
|
|
|
*/ |
90
|
|
|
public function error($message, $title = null) |
91
|
|
|
{ |
92
|
|
|
return $this->alert($message, $title); |
93
|
|
|
} |
94
|
|
|
} |
95
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.