@@ -155,14 +155,12 @@ |
||
155 | 155 | } |
156 | 156 | |
157 | 157 | return; |
158 | - } |
|
159 | - catch( \Aimeos\MShop\Exception $e ) |
|
158 | + } catch( \Aimeos\MShop\Exception $e ) |
|
160 | 159 | { |
161 | 160 | $error = array( 'product-item-related' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
162 | 161 | $view->errors = $view->get( 'errors', [] ) + $error; |
163 | 162 | $this->logException( $e ); |
164 | - } |
|
165 | - catch( \Exception $e ) |
|
163 | + } catch( \Exception $e ) |
|
166 | 164 | { |
167 | 165 | $error = array( 'product-item-related' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
168 | 166 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Product\Related; |
12 | 12 | |
13 | -sprintf( 'related' ); // for translation |
|
13 | +sprintf('related'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | |
47 | 47 | $view->relatedBody = ''; |
48 | 48 | |
49 | - foreach( $this->getSubClients() as $client ) { |
|
49 | + foreach ($this->getSubClients() as $client) { |
|
50 | 50 | $view->relatedBody .= $client->copy(); |
51 | 51 | } |
52 | 52 | |
53 | - return $this->render( $view ); |
|
53 | + return $this->render($view); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | |
66 | 66 | $view->relatedBody = ''; |
67 | 67 | |
68 | - foreach( $this->getSubClients() as $client ) { |
|
68 | + foreach ($this->getSubClients() as $client) { |
|
69 | 69 | $view->relatedBody .= $client->create(); |
70 | 70 | } |
71 | 71 | |
72 | - return $this->render( $view ); |
|
72 | + return $this->render($view); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | |
85 | 85 | $view->relatedBody = ''; |
86 | 86 | |
87 | - foreach( $this->getSubClients() as $client ) { |
|
87 | + foreach ($this->getSubClients() as $client) { |
|
88 | 88 | $view->relatedBody .= $client->get(); |
89 | 89 | } |
90 | 90 | |
91 | - return $this->render( $view ); |
|
91 | + return $this->render($view); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
@@ -103,23 +103,23 @@ discard block |
||
103 | 103 | { |
104 | 104 | $view->relatedBody = ''; |
105 | 105 | |
106 | - foreach( $this->getSubClients() as $client ) { |
|
106 | + foreach ($this->getSubClients() as $client) { |
|
107 | 107 | $view->relatedBody .= $client->save(); |
108 | 108 | } |
109 | 109 | |
110 | 110 | return; |
111 | 111 | } |
112 | - catch( \Aimeos\MShop\Exception $e ) |
|
112 | + catch (\Aimeos\MShop\Exception $e) |
|
113 | 113 | { |
114 | - $error = array( 'product-item-related' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
115 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
116 | - $this->logException( $e ); |
|
114 | + $error = array('product-item-related' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
115 | + $view->errors = $view->get('errors', []) + $error; |
|
116 | + $this->logException($e); |
|
117 | 117 | } |
118 | - catch( \Exception $e ) |
|
118 | + catch (\Exception $e) |
|
119 | 119 | { |
120 | - $error = array( 'product-item-related' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
121 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
122 | - $this->logException( $e ); |
|
120 | + $error = array('product-item-related' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
121 | + $view->errors = $view->get('errors', []) + $error; |
|
122 | + $this->logException($e); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | throw new \Aimeos\Admin\JQAdm\Exception(); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @param string|null $name Name of the sub-client (Default if null) |
134 | 134 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
135 | 135 | */ |
136 | - public function getSubClient( $type, $name = null ) |
|
136 | + public function getSubClient($type, $name = null) |
|
137 | 137 | { |
138 | 138 | /** admin/jqadm/product/related/decorators/excludes |
139 | 139 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * @see admin/jqadm/product/related/decorators/excludes |
209 | 209 | * @see admin/jqadm/product/related/decorators/global |
210 | 210 | */ |
211 | - return $this->createSubClient( 'product/related/' . $type, $name ); |
|
211 | + return $this->createSubClient('product/related/' . $type, $name); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * @since 2016.01 |
253 | 253 | * @category Developer |
254 | 254 | */ |
255 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/product/related/standard/subparts', [] ); |
|
255 | + return $this->getContext()->getConfig()->get('admin/jqadm/product/related/standard/subparts', []); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
263 | 263 | * @return string HTML output |
264 | 264 | */ |
265 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
265 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
266 | 266 | { |
267 | 267 | /** admin/jqadm/product/related/template-item |
268 | 268 | * Relative path to the HTML body template of the related subpart for products. |
@@ -286,6 +286,6 @@ discard block |
||
286 | 286 | $tplconf = 'admin/jqadm/product/related/template-item'; |
287 | 287 | $default = 'product/item-related-standard'; |
288 | 288 | |
289 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
289 | + return $view->render($view->config($tplconf, $default)); |
|
290 | 290 | } |
291 | 291 | } |
292 | 292 | \ No newline at end of file |
@@ -144,14 +144,12 @@ |
||
144 | 144 | } |
145 | 145 | |
146 | 146 | return; |
147 | - } |
|
148 | - catch( \Aimeos\MShop\Exception $e ) |
|
147 | + } catch( \Aimeos\MShop\Exception $e ) |
|
149 | 148 | { |
150 | 149 | $error = array( 'product-item-special' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
151 | 150 | $view->errors = $view->get( 'errors', [] ) + $error; |
152 | 151 | $this->logException( $e ); |
153 | - } |
|
154 | - catch( \Exception $e ) |
|
152 | + } catch( \Exception $e ) |
|
155 | 153 | { |
156 | 154 | $error = array( 'product-item-special' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
157 | 155 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Product\Special; |
12 | 12 | |
13 | -sprintf( 'special' ); // for translation |
|
13 | +sprintf('special'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | |
47 | 47 | $view->specialBody = ''; |
48 | 48 | |
49 | - foreach( $this->getSubClients() as $client ) { |
|
49 | + foreach ($this->getSubClients() as $client) { |
|
50 | 50 | $view->specialBody .= $client->copy(); |
51 | 51 | } |
52 | 52 | |
53 | - return $this->render( $view ); |
|
53 | + return $this->render($view); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | |
66 | 66 | $view->specialBody = ''; |
67 | 67 | |
68 | - foreach( $this->getSubClients() as $client ) { |
|
68 | + foreach ($this->getSubClients() as $client) { |
|
69 | 69 | $view->specialBody .= $client->create(); |
70 | 70 | } |
71 | 71 | |
72 | - return $this->render( $view ); |
|
72 | + return $this->render($view); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | |
85 | 85 | $view->specialBody = ''; |
86 | 86 | |
87 | - foreach( $this->getSubClients() as $client ) { |
|
87 | + foreach ($this->getSubClients() as $client) { |
|
88 | 88 | $view->specialBody .= $client->get(); |
89 | 89 | } |
90 | 90 | |
91 | - return $this->render( $view ); |
|
91 | + return $this->render($view); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
@@ -103,23 +103,23 @@ discard block |
||
103 | 103 | { |
104 | 104 | $view->specialBody = ''; |
105 | 105 | |
106 | - foreach( $this->getSubClients() as $client ) { |
|
106 | + foreach ($this->getSubClients() as $client) { |
|
107 | 107 | $view->specialBody .= $client->save(); |
108 | 108 | } |
109 | 109 | |
110 | 110 | return; |
111 | 111 | } |
112 | - catch( \Aimeos\MShop\Exception $e ) |
|
112 | + catch (\Aimeos\MShop\Exception $e) |
|
113 | 113 | { |
114 | - $error = array( 'product-item-special' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
115 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
116 | - $this->logException( $e ); |
|
114 | + $error = array('product-item-special' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
115 | + $view->errors = $view->get('errors', []) + $error; |
|
116 | + $this->logException($e); |
|
117 | 117 | } |
118 | - catch( \Exception $e ) |
|
118 | + catch (\Exception $e) |
|
119 | 119 | { |
120 | - $error = array( 'product-item-special' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
121 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
122 | - $this->logException( $e ); |
|
120 | + $error = array('product-item-special' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
121 | + $view->errors = $view->get('errors', []) + $error; |
|
122 | + $this->logException($e); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | throw new \Aimeos\Admin\JQAdm\Exception(); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @param string|null $name Name of the sub-client (Default if null) |
134 | 134 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
135 | 135 | */ |
136 | - public function getSubClient( $type, $name = null ) |
|
136 | + public function getSubClient($type, $name = null) |
|
137 | 137 | { |
138 | 138 | /** admin/jqadm/product/special/decorators/excludes |
139 | 139 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * @see admin/jqadm/product/special/decorators/excludes |
209 | 209 | * @see admin/jqadm/product/special/decorators/global |
210 | 210 | */ |
211 | - return $this->createSubClient( 'product/special/' . $type, $name ); |
|
211 | + return $this->createSubClient('product/special/' . $type, $name); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * @since 2016.03 |
253 | 253 | * @category Developer |
254 | 254 | */ |
255 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/product/special/standard/subparts', [] ); |
|
255 | + return $this->getContext()->getConfig()->get('admin/jqadm/product/special/standard/subparts', []); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
263 | 263 | * @return string HTML output |
264 | 264 | */ |
265 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
265 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
266 | 266 | { |
267 | 267 | /** admin/jqadm/product/special/template-item |
268 | 268 | * Relative path to the HTML body template of the special subpart for products. |
@@ -286,6 +286,6 @@ discard block |
||
286 | 286 | $tplconf = 'admin/jqadm/product/special/template-item'; |
287 | 287 | $default = 'product/item-special-standard'; |
288 | 288 | |
289 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
289 | + return $view->render($view->config($tplconf, $default)); |
|
290 | 290 | } |
291 | 291 | } |
292 | 292 | \ No newline at end of file |
@@ -88,14 +88,12 @@ discard block |
||
88 | 88 | $view->tabindex = ++$idx + 1; |
89 | 89 | $view->itemBody .= $client->copy(); |
90 | 90 | } |
91 | - } |
|
92 | - catch( \Aimeos\MShop\Exception $e ) |
|
91 | + } catch( \Aimeos\MShop\Exception $e ) |
|
93 | 92 | { |
94 | 93 | $error = array( 'subscription-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
95 | 94 | $view->errors = $view->get( 'errors', [] ) + $error; |
96 | 95 | $this->logException( $e ); |
97 | - } |
|
98 | - catch( \Exception $e ) |
|
96 | + } catch( \Exception $e ) |
|
99 | 97 | { |
100 | 98 | $error = array( 'subscription-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
101 | 99 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -137,14 +135,12 @@ discard block |
||
137 | 135 | $view->tabindex = ++$idx + 1; |
138 | 136 | $view->itemBody .= $client->create(); |
139 | 137 | } |
140 | - } |
|
141 | - catch( \Aimeos\MShop\Exception $e ) |
|
138 | + } catch( \Aimeos\MShop\Exception $e ) |
|
142 | 139 | { |
143 | 140 | $error = array( 'subscription-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
144 | 141 | $view->errors = $view->get( 'errors', [] ) + $error; |
145 | 142 | $this->logException( $e ); |
146 | - } |
|
147 | - catch( \Exception $e ) |
|
143 | + } catch( \Exception $e ) |
|
148 | 144 | { |
149 | 145 | $error = array( 'subscription-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
150 | 146 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -185,14 +181,12 @@ discard block |
||
185 | 181 | |
186 | 182 | $this->nextAction( $view, 'search', 'subscription', null, 'delete' ); |
187 | 183 | return; |
188 | - } |
|
189 | - catch( \Aimeos\MShop\Exception $e ) |
|
184 | + } catch( \Aimeos\MShop\Exception $e ) |
|
190 | 185 | { |
191 | 186 | $error = array( 'subscription-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
192 | 187 | $view->errors = $view->get( 'errors', [] ) + $error; |
193 | 188 | $this->logException( $e ); |
194 | - } |
|
195 | - catch( \Exception $e ) |
|
189 | + } catch( \Exception $e ) |
|
196 | 190 | { |
197 | 191 | $error = array( 'subscription-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
198 | 192 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -233,14 +227,12 @@ discard block |
||
233 | 227 | |
234 | 228 | $msg = $context->getI18n()->dt( 'admin', 'Your export will be available in a few minutes for download' ); |
235 | 229 | $view->info = $view->get( 'info', [] ) + ['subscription-item' => $msg]; |
236 | - } |
|
237 | - catch( \Aimeos\MShop\Exception $e ) |
|
230 | + } catch( \Aimeos\MShop\Exception $e ) |
|
238 | 231 | { |
239 | 232 | $error = array( 'subscription-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
240 | 233 | $view->errors = $view->get( 'errors', [] ) + $error; |
241 | 234 | $this->logException( $e ); |
242 | - } |
|
243 | - catch( \Exception $e ) |
|
235 | + } catch( \Exception $e ) |
|
244 | 236 | { |
245 | 237 | $error = array( 'subscription-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
246 | 238 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -279,14 +271,12 @@ discard block |
||
279 | 271 | $view->tabindex = ++$idx + 1; |
280 | 272 | $view->itemBody .= $client->get(); |
281 | 273 | } |
282 | - } |
|
283 | - catch( \Aimeos\MShop\Exception $e ) |
|
274 | + } catch( \Aimeos\MShop\Exception $e ) |
|
284 | 275 | { |
285 | 276 | $error = array( 'subscription-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
286 | 277 | $view->errors = $view->get( 'errors', [] ) + $error; |
287 | 278 | $this->logException( $e ); |
288 | - } |
|
289 | - catch( \Exception $e ) |
|
279 | + } catch( \Exception $e ) |
|
290 | 280 | { |
291 | 281 | $error = array( 'subscription-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
292 | 282 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -323,18 +313,15 @@ discard block |
||
323 | 313 | |
324 | 314 | $this->nextAction( $view, $view->param( 'next' ), 'subscription', $view->item->getId(), 'save' ); |
325 | 315 | return; |
326 | - } |
|
327 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
316 | + } catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
328 | 317 | { |
329 | 318 | // fall through to create |
330 | - } |
|
331 | - catch( \Aimeos\MShop\Exception $e ) |
|
319 | + } catch( \Aimeos\MShop\Exception $e ) |
|
332 | 320 | { |
333 | 321 | $error = array( 'subscription-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
334 | 322 | $view->errors = $view->get( 'errors', [] ) + $error; |
335 | 323 | $this->logException( $e ); |
336 | - } |
|
337 | - catch( \Exception $e ) |
|
324 | + } catch( \Exception $e ) |
|
338 | 325 | { |
339 | 326 | $error = array( 'subscription-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
340 | 327 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -376,14 +363,12 @@ discard block |
||
376 | 363 | foreach( $this->getSubClients() as $client ) { |
377 | 364 | $view->itemBody .= $client->search(); |
378 | 365 | } |
379 | - } |
|
380 | - catch( \Aimeos\MShop\Exception $e ) |
|
366 | + } catch( \Aimeos\MShop\Exception $e ) |
|
381 | 367 | { |
382 | 368 | $error = array( 'subscription-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
383 | 369 | $view->errors = $view->get( 'errors', [] ) + $error; |
384 | 370 | $this->logException( $e ); |
385 | - } |
|
386 | - catch( \Exception $e ) |
|
371 | + } catch( \Exception $e ) |
|
387 | 372 | { |
388 | 373 | $error = array( 'subscription-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
389 | 374 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Subscription; |
12 | 12 | |
13 | -sprintf( 'subscription' ); // for translation |
|
13 | +sprintf('subscription'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -35,39 +35,39 @@ discard block |
||
35 | 35 | |
36 | 36 | try |
37 | 37 | { |
38 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
39 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
38 | + if (($id = $view->param('id')) === null) { |
|
39 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
40 | 40 | } |
41 | 41 | |
42 | - $manager = \Aimeos\MShop::create( $context, 'subscription' ); |
|
43 | - $baseManager = \Aimeos\MShop::create( $context, 'order/base' ); |
|
42 | + $manager = \Aimeos\MShop::create($context, 'subscription'); |
|
43 | + $baseManager = \Aimeos\MShop::create($context, 'order/base'); |
|
44 | 44 | |
45 | - $view->item = $manager->getItem( $id ); |
|
46 | - $view->itemBase = $baseManager->getItem( $view->item->getOrderBaseId(), ['order/base/address', 'order/base/product'] ); |
|
47 | - $view->itemData = $this->toArray( $view->item, true ); |
|
45 | + $view->item = $manager->getItem($id); |
|
46 | + $view->itemBase = $baseManager->getItem($view->item->getOrderBaseId(), ['order/base/address', 'order/base/product']); |
|
47 | + $view->itemData = $this->toArray($view->item, true); |
|
48 | 48 | $view->itemSubparts = $this->getSubClientNames(); |
49 | 49 | $view->itemBody = ''; |
50 | 50 | |
51 | - foreach( $this->getSubClients() as $idx => $client ) |
|
51 | + foreach ($this->getSubClients() as $idx => $client) |
|
52 | 52 | { |
53 | 53 | $view->tabindex = ++$idx + 1; |
54 | 54 | $view->itemBody .= $client->copy(); |
55 | 55 | } |
56 | 56 | } |
57 | - catch( \Aimeos\MShop\Exception $e ) |
|
57 | + catch (\Aimeos\MShop\Exception $e) |
|
58 | 58 | { |
59 | - $error = array( 'subscription-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
60 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
61 | - $this->logException( $e ); |
|
59 | + $error = array('subscription-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
60 | + $view->errors = $view->get('errors', []) + $error; |
|
61 | + $this->logException($e); |
|
62 | 62 | } |
63 | - catch( \Exception $e ) |
|
63 | + catch (\Exception $e) |
|
64 | 64 | { |
65 | - $error = array( 'subscription-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
66 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
67 | - $this->logException( $e ); |
|
65 | + $error = array('subscription-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
66 | + $view->errors = $view->get('errors', []) + $error; |
|
67 | + $this->logException($e); |
|
68 | 68 | } |
69 | 69 | |
70 | - return $this->render( $view ); |
|
70 | + return $this->render($view); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -83,17 +83,17 @@ discard block |
||
83 | 83 | |
84 | 84 | try |
85 | 85 | { |
86 | - $data = $view->param( 'item', [] ); |
|
86 | + $data = $view->param('item', []); |
|
87 | 87 | |
88 | - if( !isset( $view->item ) ) { |
|
89 | - $view->item = \Aimeos\MShop::create( $context, 'subscription' )->createItem(); |
|
88 | + if (!isset($view->item)) { |
|
89 | + $view->item = \Aimeos\MShop::create($context, 'subscription')->createItem(); |
|
90 | 90 | } |
91 | 91 | |
92 | - $baseManager = \Aimeos\MShop::create( $context, 'order/base' ); |
|
93 | - $baseId = ( $view->item->getOrderBaseId() ?: $view->param( 'item/subscription.ordbaseid' ) ); |
|
92 | + $baseManager = \Aimeos\MShop::create($context, 'order/base'); |
|
93 | + $baseId = ($view->item->getOrderBaseId() ?: $view->param('item/subscription.ordbaseid')); |
|
94 | 94 | |
95 | - if( $baseId ) { |
|
96 | - $view->itemBase = $baseManager->getItem( $baseId, ['order/base/address', 'order/base/product'] ); |
|
95 | + if ($baseId) { |
|
96 | + $view->itemBase = $baseManager->getItem($baseId, ['order/base/address', 'order/base/product']); |
|
97 | 97 | } else { |
98 | 98 | $view->itemBase = $baseManager->createItem(); |
99 | 99 | } |
@@ -104,26 +104,26 @@ discard block |
||
104 | 104 | $view->itemData = $data; |
105 | 105 | $view->itemBody = ''; |
106 | 106 | |
107 | - foreach( $this->getSubClients() as $idx => $client ) |
|
107 | + foreach ($this->getSubClients() as $idx => $client) |
|
108 | 108 | { |
109 | 109 | $view->tabindex = ++$idx + 1; |
110 | 110 | $view->itemBody .= $client->create(); |
111 | 111 | } |
112 | 112 | } |
113 | - catch( \Aimeos\MShop\Exception $e ) |
|
113 | + catch (\Aimeos\MShop\Exception $e) |
|
114 | 114 | { |
115 | - $error = array( 'subscription-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
116 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
117 | - $this->logException( $e ); |
|
115 | + $error = array('subscription-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
116 | + $view->errors = $view->get('errors', []) + $error; |
|
117 | + $this->logException($e); |
|
118 | 118 | } |
119 | - catch( \Exception $e ) |
|
119 | + catch (\Exception $e) |
|
120 | 120 | { |
121 | - $error = array( 'subscription-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
122 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
123 | - $this->logException( $e ); |
|
121 | + $error = array('subscription-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
122 | + $view->errors = $view->get('errors', []) + $error; |
|
123 | + $this->logException($e); |
|
124 | 124 | } |
125 | 125 | |
126 | - return $this->render( $view ); |
|
126 | + return $this->render($view); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | |
@@ -137,38 +137,38 @@ discard block |
||
137 | 137 | $view = $this->getView(); |
138 | 138 | $context = $this->getContext(); |
139 | 139 | |
140 | - $manager = \Aimeos\MShop::create( $context, 'subscription' ); |
|
140 | + $manager = \Aimeos\MShop::create($context, 'subscription'); |
|
141 | 141 | $manager->begin(); |
142 | 142 | |
143 | 143 | try |
144 | 144 | { |
145 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
146 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
145 | + if (($id = $view->param('id')) === null) { |
|
146 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
147 | 147 | } |
148 | 148 | |
149 | - $view->item = $manager->getItem( $id ); |
|
149 | + $view->item = $manager->getItem($id); |
|
150 | 150 | |
151 | - foreach( $this->getSubClients() as $client ) { |
|
151 | + foreach ($this->getSubClients() as $client) { |
|
152 | 152 | $client->delete(); |
153 | 153 | } |
154 | 154 | |
155 | - $manager->deleteItem( $id ); |
|
155 | + $manager->deleteItem($id); |
|
156 | 156 | $manager->commit(); |
157 | 157 | |
158 | - $this->nextAction( $view, 'search', 'subscription', null, 'delete' ); |
|
158 | + $this->nextAction($view, 'search', 'subscription', null, 'delete'); |
|
159 | 159 | return; |
160 | 160 | } |
161 | - catch( \Aimeos\MShop\Exception $e ) |
|
161 | + catch (\Aimeos\MShop\Exception $e) |
|
162 | 162 | { |
163 | - $error = array( 'subscription-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
164 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
165 | - $this->logException( $e ); |
|
163 | + $error = array('subscription-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
164 | + $view->errors = $view->get('errors', []) + $error; |
|
165 | + $this->logException($e); |
|
166 | 166 | } |
167 | - catch( \Exception $e ) |
|
167 | + catch (\Exception $e) |
|
168 | 168 | { |
169 | - $error = array( 'subscription-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
170 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
171 | - $this->logException( $e ); |
|
169 | + $error = array('subscription-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
170 | + $view->errors = $view->get('errors', []) + $error; |
|
171 | + $this->logException($e); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | $manager->rollback(); |
@@ -189,34 +189,34 @@ discard block |
||
189 | 189 | |
190 | 190 | try |
191 | 191 | { |
192 | - $params = $this->storeSearchParams( $view->param(), 'subscription' ); |
|
192 | + $params = $this->storeSearchParams($view->param(), 'subscription'); |
|
193 | 193 | $msg = ['sitecode' => $context->getLocale()->getSite()->getCode()]; |
194 | 194 | |
195 | - if( isset( $params['filter'] ) ) { |
|
196 | - $msg['filter'] = $this->getCriteriaConditions( $params['filter'] ); |
|
195 | + if (isset($params['filter'])) { |
|
196 | + $msg['filter'] = $this->getCriteriaConditions($params['filter']); |
|
197 | 197 | } |
198 | 198 | |
199 | - if( isset( $params['sort'] ) ) { |
|
200 | - $msg['sort'] = $this->getCriteriaSortations( $params['sort'] ); |
|
199 | + if (isset($params['sort'])) { |
|
200 | + $msg['sort'] = $this->getCriteriaSortations($params['sort']); |
|
201 | 201 | } |
202 | 202 | |
203 | - $mq = $context->getMessageQueueManager()->get( 'mq-admin' )->getQueue( 'subscription-export' ); |
|
204 | - $mq->add( json_encode( $msg ) ); |
|
203 | + $mq = $context->getMessageQueueManager()->get('mq-admin')->getQueue('subscription-export'); |
|
204 | + $mq->add(json_encode($msg)); |
|
205 | 205 | |
206 | - $msg = $context->getI18n()->dt( 'admin', 'Your export will be available in a few minutes for download' ); |
|
207 | - $view->info = $view->get( 'info', [] ) + ['subscription-item' => $msg]; |
|
206 | + $msg = $context->getI18n()->dt('admin', 'Your export will be available in a few minutes for download'); |
|
207 | + $view->info = $view->get('info', []) + ['subscription-item' => $msg]; |
|
208 | 208 | } |
209 | - catch( \Aimeos\MShop\Exception $e ) |
|
209 | + catch (\Aimeos\MShop\Exception $e) |
|
210 | 210 | { |
211 | - $error = array( 'subscription-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
212 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
213 | - $this->logException( $e ); |
|
211 | + $error = array('subscription-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
212 | + $view->errors = $view->get('errors', []) + $error; |
|
213 | + $this->logException($e); |
|
214 | 214 | } |
215 | - catch( \Exception $e ) |
|
215 | + catch (\Exception $e) |
|
216 | 216 | { |
217 | - $error = array( 'subscription-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
218 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
219 | - $this->logException( $e ); |
|
217 | + $error = array('subscription-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
218 | + $view->errors = $view->get('errors', []) + $error; |
|
219 | + $this->logException($e); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | return $this->search(); |
@@ -235,39 +235,39 @@ discard block |
||
235 | 235 | |
236 | 236 | try |
237 | 237 | { |
238 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
239 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
238 | + if (($id = $view->param('id')) === null) { |
|
239 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
240 | 240 | } |
241 | 241 | |
242 | - $manager = \Aimeos\MShop::create( $context, 'subscription' ); |
|
243 | - $baseManager = \Aimeos\MShop::create( $context, 'order/base' ); |
|
242 | + $manager = \Aimeos\MShop::create($context, 'subscription'); |
|
243 | + $baseManager = \Aimeos\MShop::create($context, 'order/base'); |
|
244 | 244 | |
245 | - $view->item = $manager->getItem( $id ); |
|
246 | - $view->itemBase = $baseManager->getItem( $view->item->getOrderBaseId(), ['order/base/address', 'order/base/product'] ); |
|
245 | + $view->item = $manager->getItem($id); |
|
246 | + $view->itemBase = $baseManager->getItem($view->item->getOrderBaseId(), ['order/base/address', 'order/base/product']); |
|
247 | 247 | $view->itemSubparts = $this->getSubClientNames(); |
248 | - $view->itemData = $this->toArray( $view->item ); |
|
248 | + $view->itemData = $this->toArray($view->item); |
|
249 | 249 | $view->itemBody = ''; |
250 | 250 | |
251 | - foreach( $this->getSubClients() as $idx => $client ) |
|
251 | + foreach ($this->getSubClients() as $idx => $client) |
|
252 | 252 | { |
253 | 253 | $view->tabindex = ++$idx + 1; |
254 | 254 | $view->itemBody .= $client->get(); |
255 | 255 | } |
256 | 256 | } |
257 | - catch( \Aimeos\MShop\Exception $e ) |
|
257 | + catch (\Aimeos\MShop\Exception $e) |
|
258 | 258 | { |
259 | - $error = array( 'subscription-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
260 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
261 | - $this->logException( $e ); |
|
259 | + $error = array('subscription-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
260 | + $view->errors = $view->get('errors', []) + $error; |
|
261 | + $this->logException($e); |
|
262 | 262 | } |
263 | - catch( \Exception $e ) |
|
263 | + catch (\Exception $e) |
|
264 | 264 | { |
265 | - $error = array( 'subscription-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
266 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
267 | - $this->logException( $e ); |
|
265 | + $error = array('subscription-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
266 | + $view->errors = $view->get('errors', []) + $error; |
|
267 | + $this->logException($e); |
|
268 | 268 | } |
269 | 269 | |
270 | - return $this->render( $view ); |
|
270 | + return $this->render($view); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | |
@@ -281,40 +281,40 @@ discard block |
||
281 | 281 | $view = $this->getView(); |
282 | 282 | $context = $this->getContext(); |
283 | 283 | |
284 | - $manager = \Aimeos\MShop::create( $context, 'subscription' ); |
|
284 | + $manager = \Aimeos\MShop::create($context, 'subscription'); |
|
285 | 285 | $manager->begin(); |
286 | 286 | |
287 | 287 | try |
288 | 288 | { |
289 | - $item = $this->fromArray( $view->param( 'item', [] ) ); |
|
290 | - $view->item = $item->getId() ? $item : $manager->saveItem( $item ); |
|
289 | + $item = $this->fromArray($view->param('item', [])); |
|
290 | + $view->item = $item->getId() ? $item : $manager->saveItem($item); |
|
291 | 291 | $view->itemBody = ''; |
292 | 292 | |
293 | - foreach( $this->getSubClients() as $client ) { |
|
293 | + foreach ($this->getSubClients() as $client) { |
|
294 | 294 | $view->itemBody .= $client->save(); |
295 | 295 | } |
296 | 296 | |
297 | - $manager->saveItem( clone $view->item ); |
|
297 | + $manager->saveItem(clone $view->item); |
|
298 | 298 | $manager->commit(); |
299 | 299 | |
300 | - $this->nextAction( $view, $view->param( 'next' ), 'subscription', $view->item->getId(), 'save' ); |
|
300 | + $this->nextAction($view, $view->param('next'), 'subscription', $view->item->getId(), 'save'); |
|
301 | 301 | return; |
302 | 302 | } |
303 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
303 | + catch (\Aimeos\Admin\JQAdm\Exception $e) |
|
304 | 304 | { |
305 | 305 | // fall through to create |
306 | 306 | } |
307 | - catch( \Aimeos\MShop\Exception $e ) |
|
307 | + catch (\Aimeos\MShop\Exception $e) |
|
308 | 308 | { |
309 | - $error = array( 'subscription-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
310 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
311 | - $this->logException( $e ); |
|
309 | + $error = array('subscription-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
310 | + $view->errors = $view->get('errors', []) + $error; |
|
311 | + $this->logException($e); |
|
312 | 312 | } |
313 | - catch( \Exception $e ) |
|
313 | + catch (\Exception $e) |
|
314 | 314 | { |
315 | - $error = array( 'subscription-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
316 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
317 | - $this->logException( $e ); |
|
315 | + $error = array('subscription-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
316 | + $view->errors = $view->get('errors', []) + $error; |
|
317 | + $this->logException($e); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | $manager->rollback(); |
@@ -336,35 +336,35 @@ discard block |
||
336 | 336 | try |
337 | 337 | { |
338 | 338 | $total = 0; |
339 | - $params = $this->storeSearchParams( $view->param(), 'subscription' ); |
|
340 | - $manager = \Aimeos\MShop::create( $context, 'subscription' ); |
|
339 | + $params = $this->storeSearchParams($view->param(), 'subscription'); |
|
340 | + $manager = \Aimeos\MShop::create($context, 'subscription'); |
|
341 | 341 | |
342 | 342 | $search = $manager->createSearch(); |
343 | - $search->setSortations( [$search->sort( '-', 'subscription.ctime' )] ); |
|
344 | - $search = $this->initCriteria( $search, $params ); |
|
343 | + $search->setSortations([$search->sort('-', 'subscription.ctime')]); |
|
344 | + $search = $this->initCriteria($search, $params); |
|
345 | 345 | |
346 | - $view->items = $manager->searchItems( $search, [], $total ); |
|
347 | - $view->baseItems = $this->getOrderBaseItems( $view->items ); |
|
348 | - $view->filterAttributes = $manager->getSearchAttributes( true ); |
|
346 | + $view->items = $manager->searchItems($search, [], $total); |
|
347 | + $view->baseItems = $this->getOrderBaseItems($view->items); |
|
348 | + $view->filterAttributes = $manager->getSearchAttributes(true); |
|
349 | 349 | $view->filterOperators = $search->getOperators(); |
350 | 350 | $view->total = $total; |
351 | 351 | $view->itemBody = ''; |
352 | 352 | |
353 | - foreach( $this->getSubClients() as $client ) { |
|
353 | + foreach ($this->getSubClients() as $client) { |
|
354 | 354 | $view->itemBody .= $client->search(); |
355 | 355 | } |
356 | 356 | } |
357 | - catch( \Aimeos\MShop\Exception $e ) |
|
357 | + catch (\Aimeos\MShop\Exception $e) |
|
358 | 358 | { |
359 | - $error = array( 'subscription-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
360 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
361 | - $this->logException( $e ); |
|
359 | + $error = array('subscription-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
360 | + $view->errors = $view->get('errors', []) + $error; |
|
361 | + $this->logException($e); |
|
362 | 362 | } |
363 | - catch( \Exception $e ) |
|
363 | + catch (\Exception $e) |
|
364 | 364 | { |
365 | - $error = array( 'subscription-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
366 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
367 | - $this->logException( $e ); |
|
365 | + $error = array('subscription-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
366 | + $view->errors = $view->get('errors', []) + $error; |
|
367 | + $this->logException($e); |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | /** admin/jqadm/subscription/template-list |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | $tplconf = 'admin/jqadm/subscription/template-list'; |
390 | 390 | $default = 'subscription/list-standard'; |
391 | 391 | |
392 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
392 | + return $view->render($view->config($tplconf, $default)); |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | * @param string|null $name Name of the sub-client (Default if null) |
401 | 401 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
402 | 402 | */ |
403 | - public function getSubClient( $type, $name = null ) |
|
403 | + public function getSubClient($type, $name = null) |
|
404 | 404 | { |
405 | 405 | /** admin/jqadm/subscription/decorators/excludes |
406 | 406 | * Excludes decorators added by the "common" option from the subscription JQAdm client |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | * @see admin/jqadm/subscription/decorators/excludes |
476 | 476 | * @see admin/jqadm/subscription/decorators/global |
477 | 477 | */ |
478 | - return $this->createSubClient( 'subscription/' . $type, $name ); |
|
478 | + return $this->createSubClient('subscription/' . $type, $name); |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | |
@@ -485,19 +485,19 @@ discard block |
||
485 | 485 | * @param \Aimeos\MShop\Subscription\Item\Iface[] $items List of subscription items |
486 | 486 | * @param \Aimeos\MShop\Order\Item\Base\Iface[] List of order base items |
487 | 487 | */ |
488 | - protected function getOrderBaseItems( array $items ) |
|
488 | + protected function getOrderBaseItems(array $items) |
|
489 | 489 | { |
490 | 490 | $baseIds = []; |
491 | - foreach( $items as $item ) { |
|
491 | + foreach ($items as $item) { |
|
492 | 492 | $baseIds[] = $item->getOrderBaseId(); |
493 | 493 | } |
494 | 494 | |
495 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'order/base' ); |
|
495 | + $manager = \Aimeos\MShop::create($this->getContext(), 'order/base'); |
|
496 | 496 | |
497 | - $search = $manager->createSearch()->setSlice( 0, count( $baseIds ) ); |
|
498 | - $search->setConditions( $search->compare( '==', 'order.base.id', $baseIds ) ); |
|
497 | + $search = $manager->createSearch()->setSlice(0, count($baseIds)); |
|
498 | + $search->setConditions($search->compare('==', 'order.base.id', $baseIds)); |
|
499 | 499 | |
500 | - return $manager->searchItems( $search, ['order/base/address', 'order/base/product'] ); |
|
500 | + return $manager->searchItems($search, ['order/base/address', 'order/base/product']); |
|
501 | 501 | } |
502 | 502 | |
503 | 503 | |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | * @since 2018.04 |
542 | 542 | * @category Developer |
543 | 543 | */ |
544 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/subscription/standard/subparts', [] ); |
|
544 | + return $this->getContext()->getConfig()->get('admin/jqadm/subscription/standard/subparts', []); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | |
@@ -551,17 +551,17 @@ discard block |
||
551 | 551 | * @param string[] Data array |
552 | 552 | * @return \Aimeos\MShop\Subscription\Item\Iface New subscription item object |
553 | 553 | */ |
554 | - protected function fromArray( array $data ) |
|
554 | + protected function fromArray(array $data) |
|
555 | 555 | { |
556 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'subscription' ); |
|
556 | + $manager = \Aimeos\MShop::create($this->getContext(), 'subscription'); |
|
557 | 557 | |
558 | - if( isset( $data['subscription.id'] ) && $data['subscription.id'] != '' ) { |
|
559 | - $item = $manager->getItem( $data['subscription.id'] ); |
|
558 | + if (isset($data['subscription.id']) && $data['subscription.id'] != '') { |
|
559 | + $item = $manager->getItem($data['subscription.id']); |
|
560 | 560 | } else { |
561 | 561 | $item = $manager->createItem(); |
562 | 562 | } |
563 | 563 | |
564 | - $item->fromArray( $data ); |
|
564 | + $item->fromArray($data); |
|
565 | 565 | |
566 | 566 | return $item; |
567 | 567 | } |
@@ -573,12 +573,12 @@ discard block |
||
573 | 573 | * @param \Aimeos\MShop\Subscription\Item\Iface $item Subscription item object |
574 | 574 | * @return string[] Multi-dimensional associative list of item data |
575 | 575 | */ |
576 | - protected function toArray( \Aimeos\MShop\Subscription\Item\Iface $item, $copy = false ) |
|
576 | + protected function toArray(\Aimeos\MShop\Subscription\Item\Iface $item, $copy = false) |
|
577 | 577 | { |
578 | 578 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
579 | - $data = $item->toArray( true ); |
|
579 | + $data = $item->toArray(true); |
|
580 | 580 | |
581 | - if( $copy === true ) |
|
581 | + if ($copy === true) |
|
582 | 582 | { |
583 | 583 | $data['subscription.siteid'] = $siteId; |
584 | 584 | $data['subscription.id'] = ''; |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
595 | 595 | * @return string HTML output |
596 | 596 | */ |
597 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
597 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
598 | 598 | { |
599 | 599 | /** admin/jqadm/subscription/template-item |
600 | 600 | * Relative path to the HTML body template for the subscription item. |
@@ -618,6 +618,6 @@ discard block |
||
618 | 618 | $tplconf = 'admin/jqadm/subscription/template-item'; |
619 | 619 | $default = 'subscription/item-standard'; |
620 | 620 | |
621 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
621 | + return $view->render($view->config($tplconf, $default)); |
|
622 | 622 | } |
623 | 623 | } |
@@ -10,48 +10,48 @@ |
||
10 | 10 | |
11 | 11 | ?> |
12 | 12 | <div id="physical" class="row item-physical tab-pane fade" role="tabpanel" aria-labelledby="physical"> |
13 | - <div class="col-xl-6 content-block <?= $this->site()->readonly( $this->get( 'itemData/product.siteid' ) ) ?>"> |
|
13 | + <div class="col-xl-6 content-block <?= $this->site()->readonly($this->get('itemData/product.siteid')) ?>"> |
|
14 | 14 | <div class="form-group row optional"> |
15 | - <label class="col-sm-4 form-control-label"><?= $enc->html( $this->translate( 'admin', 'Length' ) ); ?></label> |
|
15 | + <label class="col-sm-4 form-control-label"><?= $enc->html($this->translate('admin', 'Length')); ?></label> |
|
16 | 16 | <div class="col-sm-8"> |
17 | - <input class="form-control item-package-length" type="number" step="any" min="0" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
18 | - name="<?= $enc->attr( $this->formparam( array( 'physical', 'package-length' ) ) ); ?>" |
|
19 | - placeholder="<?= $enc->attr( $this->translate( 'admin', 'Product length, e.g. 30.0 (in yard, inch, etc.)' ) ); ?>" |
|
20 | - value="<?= $enc->attr( $this->get( 'physicalData/package-length' ) ); ?>" |
|
21 | - <?= $this->site()->readonly( $this->get( 'itemData/product.siteid' ) ) ?> > |
|
17 | + <input class="form-control item-package-length" type="number" step="any" min="0" tabindex="<?= $this->get('tabindex'); ?>" |
|
18 | + name="<?= $enc->attr($this->formparam(array('physical', 'package-length'))); ?>" |
|
19 | + placeholder="<?= $enc->attr($this->translate('admin', 'Product length, e.g. 30.0 (in yard, inch, etc.)')); ?>" |
|
20 | + value="<?= $enc->attr($this->get('physicalData/package-length')); ?>" |
|
21 | + <?= $this->site()->readonly($this->get('itemData/product.siteid')) ?> > |
|
22 | 22 | </div> |
23 | 23 | </div> |
24 | 24 | <div class="form-group row optional"> |
25 | - <label class="col-sm-4 form-control-label"><?= $enc->html( $this->translate( 'admin', 'Width' ) ); ?></label> |
|
25 | + <label class="col-sm-4 form-control-label"><?= $enc->html($this->translate('admin', 'Width')); ?></label> |
|
26 | 26 | <div class="col-sm-8"> |
27 | - <input class="form-control item-package-width" type="number" step="any" min="0" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
28 | - name="<?= $enc->attr( $this->formparam( array( 'physical', 'package-width' ) ) ); ?>" |
|
29 | - placeholder="<?= $enc->attr( $this->translate( 'admin', 'Product width, e.g. 17.5 (in yard, inch etc.)' ) ); ?>" |
|
30 | - value="<?= $enc->attr( $this->get( 'physicalData/package-width' ) ); ?>" |
|
31 | - <?= $this->site()->readonly( $this->get( 'itemData/product.siteid' ) ) ?> > |
|
27 | + <input class="form-control item-package-width" type="number" step="any" min="0" tabindex="<?= $this->get('tabindex'); ?>" |
|
28 | + name="<?= $enc->attr($this->formparam(array('physical', 'package-width'))); ?>" |
|
29 | + placeholder="<?= $enc->attr($this->translate('admin', 'Product width, e.g. 17.5 (in yard, inch etc.)')); ?>" |
|
30 | + value="<?= $enc->attr($this->get('physicalData/package-width')); ?>" |
|
31 | + <?= $this->site()->readonly($this->get('itemData/product.siteid')) ?> > |
|
32 | 32 | </div> |
33 | 33 | </div> |
34 | 34 | <div class="form-group row optional"> |
35 | - <label class="col-sm-4 form-control-label"><?= $enc->html( $this->translate( 'admin', 'Height' ) ); ?></label> |
|
35 | + <label class="col-sm-4 form-control-label"><?= $enc->html($this->translate('admin', 'Height')); ?></label> |
|
36 | 36 | <div class="col-sm-8"> |
37 | - <input class="form-control item-package-height" type="number" step="any" min="0" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
38 | - name="<?= $enc->attr( $this->formparam( array( 'physical', 'package-height' ) ) ); ?>" |
|
39 | - placeholder="<?= $enc->attr( $this->translate( 'admin', 'Product height, e.g. 20.0 (in yard, inch, etc.)' ) ); ?>" |
|
40 | - value="<?= $enc->attr( $this->get( 'physicalData/package-height' ) ); ?>" |
|
41 | - <?= $this->site()->readonly( $this->get( 'itemData/product.siteid' ) ) ?> > |
|
37 | + <input class="form-control item-package-height" type="number" step="any" min="0" tabindex="<?= $this->get('tabindex'); ?>" |
|
38 | + name="<?= $enc->attr($this->formparam(array('physical', 'package-height'))); ?>" |
|
39 | + placeholder="<?= $enc->attr($this->translate('admin', 'Product height, e.g. 20.0 (in yard, inch, etc.)')); ?>" |
|
40 | + value="<?= $enc->attr($this->get('physicalData/package-height')); ?>" |
|
41 | + <?= $this->site()->readonly($this->get('itemData/product.siteid')) ?> > |
|
42 | 42 | </div> |
43 | 43 | </div> |
44 | 44 | <div class="form-group row optional"> |
45 | - <label class="col-sm-4 form-control-label"><?= $enc->html( $this->translate( 'admin', 'Weight' ) ); ?></label> |
|
45 | + <label class="col-sm-4 form-control-label"><?= $enc->html($this->translate('admin', 'Weight')); ?></label> |
|
46 | 46 | <div class="col-sm-8"> |
47 | - <input class="form-control item-package-weight" type="number" step="any" min="0" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
48 | - name="<?= $enc->attr( $this->formparam( array( 'physical', 'package-weight' ) ) ); ?>" |
|
49 | - placeholder="<?= $enc->attr( $this->translate( 'admin', 'Product weight, e.g. 1.25 (in pound, ounce, etc.)' ) ); ?>" |
|
50 | - value="<?= $enc->attr( $this->get( 'physicalData/package-weight' ) ); ?>" |
|
51 | - <?= $this->site()->readonly( $this->get( 'itemData/product.siteid' ) ) ?> > |
|
47 | + <input class="form-control item-package-weight" type="number" step="any" min="0" tabindex="<?= $this->get('tabindex'); ?>" |
|
48 | + name="<?= $enc->attr($this->formparam(array('physical', 'package-weight'))); ?>" |
|
49 | + placeholder="<?= $enc->attr($this->translate('admin', 'Product weight, e.g. 1.25 (in pound, ounce, etc.)')); ?>" |
|
50 | + value="<?= $enc->attr($this->get('physicalData/package-weight')); ?>" |
|
51 | + <?= $this->site()->readonly($this->get('itemData/product.siteid')) ?> > |
|
52 | 52 | </div> |
53 | 53 | </div> |
54 | 54 | </div> |
55 | 55 | |
56 | - <?= $this->get( 'physicalBody' ); ?> |
|
56 | + <?= $this->get('physicalBody'); ?> |
|
57 | 57 | </div> |
@@ -17,49 +17,49 @@ |
||
17 | 17 | */ |
18 | 18 | |
19 | 19 | |
20 | -$selected = function( array $filter, $key, $code ) { |
|
21 | - return ( isset( $filter[$key][0] ) && $filter[$key][0] == $code ? 'selected="selected"' : '' ); |
|
20 | +$selected = function(array $filter, $key, $code) { |
|
21 | + return (isset($filter[$key][0]) && $filter[$key][0] == $code ? 'selected="selected"' : ''); |
|
22 | 22 | }; |
23 | 23 | |
24 | 24 | |
25 | -$target = $this->config( 'admin/jqadm/url/search/target' ); |
|
26 | -$controller = $this->config( 'admin/jqadm/url/search/controller', 'Jqadm' ); |
|
27 | -$action = $this->config( 'admin/jqadm/url/search/action', 'search' ); |
|
28 | -$config = $this->config( 'admin/jqadm/url/search/config', [] ); |
|
25 | +$target = $this->config('admin/jqadm/url/search/target'); |
|
26 | +$controller = $this->config('admin/jqadm/url/search/controller', 'Jqadm'); |
|
27 | +$action = $this->config('admin/jqadm/url/search/action', 'search'); |
|
28 | +$config = $this->config('admin/jqadm/url/search/config', []); |
|
29 | 29 | |
30 | -$filter = $this->get( 'filter', [] ); |
|
31 | -$params = $this->get( 'params', [] ); |
|
30 | +$filter = $this->get('filter', []); |
|
31 | +$params = $this->get('params', []); |
|
32 | 32 | $params['page']['start'] = 0; |
33 | -unset( $params['filter'] ); |
|
33 | +unset($params['filter']); |
|
34 | 34 | |
35 | 35 | $enc = $this->encoder(); |
36 | 36 | |
37 | 37 | |
38 | 38 | ?> |
39 | -<form class="form-inline" method="POST" action="<?= $enc->attr( $this->url( $target, $controller, $action, $params, [], $config ) ); ?>"> |
|
39 | +<form class="form-inline" method="POST" action="<?= $enc->attr($this->url($target, $controller, $action, $params, [], $config)); ?>"> |
|
40 | 40 | <?= $this->csrf()->formfield(); ?> |
41 | 41 | |
42 | 42 | <i class="fa more"></i> |
43 | 43 | |
44 | 44 | <div class="input-group"> |
45 | - <select class="custom-select filter-key" name="<?= $this->formparam( ['filter', 'key', '0'] ); ?>"> |
|
46 | - <?php foreach( $this->get( 'filterAttributes', [] ) as $code => $attrItem ) : ?> |
|
47 | - <?php if( $attrItem->isPublic() ) : ?> |
|
48 | - <option value="<?= $enc->attr( $code ); ?>" data-type="<?= $enc->attr( $attrItem->getType() ); ?>" <?= $selected( $filter, 'key', $code ); ?> > |
|
49 | - <?= $enc->html( $this->translate( 'admin/ext', $attrItem->getLabel() ) ); ?> |
|
45 | + <select class="custom-select filter-key" name="<?= $this->formparam(['filter', 'key', '0']); ?>"> |
|
46 | + <?php foreach ($this->get('filterAttributes', []) as $code => $attrItem) : ?> |
|
47 | + <?php if ($attrItem->isPublic()) : ?> |
|
48 | + <option value="<?= $enc->attr($code); ?>" data-type="<?= $enc->attr($attrItem->getType()); ?>" <?= $selected($filter, 'key', $code); ?> > |
|
49 | + <?= $enc->html($this->translate('admin/ext', $attrItem->getLabel())); ?> |
|
50 | 50 | </option> |
51 | 51 | <?php endif; ?> |
52 | 52 | <?php endforeach; ?> |
53 | 53 | </select> |
54 | - <select class="custom-select filter-operator" name="<?= $this->formparam( ['filter', 'op', '0'] ); ?>"> |
|
55 | - <?php foreach( $this->get( 'filterOperators/compare', [] ) as $code ) : ?> |
|
56 | - <option value="<?= $enc->attr( $code ); ?>" <?= $selected( $filter, 'op', $code ); ?> > |
|
57 | - <?= $enc->html( $code ) . ( strlen( $code ) === 1 ? ' ' : '' ); ?> <?= $enc->html( $this->translate( 'admin/ext', $code ) ); ?> |
|
54 | + <select class="custom-select filter-operator" name="<?= $this->formparam(['filter', 'op', '0']); ?>"> |
|
55 | + <?php foreach ($this->get('filterOperators/compare', []) as $code) : ?> |
|
56 | + <option value="<?= $enc->attr($code); ?>" <?= $selected($filter, 'op', $code); ?> > |
|
57 | + <?= $enc->html($code) . (strlen($code) === 1 ? ' ' : ''); ?> <?= $enc->html($this->translate('admin/ext', $code)); ?> |
|
58 | 58 | </option> |
59 | 59 | <?php endforeach; ?> |
60 | 60 | </select> |
61 | - <input type="text" class="form-control filter-value" name="<?= $this->formparam( ['filter', 'val', '0'] ); ?>" |
|
62 | - value="<?= $enc->attr( ( isset( $filter['val'][0] ) ? $filter['val'][0] : '' ) ); ?>" > |
|
61 | + <input type="text" class="form-control filter-value" name="<?= $this->formparam(['filter', 'val', '0']); ?>" |
|
62 | + value="<?= $enc->attr((isset($filter['val'][0]) ? $filter['val'][0] : '')); ?>" > |
|
63 | 63 | <div class="input-group-append"> |
64 | 64 | <button class="btn btn-primary fa fa-search"></button> |
65 | 65 | </div> |
@@ -88,14 +88,12 @@ discard block |
||
88 | 88 | $view->tabindex = ++$idx + 1; |
89 | 89 | $view->itemBody .= $client->copy(); |
90 | 90 | } |
91 | - } |
|
92 | - catch( \Aimeos\MShop\Exception $e ) |
|
91 | + } catch( \Aimeos\MShop\Exception $e ) |
|
93 | 92 | { |
94 | 93 | $error = array( 'group-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
95 | 94 | $view->errors = $view->get( 'errors', [] ) + $error; |
96 | 95 | $this->logException( $e ); |
97 | - } |
|
98 | - catch( \Exception $e ) |
|
96 | + } catch( \Exception $e ) |
|
99 | 97 | { |
100 | 98 | $error = array( 'group-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
101 | 99 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -137,14 +135,12 @@ discard block |
||
137 | 135 | $view->tabindex = ++$idx + 1; |
138 | 136 | $view->itemBody .= $client->create(); |
139 | 137 | } |
140 | - } |
|
141 | - catch( \Aimeos\MShop\Exception $e ) |
|
138 | + } catch( \Aimeos\MShop\Exception $e ) |
|
142 | 139 | { |
143 | 140 | $error = array( 'group-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
144 | 141 | $view->errors = $view->get( 'errors', [] ) + $error; |
145 | 142 | $this->logException( $e ); |
146 | - } |
|
147 | - catch( \Exception $e ) |
|
143 | + } catch( \Exception $e ) |
|
148 | 144 | { |
149 | 145 | $error = array( 'group-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
150 | 146 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -185,14 +181,12 @@ discard block |
||
185 | 181 | |
186 | 182 | $this->nextAction( $view, 'search', 'group', null, 'delete' ); |
187 | 183 | return; |
188 | - } |
|
189 | - catch( \Aimeos\MShop\Exception $e ) |
|
184 | + } catch( \Aimeos\MShop\Exception $e ) |
|
190 | 185 | { |
191 | 186 | $error = array( 'group-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
192 | 187 | $view->errors = $view->get( 'errors', [] ) + $error; |
193 | 188 | $this->logException( $e ); |
194 | - } |
|
195 | - catch( \Exception $e ) |
|
189 | + } catch( \Exception $e ) |
|
196 | 190 | { |
197 | 191 | $error = array( 'group-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
198 | 192 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -233,14 +227,12 @@ discard block |
||
233 | 227 | $view->tabindex = ++$idx + 1; |
234 | 228 | $view->itemBody .= $client->get(); |
235 | 229 | } |
236 | - } |
|
237 | - catch( \Aimeos\MShop\Exception $e ) |
|
230 | + } catch( \Aimeos\MShop\Exception $e ) |
|
238 | 231 | { |
239 | 232 | $error = array( 'group-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
240 | 233 | $view->errors = $view->get( 'errors', [] ) + $error; |
241 | 234 | $this->logException( $e ); |
242 | - } |
|
243 | - catch( \Exception $e ) |
|
235 | + } catch( \Exception $e ) |
|
244 | 236 | { |
245 | 237 | $error = array( 'group-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
246 | 238 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -277,18 +269,15 @@ discard block |
||
277 | 269 | |
278 | 270 | $this->nextAction( $view, $view->param( 'next' ), 'group', $view->item->getId(), 'save' ); |
279 | 271 | return; |
280 | - } |
|
281 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
272 | + } catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
282 | 273 | { |
283 | 274 | // fall through to create |
284 | - } |
|
285 | - catch( \Aimeos\MShop\Exception $e ) |
|
275 | + } catch( \Aimeos\MShop\Exception $e ) |
|
286 | 276 | { |
287 | 277 | $error = array( 'group-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
288 | 278 | $view->errors = $view->get( 'errors', [] ) + $error; |
289 | 279 | $this->logException( $e ); |
290 | - } |
|
291 | - catch( \Exception $e ) |
|
280 | + } catch( \Exception $e ) |
|
292 | 281 | { |
293 | 282 | $error = array( 'group-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
294 | 283 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -327,14 +316,12 @@ discard block |
||
327 | 316 | foreach( $this->getSubClients() as $client ) { |
328 | 317 | $view->itemBody .= $client->search(); |
329 | 318 | } |
330 | - } |
|
331 | - catch( \Aimeos\MShop\Exception $e ) |
|
319 | + } catch( \Aimeos\MShop\Exception $e ) |
|
332 | 320 | { |
333 | 321 | $error = array( 'group-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
334 | 322 | $view->errors = $view->get( 'errors', [] ) + $error; |
335 | 323 | $this->logException( $e ); |
336 | - } |
|
337 | - catch( \Exception $e ) |
|
324 | + } catch( \Exception $e ) |
|
338 | 325 | { |
339 | 326 | $error = array( 'group-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
340 | 327 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Group; |
12 | 12 | |
13 | -sprintf( 'group' ); // for translation |
|
13 | +sprintf('group'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -35,37 +35,37 @@ discard block |
||
35 | 35 | |
36 | 36 | try |
37 | 37 | { |
38 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
39 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
38 | + if (($id = $view->param('id')) === null) { |
|
39 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
40 | 40 | } |
41 | 41 | |
42 | - $manager = \Aimeos\MShop::create( $context, 'customer/group' ); |
|
43 | - $view->item = $manager->getItem( $id ); |
|
42 | + $manager = \Aimeos\MShop::create($context, 'customer/group'); |
|
43 | + $view->item = $manager->getItem($id); |
|
44 | 44 | |
45 | - $view->itemData = $this->toArray( $view->item, true ); |
|
45 | + $view->itemData = $this->toArray($view->item, true); |
|
46 | 46 | $view->itemSubparts = $this->getSubClientNames(); |
47 | 47 | $view->itemBody = ''; |
48 | 48 | |
49 | - foreach( $this->getSubClients() as $idx => $client ) |
|
49 | + foreach ($this->getSubClients() as $idx => $client) |
|
50 | 50 | { |
51 | 51 | $view->tabindex = ++$idx + 1; |
52 | 52 | $view->itemBody .= $client->copy(); |
53 | 53 | } |
54 | 54 | } |
55 | - catch( \Aimeos\MShop\Exception $e ) |
|
55 | + catch (\Aimeos\MShop\Exception $e) |
|
56 | 56 | { |
57 | - $error = array( 'group-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
58 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
59 | - $this->logException( $e ); |
|
57 | + $error = array('group-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
58 | + $view->errors = $view->get('errors', []) + $error; |
|
59 | + $this->logException($e); |
|
60 | 60 | } |
61 | - catch( \Exception $e ) |
|
61 | + catch (\Exception $e) |
|
62 | 62 | { |
63 | - $error = array( 'group-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
64 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
65 | - $this->logException( $e ); |
|
63 | + $error = array('group-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
64 | + $view->errors = $view->get('errors', []) + $error; |
|
65 | + $this->logException($e); |
|
66 | 66 | } |
67 | 67 | |
68 | - return $this->render( $view ); |
|
68 | + return $this->render($view); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | |
82 | 82 | try |
83 | 83 | { |
84 | - $data = $view->param( 'item', [] ); |
|
84 | + $data = $view->param('item', []); |
|
85 | 85 | |
86 | - if( !isset( $view->item ) ) { |
|
87 | - $view->item = \Aimeos\MShop::create( $context, 'customer/group' )->createItem(); |
|
86 | + if (!isset($view->item)) { |
|
87 | + $view->item = \Aimeos\MShop::create($context, 'customer/group')->createItem(); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | $data['customer.group.siteid'] = $view->item->getSiteId(); |
@@ -93,26 +93,26 @@ discard block |
||
93 | 93 | $view->itemData = $data; |
94 | 94 | $view->itemBody = ''; |
95 | 95 | |
96 | - foreach( $this->getSubClients() as $idx => $client ) |
|
96 | + foreach ($this->getSubClients() as $idx => $client) |
|
97 | 97 | { |
98 | 98 | $view->tabindex = ++$idx + 1; |
99 | 99 | $view->itemBody .= $client->create(); |
100 | 100 | } |
101 | 101 | } |
102 | - catch( \Aimeos\MShop\Exception $e ) |
|
102 | + catch (\Aimeos\MShop\Exception $e) |
|
103 | 103 | { |
104 | - $error = array( 'group-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
105 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
106 | - $this->logException( $e ); |
|
104 | + $error = array('group-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
105 | + $view->errors = $view->get('errors', []) + $error; |
|
106 | + $this->logException($e); |
|
107 | 107 | } |
108 | - catch( \Exception $e ) |
|
108 | + catch (\Exception $e) |
|
109 | 109 | { |
110 | - $error = array( 'group-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
111 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
112 | - $this->logException( $e ); |
|
110 | + $error = array('group-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
111 | + $view->errors = $view->get('errors', []) + $error; |
|
112 | + $this->logException($e); |
|
113 | 113 | } |
114 | 114 | |
115 | - return $this->render( $view ); |
|
115 | + return $this->render($view); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -126,38 +126,38 @@ discard block |
||
126 | 126 | $view = $this->getView(); |
127 | 127 | $context = $this->getContext(); |
128 | 128 | |
129 | - $manager = \Aimeos\MShop::create( $context, 'customer/group' ); |
|
129 | + $manager = \Aimeos\MShop::create($context, 'customer/group'); |
|
130 | 130 | $manager->begin(); |
131 | 131 | |
132 | 132 | try |
133 | 133 | { |
134 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
135 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
134 | + if (($id = $view->param('id')) === null) { |
|
135 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
136 | 136 | } |
137 | 137 | |
138 | - $view->item = $manager->getItem( $id ); |
|
138 | + $view->item = $manager->getItem($id); |
|
139 | 139 | |
140 | - foreach( $this->getSubClients() as $client ) { |
|
140 | + foreach ($this->getSubClients() as $client) { |
|
141 | 141 | $client->delete(); |
142 | 142 | } |
143 | 143 | |
144 | - $manager->deleteItem( $id ); |
|
144 | + $manager->deleteItem($id); |
|
145 | 145 | $manager->commit(); |
146 | 146 | |
147 | - $this->nextAction( $view, 'search', 'group', null, 'delete' ); |
|
147 | + $this->nextAction($view, 'search', 'group', null, 'delete'); |
|
148 | 148 | return; |
149 | 149 | } |
150 | - catch( \Aimeos\MShop\Exception $e ) |
|
150 | + catch (\Aimeos\MShop\Exception $e) |
|
151 | 151 | { |
152 | - $error = array( 'group-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
153 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
154 | - $this->logException( $e ); |
|
152 | + $error = array('group-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
153 | + $view->errors = $view->get('errors', []) + $error; |
|
154 | + $this->logException($e); |
|
155 | 155 | } |
156 | - catch( \Exception $e ) |
|
156 | + catch (\Exception $e) |
|
157 | 157 | { |
158 | - $error = array( 'group-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
159 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
160 | - $this->logException( $e ); |
|
158 | + $error = array('group-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
159 | + $view->errors = $view->get('errors', []) + $error; |
|
160 | + $this->logException($e); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | $manager->rollback(); |
@@ -178,37 +178,37 @@ discard block |
||
178 | 178 | |
179 | 179 | try |
180 | 180 | { |
181 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
182 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
181 | + if (($id = $view->param('id')) === null) { |
|
182 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
183 | 183 | } |
184 | 184 | |
185 | - $manager = \Aimeos\MShop::create( $context, 'customer/group' ); |
|
185 | + $manager = \Aimeos\MShop::create($context, 'customer/group'); |
|
186 | 186 | |
187 | - $view->item = $manager->getItem( $id ); |
|
187 | + $view->item = $manager->getItem($id); |
|
188 | 188 | $view->itemSubparts = $this->getSubClientNames(); |
189 | - $view->itemData = $this->toArray( $view->item ); |
|
189 | + $view->itemData = $this->toArray($view->item); |
|
190 | 190 | $view->itemBody = ''; |
191 | 191 | |
192 | - foreach( $this->getSubClients() as $idx => $client ) |
|
192 | + foreach ($this->getSubClients() as $idx => $client) |
|
193 | 193 | { |
194 | 194 | $view->tabindex = ++$idx + 1; |
195 | 195 | $view->itemBody .= $client->get(); |
196 | 196 | } |
197 | 197 | } |
198 | - catch( \Aimeos\MShop\Exception $e ) |
|
198 | + catch (\Aimeos\MShop\Exception $e) |
|
199 | 199 | { |
200 | - $error = array( 'group-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
201 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
202 | - $this->logException( $e ); |
|
200 | + $error = array('group-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
201 | + $view->errors = $view->get('errors', []) + $error; |
|
202 | + $this->logException($e); |
|
203 | 203 | } |
204 | - catch( \Exception $e ) |
|
204 | + catch (\Exception $e) |
|
205 | 205 | { |
206 | - $error = array( 'group-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
207 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
208 | - $this->logException( $e ); |
|
206 | + $error = array('group-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
207 | + $view->errors = $view->get('errors', []) + $error; |
|
208 | + $this->logException($e); |
|
209 | 209 | } |
210 | 210 | |
211 | - return $this->render( $view ); |
|
211 | + return $this->render($view); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | |
@@ -222,40 +222,40 @@ discard block |
||
222 | 222 | $view = $this->getView(); |
223 | 223 | $context = $this->getContext(); |
224 | 224 | |
225 | - $manager = \Aimeos\MShop::create( $context, 'customer/group' ); |
|
225 | + $manager = \Aimeos\MShop::create($context, 'customer/group'); |
|
226 | 226 | $manager->begin(); |
227 | 227 | |
228 | 228 | try |
229 | 229 | { |
230 | - $item = $this->fromArray( $view->param( 'item', [] ) ); |
|
231 | - $view->item = $item->getId() ? $item : $manager->saveItem( $item ); |
|
230 | + $item = $this->fromArray($view->param('item', [])); |
|
231 | + $view->item = $item->getId() ? $item : $manager->saveItem($item); |
|
232 | 232 | $view->itemBody = ''; |
233 | 233 | |
234 | - foreach( $this->getSubClients() as $client ) { |
|
234 | + foreach ($this->getSubClients() as $client) { |
|
235 | 235 | $view->itemBody .= $client->save(); |
236 | 236 | } |
237 | 237 | |
238 | - $manager->saveItem( clone $view->item ); |
|
238 | + $manager->saveItem(clone $view->item); |
|
239 | 239 | $manager->commit(); |
240 | 240 | |
241 | - $this->nextAction( $view, $view->param( 'next' ), 'group', $view->item->getId(), 'save' ); |
|
241 | + $this->nextAction($view, $view->param('next'), 'group', $view->item->getId(), 'save'); |
|
242 | 242 | return; |
243 | 243 | } |
244 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
244 | + catch (\Aimeos\Admin\JQAdm\Exception $e) |
|
245 | 245 | { |
246 | 246 | // fall through to create |
247 | 247 | } |
248 | - catch( \Aimeos\MShop\Exception $e ) |
|
248 | + catch (\Aimeos\MShop\Exception $e) |
|
249 | 249 | { |
250 | - $error = array( 'group-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
251 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
252 | - $this->logException( $e ); |
|
250 | + $error = array('group-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
251 | + $view->errors = $view->get('errors', []) + $error; |
|
252 | + $this->logException($e); |
|
253 | 253 | } |
254 | - catch( \Exception $e ) |
|
254 | + catch (\Exception $e) |
|
255 | 255 | { |
256 | - $error = array( 'group-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
257 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
258 | - $this->logException( $e ); |
|
256 | + $error = array('group-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
257 | + $view->errors = $view->get('errors', []) + $error; |
|
258 | + $this->logException($e); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | $manager->rollback(); |
@@ -277,31 +277,31 @@ discard block |
||
277 | 277 | try |
278 | 278 | { |
279 | 279 | $total = 0; |
280 | - $params = $this->storeSearchParams( $view->param(), 'group' ); |
|
281 | - $manager = \Aimeos\MShop::create( $context, 'customer/group' ); |
|
282 | - $search = $this->initCriteria( $manager->createSearch(), $params ); |
|
280 | + $params = $this->storeSearchParams($view->param(), 'group'); |
|
281 | + $manager = \Aimeos\MShop::create($context, 'customer/group'); |
|
282 | + $search = $this->initCriteria($manager->createSearch(), $params); |
|
283 | 283 | |
284 | - $view->items = $manager->searchItems( $search, [], $total ); |
|
285 | - $view->filterAttributes = $manager->getSearchAttributes( true ); |
|
284 | + $view->items = $manager->searchItems($search, [], $total); |
|
285 | + $view->filterAttributes = $manager->getSearchAttributes(true); |
|
286 | 286 | $view->filterOperators = $search->getOperators(); |
287 | 287 | $view->total = $total; |
288 | 288 | $view->itemBody = ''; |
289 | 289 | |
290 | - foreach( $this->getSubClients() as $client ) { |
|
290 | + foreach ($this->getSubClients() as $client) { |
|
291 | 291 | $view->itemBody .= $client->search(); |
292 | 292 | } |
293 | 293 | } |
294 | - catch( \Aimeos\MShop\Exception $e ) |
|
294 | + catch (\Aimeos\MShop\Exception $e) |
|
295 | 295 | { |
296 | - $error = array( 'group-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
297 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
298 | - $this->logException( $e ); |
|
296 | + $error = array('group-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
297 | + $view->errors = $view->get('errors', []) + $error; |
|
298 | + $this->logException($e); |
|
299 | 299 | } |
300 | - catch( \Exception $e ) |
|
300 | + catch (\Exception $e) |
|
301 | 301 | { |
302 | - $error = array( 'group-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
303 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
304 | - $this->logException( $e ); |
|
302 | + $error = array('group-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
303 | + $view->errors = $view->get('errors', []) + $error; |
|
304 | + $this->logException($e); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | /** admin/jqadm/group/template-list |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | $tplconf = 'admin/jqadm/group/template-list'; |
327 | 327 | $default = 'group/list-standard'; |
328 | 328 | |
329 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
329 | + return $view->render($view->config($tplconf, $default)); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | * @param string|null $name Name of the sub-client (Default if null) |
338 | 338 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
339 | 339 | */ |
340 | - public function getSubClient( $type, $name = null ) |
|
340 | + public function getSubClient($type, $name = null) |
|
341 | 341 | { |
342 | 342 | /** admin/jqadm/group/decorators/excludes |
343 | 343 | * Excludes decorators added by the "common" option from the group JQAdm client |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * @see admin/jqadm/group/decorators/excludes |
413 | 413 | * @see admin/jqadm/group/decorators/global |
414 | 414 | */ |
415 | - return $this->createSubClient( 'group/' . $type, $name ); |
|
415 | + return $this->createSubClient('group/' . $type, $name); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | * @since 2018.07 |
457 | 457 | * @category Developer |
458 | 458 | */ |
459 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/group/standard/subparts', [] ); |
|
459 | + return $this->getContext()->getConfig()->get('admin/jqadm/group/standard/subparts', []); |
|
460 | 460 | } |
461 | 461 | |
462 | 462 | |
@@ -467,17 +467,17 @@ discard block |
||
467 | 467 | * @param string[] Data array |
468 | 468 | * @return \Aimeos\MShop\Group\Item\Iface New group item object |
469 | 469 | */ |
470 | - protected function fromArray( array $data ) |
|
470 | + protected function fromArray(array $data) |
|
471 | 471 | { |
472 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'customer/group' ); |
|
472 | + $manager = \Aimeos\MShop::create($this->getContext(), 'customer/group'); |
|
473 | 473 | |
474 | - if( isset( $data['customer.group.id'] ) && $data['customer.group.id'] != '' ) { |
|
475 | - $item = $manager->getItem( $data['customer.group.id'] ); |
|
474 | + if (isset($data['customer.group.id']) && $data['customer.group.id'] != '') { |
|
475 | + $item = $manager->getItem($data['customer.group.id']); |
|
476 | 476 | } else { |
477 | 477 | $item = $manager->createItem(); |
478 | 478 | } |
479 | 479 | |
480 | - $item->fromArray( $data ); |
|
480 | + $item->fromArray($data); |
|
481 | 481 | |
482 | 482 | return $item; |
483 | 483 | } |
@@ -489,11 +489,11 @@ discard block |
||
489 | 489 | * @param \Aimeos\MShop\Customer\Item\Group\Iface $item Group item object |
490 | 490 | * @return string[] Multi-dimensional associative list of item data |
491 | 491 | */ |
492 | - protected function toArray( \Aimeos\MShop\Customer\Item\Group\Iface $item, $copy = false ) |
|
492 | + protected function toArray(\Aimeos\MShop\Customer\Item\Group\Iface $item, $copy = false) |
|
493 | 493 | { |
494 | - $data = $item->toArray( true ); |
|
494 | + $data = $item->toArray(true); |
|
495 | 495 | |
496 | - if( $copy === true ) |
|
496 | + if ($copy === true) |
|
497 | 497 | { |
498 | 498 | $data['customer.group.siteid'] = $this->getContext()->getLocale()->getSiteId(); |
499 | 499 | $data['customer.group.id'] = ''; |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
510 | 510 | * @return string HTML output |
511 | 511 | */ |
512 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
512 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
513 | 513 | { |
514 | 514 | /** admin/jqadm/group/template-item |
515 | 515 | * Relative path to the HTML body template for the group item. |
@@ -533,6 +533,6 @@ discard block |
||
533 | 533 | $tplconf = 'admin/jqadm/group/template-item'; |
534 | 534 | $default = 'group/item-standard'; |
535 | 535 | |
536 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
536 | + return $view->render($view->config($tplconf, $default)); |
|
537 | 537 | } |
538 | 538 | } |
@@ -160,14 +160,12 @@ |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | return; |
163 | - } |
|
164 | - catch( \Aimeos\MShop\Exception $e ) |
|
163 | + } catch( \Aimeos\MShop\Exception $e ) |
|
165 | 164 | { |
166 | 165 | $error = array( 'attribute-item-text' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
167 | 166 | $view->errors = $view->get( 'errors', [] ) + $error; |
168 | 167 | $this->logException( $e ); |
169 | - } |
|
170 | - catch( \Exception $e ) |
|
168 | + } catch( \Exception $e ) |
|
171 | 169 | { |
172 | 170 | $error = array( 'attribute-item-text' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
173 | 171 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Attribute\Text; |
12 | 12 | |
13 | -sprintf( 'text' ); // for translation |
|
13 | +sprintf('text'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -42,16 +42,16 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function copy() |
44 | 44 | { |
45 | - $view = $this->addViewData( $this->getView() ); |
|
45 | + $view = $this->addViewData($this->getView()); |
|
46 | 46 | |
47 | - $view->textData = $this->toArray( $view->item, true ); |
|
47 | + $view->textData = $this->toArray($view->item, true); |
|
48 | 48 | $view->textBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->textBody .= $client->copy(); |
52 | 52 | } |
53 | 53 | |
54 | - return $this->render( $view ); |
|
54 | + return $this->render($view); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function create() |
64 | 64 | { |
65 | - $view = $this->addViewData( $this->getView() ); |
|
65 | + $view = $this->addViewData($this->getView()); |
|
66 | 66 | $siteid = $this->getContext()->getLocale()->getSiteId(); |
67 | - $data = $view->param( 'text', [] ); |
|
67 | + $data = $view->param('text', []); |
|
68 | 68 | |
69 | - foreach( $data as $idx => $entry ) |
|
69 | + foreach ($data as $idx => $entry) |
|
70 | 70 | { |
71 | 71 | $data[$idx]['attribute.lists.siteid'] = $siteid; |
72 | 72 | $data[$idx]['text.siteid'] = $siteid; |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | $view->textData = $data; |
76 | 76 | $view->textBody = ''; |
77 | 77 | |
78 | - foreach( $this->getSubClients() as $client ) { |
|
78 | + foreach ($this->getSubClients() as $client) { |
|
79 | 79 | $view->textBody .= $client->create(); |
80 | 80 | } |
81 | 81 | |
82 | - return $this->render( $view ); |
|
82 | + return $this->render($view); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | parent::delete(); |
92 | 92 | |
93 | 93 | $item = $this->getView()->item; |
94 | - $item->deleteListItems( $item->getListItems( 'text', null, null, false ), true ); |
|
94 | + $item->deleteListItems($item->getListItems('text', null, null, false), true); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
@@ -102,16 +102,16 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function get() |
104 | 104 | { |
105 | - $view = $this->addViewData( $this->getView() ); |
|
105 | + $view = $this->addViewData($this->getView()); |
|
106 | 106 | |
107 | - $view->textData = $this->toArray( $view->item ); |
|
107 | + $view->textData = $this->toArray($view->item); |
|
108 | 108 | $view->textBody = ''; |
109 | 109 | |
110 | - foreach( $this->getSubClients() as $client ) { |
|
110 | + foreach ($this->getSubClients() as $client) { |
|
111 | 111 | $view->textBody .= $client->get(); |
112 | 112 | } |
113 | 113 | |
114 | - return $this->render( $view ); |
|
114 | + return $this->render($view); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -124,26 +124,26 @@ discard block |
||
124 | 124 | |
125 | 125 | try |
126 | 126 | { |
127 | - $view->item = $this->fromArray( $view->item, $view->param( 'text', [] ) ); |
|
127 | + $view->item = $this->fromArray($view->item, $view->param('text', [])); |
|
128 | 128 | $view->textBody = ''; |
129 | 129 | |
130 | - foreach( $this->getSubClients() as $client ) { |
|
130 | + foreach ($this->getSubClients() as $client) { |
|
131 | 131 | $view->textBody .= $client->save(); |
132 | 132 | } |
133 | 133 | |
134 | 134 | return; |
135 | 135 | } |
136 | - catch( \Aimeos\MShop\Exception $e ) |
|
136 | + catch (\Aimeos\MShop\Exception $e) |
|
137 | 137 | { |
138 | - $error = array( 'attribute-item-text' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
139 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
140 | - $this->logException( $e ); |
|
138 | + $error = array('attribute-item-text' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
139 | + $view->errors = $view->get('errors', []) + $error; |
|
140 | + $this->logException($e); |
|
141 | 141 | } |
142 | - catch( \Exception $e ) |
|
142 | + catch (\Exception $e) |
|
143 | 143 | { |
144 | - $error = array( 'attribute-item-text' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
145 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
146 | - $this->logException( $e ); |
|
144 | + $error = array('attribute-item-text' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
145 | + $view->errors = $view->get('errors', []) + $error; |
|
146 | + $this->logException($e); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | throw new \Aimeos\Admin\JQAdm\Exception(); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @param string|null $name Name of the sub-client (Default if null) |
158 | 158 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
159 | 159 | */ |
160 | - public function getSubClient( $type, $name = null ) |
|
160 | + public function getSubClient($type, $name = null) |
|
161 | 161 | { |
162 | 162 | /** admin/jqadm/attribute/text/decorators/excludes |
163 | 163 | * Excludes decorators added by the "common" option from the attribute JQAdm client |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @see admin/jqadm/attribute/text/decorators/excludes |
233 | 233 | * @see admin/jqadm/attribute/text/decorators/global |
234 | 234 | */ |
235 | - return $this->createSubClient( 'attribute/text/' . $type, $name ); |
|
235 | + return $this->createSubClient('attribute/text/' . $type, $name); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * @since 2017.07 |
277 | 277 | * @category Developer |
278 | 278 | */ |
279 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/attribute/text/standard/subparts', [] ); |
|
279 | + return $this->getContext()->getConfig()->get('admin/jqadm/attribute/text/standard/subparts', []); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | |
@@ -286,23 +286,23 @@ discard block |
||
286 | 286 | * @param \Aimeos\MW\View\Iface $view View object |
287 | 287 | * @return \Aimeos\MW\View\Iface View object with assigned parameters |
288 | 288 | */ |
289 | - protected function addViewData( \Aimeos\MW\View\Iface $view ) |
|
289 | + protected function addViewData(\Aimeos\MW\View\Iface $view) |
|
290 | 290 | { |
291 | 291 | $context = $this->getContext(); |
292 | 292 | |
293 | - $textTypeManager = \Aimeos\MShop::create( $context, 'text/type' ); |
|
294 | - $listTypeManager = \Aimeos\MShop::create( $context, 'attribute/lists/type' ); |
|
293 | + $textTypeManager = \Aimeos\MShop::create($context, 'text/type'); |
|
294 | + $listTypeManager = \Aimeos\MShop::create($context, 'attribute/lists/type'); |
|
295 | 295 | |
296 | - $search = $textTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff ); |
|
297 | - $search->setConditions( $search->compare( '==', 'text.type.domain', 'attribute' ) ); |
|
298 | - $search->setSortations( array( $search->sort( '+', 'text.type.label' ) ) ); |
|
296 | + $search = $textTypeManager->createSearch(true)->setSlice(0, 0x7fffffff); |
|
297 | + $search->setConditions($search->compare('==', 'text.type.domain', 'attribute')); |
|
298 | + $search->setSortations(array($search->sort('+', 'text.type.label'))); |
|
299 | 299 | |
300 | - $listSearch = $listTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff ); |
|
301 | - $listSearch->setConditions( $listSearch->compare( '==', 'attribute.lists.type.domain', 'text' ) ); |
|
302 | - $listSearch->setSortations( array( $listSearch->sort( '+', 'attribute.lists.type.label' ) ) ); |
|
300 | + $listSearch = $listTypeManager->createSearch(true)->setSlice(0, 0x7fffffff); |
|
301 | + $listSearch->setConditions($listSearch->compare('==', 'attribute.lists.type.domain', 'text')); |
|
302 | + $listSearch->setSortations(array($listSearch->sort('+', 'attribute.lists.type.label'))); |
|
303 | 303 | |
304 | - $view->textTypes = $textTypeManager->searchItems( $search ); |
|
305 | - $view->textListTypes = $this->sortType( $listTypeManager->searchItems( $listSearch ) ); |
|
304 | + $view->textTypes = $textTypeManager->searchItems($search); |
|
305 | + $view->textListTypes = $this->sortType($listTypeManager->searchItems($listSearch)); |
|
306 | 306 | |
307 | 307 | return $view; |
308 | 308 | } |
@@ -314,50 +314,50 @@ discard block |
||
314 | 314 | * @param \Aimeos\MShop\Attribute\Item\Iface $item Attribute item object without referenced domain items |
315 | 315 | * @param string[] $data Data array |
316 | 316 | */ |
317 | - protected function fromArray( \Aimeos\MShop\Attribute\Item\Iface $item, array $data ) |
|
317 | + protected function fromArray(\Aimeos\MShop\Attribute\Item\Iface $item, array $data) |
|
318 | 318 | { |
319 | 319 | $context = $this->getContext(); |
320 | 320 | |
321 | - $textManager = \Aimeos\MShop::create( $context, 'text' ); |
|
322 | - $listManager = \Aimeos\MShop::create( $context, 'attribute/lists' ); |
|
321 | + $textManager = \Aimeos\MShop::create($context, 'text'); |
|
322 | + $listManager = \Aimeos\MShop::create($context, 'attribute/lists'); |
|
323 | 323 | |
324 | - $listItems = $item->getListItems( 'text', null, null, false ); |
|
324 | + $listItems = $item->getListItems('text', null, null, false); |
|
325 | 325 | |
326 | 326 | |
327 | - foreach( $data as $idx => $entry ) |
|
327 | + foreach ($data as $idx => $entry) |
|
328 | 328 | { |
329 | - if( trim( $this->getValue( $entry, 'text.content', '' ) ) === '' ) { |
|
329 | + if (trim($this->getValue($entry, 'text.content', '')) === '') { |
|
330 | 330 | continue; |
331 | 331 | } |
332 | 332 | |
333 | - if( ( $listItem = $item->getListItem( 'text', $entry['attribute.lists.type'], $entry['text.id'], false ) ) === null ) { |
|
333 | + if (($listItem = $item->getListItem('text', $entry['attribute.lists.type'], $entry['text.id'], false)) === null) { |
|
334 | 334 | $listItem = $listManager->createItem(); |
335 | 335 | } |
336 | 336 | |
337 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
337 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
338 | 338 | $refItem = $textManager->createItem(); |
339 | 339 | } |
340 | 340 | |
341 | - $refItem->fromArray( $entry ); |
|
341 | + $refItem->fromArray($entry); |
|
342 | 342 | $conf = []; |
343 | 343 | |
344 | - foreach( (array) $this->getValue( $entry, 'config/key' ) as $num => $key ) |
|
344 | + foreach ((array) $this->getValue($entry, 'config/key') as $num => $key) |
|
345 | 345 | { |
346 | - if( trim( $key ) !== '' && ( $val = $this->getValue( $entry, 'config/val/' . $num ) ) !== null ) { |
|
347 | - $conf[$key] = trim( $val ); |
|
346 | + if (trim($key) !== '' && ($val = $this->getValue($entry, 'config/val/' . $num)) !== null) { |
|
347 | + $conf[$key] = trim($val); |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | |
351 | - $listItem->fromArray( $entry ); |
|
352 | - $listItem->setPosition( $idx ); |
|
353 | - $listItem->setConfig( $conf ); |
|
351 | + $listItem->fromArray($entry); |
|
352 | + $listItem->setPosition($idx); |
|
353 | + $listItem->setConfig($conf); |
|
354 | 354 | |
355 | - $item->addListItem( 'text', $listItem, $refItem ); |
|
355 | + $item->addListItem('text', $listItem, $refItem); |
|
356 | 356 | |
357 | - unset( $listItems[$listItem->getId()] ); |
|
357 | + unset($listItems[$listItem->getId()]); |
|
358 | 358 | } |
359 | 359 | |
360 | - return $item->deleteListItems( $listItems, true ); |
|
360 | + return $item->deleteListItems($listItems, true); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | |
@@ -368,20 +368,20 @@ discard block |
||
368 | 368 | * @param boolean $copy True if items should be copied, false if not |
369 | 369 | * @return string[] Multi-dimensional associative list of item data |
370 | 370 | */ |
371 | - protected function toArray( \Aimeos\MShop\Attribute\Item\Iface $item, $copy = false ) |
|
371 | + protected function toArray(\Aimeos\MShop\Attribute\Item\Iface $item, $copy = false) |
|
372 | 372 | { |
373 | 373 | $data = []; |
374 | 374 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
375 | 375 | |
376 | - foreach( $item->getListItems( 'text', null, null, false ) as $listItem ) |
|
376 | + foreach ($item->getListItems('text', null, null, false) as $listItem) |
|
377 | 377 | { |
378 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
378 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
379 | 379 | continue; |
380 | 380 | } |
381 | 381 | |
382 | - $list = $listItem->toArray( true ) + $refItem->toArray( true ); |
|
382 | + $list = $listItem->toArray(true) + $refItem->toArray(true); |
|
383 | 383 | |
384 | - if( $copy === true ) |
|
384 | + if ($copy === true) |
|
385 | 385 | { |
386 | 386 | $list['attribute.lists.siteid'] = $siteId; |
387 | 387 | $list['attribute.lists.id'] = ''; |
@@ -389,10 +389,10 @@ discard block |
||
389 | 389 | $list['text.id'] = null; |
390 | 390 | } |
391 | 391 | |
392 | - $list['attribute.lists.datestart'] = str_replace( ' ', 'T', $list['attribute.lists.datestart'] ); |
|
393 | - $list['attribute.lists.dateend'] = str_replace( ' ', 'T', $list['attribute.lists.dateend'] ); |
|
392 | + $list['attribute.lists.datestart'] = str_replace(' ', 'T', $list['attribute.lists.datestart']); |
|
393 | + $list['attribute.lists.dateend'] = str_replace(' ', 'T', $list['attribute.lists.dateend']); |
|
394 | 394 | |
395 | - foreach( $list['attribute.lists.config'] as $key => $val ) |
|
395 | + foreach ($list['attribute.lists.config'] as $key => $val) |
|
396 | 396 | { |
397 | 397 | $list['config']['key'][] = $key; |
398 | 398 | $list['config']['val'][] = $val; |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
412 | 412 | * @return string HTML output |
413 | 413 | */ |
414 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
414 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
415 | 415 | { |
416 | 416 | /** admin/jqadm/attribute/text/template-item |
417 | 417 | * Relative path to the HTML body template of the text subpart for attributes. |
@@ -435,6 +435,6 @@ discard block |
||
435 | 435 | $tplconf = 'admin/jqadm/attribute/text/template-item'; |
436 | 436 | $default = 'attribute/item-text-standard'; |
437 | 437 | |
438 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
438 | + return $view->render($view->config($tplconf, $default)); |
|
439 | 439 | } |
440 | 440 | } |
441 | 441 | \ No newline at end of file |
@@ -160,14 +160,12 @@ |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | return; |
163 | - } |
|
164 | - catch( \Aimeos\MShop\Exception $e ) |
|
163 | + } catch( \Aimeos\MShop\Exception $e ) |
|
165 | 164 | { |
166 | 165 | $error = array( 'product-item-text' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
167 | 166 | $view->errors = $view->get( 'errors', [] ) + $error; |
168 | 167 | $this->logException( $e ); |
169 | - } |
|
170 | - catch( \Exception $e ) |
|
168 | + } catch( \Exception $e ) |
|
171 | 169 | { |
172 | 170 | $error = array( 'product-item-text' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
173 | 171 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Product\Text; |
12 | 12 | |
13 | -sprintf( 'text' ); // for translation |
|
13 | +sprintf('text'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -42,16 +42,16 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function copy() |
44 | 44 | { |
45 | - $view = $this->addViewData( $this->getView() ); |
|
45 | + $view = $this->addViewData($this->getView()); |
|
46 | 46 | |
47 | - $view->textData = $this->toArray( $view->item, true ); |
|
47 | + $view->textData = $this->toArray($view->item, true); |
|
48 | 48 | $view->textBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->textBody .= $client->copy(); |
52 | 52 | } |
53 | 53 | |
54 | - return $this->render( $view ); |
|
54 | + return $this->render($view); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function create() |
64 | 64 | { |
65 | - $view = $this->addViewData( $this->getView() ); |
|
65 | + $view = $this->addViewData($this->getView()); |
|
66 | 66 | $siteid = $this->getContext()->getLocale()->getSiteId(); |
67 | - $data = $view->param( 'text', [] ); |
|
67 | + $data = $view->param('text', []); |
|
68 | 68 | |
69 | - foreach( $data as $idx => $entry ) |
|
69 | + foreach ($data as $idx => $entry) |
|
70 | 70 | { |
71 | 71 | $data[$idx]['product.lists.siteid'] = $siteid; |
72 | 72 | $data[$idx]['text.siteid'] = $siteid; |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | $view->textData = $data; |
76 | 76 | $view->textBody = ''; |
77 | 77 | |
78 | - foreach( $this->getSubClients() as $client ) { |
|
78 | + foreach ($this->getSubClients() as $client) { |
|
79 | 79 | $view->textBody .= $client->create(); |
80 | 80 | } |
81 | 81 | |
82 | - return $this->render( $view ); |
|
82 | + return $this->render($view); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | parent::delete(); |
92 | 92 | |
93 | 93 | $item = $this->getView()->item; |
94 | - $item->deleteListItems( $item->getListItems( 'text', null, null, false ), true ); |
|
94 | + $item->deleteListItems($item->getListItems('text', null, null, false), true); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
@@ -102,16 +102,16 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function get() |
104 | 104 | { |
105 | - $view = $this->addViewData( $this->getView() ); |
|
105 | + $view = $this->addViewData($this->getView()); |
|
106 | 106 | |
107 | - $view->textData = $this->toArray( $view->item ); |
|
107 | + $view->textData = $this->toArray($view->item); |
|
108 | 108 | $view->textBody = ''; |
109 | 109 | |
110 | - foreach( $this->getSubClients() as $client ) { |
|
110 | + foreach ($this->getSubClients() as $client) { |
|
111 | 111 | $view->textBody .= $client->get(); |
112 | 112 | } |
113 | 113 | |
114 | - return $this->render( $view ); |
|
114 | + return $this->render($view); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -124,26 +124,26 @@ discard block |
||
124 | 124 | |
125 | 125 | try |
126 | 126 | { |
127 | - $view->item = $this->fromArray( $view->item, $view->param( 'text', [] ) ); |
|
127 | + $view->item = $this->fromArray($view->item, $view->param('text', [])); |
|
128 | 128 | $view->textBody = ''; |
129 | 129 | |
130 | - foreach( $this->getSubClients() as $client ) { |
|
130 | + foreach ($this->getSubClients() as $client) { |
|
131 | 131 | $view->textBody .= $client->save(); |
132 | 132 | } |
133 | 133 | |
134 | 134 | return; |
135 | 135 | } |
136 | - catch( \Aimeos\MShop\Exception $e ) |
|
136 | + catch (\Aimeos\MShop\Exception $e) |
|
137 | 137 | { |
138 | - $error = array( 'product-item-text' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
139 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
140 | - $this->logException( $e ); |
|
138 | + $error = array('product-item-text' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
139 | + $view->errors = $view->get('errors', []) + $error; |
|
140 | + $this->logException($e); |
|
141 | 141 | } |
142 | - catch( \Exception $e ) |
|
142 | + catch (\Exception $e) |
|
143 | 143 | { |
144 | - $error = array( 'product-item-text' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
145 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
146 | - $this->logException( $e ); |
|
144 | + $error = array('product-item-text' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
145 | + $view->errors = $view->get('errors', []) + $error; |
|
146 | + $this->logException($e); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | throw new \Aimeos\Admin\JQAdm\Exception(); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @param string|null $name Name of the sub-client (Default if null) |
158 | 158 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
159 | 159 | */ |
160 | - public function getSubClient( $type, $name = null ) |
|
160 | + public function getSubClient($type, $name = null) |
|
161 | 161 | { |
162 | 162 | /** admin/jqadm/product/text/decorators/excludes |
163 | 163 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @see admin/jqadm/product/text/decorators/excludes |
233 | 233 | * @see admin/jqadm/product/text/decorators/global |
234 | 234 | */ |
235 | - return $this->createSubClient( 'product/text/' . $type, $name ); |
|
235 | + return $this->createSubClient('product/text/' . $type, $name); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * @since 2017.07 |
277 | 277 | * @category Developer |
278 | 278 | */ |
279 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/product/text/standard/subparts', [] ); |
|
279 | + return $this->getContext()->getConfig()->get('admin/jqadm/product/text/standard/subparts', []); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | |
@@ -286,23 +286,23 @@ discard block |
||
286 | 286 | * @param \Aimeos\MW\View\Iface $view View object |
287 | 287 | * @return \Aimeos\MW\View\Iface View object with assigned parameters |
288 | 288 | */ |
289 | - protected function addViewData( \Aimeos\MW\View\Iface $view ) |
|
289 | + protected function addViewData(\Aimeos\MW\View\Iface $view) |
|
290 | 290 | { |
291 | 291 | $context = $this->getContext(); |
292 | 292 | |
293 | - $textTypeManager = \Aimeos\MShop::create( $context, 'text/type' ); |
|
294 | - $listTypeManager = \Aimeos\MShop::create( $context, 'product/lists/type' ); |
|
293 | + $textTypeManager = \Aimeos\MShop::create($context, 'text/type'); |
|
294 | + $listTypeManager = \Aimeos\MShop::create($context, 'product/lists/type'); |
|
295 | 295 | |
296 | - $search = $textTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff ); |
|
297 | - $search->setConditions( $search->compare( '==', 'text.type.domain', 'product' ) ); |
|
298 | - $search->setSortations( array( $search->sort( '+', 'text.type.label' ) ) ); |
|
296 | + $search = $textTypeManager->createSearch(true)->setSlice(0, 0x7fffffff); |
|
297 | + $search->setConditions($search->compare('==', 'text.type.domain', 'product')); |
|
298 | + $search->setSortations(array($search->sort('+', 'text.type.label'))); |
|
299 | 299 | |
300 | - $listSearch = $listTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff ); |
|
301 | - $listSearch->setConditions( $listSearch->compare( '==', 'product.lists.type.domain', 'text' ) ); |
|
302 | - $listSearch->setSortations( array( $listSearch->sort( '+', 'product.lists.type.label' ) ) ); |
|
300 | + $listSearch = $listTypeManager->createSearch(true)->setSlice(0, 0x7fffffff); |
|
301 | + $listSearch->setConditions($listSearch->compare('==', 'product.lists.type.domain', 'text')); |
|
302 | + $listSearch->setSortations(array($listSearch->sort('+', 'product.lists.type.label'))); |
|
303 | 303 | |
304 | - $view->textTypes = $textTypeManager->searchItems( $search ); |
|
305 | - $view->textListTypes = $this->sortType( $listTypeManager->searchItems( $listSearch ) ); |
|
304 | + $view->textTypes = $textTypeManager->searchItems($search); |
|
305 | + $view->textListTypes = $this->sortType($listTypeManager->searchItems($listSearch)); |
|
306 | 306 | |
307 | 307 | return $view; |
308 | 308 | } |
@@ -314,52 +314,52 @@ discard block |
||
314 | 314 | * @param \Aimeos\MShop\Product\Item\Iface $item Product item object without referenced domain items |
315 | 315 | * @param string[] $data Data array |
316 | 316 | */ |
317 | - protected function fromArray( \Aimeos\MShop\Product\Item\Iface $item, array $data ) |
|
317 | + protected function fromArray(\Aimeos\MShop\Product\Item\Iface $item, array $data) |
|
318 | 318 | { |
319 | 319 | $context = $this->getContext(); |
320 | 320 | |
321 | - $textManager = \Aimeos\MShop::create( $context, 'text' ); |
|
322 | - $listManager = \Aimeos\MShop::create( $context, 'product/lists' ); |
|
321 | + $textManager = \Aimeos\MShop::create($context, 'text'); |
|
322 | + $listManager = \Aimeos\MShop::create($context, 'product/lists'); |
|
323 | 323 | |
324 | - $listItems = $item->getListItems( 'text', null, null, false ); |
|
324 | + $listItems = $item->getListItems('text', null, null, false); |
|
325 | 325 | |
326 | 326 | |
327 | - foreach( $data as $idx => $entry ) |
|
327 | + foreach ($data as $idx => $entry) |
|
328 | 328 | { |
329 | - if( trim( $this->getValue( $entry, 'text.content', '' ) ) === '' ) { |
|
329 | + if (trim($this->getValue($entry, 'text.content', '')) === '') { |
|
330 | 330 | continue; |
331 | 331 | } |
332 | 332 | |
333 | 333 | $listType = $entry['product.lists.type']; |
334 | 334 | |
335 | - if( ( $listItem = $item->getListItem( 'text', $listType, $entry['text.id'], false ) ) === null ) { |
|
335 | + if (($listItem = $item->getListItem('text', $listType, $entry['text.id'], false)) === null) { |
|
336 | 336 | $listItem = $listManager->createItem(); |
337 | 337 | } |
338 | 338 | |
339 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
339 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
340 | 340 | $refItem = $textManager->createItem(); |
341 | 341 | } |
342 | 342 | |
343 | - $refItem->fromArray( $entry ); |
|
343 | + $refItem->fromArray($entry); |
|
344 | 344 | $conf = []; |
345 | 345 | |
346 | - foreach( (array) $this->getValue( $entry, 'config/key' ) as $num => $key ) |
|
346 | + foreach ((array) $this->getValue($entry, 'config/key') as $num => $key) |
|
347 | 347 | { |
348 | - if( trim( $key ) !== '' && ( $val = $this->getValue( $entry, 'config/val/' . $num ) ) !== null ) { |
|
349 | - $conf[$key] = trim( $val ); |
|
348 | + if (trim($key) !== '' && ($val = $this->getValue($entry, 'config/val/' . $num)) !== null) { |
|
349 | + $conf[$key] = trim($val); |
|
350 | 350 | } |
351 | 351 | } |
352 | 352 | |
353 | - $listItem->fromArray( $entry ); |
|
354 | - $listItem->setPosition( $idx ); |
|
355 | - $listItem->setConfig( $conf ); |
|
353 | + $listItem->fromArray($entry); |
|
354 | + $listItem->setPosition($idx); |
|
355 | + $listItem->setConfig($conf); |
|
356 | 356 | |
357 | - $item->addListItem( 'text', $listItem, $refItem ); |
|
357 | + $item->addListItem('text', $listItem, $refItem); |
|
358 | 358 | |
359 | - unset( $listItems[$listItem->getId()] ); |
|
359 | + unset($listItems[$listItem->getId()]); |
|
360 | 360 | } |
361 | 361 | |
362 | - return $item->deleteListItems( $listItems, true ); |
|
362 | + return $item->deleteListItems($listItems, true); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | |
@@ -370,20 +370,20 @@ discard block |
||
370 | 370 | * @param boolean $copy True if items should be copied, false if not |
371 | 371 | * @return string[] Multi-dimensional associative list of item data |
372 | 372 | */ |
373 | - protected function toArray( \Aimeos\MShop\Product\Item\Iface $item, $copy = false ) |
|
373 | + protected function toArray(\Aimeos\MShop\Product\Item\Iface $item, $copy = false) |
|
374 | 374 | { |
375 | 375 | $data = []; |
376 | 376 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
377 | 377 | |
378 | - foreach( $item->getListItems( 'text', null, null, false ) as $listItem ) |
|
378 | + foreach ($item->getListItems('text', null, null, false) as $listItem) |
|
379 | 379 | { |
380 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
380 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
381 | 381 | continue; |
382 | 382 | } |
383 | 383 | |
384 | - $list = $listItem->toArray( true ) + $refItem->toArray( true ); |
|
384 | + $list = $listItem->toArray(true) + $refItem->toArray(true); |
|
385 | 385 | |
386 | - if( $copy === true ) |
|
386 | + if ($copy === true) |
|
387 | 387 | { |
388 | 388 | $list['product.lists.siteid'] = $siteId; |
389 | 389 | $list['product.lists.id'] = ''; |
@@ -391,10 +391,10 @@ discard block |
||
391 | 391 | $list['text.id'] = null; |
392 | 392 | } |
393 | 393 | |
394 | - $list['product.lists.datestart'] = str_replace( ' ', 'T', $list['product.lists.datestart'] ); |
|
395 | - $list['product.lists.dateend'] = str_replace( ' ', 'T', $list['product.lists.dateend'] ); |
|
394 | + $list['product.lists.datestart'] = str_replace(' ', 'T', $list['product.lists.datestart']); |
|
395 | + $list['product.lists.dateend'] = str_replace(' ', 'T', $list['product.lists.dateend']); |
|
396 | 396 | |
397 | - foreach( $list['product.lists.config'] as $key => $val ) |
|
397 | + foreach ($list['product.lists.config'] as $key => $val) |
|
398 | 398 | { |
399 | 399 | $list['config']['key'][] = $key; |
400 | 400 | $list['config']['val'][] = $val; |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
414 | 414 | * @return string HTML output |
415 | 415 | */ |
416 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
416 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
417 | 417 | { |
418 | 418 | /** admin/jqadm/product/text/template-item |
419 | 419 | * Relative path to the HTML body template of the text subpart for products. |
@@ -437,6 +437,6 @@ discard block |
||
437 | 437 | $tplconf = 'admin/jqadm/product/text/template-item'; |
438 | 438 | $default = 'product/item-text-standard'; |
439 | 439 | |
440 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
440 | + return $view->render($view->config($tplconf, $default)); |
|
441 | 441 | } |
442 | 442 | } |
443 | 443 | \ No newline at end of file |
@@ -160,14 +160,12 @@ |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | return; |
163 | - } |
|
164 | - catch( \Aimeos\MShop\Exception $e ) |
|
163 | + } catch( \Aimeos\MShop\Exception $e ) |
|
165 | 164 | { |
166 | 165 | $error = array( 'service-item-text' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
167 | 166 | $view->errors = $view->get( 'errors', [] ) + $error; |
168 | 167 | $this->logException( $e ); |
169 | - } |
|
170 | - catch( \Exception $e ) |
|
168 | + } catch( \Exception $e ) |
|
171 | 169 | { |
172 | 170 | $error = array( 'service-item-text' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
173 | 171 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Service\Text; |
12 | 12 | |
13 | -sprintf( 'text' ); // for translation |
|
13 | +sprintf('text'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -42,16 +42,16 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function copy() |
44 | 44 | { |
45 | - $view = $this->addViewData( $this->getView() ); |
|
45 | + $view = $this->addViewData($this->getView()); |
|
46 | 46 | |
47 | - $view->textData = $this->toArray( $view->item, true ); |
|
47 | + $view->textData = $this->toArray($view->item, true); |
|
48 | 48 | $view->textBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->textBody .= $client->copy(); |
52 | 52 | } |
53 | 53 | |
54 | - return $this->render( $view ); |
|
54 | + return $this->render($view); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function create() |
64 | 64 | { |
65 | - $view = $this->addViewData( $this->getView() ); |
|
65 | + $view = $this->addViewData($this->getView()); |
|
66 | 66 | $siteid = $this->getContext()->getLocale()->getSiteId(); |
67 | - $data = $view->param( 'text', [] ); |
|
67 | + $data = $view->param('text', []); |
|
68 | 68 | |
69 | - foreach( $data as $idx => $entry ) |
|
69 | + foreach ($data as $idx => $entry) |
|
70 | 70 | { |
71 | 71 | $data[$idx]['service.lists.siteid'] = $siteid; |
72 | 72 | $data[$idx]['text.siteid'] = $siteid; |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | $view->textData = $data; |
76 | 76 | $view->textBody = ''; |
77 | 77 | |
78 | - foreach( $this->getSubClients() as $client ) { |
|
78 | + foreach ($this->getSubClients() as $client) { |
|
79 | 79 | $view->textBody .= $client->create(); |
80 | 80 | } |
81 | 81 | |
82 | - return $this->render( $view ); |
|
82 | + return $this->render($view); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | parent::delete(); |
92 | 92 | |
93 | 93 | $item = $this->getView()->item; |
94 | - $item->deleteListItems( $item->getListItems( 'text', null, null, false ), true ); |
|
94 | + $item->deleteListItems($item->getListItems('text', null, null, false), true); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
@@ -102,16 +102,16 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function get() |
104 | 104 | { |
105 | - $view = $this->addViewData( $this->getView() ); |
|
105 | + $view = $this->addViewData($this->getView()); |
|
106 | 106 | |
107 | - $view->textData = $this->toArray( $view->item ); |
|
107 | + $view->textData = $this->toArray($view->item); |
|
108 | 108 | $view->textBody = ''; |
109 | 109 | |
110 | - foreach( $this->getSubClients() as $client ) { |
|
110 | + foreach ($this->getSubClients() as $client) { |
|
111 | 111 | $view->textBody .= $client->get(); |
112 | 112 | } |
113 | 113 | |
114 | - return $this->render( $view ); |
|
114 | + return $this->render($view); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -124,26 +124,26 @@ discard block |
||
124 | 124 | |
125 | 125 | try |
126 | 126 | { |
127 | - $view->item = $this->fromArray( $view->item, $view->param( 'text', [] ) ); |
|
127 | + $view->item = $this->fromArray($view->item, $view->param('text', [])); |
|
128 | 128 | $view->textBody = ''; |
129 | 129 | |
130 | - foreach( $this->getSubClients() as $client ) { |
|
130 | + foreach ($this->getSubClients() as $client) { |
|
131 | 131 | $view->textBody .= $client->save(); |
132 | 132 | } |
133 | 133 | |
134 | 134 | return; |
135 | 135 | } |
136 | - catch( \Aimeos\MShop\Exception $e ) |
|
136 | + catch (\Aimeos\MShop\Exception $e) |
|
137 | 137 | { |
138 | - $error = array( 'service-item-text' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
139 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
140 | - $this->logException( $e ); |
|
138 | + $error = array('service-item-text' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
139 | + $view->errors = $view->get('errors', []) + $error; |
|
140 | + $this->logException($e); |
|
141 | 141 | } |
142 | - catch( \Exception $e ) |
|
142 | + catch (\Exception $e) |
|
143 | 143 | { |
144 | - $error = array( 'service-item-text' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
145 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
146 | - $this->logException( $e ); |
|
144 | + $error = array('service-item-text' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
145 | + $view->errors = $view->get('errors', []) + $error; |
|
146 | + $this->logException($e); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | throw new \Aimeos\Admin\JQAdm\Exception(); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @param string|null $name Name of the sub-client (Default if null) |
158 | 158 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
159 | 159 | */ |
160 | - public function getSubClient( $type, $name = null ) |
|
160 | + public function getSubClient($type, $name = null) |
|
161 | 161 | { |
162 | 162 | /** admin/jqadm/service/text/decorators/excludes |
163 | 163 | * Excludes decorators added by the "common" option from the service JQAdm client |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @see admin/jqadm/service/text/decorators/excludes |
233 | 233 | * @see admin/jqadm/service/text/decorators/global |
234 | 234 | */ |
235 | - return $this->createSubClient( 'service/text/' . $type, $name ); |
|
235 | + return $this->createSubClient('service/text/' . $type, $name); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * @since 2017.07 |
277 | 277 | * @category Developer |
278 | 278 | */ |
279 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/service/text/standard/subparts', [] ); |
|
279 | + return $this->getContext()->getConfig()->get('admin/jqadm/service/text/standard/subparts', []); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | |
@@ -286,23 +286,23 @@ discard block |
||
286 | 286 | * @param \Aimeos\MW\View\Iface $view View object |
287 | 287 | * @return \Aimeos\MW\View\Iface View object with assigned parameters |
288 | 288 | */ |
289 | - protected function addViewData( \Aimeos\MW\View\Iface $view ) |
|
289 | + protected function addViewData(\Aimeos\MW\View\Iface $view) |
|
290 | 290 | { |
291 | 291 | $context = $this->getContext(); |
292 | 292 | |
293 | - $textTypeManager = \Aimeos\MShop::create( $context, 'text/type' ); |
|
294 | - $listTypeManager = \Aimeos\MShop::create( $context, 'service/lists/type' ); |
|
293 | + $textTypeManager = \Aimeos\MShop::create($context, 'text/type'); |
|
294 | + $listTypeManager = \Aimeos\MShop::create($context, 'service/lists/type'); |
|
295 | 295 | |
296 | - $search = $textTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff ); |
|
297 | - $search->setConditions( $search->compare( '==', 'text.type.domain', 'service' ) ); |
|
298 | - $search->setSortations( array( $search->sort( '+', 'text.type.label' ) ) ); |
|
296 | + $search = $textTypeManager->createSearch(true)->setSlice(0, 0x7fffffff); |
|
297 | + $search->setConditions($search->compare('==', 'text.type.domain', 'service')); |
|
298 | + $search->setSortations(array($search->sort('+', 'text.type.label'))); |
|
299 | 299 | |
300 | - $listSearch = $listTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff ); |
|
301 | - $listSearch->setConditions( $listSearch->compare( '==', 'service.lists.type.domain', 'text' ) ); |
|
302 | - $listSearch->setSortations( array( $listSearch->sort( '+', 'service.lists.type.label' ) ) ); |
|
300 | + $listSearch = $listTypeManager->createSearch(true)->setSlice(0, 0x7fffffff); |
|
301 | + $listSearch->setConditions($listSearch->compare('==', 'service.lists.type.domain', 'text')); |
|
302 | + $listSearch->setSortations(array($listSearch->sort('+', 'service.lists.type.label'))); |
|
303 | 303 | |
304 | - $view->textTypes = $textTypeManager->searchItems( $search ); |
|
305 | - $view->textListTypes = $this->sortType( $listTypeManager->searchItems( $listSearch ) ); |
|
304 | + $view->textTypes = $textTypeManager->searchItems($search); |
|
305 | + $view->textListTypes = $this->sortType($listTypeManager->searchItems($listSearch)); |
|
306 | 306 | |
307 | 307 | return $view; |
308 | 308 | } |
@@ -314,50 +314,50 @@ discard block |
||
314 | 314 | * @param \Aimeos\MShop\Service\Item\Iface $item Service item object without referenced domain items |
315 | 315 | * @param string[] $data Data array |
316 | 316 | */ |
317 | - protected function fromArray( \Aimeos\MShop\Service\Item\Iface $item, array $data ) |
|
317 | + protected function fromArray(\Aimeos\MShop\Service\Item\Iface $item, array $data) |
|
318 | 318 | { |
319 | 319 | $context = $this->getContext(); |
320 | 320 | |
321 | - $textManager = \Aimeos\MShop::create( $context, 'text' ); |
|
322 | - $listManager = \Aimeos\MShop::create( $context, 'service/lists' ); |
|
321 | + $textManager = \Aimeos\MShop::create($context, 'text'); |
|
322 | + $listManager = \Aimeos\MShop::create($context, 'service/lists'); |
|
323 | 323 | |
324 | - $listItems = $item->getListItems( 'text', null, null, false ); |
|
324 | + $listItems = $item->getListItems('text', null, null, false); |
|
325 | 325 | |
326 | 326 | |
327 | - foreach( $data as $idx => $entry ) |
|
327 | + foreach ($data as $idx => $entry) |
|
328 | 328 | { |
329 | - if( trim( $this->getValue( $entry, 'text.content', '' ) ) === '' ) { |
|
329 | + if (trim($this->getValue($entry, 'text.content', '')) === '') { |
|
330 | 330 | continue; |
331 | 331 | } |
332 | 332 | |
333 | - if( ( $listItem = $item->getListItem( 'text', $entry['service.lists.type'], $entry['text.id'], false ) ) === null ) { |
|
333 | + if (($listItem = $item->getListItem('text', $entry['service.lists.type'], $entry['text.id'], false)) === null) { |
|
334 | 334 | $listItem = $listManager->createItem(); |
335 | 335 | } |
336 | 336 | |
337 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
337 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
338 | 338 | $refItem = $textManager->createItem(); |
339 | 339 | } |
340 | 340 | |
341 | - $refItem->fromArray( $entry ); |
|
341 | + $refItem->fromArray($entry); |
|
342 | 342 | $conf = []; |
343 | 343 | |
344 | - foreach( (array) $this->getValue( $entry, 'config/key' ) as $num => $key ) |
|
344 | + foreach ((array) $this->getValue($entry, 'config/key') as $num => $key) |
|
345 | 345 | { |
346 | - if( trim( $key ) !== '' && ( $val = $this->getValue( $entry, 'config/val/' . $num ) ) !== null ) { |
|
347 | - $conf[$key] = trim( $val ); |
|
346 | + if (trim($key) !== '' && ($val = $this->getValue($entry, 'config/val/' . $num)) !== null) { |
|
347 | + $conf[$key] = trim($val); |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | |
351 | - $listItem->fromArray( $entry ); |
|
352 | - $listItem->setPosition( $idx ); |
|
353 | - $listItem->setConfig( $conf ); |
|
351 | + $listItem->fromArray($entry); |
|
352 | + $listItem->setPosition($idx); |
|
353 | + $listItem->setConfig($conf); |
|
354 | 354 | |
355 | - $item->addListItem( 'text', $listItem, $refItem ); |
|
355 | + $item->addListItem('text', $listItem, $refItem); |
|
356 | 356 | |
357 | - unset( $listItems[$listItem->getId()] ); |
|
357 | + unset($listItems[$listItem->getId()]); |
|
358 | 358 | } |
359 | 359 | |
360 | - return $item->deleteListItems( $listItems, true ); |
|
360 | + return $item->deleteListItems($listItems, true); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | |
@@ -368,20 +368,20 @@ discard block |
||
368 | 368 | * @param boolean $copy True if items should be copied, false if not |
369 | 369 | * @return string[] Multi-dimensional associative list of item data |
370 | 370 | */ |
371 | - protected function toArray( \Aimeos\MShop\Service\Item\Iface $item, $copy = false ) |
|
371 | + protected function toArray(\Aimeos\MShop\Service\Item\Iface $item, $copy = false) |
|
372 | 372 | { |
373 | 373 | $data = []; |
374 | 374 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
375 | 375 | |
376 | - foreach( $item->getListItems( 'text', null, null, false ) as $listItem ) |
|
376 | + foreach ($item->getListItems('text', null, null, false) as $listItem) |
|
377 | 377 | { |
378 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
378 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
379 | 379 | continue; |
380 | 380 | } |
381 | 381 | |
382 | - $list = $listItem->toArray( true ) + $refItem->toArray( true ); |
|
382 | + $list = $listItem->toArray(true) + $refItem->toArray(true); |
|
383 | 383 | |
384 | - if( $copy === true ) |
|
384 | + if ($copy === true) |
|
385 | 385 | { |
386 | 386 | $list['service.lists.siteid'] = $siteId; |
387 | 387 | $list['service.lists.id'] = ''; |
@@ -389,10 +389,10 @@ discard block |
||
389 | 389 | $list['text.id'] = null; |
390 | 390 | } |
391 | 391 | |
392 | - $list['service.lists.datestart'] = str_replace( ' ', 'T', $list['service.lists.datestart'] ); |
|
393 | - $list['service.lists.dateend'] = str_replace( ' ', 'T', $list['service.lists.dateend'] ); |
|
392 | + $list['service.lists.datestart'] = str_replace(' ', 'T', $list['service.lists.datestart']); |
|
393 | + $list['service.lists.dateend'] = str_replace(' ', 'T', $list['service.lists.dateend']); |
|
394 | 394 | |
395 | - foreach( $list['service.lists.config'] as $key => $val ) |
|
395 | + foreach ($list['service.lists.config'] as $key => $val) |
|
396 | 396 | { |
397 | 397 | $list['config']['key'][] = $key; |
398 | 398 | $list['config']['val'][] = $val; |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
412 | 412 | * @return string HTML output |
413 | 413 | */ |
414 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
414 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
415 | 415 | { |
416 | 416 | /** admin/jqadm/service/text/template-item |
417 | 417 | * Relative path to the HTML body template of the text subpart for services. |
@@ -435,6 +435,6 @@ discard block |
||
435 | 435 | $tplconf = 'admin/jqadm/service/text/template-item'; |
436 | 436 | $default = 'service/item-text-standard'; |
437 | 437 | |
438 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
438 | + return $view->render($view->config($tplconf, $default)); |
|
439 | 439 | } |
440 | 440 | } |
441 | 441 | \ No newline at end of file |