1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
5
|
|
|
* @copyright Aimeos (aimeos.org), 2015-2023 |
6
|
|
|
* @package Admin |
7
|
|
|
* @subpackage JQAdm |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
|
11
|
|
|
namespace Aimeos\Admin\JQAdm\Common\Decorator; |
12
|
|
|
|
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Provides common methods for JQAdm client decorators. |
16
|
|
|
* |
17
|
|
|
* @package Admin |
18
|
|
|
* @subpackage JQAdm |
19
|
|
|
*/ |
20
|
|
|
abstract class Base |
21
|
|
|
extends \Aimeos\Admin\JQAdm\Base |
22
|
|
|
implements \Aimeos\Admin\JQAdm\Common\Decorator\Iface |
23
|
|
|
{ |
24
|
|
|
private \Aimeos\Admin\JQAdm\Iface $client; |
25
|
|
|
|
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Initializes a new client decorator object. |
29
|
|
|
* |
30
|
|
|
* @param \Aimeos\Admin\JQAdm\Iface $client Admin object |
31
|
|
|
* @param \Aimeos\MShop\ContextIface $context Context object with required objects |
32
|
|
|
*/ |
33
|
|
|
public function __construct( \Aimeos\Admin\JQAdm\Iface $client, \Aimeos\MShop\ContextIface $context ) |
34
|
|
|
{ |
35
|
|
|
parent::__construct( $context ); |
36
|
|
|
|
37
|
|
|
$this->client = $client; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Passes unknown methods to wrapped objects. |
43
|
|
|
* |
44
|
|
|
* @param string $name Name of the method |
45
|
|
|
* @param array $param List of method parameter |
46
|
|
|
* @return mixed Returns the value of the called method |
47
|
|
|
* @throws \Aimeos\Admin\JQAdm\Exception If method call failed |
48
|
|
|
*/ |
49
|
|
|
public function __call( string $name, array $param ) |
50
|
|
|
{ |
51
|
|
|
return @call_user_func_array( [$this->client, $name], $param ); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Batch update of resources |
57
|
|
|
* |
58
|
|
|
* @return string|null HTML output |
59
|
|
|
*/ |
60
|
|
|
public function batch() : ?string |
61
|
|
|
{ |
62
|
|
|
return $this->client->batch(); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Copies a resource |
68
|
|
|
* |
69
|
|
|
* @return string|null HTML output |
70
|
|
|
*/ |
71
|
|
|
public function copy() : ?string |
72
|
|
|
{ |
73
|
|
|
return $this->client->copy(); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* Creates a new resource |
79
|
|
|
* |
80
|
|
|
* @return string|null HTML output |
81
|
|
|
*/ |
82
|
|
|
public function create() : ?string |
83
|
|
|
{ |
84
|
|
|
return $this->client->create(); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Adds the required data |
90
|
|
|
* |
91
|
|
|
* @param \Aimeos\Base\View\Iface $view View object |
92
|
|
|
* @return \Aimeos\Base\View\Iface View object with assigned parameters |
93
|
|
|
*/ |
94
|
|
|
public function data( \Aimeos\Base\View\Iface $view ) : \Aimeos\Base\View\Iface |
95
|
|
|
{ |
96
|
|
|
return $this->client->data( $view ); |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* Deletes a resource |
102
|
|
|
* |
103
|
|
|
* @return string|null HTML output |
104
|
|
|
*/ |
105
|
|
|
public function delete() : ?string |
106
|
|
|
{ |
107
|
|
|
return $this->client->delete(); |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* Exports a resource |
113
|
|
|
* |
114
|
|
|
* @return string|null HTML output |
115
|
|
|
*/ |
116
|
|
|
public function export() : ?string |
117
|
|
|
{ |
118
|
|
|
return $this->client->export(); |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* Returns a single resource |
124
|
|
|
* |
125
|
|
|
* @return string|null HTML output |
126
|
|
|
*/ |
127
|
|
|
public function get() : ?string |
128
|
|
|
{ |
129
|
|
|
return $this->client->get(); |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* Saves the data |
135
|
|
|
* |
136
|
|
|
* @return string|null HTML output |
137
|
|
|
*/ |
138
|
|
|
public function save() : ?string |
139
|
|
|
{ |
140
|
|
|
return $this->client->save(); |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* Returns a list of resource according to the conditions |
146
|
|
|
* |
147
|
|
|
* @return string|null HTML output |
148
|
|
|
*/ |
149
|
|
|
public function search() : ?string |
150
|
|
|
{ |
151
|
|
|
return $this->client->search(); |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* Returns the sub-client given by its name. |
157
|
|
|
* |
158
|
|
|
* @param string $type Name of the client type |
159
|
|
|
* @param string|null $name Name of the sub-client (Default if null) |
160
|
|
|
* @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
161
|
|
|
*/ |
162
|
|
|
public function getSubClient( string $type, string $name = null ) : \Aimeos\Admin\JQAdm\Iface |
163
|
|
|
{ |
164
|
|
|
return $this->client->getSubClient( $type, $name ); |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* Sets the view object that will generate the admin output. |
170
|
|
|
* |
171
|
|
|
* @param \Aimeos\Base\View\Iface $view The view object which generates the admin output |
172
|
|
|
* @return \Aimeos\Admin\JQAdm\Iface Reference to this object for fluent calls |
173
|
|
|
*/ |
174
|
|
|
public function setView( \Aimeos\Base\View\Iface $view ) : \Aimeos\Admin\JQAdm\Iface |
175
|
|
|
{ |
176
|
|
|
parent::setView( $view ); |
177
|
|
|
|
178
|
|
|
$this->client->setView( $view ); |
179
|
|
|
return $this; |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
|
183
|
|
|
/** |
184
|
|
|
* Sets the Aimeos bootstrap object |
185
|
|
|
* |
186
|
|
|
* @param \Aimeos\Bootstrap $aimeos The Aimeos bootstrap object |
187
|
|
|
* @return \Aimeos\Admin\JQAdm\Iface Reference to this object for fluent calls |
188
|
|
|
*/ |
189
|
|
|
public function setAimeos( \Aimeos\Bootstrap $aimeos ) : \Aimeos\Admin\JQAdm\Iface |
190
|
|
|
{ |
191
|
|
|
parent::setAimeos( $aimeos ); |
192
|
|
|
|
193
|
|
|
$this->client->setAimeos( $aimeos ); |
|
|
|
|
194
|
|
|
return $this; |
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* Returns the inner client object |
200
|
|
|
* |
201
|
|
|
* @return \Aimeos\Admin\JQAdm\Iface admin client |
202
|
|
|
*/ |
203
|
|
|
protected function getClient() : \Aimeos\Admin\JQAdm\Iface |
204
|
|
|
{ |
205
|
|
|
return $this->client; |
206
|
|
|
} |
207
|
|
|
|
208
|
|
|
|
209
|
|
|
/** |
210
|
|
|
* Returns the list of sub-client names configured for the client. |
211
|
|
|
* |
212
|
|
|
* @return array List of admin client names |
213
|
|
|
*/ |
214
|
|
|
protected function getSubClientNames() : array |
215
|
|
|
{ |
216
|
|
|
return []; |
217
|
|
|
} |
218
|
|
|
} |
219
|
|
|
|