@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Locale\Language; |
12 | 12 | |
13 | -sprintf( 'locale/language' ); // for translation |
|
13 | +sprintf('locale/language'); // 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, 'locale/language' ); |
|
43 | - $view->item = $manager->getItem( $id ); |
|
42 | + $manager = \Aimeos\MShop::create($context, 'locale/language'); |
|
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( 'locale-language-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
58 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
59 | - $this->logException( $e ); |
|
57 | + $error = array('locale-language-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( 'locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
64 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
65 | - $this->logException( $e ); |
|
63 | + $error = array('locale-language-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,36 +81,36 @@ 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, 'locale/language' )->createItem(); |
|
86 | + if (!isset($view->item)) { |
|
87 | + $view->item = \Aimeos\MShop::create($context, 'locale/language')->createItem(); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | $view->itemSubparts = $this->getSubClientNames(); |
91 | 91 | $view->itemData = $data; |
92 | 92 | $view->itemBody = ''; |
93 | 93 | |
94 | - foreach( $this->getSubClients() as $idx => $client ) |
|
94 | + foreach ($this->getSubClients() as $idx => $client) |
|
95 | 95 | { |
96 | 96 | $view->tabindex = ++$idx + 1; |
97 | 97 | $view->itemBody .= $client->create(); |
98 | 98 | } |
99 | 99 | } |
100 | - catch( \Aimeos\MShop\Exception $e ) |
|
100 | + catch (\Aimeos\MShop\Exception $e) |
|
101 | 101 | { |
102 | - $error = array( 'locale-language-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
103 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
104 | - $this->logException( $e ); |
|
102 | + $error = array('locale-language-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
103 | + $view->errors = $view->get('errors', []) + $error; |
|
104 | + $this->logException($e); |
|
105 | 105 | } |
106 | - catch( \Exception $e ) |
|
106 | + catch (\Exception $e) |
|
107 | 107 | { |
108 | - $error = array( 'locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
109 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
110 | - $this->logException( $e ); |
|
108 | + $error = array('locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
109 | + $view->errors = $view->get('errors', []) + $error; |
|
110 | + $this->logException($e); |
|
111 | 111 | } |
112 | 112 | |
113 | - return $this->render( $view ); |
|
113 | + return $this->render($view); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
@@ -124,38 +124,38 @@ discard block |
||
124 | 124 | $view = $this->getView(); |
125 | 125 | $context = $this->getContext(); |
126 | 126 | |
127 | - $manager = \Aimeos\MShop::create( $context, 'locale/language' ); |
|
127 | + $manager = \Aimeos\MShop::create($context, 'locale/language'); |
|
128 | 128 | $manager->begin(); |
129 | 129 | |
130 | 130 | try |
131 | 131 | { |
132 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
133 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
132 | + if (($id = $view->param('id')) === null) { |
|
133 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
134 | 134 | } |
135 | 135 | |
136 | - $view->item = $manager->getItem( $id ); |
|
136 | + $view->item = $manager->getItem($id); |
|
137 | 137 | |
138 | - foreach( $this->getSubClients() as $client ) { |
|
138 | + foreach ($this->getSubClients() as $client) { |
|
139 | 139 | $client->delete(); |
140 | 140 | } |
141 | 141 | |
142 | - $manager->deleteItem( $id ); |
|
142 | + $manager->deleteItem($id); |
|
143 | 143 | $manager->commit(); |
144 | 144 | |
145 | - $this->nextAction( $view, 'search', 'locale/language', null, 'delete' ); |
|
145 | + $this->nextAction($view, 'search', 'locale/language', null, 'delete'); |
|
146 | 146 | return; |
147 | 147 | } |
148 | - catch( \Aimeos\MShop\Exception $e ) |
|
148 | + catch (\Aimeos\MShop\Exception $e) |
|
149 | 149 | { |
150 | - $error = array( 'locale-language-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
151 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
152 | - $this->logException( $e ); |
|
150 | + $error = array('locale-language-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
151 | + $view->errors = $view->get('errors', []) + $error; |
|
152 | + $this->logException($e); |
|
153 | 153 | } |
154 | - catch( \Exception $e ) |
|
154 | + catch (\Exception $e) |
|
155 | 155 | { |
156 | - $error = array( 'locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
157 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
158 | - $this->logException( $e ); |
|
156 | + $error = array('locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
157 | + $view->errors = $view->get('errors', []) + $error; |
|
158 | + $this->logException($e); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | $manager->rollback(); |
@@ -176,37 +176,37 @@ discard block |
||
176 | 176 | |
177 | 177 | try |
178 | 178 | { |
179 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
180 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
179 | + if (($id = $view->param('id')) === null) { |
|
180 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
181 | 181 | } |
182 | 182 | |
183 | - $manager = \Aimeos\MShop::create( $context, 'locale/language' ); |
|
183 | + $manager = \Aimeos\MShop::create($context, 'locale/language'); |
|
184 | 184 | |
185 | - $view->item = $manager->getItem( $id ); |
|
185 | + $view->item = $manager->getItem($id); |
|
186 | 186 | $view->itemSubparts = $this->getSubClientNames(); |
187 | - $view->itemData = $this->toArray( $view->item ); |
|
187 | + $view->itemData = $this->toArray($view->item); |
|
188 | 188 | $view->itemBody = ''; |
189 | 189 | |
190 | - foreach( $this->getSubClients() as $idx => $client ) |
|
190 | + foreach ($this->getSubClients() as $idx => $client) |
|
191 | 191 | { |
192 | 192 | $view->tabindex = ++$idx + 1; |
193 | 193 | $view->itemBody .= $client->get(); |
194 | 194 | } |
195 | 195 | } |
196 | - catch( \Aimeos\MShop\Exception $e ) |
|
196 | + catch (\Aimeos\MShop\Exception $e) |
|
197 | 197 | { |
198 | - $error = array( 'locale-language-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
199 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
200 | - $this->logException( $e ); |
|
198 | + $error = array('locale-language-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
199 | + $view->errors = $view->get('errors', []) + $error; |
|
200 | + $this->logException($e); |
|
201 | 201 | } |
202 | - catch( \Exception $e ) |
|
202 | + catch (\Exception $e) |
|
203 | 203 | { |
204 | - $error = array( 'locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
205 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
206 | - $this->logException( $e ); |
|
204 | + $error = array('locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
205 | + $view->errors = $view->get('errors', []) + $error; |
|
206 | + $this->logException($e); |
|
207 | 207 | } |
208 | 208 | |
209 | - return $this->render( $view ); |
|
209 | + return $this->render($view); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | |
@@ -220,40 +220,40 @@ discard block |
||
220 | 220 | $view = $this->getView(); |
221 | 221 | $context = $this->getContext(); |
222 | 222 | |
223 | - $manager = \Aimeos\MShop::create( $context, 'locale/language' ); |
|
223 | + $manager = \Aimeos\MShop::create($context, 'locale/language'); |
|
224 | 224 | $manager->begin(); |
225 | 225 | |
226 | 226 | try |
227 | 227 | { |
228 | - $item = $this->fromArray( $view->param( 'item', [] ) ); |
|
229 | - $view->item = $item->getId() ? $item : $manager->saveItem( $item ); |
|
228 | + $item = $this->fromArray($view->param('item', [])); |
|
229 | + $view->item = $item->getId() ? $item : $manager->saveItem($item); |
|
230 | 230 | $view->itemBody = ''; |
231 | 231 | |
232 | - foreach( $this->getSubClients() as $client ) { |
|
232 | + foreach ($this->getSubClients() as $client) { |
|
233 | 233 | $view->itemBody .= $client->save(); |
234 | 234 | } |
235 | 235 | |
236 | - $manager->saveItem( clone $view->item ); |
|
236 | + $manager->saveItem(clone $view->item); |
|
237 | 237 | $manager->commit(); |
238 | 238 | |
239 | - $this->nextAction( $view, $view->param( 'next' ), 'locale/language', $view->item->getId(), 'save' ); |
|
239 | + $this->nextAction($view, $view->param('next'), 'locale/language', $view->item->getId(), 'save'); |
|
240 | 240 | return; |
241 | 241 | } |
242 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
242 | + catch (\Aimeos\Admin\JQAdm\Exception $e) |
|
243 | 243 | { |
244 | 244 | // fall through to create |
245 | 245 | } |
246 | - catch( \Aimeos\MShop\Exception $e ) |
|
246 | + catch (\Aimeos\MShop\Exception $e) |
|
247 | 247 | { |
248 | - $error = array( 'locale-language-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
249 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
250 | - $this->logException( $e ); |
|
248 | + $error = array('locale-language-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
249 | + $view->errors = $view->get('errors', []) + $error; |
|
250 | + $this->logException($e); |
|
251 | 251 | } |
252 | - catch( \Exception $e ) |
|
252 | + catch (\Exception $e) |
|
253 | 253 | { |
254 | - $error = array( 'locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
255 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
256 | - $this->logException( $e ); |
|
254 | + $error = array('locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
255 | + $view->errors = $view->get('errors', []) + $error; |
|
256 | + $this->logException($e); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | $manager->rollback(); |
@@ -275,34 +275,34 @@ discard block |
||
275 | 275 | try |
276 | 276 | { |
277 | 277 | $total = 0; |
278 | - $params = $this->storeSearchParams( $view->param(), 'locale/language' ); |
|
279 | - $manager = \Aimeos\MShop::create( $context, 'locale/language' ); |
|
278 | + $params = $this->storeSearchParams($view->param(), 'locale/language'); |
|
279 | + $manager = \Aimeos\MShop::create($context, 'locale/language'); |
|
280 | 280 | |
281 | 281 | $search = $manager->createSearch(); |
282 | - $search->setSortations( [$search->sort( '-', 'locale.language.status'), $search->sort( '+', 'locale.language.id')] ); |
|
283 | - $search = $this->initCriteria( $search, $params ); |
|
282 | + $search->setSortations([$search->sort('-', 'locale.language.status'), $search->sort('+', 'locale.language.id')]); |
|
283 | + $search = $this->initCriteria($search, $params); |
|
284 | 284 | |
285 | - $view->items = $manager->searchItems( $search, [], $total ); |
|
286 | - $view->filterAttributes = $manager->getSearchAttributes( true ); |
|
285 | + $view->items = $manager->searchItems($search, [], $total); |
|
286 | + $view->filterAttributes = $manager->getSearchAttributes(true); |
|
287 | 287 | $view->filterOperators = $search->getOperators(); |
288 | 288 | $view->total = $total; |
289 | 289 | $view->itemBody = ''; |
290 | 290 | |
291 | - foreach( $this->getSubClients() as $client ) { |
|
291 | + foreach ($this->getSubClients() as $client) { |
|
292 | 292 | $view->itemBody .= $client->search(); |
293 | 293 | } |
294 | 294 | } |
295 | - catch( \Aimeos\MShop\Exception $e ) |
|
295 | + catch (\Aimeos\MShop\Exception $e) |
|
296 | 296 | { |
297 | - $error = array( 'locale-language-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
298 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
299 | - $this->logException( $e ); |
|
297 | + $error = array('locale-language-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
298 | + $view->errors = $view->get('errors', []) + $error; |
|
299 | + $this->logException($e); |
|
300 | 300 | } |
301 | - catch( \Exception $e ) |
|
301 | + catch (\Exception $e) |
|
302 | 302 | { |
303 | - $error = array( 'locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
304 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
305 | - $this->logException( $e ); |
|
303 | + $error = array('locale-language-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
304 | + $view->errors = $view->get('errors', []) + $error; |
|
305 | + $this->logException($e); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | /** admin/jqadm/locale/language/template-list |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | $tplconf = 'admin/jqadm/locale/language/template-list'; |
328 | 328 | $default = 'locale/language/list-standard'; |
329 | 329 | |
330 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
330 | + return $view->render($view->config($tplconf, $default)); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | * @param string|null $name Name of the sub-client (Default if null) |
339 | 339 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
340 | 340 | */ |
341 | - public function getSubClient( $type, $name = null ) |
|
341 | + public function getSubClient($type, $name = null) |
|
342 | 342 | { |
343 | 343 | /** admin/jqadm/locale/language/decorators/excludes |
344 | 344 | * Excludes decorators added by the "common" option from the locale JQAdm client |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | * @see admin/jqadm/locale/language/decorators/excludes |
414 | 414 | * @see admin/jqadm/locale/language/decorators/global |
415 | 415 | */ |
416 | - return $this->createSubClient( 'locale/language' . $type, $name ); |
|
416 | + return $this->createSubClient('locale/language' . $type, $name); |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | * @since 2017.10 |
458 | 458 | * @category Developer |
459 | 459 | */ |
460 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/locale/language/standard/subparts', [] ); |
|
460 | + return $this->getContext()->getConfig()->get('admin/jqadm/locale/language/standard/subparts', []); |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | |
@@ -468,17 +468,17 @@ discard block |
||
468 | 468 | * @param string[] Data array |
469 | 469 | * @return \Aimeos\MShop\Locale\Item\Iface New locale item object |
470 | 470 | */ |
471 | - protected function fromArray( array $data ) |
|
471 | + protected function fromArray(array $data) |
|
472 | 472 | { |
473 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'locale/language' ); |
|
473 | + $manager = \Aimeos\MShop::create($this->getContext(), 'locale/language'); |
|
474 | 474 | |
475 | - if( isset( $data['locale.language.id'] ) && $data['locale.language.id'] != '' ) { |
|
476 | - $item = $manager->getItem( $data['locale.language.id'] ); |
|
475 | + if (isset($data['locale.language.id']) && $data['locale.language.id'] != '') { |
|
476 | + $item = $manager->getItem($data['locale.language.id']); |
|
477 | 477 | } else { |
478 | 478 | $item = $manager->createItem(); |
479 | 479 | } |
480 | 480 | |
481 | - $item->fromArray( $data ); |
|
481 | + $item->fromArray($data); |
|
482 | 482 | |
483 | 483 | return $item; |
484 | 484 | } |
@@ -490,11 +490,11 @@ discard block |
||
490 | 490 | * @param \Aimeos\MShop\Locale\Item\Iface $item Locale item object |
491 | 491 | * @return string[] Multi-dimensional associative list of item data |
492 | 492 | */ |
493 | - protected function toArray( \Aimeos\MShop\Locale\Item\Language\Iface $item, $copy = false ) |
|
493 | + protected function toArray(\Aimeos\MShop\Locale\Item\Language\Iface $item, $copy = false) |
|
494 | 494 | { |
495 | - $data = $item->toArray( true ); |
|
495 | + $data = $item->toArray(true); |
|
496 | 496 | |
497 | - if( $copy === true ) |
|
497 | + if ($copy === true) |
|
498 | 498 | { |
499 | 499 | $data['locale.language.id'] = ''; |
500 | 500 | $data['locale.language.code'] = ''; |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
511 | 511 | * @return string HTML output |
512 | 512 | */ |
513 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
513 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
514 | 514 | { |
515 | 515 | /** admin/jqadm/locale/language/template-item |
516 | 516 | * Relative path to the HTML body template for the locale item. |
@@ -534,6 +534,6 @@ discard block |
||
534 | 534 | $tplconf = 'admin/jqadm/locale/language/template-item'; |
535 | 535 | $default = 'locale/language/item-standard'; |
536 | 536 | |
537 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
537 | + return $view->render($view->config($tplconf, $default)); |
|
538 | 538 | } |
539 | 539 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Locale; |
12 | 12 | |
13 | -sprintf( 'locale' ); // for translation |
|
13 | +sprintf('locale'); // 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, 'locale' ); |
|
43 | - $view->item = $manager->getItem( $id ); |
|
42 | + $manager = \Aimeos\MShop::create($context, 'locale'); |
|
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->itemCurrencies = $this->getCurrencyItems(); |
48 | 48 | $view->itemLanguages = $this->getLanguageItems(); |
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( 'locale-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
60 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
61 | - $this->logException( $e ); |
|
59 | + $error = array('locale-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( 'locale-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
66 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
67 | - $this->logException( $e ); |
|
65 | + $error = array('locale-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,10 +83,10 @@ 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, 'locale' )->createItem(); |
|
88 | + if (!isset($view->item)) { |
|
89 | + $view->item = \Aimeos\MShop::create($context, 'locale')->createItem(); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | $data['locale.siteid'] = $view->item->getSiteId(); |
@@ -97,26 +97,26 @@ discard block |
||
97 | 97 | $view->itemData = $data; |
98 | 98 | $view->itemBody = ''; |
99 | 99 | |
100 | - foreach( $this->getSubClients() as $idx => $client ) |
|
100 | + foreach ($this->getSubClients() as $idx => $client) |
|
101 | 101 | { |
102 | 102 | $view->tabindex = ++$idx + 1; |
103 | 103 | $view->itemBody .= $client->create(); |
104 | 104 | } |
105 | 105 | } |
106 | - catch( \Aimeos\MShop\Exception $e ) |
|
106 | + catch (\Aimeos\MShop\Exception $e) |
|
107 | 107 | { |
108 | - $error = array( 'locale-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
109 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
110 | - $this->logException( $e ); |
|
108 | + $error = array('locale-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
109 | + $view->errors = $view->get('errors', []) + $error; |
|
110 | + $this->logException($e); |
|
111 | 111 | } |
112 | - catch( \Exception $e ) |
|
112 | + catch (\Exception $e) |
|
113 | 113 | { |
114 | - $error = array( 'locale-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
115 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
116 | - $this->logException( $e ); |
|
114 | + $error = array('locale-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
115 | + $view->errors = $view->get('errors', []) + $error; |
|
116 | + $this->logException($e); |
|
117 | 117 | } |
118 | 118 | |
119 | - return $this->render( $view ); |
|
119 | + return $this->render($view); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | |
@@ -130,38 +130,38 @@ discard block |
||
130 | 130 | $view = $this->getView(); |
131 | 131 | $context = $this->getContext(); |
132 | 132 | |
133 | - $manager = \Aimeos\MShop::create( $context, 'locale' ); |
|
133 | + $manager = \Aimeos\MShop::create($context, 'locale'); |
|
134 | 134 | $manager->begin(); |
135 | 135 | |
136 | 136 | try |
137 | 137 | { |
138 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
139 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
138 | + if (($id = $view->param('id')) === null) { |
|
139 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
140 | 140 | } |
141 | 141 | |
142 | - $view->item = $manager->getItem( $id ); |
|
142 | + $view->item = $manager->getItem($id); |
|
143 | 143 | |
144 | - foreach( $this->getSubClients() as $client ) { |
|
144 | + foreach ($this->getSubClients() as $client) { |
|
145 | 145 | $client->delete(); |
146 | 146 | } |
147 | 147 | |
148 | - $manager->deleteItem( $id ); |
|
148 | + $manager->deleteItem($id); |
|
149 | 149 | $manager->commit(); |
150 | 150 | |
151 | - $this->nextAction( $view, 'search', 'locale', null, 'delete' ); |
|
151 | + $this->nextAction($view, 'search', 'locale', null, 'delete'); |
|
152 | 152 | return; |
153 | 153 | } |
154 | - catch( \Aimeos\MShop\Exception $e ) |
|
154 | + catch (\Aimeos\MShop\Exception $e) |
|
155 | 155 | { |
156 | - $error = array( 'locale-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
157 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
158 | - $this->logException( $e ); |
|
156 | + $error = array('locale-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
157 | + $view->errors = $view->get('errors', []) + $error; |
|
158 | + $this->logException($e); |
|
159 | 159 | } |
160 | - catch( \Exception $e ) |
|
160 | + catch (\Exception $e) |
|
161 | 161 | { |
162 | - $error = array( 'locale-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
163 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
164 | - $this->logException( $e ); |
|
162 | + $error = array('locale-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
163 | + $view->errors = $view->get('errors', []) + $error; |
|
164 | + $this->logException($e); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | $manager->rollback(); |
@@ -182,39 +182,39 @@ discard block |
||
182 | 182 | |
183 | 183 | try |
184 | 184 | { |
185 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
186 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
185 | + if (($id = $view->param('id')) === null) { |
|
186 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
187 | 187 | } |
188 | 188 | |
189 | - $manager = \Aimeos\MShop::create( $context, 'locale' ); |
|
189 | + $manager = \Aimeos\MShop::create($context, 'locale'); |
|
190 | 190 | |
191 | - $view->item = $manager->getItem( $id ); |
|
191 | + $view->item = $manager->getItem($id); |
|
192 | 192 | $view->itemSubparts = $this->getSubClientNames(); |
193 | - $view->itemData = $this->toArray( $view->item ); |
|
193 | + $view->itemData = $this->toArray($view->item); |
|
194 | 194 | $view->itemCurrencies = $this->getCurrencyItems(); |
195 | 195 | $view->itemLanguages = $this->getLanguageItems(); |
196 | 196 | $view->itemBody = ''; |
197 | 197 | |
198 | - foreach( $this->getSubClients() as $idx => $client ) |
|
198 | + foreach ($this->getSubClients() as $idx => $client) |
|
199 | 199 | { |
200 | 200 | $view->tabindex = ++$idx + 1; |
201 | 201 | $view->itemBody .= $client->get(); |
202 | 202 | } |
203 | 203 | } |
204 | - catch( \Aimeos\MShop\Exception $e ) |
|
204 | + catch (\Aimeos\MShop\Exception $e) |
|
205 | 205 | { |
206 | - $error = array( 'locale-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
207 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
208 | - $this->logException( $e ); |
|
206 | + $error = array('locale-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
207 | + $view->errors = $view->get('errors', []) + $error; |
|
208 | + $this->logException($e); |
|
209 | 209 | } |
210 | - catch( \Exception $e ) |
|
210 | + catch (\Exception $e) |
|
211 | 211 | { |
212 | - $error = array( 'locale-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
213 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
214 | - $this->logException( $e ); |
|
212 | + $error = array('locale-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
213 | + $view->errors = $view->get('errors', []) + $error; |
|
214 | + $this->logException($e); |
|
215 | 215 | } |
216 | 216 | |
217 | - return $this->render( $view ); |
|
217 | + return $this->render($view); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | |
@@ -228,40 +228,40 @@ discard block |
||
228 | 228 | $view = $this->getView(); |
229 | 229 | $context = $this->getContext(); |
230 | 230 | |
231 | - $manager = \Aimeos\MShop::create( $context, 'locale' ); |
|
231 | + $manager = \Aimeos\MShop::create($context, 'locale'); |
|
232 | 232 | $manager->begin(); |
233 | 233 | |
234 | 234 | try |
235 | 235 | { |
236 | - $item = $this->fromArray( $view->param( 'item', [] ) ); |
|
237 | - $view->item = $item->getId() ? $item : $manager->saveItem( $item ); |
|
236 | + $item = $this->fromArray($view->param('item', [])); |
|
237 | + $view->item = $item->getId() ? $item : $manager->saveItem($item); |
|
238 | 238 | $view->itemBody = ''; |
239 | 239 | |
240 | - foreach( $this->getSubClients() as $client ) { |
|
240 | + foreach ($this->getSubClients() as $client) { |
|
241 | 241 | $view->itemBody .= $client->save(); |
242 | 242 | } |
243 | 243 | |
244 | - $manager->saveItem( $view->item ); |
|
244 | + $manager->saveItem($view->item); |
|
245 | 245 | $manager->commit(); |
246 | 246 | |
247 | - $this->nextAction( $view, $view->param( 'next' ), 'locale', $view->item->getId(), 'save' ); |
|
247 | + $this->nextAction($view, $view->param('next'), 'locale', $view->item->getId(), 'save'); |
|
248 | 248 | return; |
249 | 249 | } |
250 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
250 | + catch (\Aimeos\Admin\JQAdm\Exception $e) |
|
251 | 251 | { |
252 | 252 | // fall through to create |
253 | 253 | } |
254 | - catch( \Aimeos\MShop\Exception $e ) |
|
254 | + catch (\Aimeos\MShop\Exception $e) |
|
255 | 255 | { |
256 | - $error = array( 'locale-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
257 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
258 | - $this->logException( $e ); |
|
256 | + $error = array('locale-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
257 | + $view->errors = $view->get('errors', []) + $error; |
|
258 | + $this->logException($e); |
|
259 | 259 | } |
260 | - catch( \Exception $e ) |
|
260 | + catch (\Exception $e) |
|
261 | 261 | { |
262 | - $error = array( 'locale-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
263 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
264 | - $this->logException( $e ); |
|
262 | + $error = array('locale-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
263 | + $view->errors = $view->get('errors', []) + $error; |
|
264 | + $this->logException($e); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | $manager->rollback(); |
@@ -283,31 +283,31 @@ discard block |
||
283 | 283 | try |
284 | 284 | { |
285 | 285 | $total = 0; |
286 | - $params = $this->storeSearchParams( $view->param(), 'locale' ); |
|
287 | - $manager = \Aimeos\MShop::create( $context, 'locale' ); |
|
288 | - $search = $this->initCriteria( $manager->createSearch(), $params ); |
|
286 | + $params = $this->storeSearchParams($view->param(), 'locale'); |
|
287 | + $manager = \Aimeos\MShop::create($context, 'locale'); |
|
288 | + $search = $this->initCriteria($manager->createSearch(), $params); |
|
289 | 289 | |
290 | - $view->items = $manager->searchItems( $search, [], $total ); |
|
291 | - $view->filterAttributes = $manager->getSearchAttributes( true ); |
|
290 | + $view->items = $manager->searchItems($search, [], $total); |
|
291 | + $view->filterAttributes = $manager->getSearchAttributes(true); |
|
292 | 292 | $view->filterOperators = $search->getOperators(); |
293 | 293 | $view->total = $total; |
294 | 294 | $view->itemBody = ''; |
295 | 295 | |
296 | - foreach( $this->getSubClients() as $client ) { |
|
296 | + foreach ($this->getSubClients() as $client) { |
|
297 | 297 | $view->itemBody .= $client->search(); |
298 | 298 | } |
299 | 299 | } |
300 | - catch( \Aimeos\MShop\Exception $e ) |
|
300 | + catch (\Aimeos\MShop\Exception $e) |
|
301 | 301 | { |
302 | - $error = array( 'locale-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
303 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
304 | - $this->logException( $e ); |
|
302 | + $error = array('locale-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
303 | + $view->errors = $view->get('errors', []) + $error; |
|
304 | + $this->logException($e); |
|
305 | 305 | } |
306 | - catch( \Exception $e ) |
|
306 | + catch (\Exception $e) |
|
307 | 307 | { |
308 | - $error = array( 'locale-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
309 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
310 | - $this->logException( $e ); |
|
308 | + $error = array('locale-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
309 | + $view->errors = $view->get('errors', []) + $error; |
|
310 | + $this->logException($e); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | /** admin/jqadm/locale/template-list |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | $tplconf = 'admin/jqadm/locale/template-list'; |
333 | 333 | $default = 'locale/list-standard'; |
334 | 334 | |
335 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
335 | + return $view->render($view->config($tplconf, $default)); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | * @param string|null $name Name of the sub-client (Default if null) |
344 | 344 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
345 | 345 | */ |
346 | - public function getSubClient( $type, $name = null ) |
|
346 | + public function getSubClient($type, $name = null) |
|
347 | 347 | { |
348 | 348 | /** admin/jqadm/locale/decorators/excludes |
349 | 349 | * Excludes decorators added by the "common" option from the locale JQAdm client |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | * @see admin/jqadm/locale/decorators/excludes |
419 | 419 | * @see admin/jqadm/locale/decorators/global |
420 | 420 | */ |
421 | - return $this->createSubClient( 'locale/' . $type, $name ); |
|
421 | + return $this->createSubClient('locale/' . $type, $name); |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | |
@@ -429,13 +429,13 @@ discard block |
||
429 | 429 | */ |
430 | 430 | protected function getCurrencyItems() |
431 | 431 | { |
432 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'locale/currency' ); |
|
432 | + $manager = \Aimeos\MShop::create($this->getContext(), 'locale/currency'); |
|
433 | 433 | |
434 | - $search = $manager->createSearch( true ); |
|
435 | - $search->setSortations( [$search->sort( '+', 'locale.currency.id')] ); |
|
436 | - $search->setSlice( 0, 250 ); |
|
434 | + $search = $manager->createSearch(true); |
|
435 | + $search->setSortations([$search->sort('+', 'locale.currency.id')]); |
|
436 | + $search->setSlice(0, 250); |
|
437 | 437 | |
438 | - return $manager->searchItems( $search ); |
|
438 | + return $manager->searchItems($search); |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | |
@@ -446,13 +446,13 @@ discard block |
||
446 | 446 | */ |
447 | 447 | protected function getLanguageItems() |
448 | 448 | { |
449 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'locale/language' ); |
|
449 | + $manager = \Aimeos\MShop::create($this->getContext(), 'locale/language'); |
|
450 | 450 | |
451 | - $search = $manager->createSearch( true ); |
|
452 | - $search->setSortations( [$search->sort( '+', 'locale.language.id')] ); |
|
453 | - $search->setSlice( 0, 250 ); |
|
451 | + $search = $manager->createSearch(true); |
|
452 | + $search->setSortations([$search->sort('+', 'locale.language.id')]); |
|
453 | + $search->setSlice(0, 250); |
|
454 | 454 | |
455 | - return $manager->searchItems( $search ); |
|
455 | + return $manager->searchItems($search); |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | * @since 2017.10 |
497 | 497 | * @category Developer |
498 | 498 | */ |
499 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/locale/standard/subparts', [] ); |
|
499 | + return $this->getContext()->getConfig()->get('admin/jqadm/locale/standard/subparts', []); |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | |
@@ -507,17 +507,17 @@ discard block |
||
507 | 507 | * @param string[] Data array |
508 | 508 | * @return \Aimeos\MShop\Locale\Item\Iface New locale item object |
509 | 509 | */ |
510 | - protected function fromArray( array $data ) |
|
510 | + protected function fromArray(array $data) |
|
511 | 511 | { |
512 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'locale' ); |
|
512 | + $manager = \Aimeos\MShop::create($this->getContext(), 'locale'); |
|
513 | 513 | |
514 | - if( isset( $data['locale.id'] ) && $data['locale.id'] != '' ) { |
|
515 | - $item = $manager->getItem( $data['locale.id'] ); |
|
514 | + if (isset($data['locale.id']) && $data['locale.id'] != '') { |
|
515 | + $item = $manager->getItem($data['locale.id']); |
|
516 | 516 | } else { |
517 | 517 | $item = $manager->createItem(); |
518 | 518 | } |
519 | 519 | |
520 | - $item->fromArray( $data ); |
|
520 | + $item->fromArray($data); |
|
521 | 521 | |
522 | 522 | return $item; |
523 | 523 | } |
@@ -529,11 +529,11 @@ discard block |
||
529 | 529 | * @param \Aimeos\MShop\Locale\Item\Iface $item Locale item object |
530 | 530 | * @return string[] Multi-dimensional associative list of item data |
531 | 531 | */ |
532 | - protected function toArray( \Aimeos\MShop\Locale\Item\Iface $item, $copy = false ) |
|
532 | + protected function toArray(\Aimeos\MShop\Locale\Item\Iface $item, $copy = false) |
|
533 | 533 | { |
534 | - $data = $item->toArray( true ); |
|
534 | + $data = $item->toArray(true); |
|
535 | 535 | |
536 | - if( $copy === true ) |
|
536 | + if ($copy === true) |
|
537 | 537 | { |
538 | 538 | $data['locale.siteid'] = $this->getContext()->getLocale()->getSiteId(); |
539 | 539 | $data['locale.id'] = ''; |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
550 | 550 | * @return string HTML output |
551 | 551 | */ |
552 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
552 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
553 | 553 | { |
554 | 554 | /** admin/jqadm/locale/template-item |
555 | 555 | * Relative path to the HTML body template for the locale item. |
@@ -573,6 +573,6 @@ discard block |
||
573 | 573 | $tplconf = 'admin/jqadm/locale/template-item'; |
574 | 574 | $default = 'locale/item-standard'; |
575 | 575 | |
576 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
576 | + return $view->render($view->config($tplconf, $default)); |
|
577 | 577 | } |
578 | 578 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Dashboard\Order\Latest; |
12 | 12 | |
13 | -sprintf( 'latest' ); // for translation |
|
13 | +sprintf('latest'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -46,24 +46,24 @@ discard block |
||
46 | 46 | |
47 | 47 | try |
48 | 48 | { |
49 | - $this->addOrders( $view ); |
|
49 | + $this->addOrders($view); |
|
50 | 50 | $view->orderlatestBody = ''; |
51 | 51 | |
52 | - foreach( $this->getSubClients() as $client ) { |
|
52 | + foreach ($this->getSubClients() as $client) { |
|
53 | 53 | $view->orderlatestBody .= $client->search(); |
54 | 54 | } |
55 | 55 | } |
56 | - catch( \Aimeos\MShop\Exception $e ) |
|
56 | + catch (\Aimeos\MShop\Exception $e) |
|
57 | 57 | { |
58 | - $error = array( 'order-latest' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
59 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
60 | - $this->logException( $e ); |
|
58 | + $error = array('order-latest' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
59 | + $view->errors = $view->get('errors', []) + $error; |
|
60 | + $this->logException($e); |
|
61 | 61 | } |
62 | - catch( \Exception $e ) |
|
62 | + catch (\Exception $e) |
|
63 | 63 | { |
64 | - $error = array( 'order-latest' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
65 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
66 | - $this->logException( $e ); |
|
64 | + $error = array('order-latest' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
65 | + $view->errors = $view->get('errors', []) + $error; |
|
66 | + $this->logException($e); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** admin/jqadm/dashboard/order/latest/template-item |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $tplconf = 'admin/jqadm/dashboard/order/latest/template-item'; |
89 | 89 | $default = 'dashboard/item-order-latest-standard'; |
90 | 90 | |
91 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
91 | + return $view->render($view->config($tplconf, $default)); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @param string|null $name Name of the sub-client (Default if null) |
100 | 100 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
101 | 101 | */ |
102 | - public function getSubClient( $type, $name = null ) |
|
102 | + public function getSubClient($type, $name = null) |
|
103 | 103 | { |
104 | 104 | /** admin/jqadm/dashboard/order/latest/decorators/excludes |
105 | 105 | * Excludes decorators added by the "common" option from the dashboard JQAdm client |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @see admin/jqadm/dashboard/order/latest/decorators/excludes |
175 | 175 | * @see admin/jqadm/dashboard/order/latest/decorators/global |
176 | 176 | */ |
177 | - return $this->createSubClient( 'dashboard/order/latest/' . $type, $name ); |
|
177 | + return $this->createSubClient('dashboard/order/latest/' . $type, $name); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
@@ -183,28 +183,28 @@ discard block |
||
183 | 183 | * |
184 | 184 | * @param \Aimeos\MW\View\Iface $view View object to add the parameters to |
185 | 185 | */ |
186 | - protected function addOrders( \Aimeos\MW\View\Iface $view ) |
|
186 | + protected function addOrders(\Aimeos\MW\View\Iface $view) |
|
187 | 187 | { |
188 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'order' ); |
|
188 | + $manager = \Aimeos\MShop::create($this->getContext(), 'order'); |
|
189 | 189 | |
190 | 190 | $search = $manager->createSearch(); |
191 | - $search->setSortations( [$search->sort( '-', 'order.ctime' ), $search->sort( '-', 'order.id' )] ); |
|
192 | - $search->setSlice( 0, 10 ); |
|
191 | + $search->setSortations([$search->sort('-', 'order.ctime'), $search->sort('-', 'order.id')]); |
|
192 | + $search->setSlice(0, 10); |
|
193 | 193 | |
194 | - $items = $manager->searchItems( $search ); |
|
194 | + $items = $manager->searchItems($search); |
|
195 | 195 | |
196 | 196 | $baseIds = []; |
197 | - foreach( $items as $item ) { |
|
197 | + foreach ($items as $item) { |
|
198 | 198 | $baseIds[] = $item->getBaseId(); |
199 | 199 | } |
200 | 200 | |
201 | 201 | |
202 | - $baseManager = \Aimeos\MShop::create( $this->getContext(), 'order/base' ); |
|
202 | + $baseManager = \Aimeos\MShop::create($this->getContext(), 'order/base'); |
|
203 | 203 | |
204 | - $baseSearch = $manager->createSearch()->setSlice( 0, count( $baseIds ) ); |
|
205 | - $baseSearch->setConditions( $baseSearch->compare( '==', 'order.base.id', $baseIds ) ); |
|
204 | + $baseSearch = $manager->createSearch()->setSlice(0, count($baseIds)); |
|
205 | + $baseSearch->setConditions($baseSearch->compare('==', 'order.base.id', $baseIds)); |
|
206 | 206 | |
207 | - $basketItems = $baseManager->searchItems( $baseSearch, ['order/base/address', 'order/base/service'] ); |
|
207 | + $basketItems = $baseManager->searchItems($baseSearch, ['order/base/address', 'order/base/service']); |
|
208 | 208 | |
209 | 209 | |
210 | 210 | $view->orderlatestBaskets = $basketItems; |
@@ -252,6 +252,6 @@ discard block |
||
252 | 252 | * @since 2016.07 |
253 | 253 | * @category Developer |
254 | 254 | */ |
255 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/dashboard/order/latest/standard/subparts', [] ); |
|
255 | + return $this->getContext()->getConfig()->get('admin/jqadm/dashboard/order/latest/standard/subparts', []); |
|
256 | 256 | } |
257 | 257 | } |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | $view = $this->getView(); |
44 | 44 | $view->orderBody = ''; |
45 | 45 | |
46 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'locale/currency' ); |
|
47 | - $view->orderCurrencyItems = $manager->searchItems( $manager->createSearch( true ) ); |
|
46 | + $manager = \Aimeos\MShop::create($this->getContext(), 'locale/currency'); |
|
47 | + $view->orderCurrencyItems = $manager->searchItems($manager->createSearch(true)); |
|
48 | 48 | |
49 | - foreach( $this->getSubClients() as $client ) { |
|
49 | + foreach ($this->getSubClients() as $client) { |
|
50 | 50 | $view->orderBody .= $client->search(); |
51 | 51 | } |
52 | 52 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $tplconf = 'admin/jqadm/dashboard/order/template-list'; |
73 | 73 | $default = 'dashboard/list-order-standard'; |
74 | 74 | |
75 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
75 | + return $view->render($view->config($tplconf, $default)); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @param string|null $name Name of the sub-client (Default if null) |
84 | 84 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
85 | 85 | */ |
86 | - public function getSubClient( $type, $name = null ) |
|
86 | + public function getSubClient($type, $name = null) |
|
87 | 87 | { |
88 | 88 | /** admin/jqadm/dashboard/order/decorators/excludes |
89 | 89 | * Excludes decorators added by the "common" option from the dashboard JQAdm client |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @see admin/jqadm/dashboard/order/decorators/excludes |
159 | 159 | * @see admin/jqadm/dashboard/order/decorators/global |
160 | 160 | */ |
161 | - return $this->createSubClient( 'dashboard/order/' . $type, $name ); |
|
161 | + return $this->createSubClient('dashboard/order/' . $type, $name); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | |
@@ -202,6 +202,6 @@ discard block |
||
202 | 202 | * @since 2018.01 |
203 | 203 | * @category Developer |
204 | 204 | */ |
205 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/dashboard/order/standard/subparts', [] ); |
|
205 | + return $this->getContext()->getConfig()->get('admin/jqadm/dashboard/order/standard/subparts', []); |
|
206 | 206 | } |
207 | 207 | } |
@@ -45,32 +45,32 @@ discard block |
||
45 | 45 | |
46 | 46 | try |
47 | 47 | { |
48 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
49 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
48 | + if (($id = $view->param('id')) === null) { |
|
49 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
50 | 50 | } |
51 | 51 | |
52 | - $fs = $context->getFileSystemManager()->get( 'fs-admin' ); |
|
53 | - $manager = \Aimeos\MAdmin::create( $context, 'job' ); |
|
54 | - $item = $manager->getItem( $id ); |
|
52 | + $fs = $context->getFileSystemManager()->get('fs-admin'); |
|
53 | + $manager = \Aimeos\MAdmin::create($context, 'job'); |
|
54 | + $item = $manager->getItem($id); |
|
55 | 55 | $result = $item->getResult(); |
56 | 56 | |
57 | - if( isset( $result['file'] ) && $fs->has( $result['file'] ) ) { |
|
58 | - $fs->rm( $result['file'] ); |
|
57 | + if (isset($result['file']) && $fs->has($result['file'])) { |
|
58 | + $fs->rm($result['file']); |
|
59 | 59 | } |
60 | 60 | |
61 | - $manager->deleteItem( $id ); |
|
61 | + $manager->deleteItem($id); |
|
62 | 62 | } |
63 | - catch( \Aimeos\MAdmin\Exception $e ) |
|
63 | + catch (\Aimeos\MAdmin\Exception $e) |
|
64 | 64 | { |
65 | - $error = array( 'job-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
66 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
67 | - $this->logException( $e ); |
|
65 | + $error = array('job-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
66 | + $view->errors = $view->get('errors', []) + $error; |
|
67 | + $this->logException($e); |
|
68 | 68 | } |
69 | - catch( \Exception $e ) |
|
69 | + catch (\Exception $e) |
|
70 | 70 | { |
71 | - $error = array( 'job-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
72 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
73 | - $this->logException( $e ); |
|
71 | + $error = array('job-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
72 | + $view->errors = $view->get('errors', []) + $error; |
|
73 | + $this->logException($e); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | return $this->search(); |
@@ -89,33 +89,33 @@ discard block |
||
89 | 89 | |
90 | 90 | try |
91 | 91 | { |
92 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
93 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
92 | + if (($id = $view->param('id')) === null) { |
|
93 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
94 | 94 | } |
95 | 95 | |
96 | - $fs = $context->getFileSystemManager()->get( 'fs-admin' ); |
|
97 | - $item = \Aimeos\MAdmin::create( $context, 'job' )->getItem( $id ); |
|
96 | + $fs = $context->getFileSystemManager()->get('fs-admin'); |
|
97 | + $item = \Aimeos\MAdmin::create($context, 'job')->getItem($id); |
|
98 | 98 | $result = $item->getResult(); |
99 | 99 | |
100 | - if( isset( $result['file'] ) && $fs->has( $result['file'] ) ) |
|
100 | + if (isset($result['file']) && $fs->has($result['file'])) |
|
101 | 101 | { |
102 | - $stream = $view->response()->createStream( $fs->reads( $result['file'] ) ); |
|
103 | - $view->response()->withHeader( 'Content-Disposition', 'attachment; filename="' . $result['file'] . '"' ); |
|
104 | - $view->response()->withHeader( 'Content-Type', 'text/csv' ); |
|
105 | - $view->response()->withBody( $stream ); |
|
102 | + $stream = $view->response()->createStream($fs->reads($result['file'])); |
|
103 | + $view->response()->withHeader('Content-Disposition', 'attachment; filename="' . $result['file'] . '"'); |
|
104 | + $view->response()->withHeader('Content-Type', 'text/csv'); |
|
105 | + $view->response()->withBody($stream); |
|
106 | 106 | } |
107 | 107 | } |
108 | - catch( \Aimeos\MAdmin\Exception $e ) |
|
108 | + catch (\Aimeos\MAdmin\Exception $e) |
|
109 | 109 | { |
110 | - $error = array( 'job-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
111 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
112 | - $this->logException( $e ); |
|
110 | + $error = array('job-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
111 | + $view->errors = $view->get('errors', []) + $error; |
|
112 | + $this->logException($e); |
|
113 | 113 | } |
114 | - catch( \Exception $e ) |
|
114 | + catch (\Exception $e) |
|
115 | 115 | { |
116 | - $error = array( 'job-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
117 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
118 | - $this->logException( $e ); |
|
116 | + $error = array('job-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
117 | + $view->errors = $view->get('errors', []) + $error; |
|
118 | + $this->logException($e); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
@@ -132,32 +132,32 @@ discard block |
||
132 | 132 | |
133 | 133 | try |
134 | 134 | { |
135 | - $manager = \Aimeos\MAdmin::create( $context, 'job' ); |
|
135 | + $manager = \Aimeos\MAdmin::create($context, 'job'); |
|
136 | 136 | |
137 | 137 | $search = $manager->createSearch(); |
138 | - $search->setSortations( [$search->sort( '-', 'job.ctime' ), $search->sort( '-', 'job.id' )] ); |
|
138 | + $search->setSortations([$search->sort('-', 'job.ctime'), $search->sort('-', 'job.id')]); |
|
139 | 139 | $total = 0; |
140 | 140 | |
141 | 141 | $view->jobBody = ''; |
142 | - $view->jobItems = $manager->searchItems( $search, [], $total ); |
|
142 | + $view->jobItems = $manager->searchItems($search, [], $total); |
|
143 | 143 | $view->jobTotal = $total; |
144 | 144 | |
145 | 145 | |
146 | - foreach( $this->getSubClients() as $client ) { |
|
146 | + foreach ($this->getSubClients() as $client) { |
|
147 | 147 | $view->jobBody .= $client->search(); |
148 | 148 | } |
149 | 149 | } |
150 | - catch( \Aimeos\MShop\Exception $e ) |
|
150 | + catch (\Aimeos\MShop\Exception $e) |
|
151 | 151 | { |
152 | - $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
153 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
154 | - $this->logException( $e ); |
|
152 | + $error = array('product-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( 'product-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
159 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
160 | - $this->logException( $e ); |
|
158 | + $error = array('product-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
159 | + $view->errors = $view->get('errors', []) + $error; |
|
160 | + $this->logException($e); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** admin/jqadm/dashboard/job/template-list |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $tplconf = 'admin/jqadm/dashboard/job/template-list'; |
183 | 183 | $default = 'dashboard/list-job-standard'; |
184 | 184 | |
185 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
185 | + return $view->render($view->config($tplconf, $default)); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * @param string|null $name Name of the sub-client (Default if null) |
194 | 194 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
195 | 195 | */ |
196 | - public function getSubClient( $type, $name = null ) |
|
196 | + public function getSubClient($type, $name = null) |
|
197 | 197 | { |
198 | 198 | /** admin/jqadm/dashboard/job/decorators/excludes |
199 | 199 | * Excludes decorators added by the "common" option from the dashboard JQAdm client |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | * @see admin/jqadm/dashboard/job/decorators/excludes |
269 | 269 | * @see admin/jqadm/dashboard/job/decorators/global |
270 | 270 | */ |
271 | - return $this->createSubClient( 'dashboard/job/' . $type, $name ); |
|
271 | + return $this->createSubClient('dashboard/job/' . $type, $name); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | |
@@ -312,6 +312,6 @@ discard block |
||
312 | 312 | * @since 2017.08 |
313 | 313 | * @category Developer |
314 | 314 | */ |
315 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/dashboard/job/standard/subparts', [] ); |
|
315 | + return $this->getContext()->getConfig()->get('admin/jqadm/dashboard/job/standard/subparts', []); |
|
316 | 316 | } |
317 | 317 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Coupon; |
12 | 12 | |
13 | -sprintf( 'coupon' ); // for translation |
|
13 | +sprintf('coupon'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -35,40 +35,40 @@ 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, 'coupon' ); |
|
42 | + $manager = \Aimeos\MShop::create($context, 'coupon'); |
|
43 | 43 | |
44 | - $view->item = $manager->getItem( $id ); |
|
45 | - $view->itemData = $this->toArray( $view->item, true ); |
|
44 | + $view->item = $manager->getItem($id); |
|
45 | + $view->itemData = $this->toArray($view->item, true); |
|
46 | 46 | $view->itemSubparts = $this->getSubClientNames(); |
47 | 47 | $view->itemProviders = $this->getProviderNames(); |
48 | 48 | $view->itemDecorators = $this->getDecoratorNames(); |
49 | - $view->itemAttributes = $this->getConfigAttributes( $view->item ); |
|
49 | + $view->itemAttributes = $this->getConfigAttributes($view->item); |
|
50 | 50 | $view->itemBody = ''; |
51 | 51 | |
52 | - foreach( $this->getSubClients() as $idx => $client ) |
|
52 | + foreach ($this->getSubClients() as $idx => $client) |
|
53 | 53 | { |
54 | 54 | $view->tabindex = ++$idx + 1; |
55 | 55 | $view->itemBody .= $client->copy(); |
56 | 56 | } |
57 | 57 | } |
58 | - catch( \Aimeos\MShop\Exception $e ) |
|
58 | + catch (\Aimeos\MShop\Exception $e) |
|
59 | 59 | { |
60 | - $error = array( 'coupon-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
61 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
62 | - $this->logException( $e ); |
|
60 | + $error = array('coupon-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
61 | + $view->errors = $view->get('errors', []) + $error; |
|
62 | + $this->logException($e); |
|
63 | 63 | } |
64 | - catch( \Exception $e ) |
|
64 | + catch (\Exception $e) |
|
65 | 65 | { |
66 | - $error = array( 'coupon-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
67 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
68 | - $this->logException( $e ); |
|
66 | + $error = array('coupon-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
67 | + $view->errors = $view->get('errors', []) + $error; |
|
68 | + $this->logException($e); |
|
69 | 69 | } |
70 | 70 | |
71 | - return $this->render( $view ); |
|
71 | + return $this->render($view); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -84,10 +84,10 @@ discard block |
||
84 | 84 | |
85 | 85 | try |
86 | 86 | { |
87 | - $data = $view->param( 'item', [] ); |
|
87 | + $data = $view->param('item', []); |
|
88 | 88 | |
89 | - if( !isset( $view->item ) ) { |
|
90 | - $view->item = \Aimeos\MShop::create( $context, 'coupon' )->createItem(); |
|
89 | + if (!isset($view->item)) { |
|
90 | + $view->item = \Aimeos\MShop::create($context, 'coupon')->createItem(); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | $data['coupon.siteid'] = $view->item->getSiteId(); |
@@ -98,26 +98,26 @@ discard block |
||
98 | 98 | $view->itemData = $data; |
99 | 99 | $view->itemBody = ''; |
100 | 100 | |
101 | - foreach( $this->getSubClients() as $idx => $client ) |
|
101 | + foreach ($this->getSubClients() as $idx => $client) |
|
102 | 102 | { |
103 | 103 | $view->tabindex = ++$idx + 1; |
104 | 104 | $view->itemBody .= $client->create(); |
105 | 105 | } |
106 | 106 | } |
107 | - catch( \Aimeos\MShop\Exception $e ) |
|
107 | + catch (\Aimeos\MShop\Exception $e) |
|
108 | 108 | { |
109 | - $error = array( 'coupon-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
110 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
111 | - $this->logException( $e ); |
|
109 | + $error = array('coupon-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
110 | + $view->errors = $view->get('errors', []) + $error; |
|
111 | + $this->logException($e); |
|
112 | 112 | } |
113 | - catch( \Exception $e ) |
|
113 | + catch (\Exception $e) |
|
114 | 114 | { |
115 | - $error = array( 'coupon-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
116 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
117 | - $this->logException( $e ); |
|
115 | + $error = array('coupon-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
116 | + $view->errors = $view->get('errors', []) + $error; |
|
117 | + $this->logException($e); |
|
118 | 118 | } |
119 | 119 | |
120 | - return $this->render( $view ); |
|
120 | + return $this->render($view); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | |
@@ -131,38 +131,38 @@ discard block |
||
131 | 131 | $view = $this->getView(); |
132 | 132 | $context = $this->getContext(); |
133 | 133 | |
134 | - $manager = \Aimeos\MShop::create( $context, 'coupon' ); |
|
134 | + $manager = \Aimeos\MShop::create($context, 'coupon'); |
|
135 | 135 | $manager->begin(); |
136 | 136 | |
137 | 137 | try |
138 | 138 | { |
139 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
140 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
139 | + if (($id = $view->param('id')) === null) { |
|
140 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
141 | 141 | } |
142 | 142 | |
143 | - $view->item = $manager->getItem( $id ); |
|
143 | + $view->item = $manager->getItem($id); |
|
144 | 144 | |
145 | - foreach( $this->getSubClients() as $client ) { |
|
145 | + foreach ($this->getSubClients() as $client) { |
|
146 | 146 | $client->delete(); |
147 | 147 | } |
148 | 148 | |
149 | - $manager->deleteItem( $id ); |
|
149 | + $manager->deleteItem($id); |
|
150 | 150 | $manager->commit(); |
151 | 151 | |
152 | - $this->nextAction( $view, 'search', 'coupon', null, 'delete' ); |
|
152 | + $this->nextAction($view, 'search', 'coupon', null, 'delete'); |
|
153 | 153 | return; |
154 | 154 | } |
155 | - catch( \Aimeos\MShop\Exception $e ) |
|
155 | + catch (\Aimeos\MShop\Exception $e) |
|
156 | 156 | { |
157 | - $error = array( 'coupon-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
158 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
159 | - $this->logException( $e ); |
|
157 | + $error = array('coupon-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
158 | + $view->errors = $view->get('errors', []) + $error; |
|
159 | + $this->logException($e); |
|
160 | 160 | } |
161 | - catch( \Exception $e ) |
|
161 | + catch (\Exception $e) |
|
162 | 162 | { |
163 | - $error = array( 'coupon-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
164 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
165 | - $this->logException( $e ); |
|
163 | + $error = array('coupon-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
164 | + $view->errors = $view->get('errors', []) + $error; |
|
165 | + $this->logException($e); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | $manager->rollback(); |
@@ -183,40 +183,40 @@ discard block |
||
183 | 183 | |
184 | 184 | try |
185 | 185 | { |
186 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
187 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
186 | + if (($id = $view->param('id')) === null) { |
|
187 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
188 | 188 | } |
189 | 189 | |
190 | - $manager = \Aimeos\MShop::create( $context, 'coupon' ); |
|
190 | + $manager = \Aimeos\MShop::create($context, 'coupon'); |
|
191 | 191 | |
192 | - $view->item = $manager->getItem( $id ); |
|
193 | - $view->itemData = $this->toArray( $view->item ); |
|
192 | + $view->item = $manager->getItem($id); |
|
193 | + $view->itemData = $this->toArray($view->item); |
|
194 | 194 | $view->itemSubparts = $this->getSubClientNames(); |
195 | 195 | $view->itemDecorators = $this->getDecoratorNames(); |
196 | 196 | $view->itemProviders = $this->getProviderNames(); |
197 | - $view->itemAttributes = $this->getConfigAttributes( $view->item ); |
|
197 | + $view->itemAttributes = $this->getConfigAttributes($view->item); |
|
198 | 198 | $view->itemBody = ''; |
199 | 199 | |
200 | - foreach( $this->getSubClients() as $idx => $client ) |
|
200 | + foreach ($this->getSubClients() as $idx => $client) |
|
201 | 201 | { |
202 | 202 | $view->tabindex = ++$idx + 1; |
203 | 203 | $view->itemBody .= $client->get(); |
204 | 204 | } |
205 | 205 | } |
206 | - catch( \Aimeos\MShop\Exception $e ) |
|
206 | + catch (\Aimeos\MShop\Exception $e) |
|
207 | 207 | { |
208 | - $error = array( 'coupon-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
209 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
210 | - $this->logException( $e ); |
|
208 | + $error = array('coupon-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
209 | + $view->errors = $view->get('errors', []) + $error; |
|
210 | + $this->logException($e); |
|
211 | 211 | } |
212 | - catch( \Exception $e ) |
|
212 | + catch (\Exception $e) |
|
213 | 213 | { |
214 | - $error = array( 'coupon-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
215 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
216 | - $this->logException( $e ); |
|
214 | + $error = array('coupon-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
215 | + $view->errors = $view->get('errors', []) + $error; |
|
216 | + $this->logException($e); |
|
217 | 217 | } |
218 | 218 | |
219 | - return $this->render( $view ); |
|
219 | + return $this->render($view); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | |
@@ -230,40 +230,40 @@ discard block |
||
230 | 230 | $view = $this->getView(); |
231 | 231 | $context = $this->getContext(); |
232 | 232 | |
233 | - $manager = \Aimeos\MShop::create( $context, 'coupon' ); |
|
233 | + $manager = \Aimeos\MShop::create($context, 'coupon'); |
|
234 | 234 | $manager->begin(); |
235 | 235 | |
236 | 236 | try |
237 | 237 | { |
238 | - $item = $this->fromArray( $view->param( 'item', [] ) ); |
|
239 | - $view->item = $item->getId() ? $item : $manager->saveItem( $item ); |
|
238 | + $item = $this->fromArray($view->param('item', [])); |
|
239 | + $view->item = $item->getId() ? $item : $manager->saveItem($item); |
|
240 | 240 | $view->itemBody = ''; |
241 | 241 | |
242 | - foreach( $this->getSubClients() as $client ) { |
|
242 | + foreach ($this->getSubClients() as $client) { |
|
243 | 243 | $view->itemBody .= $client->save(); |
244 | 244 | } |
245 | 245 | |
246 | - $manager->saveItem( clone $view->item ); |
|
246 | + $manager->saveItem(clone $view->item); |
|
247 | 247 | $manager->commit(); |
248 | 248 | |
249 | - $this->nextAction( $view, $view->param( 'next' ), 'coupon', $view->item->getId(), 'save' ); |
|
249 | + $this->nextAction($view, $view->param('next'), 'coupon', $view->item->getId(), 'save'); |
|
250 | 250 | return; |
251 | 251 | } |
252 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
252 | + catch (\Aimeos\Admin\JQAdm\Exception $e) |
|
253 | 253 | { |
254 | 254 | // fall through to create |
255 | 255 | } |
256 | - catch( \Aimeos\MShop\Exception $e ) |
|
256 | + catch (\Aimeos\MShop\Exception $e) |
|
257 | 257 | { |
258 | - $error = array( 'coupon-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
259 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
260 | - $this->logException( $e ); |
|
258 | + $error = array('coupon-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
259 | + $view->errors = $view->get('errors', []) + $error; |
|
260 | + $this->logException($e); |
|
261 | 261 | } |
262 | - catch( \Exception $e ) |
|
262 | + catch (\Exception $e) |
|
263 | 263 | { |
264 | - $error = array( 'coupon-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
265 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
266 | - $this->logException( $e ); |
|
264 | + $error = array('coupon-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
265 | + $view->errors = $view->get('errors', []) + $error; |
|
266 | + $this->logException($e); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | $manager->rollback(); |
@@ -285,31 +285,31 @@ discard block |
||
285 | 285 | try |
286 | 286 | { |
287 | 287 | $total = 0; |
288 | - $params = $this->storeSearchParams( $view->param(), 'coupon' ); |
|
289 | - $manager = \Aimeos\MShop::create( $context, 'coupon' ); |
|
290 | - $search = $this->initCriteria( $manager->createSearch(), $params ); |
|
288 | + $params = $this->storeSearchParams($view->param(), 'coupon'); |
|
289 | + $manager = \Aimeos\MShop::create($context, 'coupon'); |
|
290 | + $search = $this->initCriteria($manager->createSearch(), $params); |
|
291 | 291 | |
292 | - $view->items = $manager->searchItems( $search, [], $total ); |
|
293 | - $view->filterAttributes = $manager->getSearchAttributes( true ); |
|
292 | + $view->items = $manager->searchItems($search, [], $total); |
|
293 | + $view->filterAttributes = $manager->getSearchAttributes(true); |
|
294 | 294 | $view->filterOperators = $search->getOperators(); |
295 | 295 | $view->total = $total; |
296 | 296 | $view->itemBody = ''; |
297 | 297 | |
298 | - foreach( $this->getSubClients() as $client ) { |
|
298 | + foreach ($this->getSubClients() as $client) { |
|
299 | 299 | $view->itemBody .= $client->search(); |
300 | 300 | } |
301 | 301 | } |
302 | - catch( \Aimeos\MShop\Exception $e ) |
|
302 | + catch (\Aimeos\MShop\Exception $e) |
|
303 | 303 | { |
304 | - $error = array( 'coupon-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
305 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
306 | - $this->logException( $e ); |
|
304 | + $error = array('coupon-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
305 | + $view->errors = $view->get('errors', []) + $error; |
|
306 | + $this->logException($e); |
|
307 | 307 | } |
308 | - catch( \Exception $e ) |
|
308 | + catch (\Exception $e) |
|
309 | 309 | { |
310 | - $error = array( 'coupon-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
311 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
312 | - $this->logException( $e ); |
|
310 | + $error = array('coupon-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
311 | + $view->errors = $view->get('errors', []) + $error; |
|
312 | + $this->logException($e); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | /** admin/jqadm/coupon/template-list |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | $tplconf = 'admin/jqadm/coupon/template-list'; |
335 | 335 | $default = 'coupon/list-standard'; |
336 | 336 | |
337 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
337 | + return $view->render($view->config($tplconf, $default)); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | * @param string|null $name Name of the sub-client (Default if null) |
346 | 346 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
347 | 347 | */ |
348 | - public function getSubClient( $type, $name = null ) |
|
348 | + public function getSubClient($type, $name = null) |
|
349 | 349 | { |
350 | 350 | /** admin/jqadm/coupon/decorators/excludes |
351 | 351 | * Excludes decorators added by the "common" option from the coupon JQAdm client |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | * @see admin/jqadm/coupon/decorators/excludes |
421 | 421 | * @see admin/jqadm/coupon/decorators/global |
422 | 422 | */ |
423 | - return $this->createSubClient( 'coupon/' . $type, $name ); |
|
423 | + return $this->createSubClient('coupon/' . $type, $name); |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | |
@@ -430,13 +430,13 @@ discard block |
||
430 | 430 | * @param \Aimeos\MShop\Coupon\Item\Iface $item Coupon item incl. provider/decorator property |
431 | 431 | * @return \Aimeos\MW\Common\Critera\Attribute\Iface[] List of configuration attributes |
432 | 432 | */ |
433 | - public function getConfigAttributes( \Aimeos\MShop\Coupon\Item\Iface $item ) |
|
433 | + public function getConfigAttributes(\Aimeos\MShop\Coupon\Item\Iface $item) |
|
434 | 434 | { |
435 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'coupon' ); |
|
435 | + $manager = \Aimeos\MShop::create($this->getContext(), 'coupon'); |
|
436 | 436 | |
437 | 437 | try { |
438 | - return $manager->getProvider( $item, '' )->getConfigBE(); |
|
439 | - } catch( \Aimeos\MShop\Exception $e ) { |
|
438 | + return $manager->getProvider($item, '')->getConfigBE(); |
|
439 | + } catch (\Aimeos\MShop\Exception $e) { |
|
440 | 440 | return []; |
441 | 441 | } |
442 | 442 | } |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | * @since 2017.07 |
483 | 483 | * @category Developer |
484 | 484 | */ |
485 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/coupon/standard/subparts', [] ); |
|
485 | + return $this->getContext()->getConfig()->get('admin/jqadm/coupon/standard/subparts', []); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | protected function getDecoratorNames() |
495 | 495 | { |
496 | 496 | $ds = DIRECTORY_SEPARATOR; |
497 | - return $this->getClassNames( 'MShop' . $ds . 'Coupon' . $ds . 'Provider' . $ds . 'Decorator' ); |
|
497 | + return $this->getClassNames('MShop' . $ds . 'Coupon' . $ds . 'Provider' . $ds . 'Decorator'); |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | protected function getProviderNames() |
507 | 507 | { |
508 | 508 | $ds = DIRECTORY_SEPARATOR; |
509 | - return $this->getClassNames( 'MShop' . $ds . 'Coupon' . $ds . 'Provider' ); |
|
509 | + return $this->getClassNames('MShop' . $ds . 'Coupon' . $ds . 'Provider'); |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | |
@@ -516,17 +516,17 @@ discard block |
||
516 | 516 | * @param string[] Data array |
517 | 517 | * @return \Aimeos\MShop\Coupon\Item\Iface New coupon item object |
518 | 518 | */ |
519 | - protected function fromArray( array $data ) |
|
519 | + protected function fromArray(array $data) |
|
520 | 520 | { |
521 | 521 | $conf = []; |
522 | 522 | |
523 | - if( isset( $data['config']['key'] ) ) |
|
523 | + if (isset($data['config']['key'])) |
|
524 | 524 | { |
525 | - foreach( (array) $data['config']['key'] as $idx => $key ) |
|
525 | + foreach ((array) $data['config']['key'] as $idx => $key) |
|
526 | 526 | { |
527 | - if( trim( $key ) !== '' && isset( $data['config']['val'][$idx] ) ) |
|
527 | + if (trim($key) !== '' && isset($data['config']['val'][$idx])) |
|
528 | 528 | { |
529 | - if( ( $val = json_decode( $data['config']['val'][$idx] ) ) === null ) { |
|
529 | + if (($val = json_decode($data['config']['val'][$idx])) === null) { |
|
530 | 530 | $conf[$key] = $data['config']['val'][$idx]; |
531 | 531 | } else { |
532 | 532 | $conf[$key] = $val; |
@@ -535,16 +535,16 @@ discard block |
||
535 | 535 | } |
536 | 536 | } |
537 | 537 | |
538 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'coupon' ); |
|
538 | + $manager = \Aimeos\MShop::create($this->getContext(), 'coupon'); |
|
539 | 539 | |
540 | - if( isset( $data['coupon.id'] ) && $data['coupon.id'] != '' ) { |
|
541 | - $item = $manager->getItem( $data['coupon.id'] ); |
|
540 | + if (isset($data['coupon.id']) && $data['coupon.id'] != '') { |
|
541 | + $item = $manager->getItem($data['coupon.id']); |
|
542 | 542 | } else { |
543 | 543 | $item = $manager->createItem(); |
544 | 544 | } |
545 | 545 | |
546 | - $item->fromArray( $data ); |
|
547 | - $item->setConfig( $conf ); |
|
546 | + $item->fromArray($data); |
|
547 | + $item->setConfig($conf); |
|
548 | 548 | |
549 | 549 | return $item; |
550 | 550 | } |
@@ -556,21 +556,21 @@ discard block |
||
556 | 556 | * @param \Aimeos\MShop\Coupon\Item\Iface $item Coupon item object |
557 | 557 | * @return string[] Multi-dimensional associative list of item data |
558 | 558 | */ |
559 | - protected function toArray( \Aimeos\MShop\Coupon\Item\Iface $item, $copy = false ) |
|
559 | + protected function toArray(\Aimeos\MShop\Coupon\Item\Iface $item, $copy = false) |
|
560 | 560 | { |
561 | 561 | $config = $item->getConfig(); |
562 | - $data = $item->toArray( true ); |
|
562 | + $data = $item->toArray(true); |
|
563 | 563 | $data['config'] = []; |
564 | 564 | |
565 | - if( $copy === true ) |
|
565 | + if ($copy === true) |
|
566 | 566 | { |
567 | 567 | $data['coupon.siteid'] = $this->getContext()->getLocale()->getSiteId(); |
568 | 568 | $data['coupon.id'] = ''; |
569 | 569 | } |
570 | 570 | |
571 | - ksort( $config ); |
|
571 | + ksort($config); |
|
572 | 572 | |
573 | - foreach( $config as $key => $value ) |
|
573 | + foreach ($config as $key => $value) |
|
574 | 574 | { |
575 | 575 | $data['config']['key'][] = $key; |
576 | 576 | $data['config']['val'][] = $value; |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
587 | 587 | * @return string HTML output |
588 | 588 | */ |
589 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
589 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
590 | 590 | { |
591 | 591 | /** admin/jqadm/coupon/template-item |
592 | 592 | * Relative path to the HTML body template for the coupon item. |
@@ -610,6 +610,6 @@ discard block |
||
610 | 610 | $tplconf = 'admin/jqadm/coupon/template-item'; |
611 | 611 | $default = 'coupon/item-standard'; |
612 | 612 | |
613 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
613 | + return $view->render($view->config($tplconf, $default)); |
|
614 | 614 | } |
615 | 615 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Coupon\Code; |
12 | 12 | |
13 | -sprintf( 'code' ); // for translation |
|
13 | +sprintf('code'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function copy() |
44 | 44 | { |
45 | - return $this->render( $this->getView() ); |
|
45 | + return $this->render($this->getView()); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function create() |
55 | 55 | { |
56 | - return $this->render( $this->getView() ); |
|
56 | + return $this->render($this->getView()); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -69,31 +69,31 @@ discard block |
||
69 | 69 | try |
70 | 70 | { |
71 | 71 | $total = 0; |
72 | - $params = $this->storeSearchParams( $view->param( 'vc', [] ), 'couponcode' ); |
|
73 | - $codeItems = $this->getCodeItems( $view->item, $params, $total ); |
|
72 | + $params = $this->storeSearchParams($view->param('vc', []), 'couponcode'); |
|
73 | + $codeItems = $this->getCodeItems($view->item, $params, $total); |
|
74 | 74 | |
75 | - $view->codeData = $this->toArray( $codeItems ); |
|
75 | + $view->codeData = $this->toArray($codeItems); |
|
76 | 76 | $view->codeTotal = $total; |
77 | 77 | $view->codeBody = ''; |
78 | 78 | |
79 | - foreach( $this->getSubClients() as $client ) { |
|
79 | + foreach ($this->getSubClients() as $client) { |
|
80 | 80 | $view->codeBody .= $client->search(); |
81 | 81 | } |
82 | 82 | } |
83 | - catch( \Aimeos\MShop\Exception $e ) |
|
83 | + catch (\Aimeos\MShop\Exception $e) |
|
84 | 84 | { |
85 | - $error = array( 'coupon-item-code' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
86 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
87 | - $this->logException( $e ); |
|
85 | + $error = array('coupon-item-code' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
86 | + $view->errors = $view->get('errors', []) + $error; |
|
87 | + $this->logException($e); |
|
88 | 88 | } |
89 | - catch( \Exception $e ) |
|
89 | + catch (\Exception $e) |
|
90 | 90 | { |
91 | - $error = array( 'coupon-item-code' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
92 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
93 | - $this->logException( $e ); |
|
91 | + $error = array('coupon-item-code' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
92 | + $view->errors = $view->get('errors', []) + $error; |
|
93 | + $this->logException($e); |
|
94 | 94 | } |
95 | 95 | |
96 | - return $this->render( $view ); |
|
96 | + return $this->render($view); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -105,34 +105,34 @@ discard block |
||
105 | 105 | $view = $this->getView(); |
106 | 106 | $context = $this->getContext(); |
107 | 107 | |
108 | - $manager = \Aimeos\MShop::create( $context, 'coupon/code' ); |
|
108 | + $manager = \Aimeos\MShop::create($context, 'coupon/code'); |
|
109 | 109 | $manager->begin(); |
110 | 110 | |
111 | 111 | try |
112 | 112 | { |
113 | - $this->storeSearchParams( $view->param( 'vc', [] ), 'couponcode' ); |
|
114 | - $this->storeFile( $view->item, (array) $view->request()->getUploadedFiles() ); |
|
115 | - $this->fromArray( $view->item, $view->param( 'code', [] ) ); |
|
113 | + $this->storeSearchParams($view->param('vc', []), 'couponcode'); |
|
114 | + $this->storeFile($view->item, (array) $view->request()->getUploadedFiles()); |
|
115 | + $this->fromArray($view->item, $view->param('code', [])); |
|
116 | 116 | $view->couponBody = ''; |
117 | 117 | |
118 | - foreach( $this->getSubClients() as $client ) { |
|
118 | + foreach ($this->getSubClients() as $client) { |
|
119 | 119 | $view->couponBody .= $client->save(); |
120 | 120 | } |
121 | 121 | |
122 | 122 | $manager->commit(); |
123 | 123 | return; |
124 | 124 | } |
125 | - catch( \Aimeos\MShop\Exception $e ) |
|
125 | + catch (\Aimeos\MShop\Exception $e) |
|
126 | 126 | { |
127 | - $error = array( 'coupon-item-code' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
128 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
129 | - $this->logException( $e ); |
|
127 | + $error = array('coupon-item-code' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
128 | + $view->errors = $view->get('errors', []) + $error; |
|
129 | + $this->logException($e); |
|
130 | 130 | } |
131 | - catch( \Exception $e ) |
|
131 | + catch (\Exception $e) |
|
132 | 132 | { |
133 | - $error = array( 'coupon-item-code' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
134 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
135 | - $this->logException( $e ); |
|
133 | + $error = array('coupon-item-code' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
134 | + $view->errors = $view->get('errors', []) + $error; |
|
135 | + $this->logException($e); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | $manager->rollback(); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @param string|null $name Name of the sub-client (Default if null) |
149 | 149 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
150 | 150 | */ |
151 | - public function getSubClient( $type, $name = null ) |
|
151 | + public function getSubClient($type, $name = null) |
|
152 | 152 | { |
153 | 153 | /** admin/jqadm/coupon/code/decorators/excludes |
154 | 154 | * Excludes decorators added by the "common" option from the coupon JQAdm client |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | * @see admin/jqadm/coupon/code/decorators/excludes |
224 | 224 | * @see admin/jqadm/coupon/code/decorators/global |
225 | 225 | */ |
226 | - return $this->createSubClient( 'coupon/code/' . $type, $name ); |
|
226 | + return $this->createSubClient('coupon/code/' . $type, $name); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | |
@@ -233,27 +233,27 @@ discard block |
||
233 | 233 | * @param \Psr\Http\Message\UploadedFileInterface $file Uploaded file |
234 | 234 | * @throws \Aimeos\Admin\JQAdm\Exception If an error occured during upload |
235 | 235 | */ |
236 | - protected function checkFileUpload( \Psr\Http\Message\UploadedFileInterface $file ) |
|
236 | + protected function checkFileUpload(\Psr\Http\Message\UploadedFileInterface $file) |
|
237 | 237 | { |
238 | - if( $file->getError() !== UPLOAD_ERR_OK ) |
|
238 | + if ($file->getError() !== UPLOAD_ERR_OK) |
|
239 | 239 | { |
240 | - switch( $file->getError() ) |
|
240 | + switch ($file->getError()) |
|
241 | 241 | { |
242 | 242 | case UPLOAD_ERR_INI_SIZE: |
243 | 243 | case UPLOAD_ERR_FORM_SIZE: |
244 | - throw new \Aimeos\Admin\JQAdm\Exception( 'The uploaded file exceeds the max. allowed filesize' ); |
|
244 | + throw new \Aimeos\Admin\JQAdm\Exception('The uploaded file exceeds the max. allowed filesize'); |
|
245 | 245 | case UPLOAD_ERR_PARTIAL: |
246 | - throw new \Aimeos\Admin\JQAdm\Exception( 'The uploaded file was only partially uploaded' ); |
|
246 | + throw new \Aimeos\Admin\JQAdm\Exception('The uploaded file was only partially uploaded'); |
|
247 | 247 | case UPLOAD_ERR_NO_FILE: |
248 | - throw new \Aimeos\Admin\JQAdm\Exception( 'No file was uploaded' ); |
|
248 | + throw new \Aimeos\Admin\JQAdm\Exception('No file was uploaded'); |
|
249 | 249 | case UPLOAD_ERR_NO_TMP_DIR: |
250 | - throw new \Aimeos\Admin\JQAdm\Exception( 'Temporary folder is missing' ); |
|
250 | + throw new \Aimeos\Admin\JQAdm\Exception('Temporary folder is missing'); |
|
251 | 251 | case UPLOAD_ERR_CANT_WRITE: |
252 | - throw new \Aimeos\Admin\JQAdm\Exception( 'Failed to write file to disk' ); |
|
252 | + throw new \Aimeos\Admin\JQAdm\Exception('Failed to write file to disk'); |
|
253 | 253 | case UPLOAD_ERR_EXTENSION: |
254 | - throw new \Aimeos\Admin\JQAdm\Exception( 'File upload stopped by extension' ); |
|
254 | + throw new \Aimeos\Admin\JQAdm\Exception('File upload stopped by extension'); |
|
255 | 255 | default: |
256 | - throw new \Aimeos\Admin\JQAdm\Exception( 'Unknown upload error' ); |
|
256 | + throw new \Aimeos\Admin\JQAdm\Exception('Unknown upload error'); |
|
257 | 257 | } |
258 | 258 | } |
259 | 259 | } |
@@ -267,21 +267,21 @@ discard block |
||
267 | 267 | * @param integer $total Value/result parameter that will contain the item total afterwards |
268 | 268 | * @return \Aimeos\MShop\Coupon\Item\Code\Iface[] Coupon code items associated to the coupon item |
269 | 269 | */ |
270 | - protected function getCodeItems( \Aimeos\MShop\Coupon\Item\Iface $item, array $params = [], &$total ) |
|
270 | + protected function getCodeItems(\Aimeos\MShop\Coupon\Item\Iface $item, array $params = [], &$total) |
|
271 | 271 | { |
272 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'coupon/code' ); |
|
272 | + $manager = \Aimeos\MShop::create($this->getContext(), 'coupon/code'); |
|
273 | 273 | |
274 | 274 | $search = $manager->createSearch(); |
275 | - $search->setSortations( [$search->sort( '+', 'coupon.code.code' )] ); |
|
275 | + $search->setSortations([$search->sort('+', 'coupon.code.code')]); |
|
276 | 276 | |
277 | - $search = $this->initCriteria( $search, $params ); |
|
277 | + $search = $this->initCriteria($search, $params); |
|
278 | 278 | $expr = [ |
279 | - $search->compare( '==', 'coupon.code.parentid', $item->getId() ), |
|
279 | + $search->compare('==', 'coupon.code.parentid', $item->getId()), |
|
280 | 280 | $search->getConditions(), |
281 | 281 | ]; |
282 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
282 | + $search->setConditions($search->combine('&&', $expr)); |
|
283 | 283 | |
284 | - return $manager->searchItems( $search, [], $total ); |
|
284 | + return $manager->searchItems($search, [], $total); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | * @since 2017.07 |
326 | 326 | * @category Developer |
327 | 327 | */ |
328 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/coupon/code/standard/subparts', [] ); |
|
328 | + return $this->getContext()->getConfig()->get('admin/jqadm/coupon/code/standard/subparts', []); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | |
@@ -335,22 +335,22 @@ discard block |
||
335 | 335 | * @param \Aimeos\MShop\Coupon\Item\Iface $item Coupon item object |
336 | 336 | * @param string[] $data Data array |
337 | 337 | */ |
338 | - protected function fromArray( \Aimeos\MShop\Coupon\Item\Iface $item, array $data ) |
|
338 | + protected function fromArray(\Aimeos\MShop\Coupon\Item\Iface $item, array $data) |
|
339 | 339 | { |
340 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'coupon/code' ); |
|
340 | + $manager = \Aimeos\MShop::create($this->getContext(), 'coupon/code'); |
|
341 | 341 | |
342 | - foreach( $this->getValue( $data, 'coupon.code.id', [] ) as $idx => $id ) |
|
342 | + foreach ($this->getValue($data, 'coupon.code.id', []) as $idx => $id) |
|
343 | 343 | { |
344 | 344 | $citem = $manager->createItem(); |
345 | 345 | |
346 | - $citem->setId( $id ); |
|
347 | - $citem->setParentId( $item->getId() ); |
|
348 | - $citem->setCode( $this->getValue( $data, 'coupon.code.code/' . $idx ) ); |
|
349 | - $citem->setCount( $this->getValue( $data, 'coupon.code.count/' . $idx ) ); |
|
350 | - $citem->setDateStart( $this->getValue( $data, 'coupon.code.datestart/' . $idx ) ); |
|
351 | - $citem->setDateEnd( $this->getValue( $data, 'coupon.code.dateend/' . $idx ) ); |
|
346 | + $citem->setId($id); |
|
347 | + $citem->setParentId($item->getId()); |
|
348 | + $citem->setCode($this->getValue($data, 'coupon.code.code/' . $idx)); |
|
349 | + $citem->setCount($this->getValue($data, 'coupon.code.count/' . $idx)); |
|
350 | + $citem->setDateStart($this->getValue($data, 'coupon.code.datestart/' . $idx)); |
|
351 | + $citem->setDateEnd($this->getValue($data, 'coupon.code.dateend/' . $idx)); |
|
352 | 352 | |
353 | - $manager->saveItem( $citem, false ); |
|
353 | + $manager->saveItem($citem, false); |
|
354 | 354 | } |
355 | 355 | } |
356 | 356 | |
@@ -361,25 +361,25 @@ discard block |
||
361 | 361 | * @param \Aimeos\MShop\Coupon\Item\Iface $item Coupon item object |
362 | 362 | * @param array $files File upload array including the PSR-7 file upload objects |
363 | 363 | */ |
364 | - protected function storeFile( \Aimeos\MShop\Coupon\Item\Iface $item, array $files ) |
|
364 | + protected function storeFile(\Aimeos\MShop\Coupon\Item\Iface $item, array $files) |
|
365 | 365 | { |
366 | - $file = $this->getValue( $files, 'code/file' ); |
|
366 | + $file = $this->getValue($files, 'code/file'); |
|
367 | 367 | |
368 | - if( $file == null || $file->getError() === UPLOAD_ERR_NO_FILE ) { |
|
368 | + if ($file == null || $file->getError() === UPLOAD_ERR_NO_FILE) { |
|
369 | 369 | return; |
370 | 370 | } |
371 | 371 | |
372 | - $this->checkFileUpload( $file ); |
|
372 | + $this->checkFileUpload($file); |
|
373 | 373 | |
374 | 374 | $context = $this->getContext(); |
375 | - $fs = $context->getFilesystemManager()->get( 'fs-import' ); |
|
375 | + $fs = $context->getFilesystemManager()->get('fs-import'); |
|
376 | 376 | $dir = 'couponcode/' . $context->getLocale()->getSite()->getCode(); |
377 | 377 | |
378 | - if( $fs->isdir( $dir ) === false ) { |
|
379 | - $fs->mkdir( $dir ); |
|
378 | + if ($fs->isdir($dir) === false) { |
|
379 | + $fs->mkdir($dir); |
|
380 | 380 | } |
381 | 381 | |
382 | - $fs->writes( $dir . '/' . $item->getId() . '.csv', $file->getStream()->detach() ); |
|
382 | + $fs->writes($dir . '/' . $item->getId() . '.csv', $file->getStream()->detach()); |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | |
@@ -389,13 +389,13 @@ discard block |
||
389 | 389 | * @param \Aimeos\MShop\Coupon\Item\Code\Iface[] $items Coupon code items |
390 | 390 | * @return string[] Multi-dimensional associative list of item data |
391 | 391 | */ |
392 | - protected function toArray( array $items ) |
|
392 | + protected function toArray(array $items) |
|
393 | 393 | { |
394 | 394 | $data = []; |
395 | 395 | |
396 | - foreach( $items as $item ) |
|
396 | + foreach ($items as $item) |
|
397 | 397 | { |
398 | - foreach( $item->toArray( true ) as $key => $value ) { |
|
398 | + foreach ($item->toArray(true) as $key => $value) { |
|
399 | 399 | $data[$key][] = $value; |
400 | 400 | } |
401 | 401 | } |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
411 | 411 | * @return string HTML output |
412 | 412 | */ |
413 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
413 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
414 | 414 | { |
415 | 415 | /** admin/jqadm/coupon/code/template-item |
416 | 416 | * Relative path to the HTML body template of the code subpart for coupons. |
@@ -434,6 +434,6 @@ discard block |
||
434 | 434 | $tplconf = 'admin/jqadm/coupon/code/template-item'; |
435 | 435 | $default = 'coupon/item-code-standard'; |
436 | 436 | |
437 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
437 | + return $view->render($view->config($tplconf, $default)); |
|
438 | 438 | } |
439 | 439 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Type\Tag; |
12 | 12 | |
13 | -sprintf( 'type/tag' ); // for translation |
|
13 | +sprintf('type/tag'); // 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, 'tag/type' ); |
|
43 | - $view->item = $manager->getItem( $id ); |
|
42 | + $manager = \Aimeos\MShop::create($context, 'tag/type'); |
|
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( 'type-tag-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
58 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
59 | - $this->logException( $e ); |
|
57 | + $error = array('type-tag-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( 'type-tag-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
64 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
65 | - $this->logException( $e ); |
|
63 | + $error = array('type-tag-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, 'tag/type' )->createItem(); |
|
86 | + if (!isset($view->item)) { |
|
87 | + $view->item = \Aimeos\MShop::create($context, 'tag/type')->createItem(); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | $data['tag.type.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( 'type-tag-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
105 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
106 | - $this->logException( $e ); |
|
104 | + $error = array('type-tag-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( 'type-tag-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
111 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
112 | - $this->logException( $e ); |
|
110 | + $error = array('type-tag-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, 'tag/type' ); |
|
129 | + $manager = \Aimeos\MShop::create($context, 'tag/type'); |
|
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', 'type/tag', null, 'delete' ); |
|
147 | + $this->nextAction($view, 'search', 'type/tag', null, 'delete'); |
|
148 | 148 | return; |
149 | 149 | } |
150 | - catch( \Aimeos\MShop\Exception $e ) |
|
150 | + catch (\Aimeos\MShop\Exception $e) |
|
151 | 151 | { |
152 | - $error = array( 'type-tag-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
153 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
154 | - $this->logException( $e ); |
|
152 | + $error = array('type-tag-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( 'type-tag-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
159 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
160 | - $this->logException( $e ); |
|
158 | + $error = array('type-tag-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, 'tag/type' ); |
|
185 | + $manager = \Aimeos\MShop::create($context, 'tag/type'); |
|
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( 'type-tag-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
201 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
202 | - $this->logException( $e ); |
|
200 | + $error = array('type-tag-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( 'type-tag-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
207 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
208 | - $this->logException( $e ); |
|
206 | + $error = array('type-tag-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, 'tag/type' ); |
|
225 | + $manager = \Aimeos\MShop::create($context, 'tag/type'); |
|
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' ), 'type/tag', $view->item->getId(), 'save' ); |
|
241 | + $this->nextAction($view, $view->param('next'), 'type/tag', $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( 'type-tag-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
251 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
252 | - $this->logException( $e ); |
|
250 | + $error = array('type-tag-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( 'type-tag-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
257 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
258 | - $this->logException( $e ); |
|
256 | + $error = array('type-tag-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(), 'type/tag' ); |
|
281 | - $manager = \Aimeos\MShop::create( $context, 'tag/type' ); |
|
282 | - $search = $this->initCriteria( $manager->createSearch(), $params ); |
|
280 | + $params = $this->storeSearchParams($view->param(), 'type/tag'); |
|
281 | + $manager = \Aimeos\MShop::create($context, 'tag/type'); |
|
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( 'type-tag-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
297 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
298 | - $this->logException( $e ); |
|
296 | + $error = array('type-tag-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( 'type-tag-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
303 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
304 | - $this->logException( $e ); |
|
302 | + $error = array('type-tag-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/type/tag/template-list |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | $tplconf = 'admin/jqadm/type/tag/template-list'; |
327 | 327 | $default = 'type/tag/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/type/tag/decorators/excludes |
343 | 343 | * Excludes decorators added by the "common" option from the type JQAdm client |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * @see admin/jqadm/type/tag/decorators/excludes |
413 | 413 | * @see admin/jqadm/type/tag/decorators/global |
414 | 414 | */ |
415 | - return $this->createSubClient( 'type/tag' . $type, $name ); |
|
415 | + return $this->createSubClient('type/tag' . $type, $name); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | * @since 2017.10 |
457 | 457 | * @category Developer |
458 | 458 | */ |
459 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/type/tag/standard/subparts', [] ); |
|
459 | + return $this->getContext()->getConfig()->get('admin/jqadm/type/tag/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\Common\Item\Type\Iface New type 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(), 'tag/type' ); |
|
472 | + $manager = \Aimeos\MShop::create($this->getContext(), 'tag/type'); |
|
473 | 473 | |
474 | - if( isset( $data['tag.type.id'] ) && $data['tag.type.id'] != '' ) { |
|
475 | - $item = $manager->getItem( $data['tag.type.id'] ); |
|
474 | + if (isset($data['tag.type.id']) && $data['tag.type.id'] != '') { |
|
475 | + $item = $manager->getItem($data['tag.type.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\Common\Item\Type\Iface $item Type item object |
490 | 490 | * @return string[] Multi-dimensional associative list of item data |
491 | 491 | */ |
492 | - protected function toArray( \Aimeos\MShop\Common\Item\Type\Iface $item, $copy = false ) |
|
492 | + protected function toArray(\Aimeos\MShop\Common\Item\Type\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['tag.type.code'] = $data['tag.type.code'] . '_copy'; |
499 | 499 | $data['tag.type.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/type/tag/template-item |
515 | 515 | * Relative path to the HTML body template for the type item. |
@@ -533,6 +533,6 @@ discard block |
||
533 | 533 | $tplconf = 'admin/jqadm/type/tag/template-item'; |
534 | 534 | $default = 'type/tag/item-standard'; |
535 | 535 | |
536 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
536 | + return $view->render($view->config($tplconf, $default)); |
|
537 | 537 | } |
538 | 538 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Type\Media\Lists; |
12 | 12 | |
13 | -sprintf( 'type/media/lists' ); // for translation |
|
13 | +sprintf('type/media/lists'); // 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, 'media/lists/type' ); |
|
43 | - $view->item = $manager->getItem( $id ); |
|
42 | + $manager = \Aimeos\MShop::create($context, 'media/lists/type'); |
|
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( 'type-media-lists-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
58 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
59 | - $this->logException( $e ); |
|
57 | + $error = array('type-media-lists-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( 'type-media-lists-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
64 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
65 | - $this->logException( $e ); |
|
63 | + $error = array('type-media-lists-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, 'media/lists/type' )->createItem(); |
|
86 | + if (!isset($view->item)) { |
|
87 | + $view->item = \Aimeos\MShop::create($context, 'media/lists/type')->createItem(); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | $data['media.lists.type.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( 'type-media-lists-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
105 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
106 | - $this->logException( $e ); |
|
104 | + $error = array('type-media-lists-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( 'type-media-lists-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
111 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
112 | - $this->logException( $e ); |
|
110 | + $error = array('type-media-lists-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, 'media/lists/type' ); |
|
129 | + $manager = \Aimeos\MShop::create($context, 'media/lists/type'); |
|
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', 'type/media/lists', null, 'delete' ); |
|
147 | + $this->nextAction($view, 'search', 'type/media/lists', null, 'delete'); |
|
148 | 148 | return; |
149 | 149 | } |
150 | - catch( \Aimeos\MShop\Exception $e ) |
|
150 | + catch (\Aimeos\MShop\Exception $e) |
|
151 | 151 | { |
152 | - $error = array( 'type-media-lists-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
153 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
154 | - $this->logException( $e ); |
|
152 | + $error = array('type-media-lists-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( 'type-media-lists-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
159 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
160 | - $this->logException( $e ); |
|
158 | + $error = array('type-media-lists-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, 'media/lists/type' ); |
|
185 | + $manager = \Aimeos\MShop::create($context, 'media/lists/type'); |
|
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( 'type-media-lists-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
201 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
202 | - $this->logException( $e ); |
|
200 | + $error = array('type-media-lists-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( 'type-media-lists-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
207 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
208 | - $this->logException( $e ); |
|
206 | + $error = array('type-media-lists-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, 'media/lists/type' ); |
|
225 | + $manager = \Aimeos\MShop::create($context, 'media/lists/type'); |
|
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' ), 'type/media/lists', $view->item->getId(), 'save' ); |
|
241 | + $this->nextAction($view, $view->param('next'), 'type/media/lists', $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( 'type-media-lists-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
251 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
252 | - $this->logException( $e ); |
|
250 | + $error = array('type-media-lists-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( 'type-media-lists-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
257 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
258 | - $this->logException( $e ); |
|
256 | + $error = array('type-media-lists-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(), 'type/media/lists' ); |
|
281 | - $manager = \Aimeos\MShop::create( $context, 'media/lists/type' ); |
|
282 | - $search = $this->initCriteria( $manager->createSearch(), $params ); |
|
280 | + $params = $this->storeSearchParams($view->param(), 'type/media/lists'); |
|
281 | + $manager = \Aimeos\MShop::create($context, 'media/lists/type'); |
|
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( 'type-media-lists-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
297 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
298 | - $this->logException( $e ); |
|
296 | + $error = array('type-media-lists-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( 'type-media-lists-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
303 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
304 | - $this->logException( $e ); |
|
302 | + $error = array('type-media-lists-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/type/media/lists/template-list |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | $tplconf = 'admin/jqadm/type/media/lists/template-list'; |
327 | 327 | $default = 'type/media/lists/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( $liststype, $name = null ) |
|
340 | + public function getSubClient($liststype, $name = null) |
|
341 | 341 | { |
342 | 342 | /** admin/jqadm/type/media/lists/decorators/excludes |
343 | 343 | * Excludes decorators added by the "common" option from the list type JQAdm client |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * @see admin/jqadm/type/media/lists/decorators/excludes |
413 | 413 | * @see admin/jqadm/type/media/lists/decorators/global |
414 | 414 | */ |
415 | - return $this->createSubClient( 'type/media/lists' . $liststype, $name ); |
|
415 | + return $this->createSubClient('type/media/lists' . $liststype, $name); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | * @since 2017.10 |
457 | 457 | * @category Developer |
458 | 458 | */ |
459 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/type/media/lists/standard/subparts', [] ); |
|
459 | + return $this->getContext()->getConfig()->get('admin/jqadm/type/media/lists/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\Common\Item\Type\Iface New list type 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(), 'media/lists/type' ); |
|
472 | + $manager = \Aimeos\MShop::create($this->getContext(), 'media/lists/type'); |
|
473 | 473 | |
474 | - if( isset( $data['media.lists.type.id'] ) && $data['media.lists.type.id'] != '' ) { |
|
475 | - $item = $manager->getItem( $data['media.lists.type.id'] ); |
|
474 | + if (isset($data['media.lists.type.id']) && $data['media.lists.type.id'] != '') { |
|
475 | + $item = $manager->getItem($data['media.lists.type.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\Common\Item\Type\Iface $item Type item object |
490 | 490 | * @return string[] Multi-dimensional associative list of item data |
491 | 491 | */ |
492 | - protected function toArray( \Aimeos\MShop\Common\Item\Type\Iface $item, $copy = false ) |
|
492 | + protected function toArray(\Aimeos\MShop\Common\Item\Type\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['media.lists.type.code'] = $data['media.lists.type.code'] . '_copy'; |
499 | 499 | $data['media.lists.type.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/type/media/lists/template-item |
515 | 515 | * Relative path to the HTML body template for the list type item. |
@@ -533,6 +533,6 @@ discard block |
||
533 | 533 | $tplconf = 'admin/jqadm/type/media/lists/template-item'; |
534 | 534 | $default = 'type/media/lists/item-standard'; |
535 | 535 | |
536 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
536 | + return $view->render($view->config($tplconf, $default)); |
|
537 | 537 | } |
538 | 538 | } |