1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Grandstream-XMLApp |
4
|
|
|
* |
5
|
|
|
* Copyright (c) 2017 pudelek.org.pl |
6
|
|
|
* |
7
|
|
|
* @license MIT License (MIT) |
8
|
|
|
* |
9
|
|
|
* For the full copyright and license information, please view source file |
10
|
|
|
* that is bundled with this package in the file LICENSE |
11
|
|
|
* |
12
|
|
|
* @author Marcin Pudełek <[email protected]> |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
namespace mrcnpdlk\Grandstream\XMLApp\Application; |
16
|
|
|
|
17
|
|
|
|
18
|
|
|
use mrcnpdlk\Grandstream\XMLApp\Application\Model\Components\ElemInterface; |
19
|
|
|
use mrcnpdlk\Grandstream\XMLApp\Application\Model\Container; |
20
|
|
|
use mrcnpdlk\Grandstream\XMLApp\Application\Model\Contents; |
21
|
|
|
use mrcnpdlk\Grandstream\XMLApp\Application\Model\Event; |
22
|
|
|
use mrcnpdlk\Grandstream\XMLApp\Application\Model\Page; |
23
|
|
|
use mrcnpdlk\Grandstream\XMLApp\Application\Model\Screen; |
24
|
|
|
use mrcnpdlk\Grandstream\XMLApp\Application\Model\SoftKey; |
25
|
|
|
|
26
|
|
|
class View |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* @var Screen $oScreen |
30
|
|
|
*/ |
31
|
|
|
private $oScreen; |
32
|
|
|
|
33
|
|
|
public function __construct() |
34
|
|
|
{ |
35
|
|
|
$this->oScreen = new Screen(new Page(new Contents())); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @param \mrcnpdlk\Grandstream\XMLApp\Application\Model\Components\ElemInterface $oElement |
40
|
|
|
* |
41
|
|
|
* @return $this |
42
|
|
|
*/ |
43
|
|
|
public function addElem(ElemInterface $oElement) |
44
|
|
|
{ |
45
|
|
|
$this->oScreen->getPage()->getContents()->addElement($oElement); |
46
|
|
|
|
47
|
|
|
return $this; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @param SoftKey $oSoftkey |
52
|
|
|
* |
53
|
|
|
* @return View |
54
|
|
|
*/ |
55
|
|
|
public function addSoftkey(SoftKey $oSoftkey) |
56
|
|
|
{ |
57
|
|
|
$this->oScreen->getPage()->addSoftkey($oSoftkey); |
58
|
|
|
|
59
|
|
|
return $this; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @param \mrcnpdlk\Grandstream\XMLApp\Application\Model\Event $oEvent |
64
|
|
|
* |
65
|
|
|
* @return \mrcnpdlk\Grandstream\XMLApp\Application\View |
66
|
|
|
*/ |
67
|
|
|
public function addEvent(Event $oEvent) |
68
|
|
|
{ |
69
|
|
|
$this->oScreen->addEvent($oEvent); |
70
|
|
|
|
71
|
|
|
return $this; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @param \mrcnpdlk\Grandstream\XMLApp\Application\Model\Container $oContainer |
76
|
|
|
* |
77
|
|
|
* @return \mrcnpdlk\Grandstream\XMLApp\Application\View |
78
|
|
|
*/ |
79
|
|
|
public function addContainer(Container $oContainer) |
80
|
|
|
{ |
81
|
|
|
foreach ($oContainer->getElements() as $oElement) { |
82
|
|
|
$this->oScreen->getPage()->getContents()->addElement($oElement); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
return $this; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @param bool $isVisible |
90
|
|
|
* |
91
|
|
|
* @return View |
92
|
|
|
*/ |
93
|
|
|
public function setVisibleStatusLine(bool $isVisible = true) |
94
|
|
|
{ |
95
|
|
|
$this->oScreen->getPage()->setVisibleStatusLine($isVisible); |
96
|
|
|
|
97
|
|
|
return $this; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @return string |
102
|
|
|
*/ |
103
|
|
|
public function asTxt() |
104
|
|
|
{ |
105
|
|
|
return $this->oScreen->getXml()->asText(); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
} |
109
|
|
|
|