-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathYiiNodeSocketFrameAlert.php
54 lines (48 loc) · 1.16 KB
/
YiiNodeSocketFrameAlert.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
<?php
/**
* Created by PhpStorm.
* User: coder1
* Date: 10.02.17
* Time: 11:36
*/
namespace digitv\yii2sockets;
/**
* @property boolean $_onlyActiveWindow
* @property string $_audioId
*/
class YiiNodeSocketFrameAlert extends YiiNodeSocketFrameBasic
{
protected $_onlyActiveWindow = true;
protected $_callback = 'alertFrameCallback';
protected $_audioId = 'notifier-audio';
/**
* Set only active window or not
* @param bool $value
* @return YiiNodeSocketFrameAlert $this
*/
public function onlyActiveWindow($value = true) {
$this->_onlyActiveWindow = !empty($value);
return $this;
}
/**
* Set alert audio element ID
* @param string $audioId
* @return YiiNodeSocketFrameAlert $this
*/
public function setAudioId($audioId)
{
$this->_audioId = $audioId;
return $this;
}
public function validate()
{
$this->composeOptions();
return parent::validate();
}
protected function composeOptions() {
$this->setBody([
'audioId' => $this->_audioId,
'onlyActiveWindow' => $this->_onlyActiveWindow,
]);
}
}