1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Repr�sente un message � afficher dans une alert Bootstrap |
4
|
|
|
* @author jcheron |
5
|
|
|
* @version 1.1 |
6
|
|
|
*/ |
7
|
|
|
class DisplayedMessage { |
|
|
|
|
8
|
|
|
private $content; |
9
|
|
|
private $type; |
10
|
|
|
private $timerInterval; |
11
|
|
|
private $dismissable; |
12
|
|
|
private $visible; |
13
|
|
|
public function DisplayedMessage($content,$type="success",$timerInterval=0,$dismissable=true,$visible=true){ |
|
|
|
|
14
|
|
|
$this->content=$content; |
15
|
|
|
$this->type=$type; |
16
|
|
|
$this->dismissable=$dismissable; |
17
|
|
|
$this->timerInterval=$timerInterval; |
18
|
|
|
$this->visible=$visible; |
19
|
|
|
} |
20
|
|
|
public function getContent() { |
21
|
|
|
return $this->content; |
22
|
|
|
} |
23
|
|
|
public function setContent($content) { |
24
|
|
|
$this->content=$content; |
25
|
|
|
return $this; |
26
|
|
|
} |
27
|
|
|
public function getType() { |
28
|
|
|
return $this->type; |
29
|
|
|
} |
30
|
|
|
public function setType($type) { |
31
|
|
|
$this->type=$type; |
32
|
|
|
return $this; |
33
|
|
|
} |
34
|
|
|
public function getTimerInterval() { |
35
|
|
|
return $this->timerInterval; |
36
|
|
|
} |
37
|
|
|
public function setTimerInterval($timerInterval) { |
38
|
|
|
$this->timerInterval=$timerInterval; |
39
|
|
|
return $this; |
40
|
|
|
} |
41
|
|
|
public function getDismissable() { |
42
|
|
|
return $this->dismissable; |
43
|
|
|
} |
44
|
|
|
public function setDismissable($dismissable) { |
45
|
|
|
$this->dismissable=$dismissable; |
46
|
|
|
return $this; |
47
|
|
|
} |
48
|
|
|
public function compile($jquery){ |
49
|
|
|
$alert=$jquery->bootstrap()->htmlAlert("message",$this->content,$this->type); |
50
|
|
|
if($this->visible==false){ |
|
|
|
|
51
|
|
|
$alert->setProperty("style","display:none;"); |
52
|
|
|
} |
53
|
|
|
$alert->setCloseable($this->dismissable); |
54
|
|
|
if(isset($this->timerInterval) && $this->timerInterval>0){ |
55
|
|
|
$jquery->hide(".alert",$this->timerInterval,'',true); |
56
|
|
|
} |
57
|
|
|
return $alert->compile($jquery); |
58
|
|
|
} |
59
|
|
|
} |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.