|
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
|
|
|
/** |
|
16
|
|
|
* Created by Marcin. |
|
17
|
|
|
* Date: 25.09.2017 |
|
18
|
|
|
* Time: 22:27 |
|
19
|
|
|
*/ |
|
20
|
|
|
|
|
21
|
|
|
namespace mrcnpdlk\Grandstream\XMLApp\Application; |
|
22
|
|
|
|
|
23
|
|
|
|
|
24
|
|
|
use mrcnpdlk\Grandstream\XMLApp\Application\Model\Components\ElemInterface; |
|
25
|
|
|
use mrcnpdlk\Grandstream\XMLApp\Application\Model\Container; |
|
26
|
|
|
use mrcnpdlk\Grandstream\XMLApp\Application\Model\Contents; |
|
27
|
|
|
use mrcnpdlk\Grandstream\XMLApp\Application\Model\Event; |
|
28
|
|
|
use mrcnpdlk\Grandstream\XMLApp\Application\Model\Page; |
|
29
|
|
|
use mrcnpdlk\Grandstream\XMLApp\Application\Model\Screen; |
|
30
|
|
|
use mrcnpdlk\Grandstream\XMLApp\Application\Model\SoftKey; |
|
31
|
|
|
|
|
32
|
|
|
class View |
|
33
|
|
|
{ |
|
34
|
|
|
/** |
|
35
|
|
|
* @var Screen $oScreen |
|
36
|
|
|
*/ |
|
37
|
|
|
private $oScreen; |
|
38
|
|
|
|
|
39
|
|
|
public function __construct() |
|
40
|
|
|
{ |
|
41
|
|
|
$this->oScreen = new Screen(new Page(new Contents())); |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* @param \mrcnpdlk\Grandstream\XMLApp\Application\Model\Components\ElemInterface $oElement |
|
46
|
|
|
* |
|
47
|
|
|
* @return $this |
|
48
|
|
|
*/ |
|
49
|
|
|
public function addElem(ElemInterface $oElement) |
|
50
|
|
|
{ |
|
51
|
|
|
$this->oScreen->getPage()->getContents()->addElement($oElement); |
|
52
|
|
|
|
|
53
|
|
|
return $this; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* @param SoftKey $oSoftkey |
|
58
|
|
|
* |
|
59
|
|
|
* @return View |
|
60
|
|
|
*/ |
|
61
|
|
|
public function addSoftkey(SoftKey $oSoftkey) |
|
62
|
|
|
{ |
|
63
|
|
|
$this->oScreen->getPage()->addSoftkey($oSoftkey); |
|
64
|
|
|
|
|
65
|
|
|
return $this; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* @param \mrcnpdlk\Grandstream\XMLApp\Application\Model\Event $oEvent |
|
70
|
|
|
* |
|
71
|
|
|
* @return \mrcnpdlk\Grandstream\XMLApp\Application\View |
|
72
|
|
|
*/ |
|
73
|
|
|
public function addEvent(Event $oEvent) |
|
74
|
|
|
{ |
|
75
|
|
|
$this->oScreen->addEvent($oEvent); |
|
76
|
|
|
|
|
77
|
|
|
return $this; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* @param \mrcnpdlk\Grandstream\XMLApp\Application\Model\Container $oContainer |
|
82
|
|
|
* |
|
83
|
|
|
* @return \mrcnpdlk\Grandstream\XMLApp\Application\View |
|
84
|
|
|
*/ |
|
85
|
|
|
public function addContainer(Container $oContainer) |
|
86
|
|
|
{ |
|
87
|
|
|
foreach ($oContainer->getElements() as $oElement) { |
|
88
|
|
|
$this->oScreen->getPage()->getContents()->addElement($oElement); |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
return $this; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* @param bool $isVisible |
|
96
|
|
|
* |
|
97
|
|
|
* @return View |
|
98
|
|
|
*/ |
|
99
|
|
|
public function setVisibleStatusLine(bool $isVisible = true) |
|
100
|
|
|
{ |
|
101
|
|
|
$this->oScreen->getPage()->setVisibleStatusLine($isVisible); |
|
102
|
|
|
|
|
103
|
|
|
return $this; |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
/** |
|
107
|
|
|
* @return string |
|
108
|
|
|
*/ |
|
109
|
|
|
public function asTxt() |
|
110
|
|
|
{ |
|
111
|
|
|
return $this->oScreen->getXml()->asText(); |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
} |
|
115
|
|
|
|