@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Product\Special\Price; |
12 | 12 | |
13 | -sprintf( 'special' ); // for translation |
|
13 | +sprintf('special'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | { |
45 | 45 | $view = $this->getView(); |
46 | 46 | |
47 | - $view->specialpriceData = $this->toArray( $view->item, true ); |
|
47 | + $view->specialpriceData = $this->toArray($view->item, true); |
|
48 | 48 | $view->specialpriceBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->specialpriceBody .= $client->copy(); |
52 | 52 | } |
53 | 53 | |
54 | - return $this->render( $view ); |
|
54 | + return $this->render($view); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -64,20 +64,20 @@ discard block |
||
64 | 64 | { |
65 | 65 | $view = $this->getView(); |
66 | 66 | $siteid = $this->getContext()->getLocale()->getSiteId(); |
67 | - $data = $view->param( 'specialprice', [] ); |
|
67 | + $data = $view->param('specialprice', []); |
|
68 | 68 | |
69 | - foreach( $view->value( $data, 'product.lists.id', [] ) as $idx => $value ) { |
|
69 | + foreach ($view->value($data, 'product.lists.id', []) as $idx => $value) { |
|
70 | 70 | $data['product.lists.siteid'][$idx] = $siteid; |
71 | 71 | } |
72 | 72 | |
73 | 73 | $view->specialpriceData = $data; |
74 | 74 | $view->specialpriceBody = ''; |
75 | 75 | |
76 | - foreach( $this->getSubClients() as $client ) { |
|
76 | + foreach ($this->getSubClients() as $client) { |
|
77 | 77 | $view->specialpriceBody .= $client->create(); |
78 | 78 | } |
79 | 79 | |
80 | - return $this->render( $view ); |
|
80 | + return $this->render($view); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | { |
91 | 91 | $view = $this->getView(); |
92 | 92 | |
93 | - $view->specialpriceData = $this->toArray( $view->item ); |
|
93 | + $view->specialpriceData = $this->toArray($view->item); |
|
94 | 94 | $view->specialpriceBody = ''; |
95 | 95 | |
96 | - foreach( $this->getSubClients() as $client ) { |
|
96 | + foreach ($this->getSubClients() as $client) { |
|
97 | 97 | $view->specialpriceBody .= $client->get(); |
98 | 98 | } |
99 | 99 | |
100 | - return $this->render( $view ); |
|
100 | + return $this->render($view); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | { |
109 | 109 | $view = $this->getView(); |
110 | 110 | |
111 | - $this->fromArray( $view->item, $view->param( 'specialprice', [] ) ); |
|
111 | + $this->fromArray($view->item, $view->param('specialprice', [])); |
|
112 | 112 | $view->specialpriceBody = ''; |
113 | 113 | |
114 | - foreach( $this->getSubClients() as $client ) { |
|
114 | + foreach ($this->getSubClients() as $client) { |
|
115 | 115 | $view->specialpriceBody .= $client->save(); |
116 | 116 | } |
117 | 117 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @param string|null $name Name of the sub-client (Default if null) |
125 | 125 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
126 | 126 | */ |
127 | - public function getSubClient( $type, $name = null ) |
|
127 | + public function getSubClient($type, $name = null) |
|
128 | 128 | { |
129 | 129 | /** admin/jqadm/product/special/price/decorators/excludes |
130 | 130 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * @see admin/jqadm/product/special/price/decorators/excludes |
200 | 200 | * @see admin/jqadm/product/special/price/decorators/global |
201 | 201 | */ |
202 | - return $this->createSubClient( 'product/special/price/' . $type, $name ); |
|
202 | + return $this->createSubClient('product/special/price/' . $type, $name); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * @since 2016.03 |
244 | 244 | * @category Developer |
245 | 245 | */ |
246 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/product/special/price/standard/subparts', [] ); |
|
246 | + return $this->getContext()->getConfig()->get('admin/jqadm/product/special/price/standard/subparts', []); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | |
@@ -253,28 +253,28 @@ discard block |
||
253 | 253 | * @param \Aimeos\MShop\Product\Item\Iface $item Product item object without referenced domain items |
254 | 254 | * @param string[] $data Data array |
255 | 255 | */ |
256 | - protected function fromArray( \Aimeos\MShop\Product\Item\Iface $item, array $data ) |
|
256 | + protected function fromArray(\Aimeos\MShop\Product\Item\Iface $item, array $data) |
|
257 | 257 | { |
258 | 258 | $context = $this->getContext(); |
259 | 259 | |
260 | - $attrManager = \Aimeos\MShop::create( $context, 'attribute' ); |
|
261 | - $listManager = \Aimeos\MShop::create( $context, 'product/lists' ); |
|
262 | - $typeManager = \Aimeos\MShop::create( $context, 'product/lists/type' ); |
|
260 | + $attrManager = \Aimeos\MShop::create($context, 'attribute'); |
|
261 | + $listManager = \Aimeos\MShop::create($context, 'product/lists'); |
|
262 | + $typeManager = \Aimeos\MShop::create($context, 'product/lists/type'); |
|
263 | 263 | |
264 | - $attrId = $attrManager->findItem( 'custom', [], 'product', 'price' )->getId(); |
|
264 | + $attrId = $attrManager->findItem('custom', [], 'product', 'price')->getId(); |
|
265 | 265 | |
266 | - if( $this->getValue( $data, 'custom', 0 ) == 1 ) |
|
266 | + if ($this->getValue($data, 'custom', 0) == 1) |
|
267 | 267 | { |
268 | - if( $item->getListItem( 'attribute', 'custom', $attrId, false ) === null ) |
|
268 | + if ($item->getListItem('attribute', 'custom', $attrId, false) === null) |
|
269 | 269 | { |
270 | - $listItem = $listManager->createItem()->setType( 'custom' )->setRefId( $attrId ); |
|
271 | - $item->addListItem( 'attribute', $listItem, $listItem->getRefItem() ); |
|
270 | + $listItem = $listManager->createItem()->setType('custom')->setRefId($attrId); |
|
271 | + $item->addListItem('attribute', $listItem, $listItem->getRefItem()); |
|
272 | 272 | } |
273 | 273 | } |
274 | 274 | else |
275 | 275 | { |
276 | - if( ( $litem = $item->getListItem( 'attribute', 'custom', $attrId, false ) ) !== null ) { |
|
277 | - $item->deleteListItem( 'attribute', $litem ); |
|
276 | + if (($litem = $item->getListItem('attribute', 'custom', $attrId, false)) !== null) { |
|
277 | + $item->deleteListItem('attribute', $litem); |
|
278 | 278 | } |
279 | 279 | } |
280 | 280 | } |
@@ -287,13 +287,13 @@ discard block |
||
287 | 287 | * @param boolean $copy True if items should be copied, false if not |
288 | 288 | * @return string[] Multi-dimensional associative list of item data |
289 | 289 | */ |
290 | - protected function toArray( \Aimeos\MShop\Product\Item\Iface $item, $copy = false ) |
|
290 | + protected function toArray(\Aimeos\MShop\Product\Item\Iface $item, $copy = false) |
|
291 | 291 | { |
292 | 292 | $data = []; |
293 | 293 | |
294 | - foreach( $item->getListItems( 'attribute', 'custom', null, false ) as $listItem ) |
|
294 | + foreach ($item->getListItems('attribute', 'custom', null, false) as $listItem) |
|
295 | 295 | { |
296 | - if( ( $refItem = $listItem->getRefItem() ) !== null && $refItem->getType() === 'price' ) { |
|
296 | + if (($refItem = $listItem->getRefItem()) !== null && $refItem->getType() === 'price') { |
|
297 | 297 | $data['custom'] = 1; |
298 | 298 | } |
299 | 299 | } |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
309 | 309 | * @return string HTML output |
310 | 310 | */ |
311 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
311 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
312 | 312 | { |
313 | 313 | /** admin/jqadm/product/special/price/template-item |
314 | 314 | * Relative path to the HTML body template of the special subpart for products. |
@@ -332,6 +332,6 @@ discard block |
||
332 | 332 | $tplconf = 'admin/jqadm/product/special/price/template-item'; |
333 | 333 | $default = 'product/item-special-price-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 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Product\Bundle; |
12 | 12 | |
13 | -sprintf( 'bundle' ); // for translation |
|
13 | +sprintf('bundle'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | { |
45 | 45 | $view = $this->getView(); |
46 | 46 | |
47 | - $view->bundleData = $this->toArray( $view->item, true ); |
|
47 | + $view->bundleData = $this->toArray($view->item, true); |
|
48 | 48 | $view->bundleBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->bundleBody .= $client->copy(); |
52 | 52 | } |
53 | 53 | |
54 | - return $this->render( $view ); |
|
54 | + return $this->render($view); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -63,21 +63,21 @@ discard block |
||
63 | 63 | public function create() |
64 | 64 | { |
65 | 65 | $view = $this->getView(); |
66 | - $data = $view->param( 'bundle', [] ); |
|
66 | + $data = $view->param('bundle', []); |
|
67 | 67 | $siteid = $this->getContext()->getLocale()->getSiteId(); |
68 | 68 | |
69 | - foreach( $view->value( $data, 'product.lists.id', [] ) as $idx => $value ) { |
|
69 | + foreach ($view->value($data, 'product.lists.id', []) as $idx => $value) { |
|
70 | 70 | $data['product.lists.siteid'][$idx] = $siteid; |
71 | 71 | } |
72 | 72 | |
73 | 73 | $view->bundleData = $data; |
74 | 74 | $view->bundleBody = ''; |
75 | 75 | |
76 | - foreach( $this->getSubClients() as $client ) { |
|
76 | + foreach ($this->getSubClients() as $client) { |
|
77 | 77 | $view->bundleBody .= $client->create(); |
78 | 78 | } |
79 | 79 | |
80 | - return $this->render( $view ); |
|
80 | + return $this->render($view); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | { |
91 | 91 | $view = $this->getView(); |
92 | 92 | |
93 | - $view->bundleData = $this->toArray( $view->item ); |
|
93 | + $view->bundleData = $this->toArray($view->item); |
|
94 | 94 | $view->bundleBody = ''; |
95 | 95 | |
96 | - foreach( $this->getSubClients() as $client ) { |
|
96 | + foreach ($this->getSubClients() as $client) { |
|
97 | 97 | $view->bundleBody .= $client->get(); |
98 | 98 | } |
99 | 99 | |
100 | - return $this->render( $view ); |
|
100 | + return $this->render($view); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | |
@@ -110,29 +110,29 @@ discard block |
||
110 | 110 | |
111 | 111 | try |
112 | 112 | { |
113 | - if( $view->item->getType() === 'bundle' ) |
|
113 | + if ($view->item->getType() === 'bundle') |
|
114 | 114 | { |
115 | - $this->fromArray( $view->item, $view->param( 'bundle', [] ) ); |
|
115 | + $this->fromArray($view->item, $view->param('bundle', [])); |
|
116 | 116 | $view->bundleBody = ''; |
117 | 117 | |
118 | - foreach( $this->getSubClients() as $client ) { |
|
118 | + foreach ($this->getSubClients() as $client) { |
|
119 | 119 | $view->bundleBody .= $client->save(); |
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
123 | 123 | return; |
124 | 124 | } |
125 | - catch( \Aimeos\MShop\Exception $e ) |
|
125 | + catch (\Aimeos\MShop\Exception $e) |
|
126 | 126 | { |
127 | - $error = array( 'product-item-bundle' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
128 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
129 | - $this->logException( $e ); |
|
127 | + $error = array('product-item-bundle' => $this->getContext()->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( 'product-item-bundle' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
134 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
135 | - $this->logException( $e ); |
|
133 | + $error = array('product-item-bundle' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
134 | + $view->errors = $view->get('errors', []) + $error; |
|
135 | + $this->logException($e); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | throw new \Aimeos\Admin\JQAdm\Exception(); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param string|null $name Name of the sub-client (Default if null) |
147 | 147 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
148 | 148 | */ |
149 | - public function getSubClient( $type, $name = null ) |
|
149 | + public function getSubClient($type, $name = null) |
|
150 | 150 | { |
151 | 151 | /** admin/jqadm/product/bundle/decorators/excludes |
152 | 152 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @see admin/jqadm/product/bundle/decorators/excludes |
222 | 222 | * @see admin/jqadm/product/bundle/decorators/global |
223 | 223 | */ |
224 | - return $this->createSubClient( 'product/bundle/' . $type, $name ); |
|
224 | + return $this->createSubClient('product/bundle/' . $type, $name); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | * @since 2016.01 |
266 | 266 | * @category Developer |
267 | 267 | */ |
268 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/product/bundle/standard/subparts', [] ); |
|
268 | + return $this->getContext()->getConfig()->get('admin/jqadm/product/bundle/standard/subparts', []); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | |
@@ -275,31 +275,31 @@ discard block |
||
275 | 275 | * @param \Aimeos\MShop\Product\Item\Iface $item Product item object without referenced domain items |
276 | 276 | * @param string[] $data Data array |
277 | 277 | */ |
278 | - protected function fromArray( \Aimeos\MShop\Product\Item\Iface $item, array $data ) |
|
278 | + protected function fromArray(\Aimeos\MShop\Product\Item\Iface $item, array $data) |
|
279 | 279 | { |
280 | - $listManager = \Aimeos\MShop::create( $this->getContext(), 'product/lists' ); |
|
280 | + $listManager = \Aimeos\MShop::create($this->getContext(), 'product/lists'); |
|
281 | 281 | |
282 | - $listItem = $listManager->createItem()->setType( 'default' ); |
|
283 | - $listItems = $item->getListItems( 'product', 'default', null, false ); |
|
282 | + $listItem = $listManager->createItem()->setType('default'); |
|
283 | + $listItems = $item->getListItems('product', 'default', null, false); |
|
284 | 284 | |
285 | - foreach( $this->getValue( $data, 'product.lists.id', [] ) as $idx => $id ) |
|
285 | + foreach ($this->getValue($data, 'product.lists.id', []) as $idx => $id) |
|
286 | 286 | { |
287 | - if( isset( $listItems[$id] ) ) { |
|
287 | + if (isset($listItems[$id])) { |
|
288 | 288 | $litem = $listItems[$id]; |
289 | 289 | } else { |
290 | 290 | $litem = clone $listItem; |
291 | 291 | } |
292 | 292 | |
293 | - $litem->setId( $id ); |
|
294 | - $litem->setPosition( $idx ); |
|
295 | - $litem->setRefId( $this->getValue( $data, 'product.lists.refid/' . $idx ) ); |
|
293 | + $litem->setId($id); |
|
294 | + $litem->setPosition($idx); |
|
295 | + $litem->setRefId($this->getValue($data, 'product.lists.refid/' . $idx)); |
|
296 | 296 | |
297 | - $item->addListItem( 'product', $litem, $litem->getRefItem() ); |
|
297 | + $item->addListItem('product', $litem, $litem->getRefItem()); |
|
298 | 298 | |
299 | - unset( $listItems[$litem->getId()] ); |
|
299 | + unset($listItems[$litem->getId()]); |
|
300 | 300 | } |
301 | 301 | |
302 | - return $item->deleteListItems( $listItems ); |
|
302 | + return $item->deleteListItems($listItems); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | |
@@ -310,30 +310,30 @@ discard block |
||
310 | 310 | * @param boolean $copy True if items should be copied, false if not |
311 | 311 | * @return string[] Multi-dimensional associative list of item data |
312 | 312 | */ |
313 | - protected function toArray( \Aimeos\MShop\Product\Item\Iface $item, $copy = false ) |
|
313 | + protected function toArray(\Aimeos\MShop\Product\Item\Iface $item, $copy = false) |
|
314 | 314 | { |
315 | - if( $item->getType() !== 'bundle' ) { |
|
315 | + if ($item->getType() !== 'bundle') { |
|
316 | 316 | return []; |
317 | 317 | } |
318 | 318 | |
319 | 319 | $data = []; |
320 | 320 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
321 | 321 | |
322 | - foreach( $item->getListItems( 'product', 'default', null, false ) as $listItem ) |
|
322 | + foreach ($item->getListItems('product', 'default', null, false) as $listItem) |
|
323 | 323 | { |
324 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
324 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
325 | 325 | continue; |
326 | 326 | } |
327 | 327 | |
328 | - $list = $listItem->toArray( true ) + $refItem->toArray( true ); |
|
328 | + $list = $listItem->toArray(true) + $refItem->toArray(true); |
|
329 | 329 | |
330 | - if( $copy === true ) |
|
330 | + if ($copy === true) |
|
331 | 331 | { |
332 | 332 | $list['product.lists.siteid'] = $siteId; |
333 | 333 | $list['product.lists.id'] = ''; |
334 | 334 | } |
335 | 335 | |
336 | - foreach( $list as $key => $value ) { |
|
336 | + foreach ($list as $key => $value) { |
|
337 | 337 | $data[$key][] = $value; |
338 | 338 | } |
339 | 339 | } |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
349 | 349 | * @return string HTML output |
350 | 350 | */ |
351 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
351 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
352 | 352 | { |
353 | 353 | /** admin/jqadm/product/bundle/template-item |
354 | 354 | * Relative path to the HTML body template of the bundle subpart for products. |
@@ -372,6 +372,6 @@ discard block |
||
372 | 372 | $tplconf = 'admin/jqadm/product/bundle/template-item'; |
373 | 373 | $default = 'product/item-bundle-standard'; |
374 | 374 | |
375 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
375 | + return $view->render($view->config($tplconf, $default)); |
|
376 | 376 | } |
377 | 377 | } |
378 | 378 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Product\Selection; |
12 | 12 | |
13 | -sprintf( 'selection' ); // for translation |
|
13 | +sprintf('selection'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | { |
45 | 45 | $view = $this->getView(); |
46 | 46 | |
47 | - $view->selectionData = $this->toArray( $view->item, true ); |
|
47 | + $view->selectionData = $this->toArray($view->item, true); |
|
48 | 48 | $view->selectionBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->selectionBody .= $client->copy(); |
52 | 52 | } |
53 | 53 | |
54 | - return $this->render( $view ); |
|
54 | + return $this->render($view); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | { |
65 | 65 | $view = $this->getView(); |
66 | 66 | $siteid = $this->getContext()->getLocale()->getSiteId(); |
67 | - $data = $view->param( 'selection', [] ); |
|
67 | + $data = $view->param('selection', []); |
|
68 | 68 | |
69 | - foreach( $data as $idx => $entry ) |
|
69 | + foreach ($data as $idx => $entry) |
|
70 | 70 | { |
71 | 71 | $data[$idx]['product.lists.siteid'] = $siteid; |
72 | 72 | $data[$idx]['product.siteid'] = $siteid; |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | $view->selectionData = $data; |
76 | 76 | $view->selectionBody = ''; |
77 | 77 | |
78 | - foreach( $this->getSubClients() as $client ) { |
|
78 | + foreach ($this->getSubClients() as $client) { |
|
79 | 79 | $view->selectionBody .= $client->create(); |
80 | 80 | } |
81 | 81 | |
82 | - return $this->render( $view ); |
|
82 | + return $this->render($view); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | parent::delete(); |
92 | 92 | |
93 | 93 | $item = $this->getView()->item; |
94 | - $item->deleteListItems( $item->getListItems( 'product', 'default', null, false ) ); |
|
94 | + $item->deleteListItems($item->getListItems('product', 'default', null, false)); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
@@ -104,14 +104,14 @@ discard block |
||
104 | 104 | { |
105 | 105 | $view = $this->getView(); |
106 | 106 | |
107 | - $view->selectionData = $this->toArray( $view->item ); |
|
107 | + $view->selectionData = $this->toArray($view->item); |
|
108 | 108 | $view->selectionBody = ''; |
109 | 109 | |
110 | - foreach( $this->getSubClients() as $client ) { |
|
110 | + foreach ($this->getSubClients() as $client) { |
|
111 | 111 | $view->selectionBody .= $client->get(); |
112 | 112 | } |
113 | 113 | |
114 | - return $this->render( $view ); |
|
114 | + return $this->render($view); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -124,29 +124,29 @@ discard block |
||
124 | 124 | |
125 | 125 | try |
126 | 126 | { |
127 | - if( $view->item->getType() === 'select' ) |
|
127 | + if ($view->item->getType() === 'select') |
|
128 | 128 | { |
129 | - $this->fromArray( $view->item, $view->param( 'selection', [] ) ); |
|
129 | + $this->fromArray($view->item, $view->param('selection', [])); |
|
130 | 130 | $view->selectionBody = ''; |
131 | 131 | |
132 | - foreach( $this->getSubClients() as $client ) { |
|
132 | + foreach ($this->getSubClients() as $client) { |
|
133 | 133 | $view->selectionBody .= $client->save(); |
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | 137 | return; |
138 | 138 | } |
139 | - catch( \Aimeos\MShop\Exception $e ) |
|
139 | + catch (\Aimeos\MShop\Exception $e) |
|
140 | 140 | { |
141 | - $error = array( 'product-item-selection' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
142 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
143 | - $this->logException( $e ); |
|
141 | + $error = array('product-item-selection' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
142 | + $view->errors = $view->get('errors', []) + $error; |
|
143 | + $this->logException($e); |
|
144 | 144 | } |
145 | - catch( \Exception $e ) |
|
145 | + catch (\Exception $e) |
|
146 | 146 | { |
147 | - $error = array( 'product-item-selection' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
148 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
149 | - $this->logException( $e ); |
|
147 | + $error = array('product-item-selection' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
148 | + $view->errors = $view->get('errors', []) + $error; |
|
149 | + $this->logException($e); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | throw new \Aimeos\Admin\JQAdm\Exception(); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @param string|null $name Name of the sub-client (Default if null) |
161 | 161 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
162 | 162 | */ |
163 | - public function getSubClient( $type, $name = null ) |
|
163 | + public function getSubClient($type, $name = null) |
|
164 | 164 | { |
165 | 165 | /** admin/jqadm/product/selection/decorators/excludes |
166 | 166 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | * @see admin/jqadm/product/selection/decorators/excludes |
236 | 236 | * @see admin/jqadm/product/selection/decorators/global |
237 | 237 | */ |
238 | - return $this->createSubClient( 'product/selection/' . $type, $name ); |
|
238 | + return $this->createSubClient('product/selection/' . $type, $name); |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | * @since 2016.01 |
280 | 280 | * @category Developer |
281 | 281 | */ |
282 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/product/selection/standard/subparts', [] ); |
|
282 | + return $this->getContext()->getConfig()->get('admin/jqadm/product/selection/standard/subparts', []); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | |
@@ -289,43 +289,43 @@ discard block |
||
289 | 289 | * @param \Aimeos\MShop\Product\Item\Iface $item Product item object without referenced domain items |
290 | 290 | * @param array $data Data array |
291 | 291 | */ |
292 | - protected function fromArray( \Aimeos\MShop\Product\Item\Iface $item, array $data ) |
|
292 | + protected function fromArray(\Aimeos\MShop\Product\Item\Iface $item, array $data) |
|
293 | 293 | { |
294 | 294 | $context = $this->getContext(); |
295 | - $manager = \Aimeos\MShop::create( $context, 'product' ); |
|
296 | - $listManager = \Aimeos\MShop::create( $context, 'product/lists' ); |
|
295 | + $manager = \Aimeos\MShop::create($context, 'product'); |
|
296 | + $listManager = \Aimeos\MShop::create($context, 'product/lists'); |
|
297 | 297 | |
298 | - $prodItem = $manager->createItem()->setType( 'default' ); |
|
299 | - $listItem = $listManager->createItem()->setType( 'default' ); |
|
300 | - $articles = $item->getRefItems( 'product', null, 'default', false ); |
|
301 | - $listItems = $item->getListItems( 'product', 'default', null, false ); |
|
298 | + $prodItem = $manager->createItem()->setType('default'); |
|
299 | + $listItem = $listManager->createItem()->setType('default'); |
|
300 | + $articles = $item->getRefItems('product', null, 'default', false); |
|
301 | + $listItems = $item->getListItems('product', 'default', null, false); |
|
302 | 302 | |
303 | - foreach( $data as $idx => $entry ) |
|
303 | + foreach ($data as $idx => $entry) |
|
304 | 304 | { |
305 | - if( ( $litem = $item->getListItem( 'product', 'default', $entry['product.id'], false ) ) === null ) { |
|
305 | + if (($litem = $item->getListItem('product', 'default', $entry['product.id'], false)) === null) { |
|
306 | 306 | $litem = clone $listItem; |
307 | 307 | } |
308 | 308 | |
309 | - if( isset( $articles[$litem->getRefId()] ) ) { |
|
309 | + if (isset($articles[$litem->getRefId()])) { |
|
310 | 310 | $refItem = $articles[$litem->getRefId()]; |
311 | 311 | } else { |
312 | 312 | $refItem = clone $prodItem; |
313 | 313 | } |
314 | 314 | |
315 | - $litem->fromArray( $entry ); |
|
316 | - $litem->setPosition( $idx ); |
|
315 | + $litem->fromArray($entry); |
|
316 | + $litem->setPosition($idx); |
|
317 | 317 | |
318 | - $refItem->fromArray( $entry ); |
|
318 | + $refItem->fromArray($entry); |
|
319 | 319 | |
320 | - if( isset( $entry['attr'] ) ) { |
|
321 | - $refItem = $this->fromArrayAttributes( $refItem, $entry['attr'] ); |
|
320 | + if (isset($entry['attr'])) { |
|
321 | + $refItem = $this->fromArrayAttributes($refItem, $entry['attr']); |
|
322 | 322 | } |
323 | 323 | |
324 | - $item->addListItem( 'product', $litem, $refItem ); |
|
325 | - unset( $listItems[$litem->getId()] ); |
|
324 | + $item->addListItem('product', $litem, $refItem); |
|
325 | + unset($listItems[$litem->getId()]); |
|
326 | 326 | } |
327 | 327 | |
328 | - return $item->deleteListItems( $listItems ); |
|
328 | + return $item->deleteListItems($listItems); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | |
@@ -336,31 +336,31 @@ discard block |
||
336 | 336 | * @param array $entry Associative list of key/values for product attribute references |
337 | 337 | * @return \Aimeos\MShop\Product\Item\Iface Updated artice item object |
338 | 338 | */ |
339 | - protected function fromArrayAttributes( \Aimeos\MShop\Product\Item\Iface $refItem, array $entry ) |
|
339 | + protected function fromArrayAttributes(\Aimeos\MShop\Product\Item\Iface $refItem, array $entry) |
|
340 | 340 | { |
341 | - $listManager = \Aimeos\MShop::create( $this->getContext(), 'product/lists' ); |
|
341 | + $listManager = \Aimeos\MShop::create($this->getContext(), 'product/lists'); |
|
342 | 342 | |
343 | - $listItem = $listManager->createItem()->setType( 'variant' ); |
|
344 | - $litems = $refItem->getListItems( 'attribute', 'variant', null, false ); |
|
343 | + $listItem = $listManager->createItem()->setType('variant'); |
|
344 | + $litems = $refItem->getListItems('attribute', 'variant', null, false); |
|
345 | 345 | |
346 | - foreach( $entry as $pos => $attr ) |
|
346 | + foreach ($entry as $pos => $attr) |
|
347 | 347 | { |
348 | - if( !isset( $attr['product.lists.refid'] ) || $attr['product.lists.refid'] == '' ) { |
|
348 | + if (!isset($attr['product.lists.refid']) || $attr['product.lists.refid'] == '') { |
|
349 | 349 | continue; |
350 | 350 | } |
351 | 351 | |
352 | - if( ( $litem = $refItem->getListItem( 'attribute', 'variant', $attr['product.lists.refid'], false ) ) === null ) { |
|
352 | + if (($litem = $refItem->getListItem('attribute', 'variant', $attr['product.lists.refid'], false)) === null) { |
|
353 | 353 | $litem = clone $listItem; |
354 | 354 | } |
355 | 355 | |
356 | - $litem->fromArray( $attr ); |
|
357 | - $litem->setPosition( $pos ); |
|
356 | + $litem->fromArray($attr); |
|
357 | + $litem->setPosition($pos); |
|
358 | 358 | |
359 | - $refItem->addListItem( 'attribute', $litem, $litem->getRefItem() ); |
|
360 | - unset( $litems[$litem->getId()] ); |
|
359 | + $refItem->addListItem('attribute', $litem, $litem->getRefItem()); |
|
360 | + unset($litems[$litem->getId()]); |
|
361 | 361 | } |
362 | 362 | |
363 | - return $refItem->deleteListItems( $litems ); |
|
363 | + return $refItem->deleteListItems($litems); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | |
@@ -371,27 +371,27 @@ discard block |
||
371 | 371 | * @param boolean $copy True if items should be copied |
372 | 372 | * @return string[] Multi-dimensional associative list of item data |
373 | 373 | */ |
374 | - protected function toArray( \Aimeos\MShop\Product\Item\Iface $item, $copy = false ) |
|
374 | + protected function toArray(\Aimeos\MShop\Product\Item\Iface $item, $copy = false) |
|
375 | 375 | { |
376 | - if( $item->getType() !== 'select' ) { |
|
376 | + if ($item->getType() !== 'select') { |
|
377 | 377 | return []; |
378 | 378 | } |
379 | 379 | |
380 | 380 | $data = []; |
381 | 381 | $context = $this->getContext(); |
382 | 382 | $siteId = $context->getLocale()->getSiteId(); |
383 | - $articles = $item->getRefItems( 'product', null, 'default', false ); |
|
383 | + $articles = $item->getRefItems('product', null, 'default', false); |
|
384 | 384 | |
385 | 385 | |
386 | - foreach( $item->getListItems( 'product', 'default', null, false ) as $id => $listItem ) |
|
386 | + foreach ($item->getListItems('product', 'default', null, false) as $id => $listItem) |
|
387 | 387 | { |
388 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
388 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
389 | 389 | continue; |
390 | 390 | } |
391 | 391 | |
392 | - $list = $listItem->toArray( true ) + $refItem->toArray( true ); |
|
392 | + $list = $listItem->toArray(true) + $refItem->toArray(true); |
|
393 | 393 | |
394 | - if( $copy === true ) |
|
394 | + if ($copy === true) |
|
395 | 395 | { |
396 | 396 | $list['product.lists.siteid'] = $siteId; |
397 | 397 | $list['product.lists.id'] = ''; |
@@ -399,14 +399,14 @@ discard block |
||
399 | 399 | $list['product.id'] = null; |
400 | 400 | } |
401 | 401 | |
402 | - if( isset( $articles[$refItem->getId()] ) ) |
|
402 | + if (isset($articles[$refItem->getId()])) |
|
403 | 403 | { |
404 | 404 | $idx = 0; |
405 | 405 | |
406 | - foreach( $articles[$refItem->getId()]->getListItems( 'attribute', 'variant', null, false ) as $litem ) |
|
406 | + foreach ($articles[$refItem->getId()]->getListItems('attribute', 'variant', null, false) as $litem) |
|
407 | 407 | { |
408 | - if( ( $attrItem = $litem->getRefItem() ) !== null ) { |
|
409 | - $list['attr'][$idx++] = $litem->toArray( true ) + $attrItem->toArray( true ); |
|
408 | + if (($attrItem = $litem->getRefItem()) !== null) { |
|
409 | + $list['attr'][$idx++] = $litem->toArray(true) + $attrItem->toArray(true); |
|
410 | 410 | } |
411 | 411 | } |
412 | 412 | } |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
425 | 425 | * @return string HTML output |
426 | 426 | */ |
427 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
427 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
428 | 428 | { |
429 | 429 | /** admin/jqadm/product/selection/template-item |
430 | 430 | * Relative path to the HTML body template of the selection subpart for products. |
@@ -448,6 +448,6 @@ discard block |
||
448 | 448 | $tplconf = 'admin/jqadm/product/selection/template-item'; |
449 | 449 | $default = 'product/item-selection-standard'; |
450 | 450 | |
451 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
451 | + return $view->render($view->config($tplconf, $default)); |
|
452 | 452 | } |
453 | 453 | } |
454 | 454 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Product\Download; |
12 | 12 | |
13 | -sprintf( 'download' ); // for translation |
|
13 | +sprintf('download'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | { |
45 | 45 | $view = $this->getView(); |
46 | 46 | |
47 | - $view->downloadData = $this->toArray( $view->item, true ); |
|
47 | + $view->downloadData = $this->toArray($view->item, true); |
|
48 | 48 | $view->downloadBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->downloadBody .= $client->copy(); |
52 | 52 | } |
53 | 53 | |
54 | - return $this->render( $view ); |
|
54 | + return $this->render($view); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -64,16 +64,16 @@ discard block |
||
64 | 64 | { |
65 | 65 | $view = $this->getView(); |
66 | 66 | $data['product.lists.siteid'] = $this->getContext()->getLocale()->getSiteId(); |
67 | - $data = array_replace_recursive( $this->toArray( $view->item ), $view->param( 'download', [] ) ); |
|
67 | + $data = array_replace_recursive($this->toArray($view->item), $view->param('download', [])); |
|
68 | 68 | |
69 | 69 | $view->downloadData = $data; |
70 | 70 | $view->downloadBody = ''; |
71 | 71 | |
72 | - foreach( $this->getSubClients() as $client ) { |
|
72 | + foreach ($this->getSubClients() as $client) { |
|
73 | 73 | $view->downloadBody .= $client->create(); |
74 | 74 | } |
75 | 75 | |
76 | - return $this->render( $view ); |
|
76 | + return $this->render($view); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
@@ -85,17 +85,17 @@ discard block |
||
85 | 85 | parent::delete(); |
86 | 86 | |
87 | 87 | $item = $this->getView()->item; |
88 | - $fs = $this->getContext()->getFilesystemManager()->get( 'fs-secure' ); |
|
88 | + $fs = $this->getContext()->getFilesystemManager()->get('fs-secure'); |
|
89 | 89 | |
90 | - foreach( $item->getListItems( 'attribute', 'hidden', 'download', false ) as $listItem ) |
|
90 | + foreach ($item->getListItems('attribute', 'hidden', 'download', false) as $listItem) |
|
91 | 91 | { |
92 | 92 | $refItem = $listItem->getRefItem(); |
93 | 93 | |
94 | - if( $refItem !== null && $refItem->getCode() != '' && $fs->has( $refItem->getCode() ) ) { |
|
95 | - $fs->rm( $refItem->getCode() ); |
|
94 | + if ($refItem !== null && $refItem->getCode() != '' && $fs->has($refItem->getCode())) { |
|
95 | + $fs->rm($refItem->getCode()); |
|
96 | 96 | } |
97 | 97 | |
98 | - $item->deleteListItem( 'attribute', $listItem, $refItem ); |
|
98 | + $item->deleteListItem('attribute', $listItem, $refItem); |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
@@ -109,14 +109,14 @@ discard block |
||
109 | 109 | { |
110 | 110 | $view = $this->getView(); |
111 | 111 | |
112 | - $view->downloadData = $this->toArray( $view->item ); |
|
112 | + $view->downloadData = $this->toArray($view->item); |
|
113 | 113 | $view->downloadBody = ''; |
114 | 114 | |
115 | - foreach( $this->getSubClients() as $client ) { |
|
115 | + foreach ($this->getSubClients() as $client) { |
|
116 | 116 | $view->downloadBody .= $client->get(); |
117 | 117 | } |
118 | 118 | |
119 | - return $this->render( $view ); |
|
119 | + return $this->render($view); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | |
@@ -129,26 +129,26 @@ discard block |
||
129 | 129 | |
130 | 130 | try |
131 | 131 | { |
132 | - $this->fromArray( $view->item, $view->param( 'download', [] ) ); |
|
132 | + $this->fromArray($view->item, $view->param('download', [])); |
|
133 | 133 | $view->downloadBody = ''; |
134 | 134 | |
135 | - foreach( $this->getSubClients() as $client ) { |
|
135 | + foreach ($this->getSubClients() as $client) { |
|
136 | 136 | $view->downloadBody .= $client->save(); |
137 | 137 | } |
138 | 138 | |
139 | 139 | return; |
140 | 140 | } |
141 | - catch( \Aimeos\MShop\Exception $e ) |
|
141 | + catch (\Aimeos\MShop\Exception $e) |
|
142 | 142 | { |
143 | - $error = array( 'product-item-download' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
144 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
145 | - $this->logException( $e ); |
|
143 | + $error = array('product-item-download' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
144 | + $view->errors = $view->get('errors', []) + $error; |
|
145 | + $this->logException($e); |
|
146 | 146 | } |
147 | - catch( \Exception $e ) |
|
147 | + catch (\Exception $e) |
|
148 | 148 | { |
149 | - $error = array( 'product-item-download' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
150 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
151 | - $this->logException( $e ); |
|
149 | + $error = array('product-item-download' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
150 | + $view->errors = $view->get('errors', []) + $error; |
|
151 | + $this->logException($e); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | throw new \Aimeos\Admin\JQAdm\Exception(); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @param string|null $name Name of the sub-client (Default if null) |
163 | 163 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
164 | 164 | */ |
165 | - public function getSubClient( $type, $name = null ) |
|
165 | + public function getSubClient($type, $name = null) |
|
166 | 166 | { |
167 | 167 | /** admin/jqadm/product/download/decorators/excludes |
168 | 168 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * @see admin/jqadm/product/download/decorators/excludes |
238 | 238 | * @see admin/jqadm/product/download/decorators/global |
239 | 239 | */ |
240 | - return $this->createSubClient( 'product/download/' . $type, $name ); |
|
240 | + return $this->createSubClient('product/download/' . $type, $name); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | * @since 2016.03 |
282 | 282 | * @category Developer |
283 | 283 | */ |
284 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/product/download/standard/subparts', [] ); |
|
284 | + return $this->getContext()->getConfig()->get('admin/jqadm/product/download/standard/subparts', []); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | |
@@ -292,22 +292,22 @@ discard block |
||
292 | 292 | * @param string $path Path the file should be stored at |
293 | 293 | * @return string Path to the uploaded file |
294 | 294 | */ |
295 | - protected function storeFile( \Psr\Http\Message\UploadedFileInterface $file, $path ) |
|
295 | + protected function storeFile(\Psr\Http\Message\UploadedFileInterface $file, $path) |
|
296 | 296 | { |
297 | - $fs = $this->getContext()->getFilesystemManager()->get( 'fs-secure' ); |
|
297 | + $fs = $this->getContext()->getFilesystemManager()->get('fs-secure'); |
|
298 | 298 | |
299 | - if( $path == null ) |
|
299 | + if ($path == null) |
|
300 | 300 | { |
301 | - $ext = pathinfo( $file->getClientFilename(), PATHINFO_EXTENSION ); |
|
302 | - $hash = md5( $file->getClientFilename() . microtime( true ) ); |
|
303 | - $path = sprintf( '%s/%s/%s.%s', $hash[0], $hash[1], $hash, $ext ); |
|
301 | + $ext = pathinfo($file->getClientFilename(), PATHINFO_EXTENSION); |
|
302 | + $hash = md5($file->getClientFilename() . microtime(true)); |
|
303 | + $path = sprintf('%s/%s/%s.%s', $hash[0], $hash[1], $hash, $ext); |
|
304 | 304 | |
305 | - if( !$fs->isdir( $hash[0] . '/' . $hash[1] ) ) { |
|
306 | - $fs->mkdir( $hash[0] . '/' . $hash[1] ); |
|
305 | + if (!$fs->isdir($hash[0] . '/' . $hash[1])) { |
|
306 | + $fs->mkdir($hash[0] . '/' . $hash[1]); |
|
307 | 307 | } |
308 | 308 | } |
309 | 309 | |
310 | - $fs->writes( $path, $file->getStream()->detach() ); |
|
310 | + $fs->writes($path, $file->getStream()->detach()); |
|
311 | 311 | |
312 | 312 | return $path; |
313 | 313 | } |
@@ -319,55 +319,55 @@ discard block |
||
319 | 319 | * @param \Aimeos\MShop\Product\Item\Iface $item Product item object without referenced domain items |
320 | 320 | * @param string[] $data Data array |
321 | 321 | */ |
322 | - protected function fromArray( \Aimeos\MShop\Product\Item\Iface $item, array $data ) |
|
322 | + protected function fromArray(\Aimeos\MShop\Product\Item\Iface $item, array $data) |
|
323 | 323 | { |
324 | 324 | $context = $this->getContext(); |
325 | - $fs = $context->getFilesystemManager()->get( 'fs-secure' ); |
|
325 | + $fs = $context->getFilesystemManager()->get('fs-secure'); |
|
326 | 326 | |
327 | - $attrManager = \Aimeos\MShop::create( $context, 'attribute' ); |
|
328 | - $typeManager = \Aimeos\MShop::create( $context, 'attribute/type' ); |
|
329 | - $listManager = \Aimeos\MShop::create( $context, 'product/lists' ); |
|
327 | + $attrManager = \Aimeos\MShop::create($context, 'attribute'); |
|
328 | + $typeManager = \Aimeos\MShop::create($context, 'attribute/type'); |
|
329 | + $listManager = \Aimeos\MShop::create($context, 'product/lists'); |
|
330 | 330 | |
331 | - $attrItem = $attrManager->createItem()->setType( 'download' ); |
|
332 | - $listItem = $listManager->createItem()->setType( 'hidden' ); |
|
333 | - $listItems = $item->getListItems( 'attribute', 'hidden', 'download', false ); |
|
331 | + $attrItem = $attrManager->createItem()->setType('download'); |
|
332 | + $listItem = $listManager->createItem()->setType('hidden'); |
|
333 | + $listItems = $item->getListItems('attribute', 'hidden', 'download', false); |
|
334 | 334 | |
335 | - if( $this->getValue( $data, 'attribute.label' ) != '' ) |
|
335 | + if ($this->getValue($data, 'attribute.label') != '') |
|
336 | 336 | { |
337 | - $listId = $this->getValue( $data, 'product.lists.id' ); |
|
337 | + $listId = $this->getValue($data, 'product.lists.id'); |
|
338 | 338 | |
339 | - if( isset( $listItems[$listId] ) ) { |
|
340 | - $litem = $listItems[$listId]; unset( $listItems[$listId] ); |
|
339 | + if (isset($listItems[$listId])) { |
|
340 | + $litem = $listItems[$listId]; unset($listItems[$listId]); |
|
341 | 341 | } else { |
342 | 342 | $litem = clone $listItem; |
343 | 343 | } |
344 | 344 | |
345 | - if( ( $refItem = $litem->getRefItem() ) === null ) { |
|
345 | + if (($refItem = $litem->getRefItem()) === null) { |
|
346 | 346 | $refItem = clone $attrItem; |
347 | 347 | } |
348 | 348 | |
349 | - $litem->fromArray( $data ); |
|
350 | - $refItem->fromArray( $data ); |
|
349 | + $litem->fromArray($data); |
|
350 | + $refItem->fromArray($data); |
|
351 | 351 | |
352 | - if( ( $file = $this->getValue( (array) $this->getView()->request()->getUploadedFiles(), 'download/file' ) ) !== null |
|
352 | + if (($file = $this->getValue((array) $this->getView()->request()->getUploadedFiles(), 'download/file')) !== null |
|
353 | 353 | && $file->getError() === UPLOAD_ERR_OK |
354 | 354 | ) { |
355 | - $path = ( $this->getValue( $data, 'overwrite' ) == 1 ? $refItem->getCode() : null ); |
|
356 | - $refItem->setCode( $this->storeFile( $file, $path ) ); |
|
355 | + $path = ($this->getValue($data, 'overwrite') == 1 ? $refItem->getCode() : null); |
|
356 | + $refItem->setCode($this->storeFile($file, $path)); |
|
357 | 357 | } |
358 | 358 | |
359 | - $item->addListItem( 'attribute', $litem, $refItem ); |
|
359 | + $item->addListItem('attribute', $litem, $refItem); |
|
360 | 360 | } |
361 | 361 | |
362 | - foreach( $listItems as $listItem ) |
|
362 | + foreach ($listItems as $listItem) |
|
363 | 363 | { |
364 | 364 | $refItem = $listItem->getRefItem(); |
365 | 365 | |
366 | - if( $refItem !== null && ( $path = $refItem->getCode() ) != '' && $fs->has( $path ) ) { |
|
367 | - $fs->rm( $path ); |
|
366 | + if ($refItem !== null && ($path = $refItem->getCode()) != '' && $fs->has($path)) { |
|
367 | + $fs->rm($path); |
|
368 | 368 | } |
369 | 369 | |
370 | - $item->deleteListItem( 'attribute', $listItem, $refItem ); |
|
370 | + $item->deleteListItem('attribute', $listItem, $refItem); |
|
371 | 371 | } |
372 | 372 | } |
373 | 373 | |
@@ -379,35 +379,35 @@ discard block |
||
379 | 379 | * @param boolean $copy True if items should be copied, false if not |
380 | 380 | * @return string[] Multi-dimensional associative list of item data |
381 | 381 | */ |
382 | - protected function toArray( \Aimeos\MShop\Product\Item\Iface $item, $copy = false ) |
|
382 | + protected function toArray(\Aimeos\MShop\Product\Item\Iface $item, $copy = false) |
|
383 | 383 | { |
384 | 384 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
385 | 385 | $data = ['product.lists.siteid' => $siteId]; |
386 | 386 | |
387 | - foreach( $item->getListItems( 'attribute', 'hidden', 'download', false ) as $listItem ) |
|
387 | + foreach ($item->getListItems('attribute', 'hidden', 'download', false) as $listItem) |
|
388 | 388 | { |
389 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
389 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
390 | 390 | continue; |
391 | 391 | } |
392 | 392 | |
393 | - $list = $listItem->toArray( true ) + $refItem->toArray( true ); |
|
393 | + $list = $listItem->toArray(true) + $refItem->toArray(true); |
|
394 | 394 | |
395 | - if( $copy === true ) { |
|
395 | + if ($copy === true) { |
|
396 | 396 | $list['product.lists.id'] = ''; |
397 | 397 | } |
398 | 398 | |
399 | - foreach( $list as $key => $value ) { |
|
399 | + foreach ($list as $key => $value) { |
|
400 | 400 | $data[$key] = $value; |
401 | 401 | } |
402 | 402 | |
403 | 403 | try |
404 | 404 | { |
405 | - $fs = $this->getContext()->getFilesystemManager()->get( 'fs-secure' ); |
|
405 | + $fs = $this->getContext()->getFilesystemManager()->get('fs-secure'); |
|
406 | 406 | |
407 | - $data['time'] = $fs->time( $data['attribute.code'] ); |
|
408 | - $data['size'] = $fs->size( $data['attribute.code'] ); |
|
407 | + $data['time'] = $fs->time($data['attribute.code']); |
|
408 | + $data['size'] = $fs->size($data['attribute.code']); |
|
409 | 409 | } |
410 | - catch( \Exception $e ) { ; } // Show product even if file isn't available any more |
|
410 | + catch (\Exception $e) {; } // Show product even if file isn't available any more |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | return $data; |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
421 | 421 | * @return string HTML output |
422 | 422 | */ |
423 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
423 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
424 | 424 | { |
425 | 425 | /** admin/jqadm/product/download/template-item |
426 | 426 | * Relative path to the HTML body template of the download subpart for products. |
@@ -444,6 +444,6 @@ discard block |
||
444 | 444 | $tplconf = 'admin/jqadm/product/download/template-item'; |
445 | 445 | $default = 'product/item-download-standard'; |
446 | 446 | |
447 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
447 | + return $view->render($view->config($tplconf, $default)); |
|
448 | 448 | } |
449 | 449 | } |
450 | 450 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Product\Physical; |
12 | 12 | |
13 | -sprintf( 'physical' ); // for translation |
|
13 | +sprintf('physical'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | { |
45 | 45 | $view = $this->getView(); |
46 | 46 | |
47 | - $view->physicalData = $this->toArray( $view->item, true ); |
|
47 | + $view->physicalData = $this->toArray($view->item, true); |
|
48 | 48 | $view->physicalBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->physicalBody .= $client->copy(); |
52 | 52 | } |
53 | 53 | |
54 | - return $this->render( $view ); |
|
54 | + return $this->render($view); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -64,20 +64,20 @@ discard block |
||
64 | 64 | { |
65 | 65 | $view = $this->getView(); |
66 | 66 | $siteid = $this->getContext()->getLocale()->getSiteId(); |
67 | - $data = $view->param( 'physical', [] ); |
|
67 | + $data = $view->param('physical', []); |
|
68 | 68 | |
69 | - foreach( $view->value( $data, 'product.property.id', [] ) as $idx => $value ) { |
|
69 | + foreach ($view->value($data, 'product.property.id', []) as $idx => $value) { |
|
70 | 70 | $data['product.property.siteid'][$idx] = $siteid; |
71 | 71 | } |
72 | 72 | |
73 | 73 | $view->physicalData = $data; |
74 | 74 | $view->physicalBody = ''; |
75 | 75 | |
76 | - foreach( $this->getSubClients() as $client ) { |
|
76 | + foreach ($this->getSubClients() as $client) { |
|
77 | 77 | $view->physicalBody .= $client->create(); |
78 | 78 | } |
79 | 79 | |
80 | - return $this->render( $view ); |
|
80 | + return $this->render($view); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | { |
91 | 91 | $view = $this->getView(); |
92 | 92 | |
93 | - $view->physicalData = $this->toArray( $view->item ); |
|
93 | + $view->physicalData = $this->toArray($view->item); |
|
94 | 94 | $view->physicalBody = ''; |
95 | 95 | |
96 | - foreach( $this->getSubClients() as $client ) { |
|
96 | + foreach ($this->getSubClients() as $client) { |
|
97 | 97 | $view->physicalBody .= $client->get(); |
98 | 98 | } |
99 | 99 | |
100 | - return $this->render( $view ); |
|
100 | + return $this->render($view); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | |
@@ -110,26 +110,26 @@ discard block |
||
110 | 110 | |
111 | 111 | try |
112 | 112 | { |
113 | - $this->fromArray( $view->item, $view->param( 'physical', [] ) ); |
|
113 | + $this->fromArray($view->item, $view->param('physical', [])); |
|
114 | 114 | $view->physicalBody = ''; |
115 | 115 | |
116 | - foreach( $this->getSubClients() as $client ) { |
|
116 | + foreach ($this->getSubClients() as $client) { |
|
117 | 117 | $view->physicalBody .= $client->save(); |
118 | 118 | } |
119 | 119 | |
120 | 120 | return; |
121 | 121 | } |
122 | - catch( \Aimeos\MShop\Exception $e ) |
|
122 | + catch (\Aimeos\MShop\Exception $e) |
|
123 | 123 | { |
124 | - $error = array( 'product-item-physical' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
125 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
126 | - $this->logException( $e ); |
|
124 | + $error = array('product-item-physical' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
125 | + $view->errors = $view->get('errors', []) + $error; |
|
126 | + $this->logException($e); |
|
127 | 127 | } |
128 | - catch( \Exception $e ) |
|
128 | + catch (\Exception $e) |
|
129 | 129 | { |
130 | - $error = array( 'product-item-physical' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
131 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
132 | - $this->logException( $e ); |
|
130 | + $error = array('product-item-physical' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
131 | + $view->errors = $view->get('errors', []) + $error; |
|
132 | + $this->logException($e); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | throw new \Aimeos\Admin\JQAdm\Exception(); |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @param string|null $name Name of the sub-client (Default if null) |
144 | 144 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
145 | 145 | */ |
146 | - public function getSubClient( $type, $name = null ) |
|
146 | + public function getSubClient($type, $name = null) |
|
147 | 147 | { |
148 | 148 | /** admin/jqadm/product/physical/decorators/excludes |
149 | 149 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * @see admin/jqadm/product/physical/decorators/excludes |
219 | 219 | * @see admin/jqadm/product/physical/decorators/global |
220 | 220 | */ |
221 | - return $this->createSubClient( 'product/physical/' . $type, $name ); |
|
221 | + return $this->createSubClient('product/physical/' . $type, $name); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @since 2016.01 |
263 | 263 | * @category Developer |
264 | 264 | */ |
265 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/product/physical/standard/subparts', [] ); |
|
265 | + return $this->getContext()->getConfig()->get('admin/jqadm/product/physical/standard/subparts', []); |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | |
@@ -272,30 +272,30 @@ discard block |
||
272 | 272 | * @param \Aimeos\MShop\Product\Item\Iface $item Product item object without referenced domain items |
273 | 273 | * @param string[] $data Data array |
274 | 274 | */ |
275 | - protected function fromArray( \Aimeos\MShop\Product\Item\Iface $item, array $data ) |
|
275 | + protected function fromArray(\Aimeos\MShop\Product\Item\Iface $item, array $data) |
|
276 | 276 | { |
277 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'product/property' ); |
|
278 | - $typeManager = \Aimeos\MShop::create( $this->getContext(), 'product/property/type' ); |
|
277 | + $manager = \Aimeos\MShop::create($this->getContext(), 'product/property'); |
|
278 | + $typeManager = \Aimeos\MShop::create($this->getContext(), 'product/property/type'); |
|
279 | 279 | |
280 | - foreach( $data as $type => $value ) |
|
280 | + foreach ($data as $type => $value) |
|
281 | 281 | { |
282 | - $propItems = $item->getPropertyItems( $type, false ); |
|
282 | + $propItems = $item->getPropertyItems($type, false); |
|
283 | 283 | |
284 | - if( ( $value = trim( $value ) ) != '' ) |
|
284 | + if (($value = trim($value)) != '') |
|
285 | 285 | { |
286 | - if( ( $propItem = reset( $propItems ) ) === false ) { |
|
287 | - $propItem = $manager->createItem()->setType( $type ); |
|
286 | + if (($propItem = reset($propItems)) === false) { |
|
287 | + $propItem = $manager->createItem()->setType($type); |
|
288 | 288 | } |
289 | 289 | |
290 | - $propItem->setLanguageId( null ); |
|
291 | - $propItem->setValue( $value ); |
|
290 | + $propItem->setLanguageId(null); |
|
291 | + $propItem->setValue($value); |
|
292 | 292 | |
293 | - $item->addPropertyItem( $propItem ); |
|
293 | + $item->addPropertyItem($propItem); |
|
294 | 294 | |
295 | 295 | } |
296 | 296 | else |
297 | 297 | { |
298 | - $item->deletePropertyItems( $propItems ); |
|
298 | + $item->deletePropertyItems($propItems); |
|
299 | 299 | } |
300 | 300 | } |
301 | 301 | } |
@@ -308,12 +308,12 @@ discard block |
||
308 | 308 | * @param boolean $copy True if items should be copied, false if not |
309 | 309 | * @return string[] Multi-dimensional associative list of item data |
310 | 310 | */ |
311 | - protected function toArray( \Aimeos\MShop\Product\Item\Iface $item, $copy = false ) |
|
311 | + protected function toArray(\Aimeos\MShop\Product\Item\Iface $item, $copy = false) |
|
312 | 312 | { |
313 | 313 | $data = []; |
314 | 314 | $types = ['package-length', 'package-height', 'package-width', 'package-weight']; |
315 | 315 | |
316 | - foreach( $item->getPropertyItems( $types, false ) as $item ) { |
|
316 | + foreach ($item->getPropertyItems($types, false) as $item) { |
|
317 | 317 | $data[$item->getType()] = $item->getValue(); |
318 | 318 | } |
319 | 319 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
328 | 328 | * @return string HTML output |
329 | 329 | */ |
330 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
330 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
331 | 331 | { |
332 | 332 | /** admin/jqadm/product/physical/template-item |
333 | 333 | * Relative path to the HTML body template of the physical subpart for products. |
@@ -351,6 +351,6 @@ discard block |
||
351 | 351 | $tplconf = 'admin/jqadm/product/physical/template-item'; |
352 | 352 | $default = 'product/item-physical-standard'; |
353 | 353 | |
354 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
354 | + return $view->render($view->config($tplconf, $default)); |
|
355 | 355 | } |
356 | 356 | } |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | { |
29 | 29 | $result = $this->getClient()->delete(); |
30 | 30 | |
31 | - $ids = (array) $this->getView()->param( 'id' ); |
|
32 | - \Aimeos\MShop::create( $this->getContext(), 'index' )->deleteItems( $ids ); |
|
31 | + $ids = (array) $this->getView()->param('id'); |
|
32 | + \Aimeos\MShop::create($this->getContext(), 'index')->deleteItems($ids); |
|
33 | 33 | |
34 | 34 | return $result; |
35 | 35 | } |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | $result = $this->getClient()->save(); |
46 | 46 | $item = $this->getView()->item; |
47 | 47 | |
48 | - if( $item->getId() !== null ) { |
|
49 | - \Aimeos\MShop::create( $this->getContext(), 'index' )->saveItem( $item ); |
|
48 | + if ($item->getId() !== null) { |
|
49 | + \Aimeos\MShop::create($this->getContext(), 'index')->saveItem($item); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | return $result; |
@@ -25,50 +25,50 @@ discard block |
||
25 | 25 | * @param \Aimeos\MW\View\Iface $view The view object which generates the admin output |
26 | 26 | * @return \Aimeos\Admin\JQAdm\Iface Reference to this object for fluent calls |
27 | 27 | */ |
28 | - public function setView( \Aimeos\MW\View\Iface $view ) |
|
28 | + public function setView(\Aimeos\MW\View\Iface $view) |
|
29 | 29 | { |
30 | - parent::setView( $view ); |
|
30 | + parent::setView($view); |
|
31 | 31 | |
32 | 32 | // set first to be able to show errors occuring afterwards |
33 | 33 | $view->pageParams = $this->getClientParams(); |
34 | 34 | $context = $this->getContext(); |
35 | 35 | |
36 | - $siteManager = \Aimeos\MShop::create( $context, 'locale/site' ); |
|
37 | - $langManager = \Aimeos\MShop::create( $context, 'locale/language' ); |
|
38 | - $customerManager = \Aimeos\MShop::create( $context, 'customer' ); |
|
36 | + $siteManager = \Aimeos\MShop::create($context, 'locale/site'); |
|
37 | + $langManager = \Aimeos\MShop::create($context, 'locale/language'); |
|
38 | + $customerManager = \Aimeos\MShop::create($context, 'customer'); |
|
39 | 39 | |
40 | - $siteItem = $siteManager->findItem( $view->param( 'site', 'default' ) ); |
|
40 | + $siteItem = $siteManager->findItem($view->param('site', 'default')); |
|
41 | 41 | |
42 | 42 | try { |
43 | - $siteid = $customerManager->getItem( $context->getUserId() )->getSiteId() ?: $siteItem->getSiteId(); |
|
44 | - } catch( \Exception $e ) { |
|
43 | + $siteid = $customerManager->getItem($context->getUserId())->getSiteId() ?: $siteItem->getSiteId(); |
|
44 | + } catch (\Exception $e) { |
|
45 | 45 | $siteid = $siteItem->getSiteId(); |
46 | 46 | } |
47 | 47 | |
48 | - if( $view->access( ['admin', 'super'] ) ) { |
|
48 | + if ($view->access(['admin', 'super'])) { |
|
49 | 49 | $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE; |
50 | 50 | } else { |
51 | 51 | $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE; |
52 | 52 | } |
53 | 53 | |
54 | - $sitePath = $siteManager->getPath( $siteid ); |
|
54 | + $sitePath = $siteManager->getPath($siteid); |
|
55 | 55 | |
56 | - $view->pageI18nList = $this->getAimeos()->getI18nList( 'admin' ); |
|
57 | - $view->pageLangItems = $langManager->searchItems( $langManager->createSearch( true ) ); |
|
58 | - $view->pageSiteTree = $siteManager->getTree( $siteid, [], $level ); |
|
56 | + $view->pageI18nList = $this->getAimeos()->getI18nList('admin'); |
|
57 | + $view->pageLangItems = $langManager->searchItems($langManager->createSearch(true)); |
|
58 | + $view->pageSiteTree = $siteManager->getTree($siteid, [], $level); |
|
59 | 59 | $view->pageSitePath = $sitePath; |
60 | 60 | $view->pageSiteItem = $siteItem; |
61 | 61 | |
62 | - if( $view->access( ['super'] ) ) |
|
62 | + if ($view->access(['super'])) |
|
63 | 63 | { |
64 | - $search = $siteManager->createSearch()->setSlice( 0, 1000 ); |
|
65 | - $search->setSortations( [$search->sort( '+', 'locale.site.label')] ); |
|
66 | - $search->setConditions( $search->compare( '==', 'locale.site.level', 0 ) ); |
|
64 | + $search = $siteManager->createSearch()->setSlice(0, 1000); |
|
65 | + $search->setSortations([$search->sort('+', 'locale.site.label')]); |
|
66 | + $search->setConditions($search->compare('==', 'locale.site.level', 0)); |
|
67 | 67 | |
68 | - $view->pageSiteList = $siteManager->searchItems( $search ); |
|
68 | + $view->pageSiteList = $siteManager->searchItems($search); |
|
69 | 69 | |
70 | - if( ( $rootItem = reset( $sitePath ) ) !== false ) { |
|
71 | - $view->pageSiteTree = $siteManager->getTree( $rootItem->getId(), [], $level ); |
|
70 | + if (($rootItem = reset($sitePath)) !== false) { |
|
71 | + $view->pageSiteTree = $siteManager->getTree($rootItem->getId(), [], $level); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | else |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $view->pageSiteList = [$view->pageSiteTree]; |
77 | 77 | } |
78 | 78 | |
79 | - $this->getClient()->setView( $view ); |
|
79 | + $this->getClient()->setView($view); |
|
80 | 80 | return $this; |
81 | 81 | } |
82 | 82 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Log; |
12 | 12 | |
13 | -sprintf( 'log' ); // for translation |
|
13 | +sprintf('log'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -36,32 +36,32 @@ discard block |
||
36 | 36 | try |
37 | 37 | { |
38 | 38 | $total = 0; |
39 | - $params = $this->storeSearchParams( $view->param(), 'log' ); |
|
40 | - $manager = \Aimeos\MAdmin::create( $context, 'log' ); |
|
39 | + $params = $this->storeSearchParams($view->param(), 'log'); |
|
40 | + $manager = \Aimeos\MAdmin::create($context, 'log'); |
|
41 | 41 | |
42 | 42 | $search = $manager->createSearch(); |
43 | - $search->setSortations( [$search->sort( '-', 'log.timestamp')] ); |
|
44 | - $search = $this->initCriteria( $search, $params ); |
|
43 | + $search->setSortations([$search->sort('-', 'log.timestamp')]); |
|
44 | + $search = $this->initCriteria($search, $params); |
|
45 | 45 | |
46 | - $view->items = $manager->searchItems( $search, [], $total ); |
|
46 | + $view->items = $manager->searchItems($search, [], $total); |
|
47 | 47 | $view->total = $total; |
48 | 48 | $view->itemBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->itemBody .= $client->search(); |
52 | 52 | } |
53 | 53 | } |
54 | - catch( \Aimeos\MAdmin\Exception $e ) |
|
54 | + catch (\Aimeos\MAdmin\Exception $e) |
|
55 | 55 | { |
56 | - $error = array( 'log-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
57 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
58 | - $this->logException( $e ); |
|
56 | + $error = array('log-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
57 | + $view->errors = $view->get('errors', []) + $error; |
|
58 | + $this->logException($e); |
|
59 | 59 | } |
60 | - catch( \Exception $e ) |
|
60 | + catch (\Exception $e) |
|
61 | 61 | { |
62 | - $error = array( 'log-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
63 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
64 | - $this->logException( $e ); |
|
62 | + $error = array('log-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
63 | + $view->errors = $view->get('errors', []) + $error; |
|
64 | + $this->logException($e); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** admin/jqadm/log/template-list |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $tplconf = 'admin/jqadm/log/template-list'; |
87 | 87 | $default = 'log/list-standard'; |
88 | 88 | |
89 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
89 | + return $view->render($view->config($tplconf, $default)); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @param string|null $name Name of the sub-client (Default if null) |
98 | 98 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
99 | 99 | */ |
100 | - public function getSubClient( $type, $name = null ) |
|
100 | + public function getSubClient($type, $name = null) |
|
101 | 101 | { |
102 | 102 | /** admin/jqadm/log/decorators/excludes |
103 | 103 | * Excludes decorators added by the "common" option from the log JQAdm client |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * @see admin/jqadm/log/decorators/excludes |
173 | 173 | * @see admin/jqadm/log/decorators/global |
174 | 174 | */ |
175 | - return $this->createSubClient( 'log/' . $type, $name ); |
|
175 | + return $this->createSubClient('log/' . $type, $name); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * @since 2018.04 |
217 | 217 | * @category Developer |
218 | 218 | */ |
219 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/log/standard/subparts', [] ); |
|
219 | + return $this->getContext()->getConfig()->get('admin/jqadm/log/standard/subparts', []); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
227 | 227 | * @return string HTML output |
228 | 228 | */ |
229 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
229 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
230 | 230 | { |
231 | 231 | /** admin/jqadm/log/template-item |
232 | 232 | * Relative path to the HTML body template for the log item. |
@@ -250,6 +250,6 @@ discard block |
||
250 | 250 | $tplconf = 'admin/jqadm/log/template-item'; |
251 | 251 | $default = 'log/item-standard'; |
252 | 252 | |
253 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
253 | + return $view->render($view->config($tplconf, $default)); |
|
254 | 254 | } |
255 | 255 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Locale\Site; |
12 | 12 | |
13 | -sprintf( 'locale/site' ); // for translation |
|
13 | +sprintf('locale/site'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -35,45 +35,45 @@ 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 | - $this->checkSite( $view->access( 'super' ), $id ); |
|
42 | + $this->checkSite($view->access('super'), $id); |
|
43 | 43 | |
44 | - $manager = \Aimeos\MShop::create( $context, 'locale/site' ); |
|
45 | - $view->item = $manager->getItem( $id ); |
|
44 | + $manager = \Aimeos\MShop::create($context, 'locale/site'); |
|
45 | + $view->item = $manager->getItem($id); |
|
46 | 46 | |
47 | - $view->itemData = $this->toArray( $view->item, true ); |
|
47 | + $view->itemData = $this->toArray($view->item, true); |
|
48 | 48 | $view->itemSubparts = $this->getSubClientNames(); |
49 | 49 | $view->itemBody = ''; |
50 | 50 | |
51 | - foreach( $this->getSubClients() as $idx => $client ) |
|
51 | + foreach ($this->getSubClients() as $idx => $client) |
|
52 | 52 | { |
53 | 53 | $view->tabindex = ++$idx + 1; |
54 | 54 | $view->itemBody .= $client->copy(); |
55 | 55 | } |
56 | 56 | } |
57 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
57 | + catch (\Aimeos\Admin\JQAdm\Exception $e) |
|
58 | 58 | { |
59 | - $error = array( 'locale-site-item' => $context->getI18n()->dt( 'admin', $e->getMessage() ) ); |
|
60 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
61 | - $this->logException( $e ); |
|
59 | + $error = array('locale-site-item' => $context->getI18n()->dt('admin', $e->getMessage())); |
|
60 | + $view->errors = $view->get('errors', []) + $error; |
|
61 | + $this->logException($e); |
|
62 | 62 | } |
63 | - catch( \Aimeos\MShop\Exception $e ) |
|
63 | + catch (\Aimeos\MShop\Exception $e) |
|
64 | 64 | { |
65 | - $error = array( 'locale-site-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
66 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
67 | - $this->logException( $e ); |
|
65 | + $error = array('locale-site-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( 'locale-site-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
72 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
73 | - $this->logException( $e ); |
|
71 | + $error = array('locale-site-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
72 | + $view->errors = $view->get('errors', []) + $error; |
|
73 | + $this->logException($e); |
|
74 | 74 | } |
75 | 75 | |
76 | - return $this->render( $view ); |
|
76 | + return $this->render($view); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
@@ -89,44 +89,44 @@ discard block |
||
89 | 89 | |
90 | 90 | try |
91 | 91 | { |
92 | - $this->checkSite( $view->access( 'super' ) ); |
|
92 | + $this->checkSite($view->access('super')); |
|
93 | 93 | |
94 | - $data = $view->param( 'item', [] ); |
|
94 | + $data = $view->param('item', []); |
|
95 | 95 | |
96 | - if( !isset( $view->item ) ) { |
|
97 | - $view->item = \Aimeos\MShop::create( $context, 'locale/site' )->createItem(); |
|
96 | + if (!isset($view->item)) { |
|
97 | + $view->item = \Aimeos\MShop::create($context, 'locale/site')->createItem(); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | $view->itemSubparts = $this->getSubClientNames(); |
101 | 101 | $view->itemData = $data; |
102 | 102 | $view->itemBody = ''; |
103 | 103 | |
104 | - foreach( $this->getSubClients() as $idx => $client ) |
|
104 | + foreach ($this->getSubClients() as $idx => $client) |
|
105 | 105 | { |
106 | 106 | $view->tabindex = ++$idx + 1; |
107 | 107 | $view->itemBody .= $client->create(); |
108 | 108 | } |
109 | 109 | } |
110 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
110 | + catch (\Aimeos\Admin\JQAdm\Exception $e) |
|
111 | 111 | { |
112 | - $error = array( 'locale-site-item' => $context->getI18n()->dt( 'admin', $e->getMessage() ) ); |
|
113 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
114 | - $this->logException( $e ); |
|
112 | + $error = array('locale-site-item' => $context->getI18n()->dt('admin', $e->getMessage())); |
|
113 | + $view->errors = $view->get('errors', []) + $error; |
|
114 | + $this->logException($e); |
|
115 | 115 | } |
116 | - catch( \Aimeos\MShop\Exception $e ) |
|
116 | + catch (\Aimeos\MShop\Exception $e) |
|
117 | 117 | { |
118 | - $error = array( 'locale-site-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
119 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
120 | - $this->logException( $e ); |
|
118 | + $error = array('locale-site-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
119 | + $view->errors = $view->get('errors', []) + $error; |
|
120 | + $this->logException($e); |
|
121 | 121 | } |
122 | - catch( \Exception $e ) |
|
122 | + catch (\Exception $e) |
|
123 | 123 | { |
124 | - $error = array( 'locale-site-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
125 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
126 | - $this->logException( $e ); |
|
124 | + $error = array('locale-site-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
125 | + $view->errors = $view->get('errors', []) + $error; |
|
126 | + $this->logException($e); |
|
127 | 127 | } |
128 | 128 | |
129 | - return $this->render( $view ); |
|
129 | + return $this->render($view); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -140,46 +140,46 @@ discard block |
||
140 | 140 | $view = $this->getView(); |
141 | 141 | $context = $this->getContext(); |
142 | 142 | |
143 | - $manager = \Aimeos\MShop::create( $context, 'locale/site' ); |
|
143 | + $manager = \Aimeos\MShop::create($context, 'locale/site'); |
|
144 | 144 | $manager->begin(); |
145 | 145 | |
146 | 146 | try |
147 | 147 | { |
148 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
149 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
148 | + if (($id = $view->param('id')) === null) { |
|
149 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
150 | 150 | } |
151 | 151 | |
152 | - $this->checkSite( $view->access( 'super' ), $id ); |
|
152 | + $this->checkSite($view->access('super'), $id); |
|
153 | 153 | |
154 | - $view->item = $manager->getItem( $id ); |
|
154 | + $view->item = $manager->getItem($id); |
|
155 | 155 | |
156 | - foreach( $this->getSubClients() as $client ) { |
|
156 | + foreach ($this->getSubClients() as $client) { |
|
157 | 157 | $client->delete(); |
158 | 158 | } |
159 | 159 | |
160 | - $manager->deleteItem( $id ); |
|
160 | + $manager->deleteItem($id); |
|
161 | 161 | $manager->commit(); |
162 | 162 | |
163 | - $this->nextAction( $view, 'search', 'locale/site', null, 'delete' ); |
|
163 | + $this->nextAction($view, 'search', 'locale/site', null, 'delete'); |
|
164 | 164 | return; |
165 | 165 | } |
166 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
166 | + catch (\Aimeos\Admin\JQAdm\Exception $e) |
|
167 | 167 | { |
168 | - $error = array( 'locale-site-item' => $context->getI18n()->dt( 'admin', $e->getMessage() ) ); |
|
169 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
170 | - $this->logException( $e ); |
|
168 | + $error = array('locale-site-item' => $context->getI18n()->dt('admin', $e->getMessage())); |
|
169 | + $view->errors = $view->get('errors', []) + $error; |
|
170 | + $this->logException($e); |
|
171 | 171 | } |
172 | - catch( \Aimeos\MShop\Exception $e ) |
|
172 | + catch (\Aimeos\MShop\Exception $e) |
|
173 | 173 | { |
174 | - $error = array( 'locale-site-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
175 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
176 | - $this->logException( $e ); |
|
174 | + $error = array('locale-site-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
175 | + $view->errors = $view->get('errors', []) + $error; |
|
176 | + $this->logException($e); |
|
177 | 177 | } |
178 | - catch( \Exception $e ) |
|
178 | + catch (\Exception $e) |
|
179 | 179 | { |
180 | - $error = array( 'locale-site-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
181 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
182 | - $this->logException( $e ); |
|
180 | + $error = array('locale-site-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
181 | + $view->errors = $view->get('errors', []) + $error; |
|
182 | + $this->logException($e); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | $manager->rollback(); |
@@ -200,45 +200,45 @@ discard block |
||
200 | 200 | |
201 | 201 | try |
202 | 202 | { |
203 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
204 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
203 | + if (($id = $view->param('id')) === null) { |
|
204 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
205 | 205 | } |
206 | 206 | |
207 | - $this->checkSite( $view->access( 'super' ), $id ); |
|
207 | + $this->checkSite($view->access('super'), $id); |
|
208 | 208 | |
209 | - $manager = \Aimeos\MShop::create( $context, 'locale/site' ); |
|
209 | + $manager = \Aimeos\MShop::create($context, 'locale/site'); |
|
210 | 210 | |
211 | - $view->item = $manager->getItem( $id ); |
|
211 | + $view->item = $manager->getItem($id); |
|
212 | 212 | $view->itemSubparts = $this->getSubClientNames(); |
213 | - $view->itemData = $this->toArray( $view->item ); |
|
213 | + $view->itemData = $this->toArray($view->item); |
|
214 | 214 | $view->itemBody = ''; |
215 | 215 | |
216 | - foreach( $this->getSubClients() as $idx => $client ) |
|
216 | + foreach ($this->getSubClients() as $idx => $client) |
|
217 | 217 | { |
218 | 218 | $view->tabindex = ++$idx + 1; |
219 | 219 | $view->itemBody .= $client->get(); |
220 | 220 | } |
221 | 221 | } |
222 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
222 | + catch (\Aimeos\Admin\JQAdm\Exception $e) |
|
223 | 223 | { |
224 | - $error = array( 'locale-site-item' => $context->getI18n()->dt( 'admin', $e->getMessage() ) ); |
|
225 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
226 | - $this->logException( $e ); |
|
224 | + $error = array('locale-site-item' => $context->getI18n()->dt('admin', $e->getMessage())); |
|
225 | + $view->errors = $view->get('errors', []) + $error; |
|
226 | + $this->logException($e); |
|
227 | 227 | } |
228 | - catch( \Aimeos\MShop\Exception $e ) |
|
228 | + catch (\Aimeos\MShop\Exception $e) |
|
229 | 229 | { |
230 | - $error = array( 'locale-site-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
231 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
232 | - $this->logException( $e ); |
|
230 | + $error = array('locale-site-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
231 | + $view->errors = $view->get('errors', []) + $error; |
|
232 | + $this->logException($e); |
|
233 | 233 | } |
234 | - catch( \Exception $e ) |
|
234 | + catch (\Exception $e) |
|
235 | 235 | { |
236 | - $error = array( 'locale-site-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
237 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
238 | - $this->logException( $e ); |
|
236 | + $error = array('locale-site-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
237 | + $view->errors = $view->get('errors', []) + $error; |
|
238 | + $this->logException($e); |
|
239 | 239 | } |
240 | 240 | |
241 | - return $this->render( $view ); |
|
241 | + return $this->render($view); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | |
@@ -252,42 +252,42 @@ discard block |
||
252 | 252 | $view = $this->getView(); |
253 | 253 | $context = $this->getContext(); |
254 | 254 | |
255 | - $manager = \Aimeos\MShop::create( $context, 'locale/site' ); |
|
255 | + $manager = \Aimeos\MShop::create($context, 'locale/site'); |
|
256 | 256 | $manager->begin(); |
257 | 257 | |
258 | 258 | try |
259 | 259 | { |
260 | - $item = $this->fromArray( $view->param( 'item', [] ), $view->access( 'super' ) ); |
|
261 | - $view->item = $item->getId() ? $item : $manager->saveItem( $item ); |
|
260 | + $item = $this->fromArray($view->param('item', []), $view->access('super')); |
|
261 | + $view->item = $item->getId() ? $item : $manager->saveItem($item); |
|
262 | 262 | $view->itemBody = ''; |
263 | 263 | |
264 | - foreach( $this->getSubClients() as $client ) { |
|
264 | + foreach ($this->getSubClients() as $client) { |
|
265 | 265 | $view->itemBody .= $client->save(); |
266 | 266 | } |
267 | 267 | |
268 | - $manager->saveItem( clone $view->item ); |
|
268 | + $manager->saveItem(clone $view->item); |
|
269 | 269 | $manager->commit(); |
270 | 270 | |
271 | - $this->nextAction( $view, $view->param( 'next' ), 'locale/site', $view->item->getId(), 'save' ); |
|
271 | + $this->nextAction($view, $view->param('next'), 'locale/site', $view->item->getId(), 'save'); |
|
272 | 272 | return; |
273 | 273 | } |
274 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
274 | + catch (\Aimeos\Admin\JQAdm\Exception $e) |
|
275 | 275 | { |
276 | - $error = array( 'locale-site-item' => $context->getI18n()->dt( 'admin', $e->getMessage() ) ); |
|
277 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
278 | - $this->logException( $e ); |
|
276 | + $error = array('locale-site-item' => $context->getI18n()->dt('admin', $e->getMessage())); |
|
277 | + $view->errors = $view->get('errors', []) + $error; |
|
278 | + $this->logException($e); |
|
279 | 279 | } |
280 | - catch( \Aimeos\MShop\Exception $e ) |
|
280 | + catch (\Aimeos\MShop\Exception $e) |
|
281 | 281 | { |
282 | - $error = array( 'locale-site-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
283 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
284 | - $this->logException( $e ); |
|
282 | + $error = array('locale-site-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
283 | + $view->errors = $view->get('errors', []) + $error; |
|
284 | + $this->logException($e); |
|
285 | 285 | } |
286 | - catch( \Exception $e ) |
|
286 | + catch (\Exception $e) |
|
287 | 287 | { |
288 | - $error = array( 'locale-site-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
289 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
290 | - $this->logException( $e ); |
|
288 | + $error = array('locale-site-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
289 | + $view->errors = $view->get('errors', []) + $error; |
|
290 | + $this->logException($e); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | $manager->rollback(); |
@@ -309,39 +309,39 @@ discard block |
||
309 | 309 | try |
310 | 310 | { |
311 | 311 | $total = 0; |
312 | - $params = $this->storeSearchParams( $view->param(), 'locale/site' ); |
|
313 | - $manager = \Aimeos\MShop::create( $context, 'locale/site' ); |
|
314 | - $search = $this->initCriteria( $manager->createSearch(), $params ); |
|
312 | + $params = $this->storeSearchParams($view->param(), 'locale/site'); |
|
313 | + $manager = \Aimeos\MShop::create($context, 'locale/site'); |
|
314 | + $search = $this->initCriteria($manager->createSearch(), $params); |
|
315 | 315 | |
316 | - if( $view->access( 'super' ) === false ) |
|
316 | + if ($view->access('super') === false) |
|
317 | 317 | { |
318 | - $search->setConditions( $search->combine( '&&', [ |
|
319 | - $search->compare( '==', 'locale.site.id', $this->getUserSiteId() ), |
|
318 | + $search->setConditions($search->combine('&&', [ |
|
319 | + $search->compare('==', 'locale.site.id', $this->getUserSiteId()), |
|
320 | 320 | $search->getConditions(), |
321 | - ] ) ); |
|
321 | + ])); |
|
322 | 322 | } |
323 | 323 | |
324 | - $view->items = $manager->searchItems( $search, [], $total ); |
|
325 | - $view->filterAttributes = $manager->getSearchAttributes( true ); |
|
324 | + $view->items = $manager->searchItems($search, [], $total); |
|
325 | + $view->filterAttributes = $manager->getSearchAttributes(true); |
|
326 | 326 | $view->filterOperators = $search->getOperators(); |
327 | 327 | $view->total = $total; |
328 | 328 | $view->itemBody = ''; |
329 | 329 | |
330 | - foreach( $this->getSubClients() as $client ) { |
|
330 | + foreach ($this->getSubClients() as $client) { |
|
331 | 331 | $view->itemBody .= $client->search(); |
332 | 332 | } |
333 | 333 | } |
334 | - catch( \Aimeos\MShop\Exception $e ) |
|
334 | + catch (\Aimeos\MShop\Exception $e) |
|
335 | 335 | { |
336 | - $error = array( 'locale-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
337 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
338 | - $this->logException( $e ); |
|
336 | + $error = array('locale-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
337 | + $view->errors = $view->get('errors', []) + $error; |
|
338 | + $this->logException($e); |
|
339 | 339 | } |
340 | - catch( \Exception $e ) |
|
340 | + catch (\Exception $e) |
|
341 | 341 | { |
342 | - $error = array( 'locale-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
343 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
344 | - $this->logException( $e ); |
|
342 | + $error = array('locale-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
343 | + $view->errors = $view->get('errors', []) + $error; |
|
344 | + $this->logException($e); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | /** admin/jqadm/locale/site/template-list |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | $tplconf = 'admin/jqadm/locale/site/template-list'; |
367 | 367 | $default = 'locale/site/list-standard'; |
368 | 368 | |
369 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
369 | + return $view->render($view->config($tplconf, $default)); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | * @param string|null $name Name of the sub-client (Default if null) |
378 | 378 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
379 | 379 | */ |
380 | - public function getSubClient( $type, $name = null ) |
|
380 | + public function getSubClient($type, $name = null) |
|
381 | 381 | { |
382 | 382 | /** admin/jqadm/locale/site/decorators/excludes |
383 | 383 | * Excludes decorators added by the "common" option from the locale JQAdm client |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | * @see admin/jqadm/locale/site/decorators/excludes |
453 | 453 | * @see admin/jqadm/locale/site/decorators/global |
454 | 454 | */ |
455 | - return $this->createSubClient( 'locale/site' . $type, $name ); |
|
455 | + return $this->createSubClient('locale/site' . $type, $name); |
|
456 | 456 | } |
457 | 457 | |
458 | 458 | |
@@ -463,13 +463,13 @@ discard block |
||
463 | 463 | * @param string $id ID of the site to access |
464 | 464 | * @throws \Aimeos\Admin\JQAdm\Exception If user isn't allowed to access the site |
465 | 465 | */ |
466 | - protected function checkSite( $super, $id = null ) |
|
466 | + protected function checkSite($super, $id = null) |
|
467 | 467 | { |
468 | - if( $super === true || (string) $this->getUserSiteId() === (string) $id ) { |
|
468 | + if ($super === true || (string) $this->getUserSiteId() === (string) $id) { |
|
469 | 469 | return; |
470 | 470 | } |
471 | 471 | |
472 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Permission denied' ) ); |
|
472 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Permission denied')); |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | |
@@ -481,9 +481,9 @@ discard block |
||
481 | 481 | protected function getUserSiteId() |
482 | 482 | { |
483 | 483 | $context = $this->getContext(); |
484 | - $manager = \Aimeos\MShop::create( $context, 'customer' ); |
|
484 | + $manager = \Aimeos\MShop::create($context, 'customer'); |
|
485 | 485 | |
486 | - return $manager->getItem( $context->getUserId() )->getSiteId(); |
|
486 | + return $manager->getItem($context->getUserId())->getSiteId(); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | * @since 2017.10 |
528 | 528 | * @category Developer |
529 | 529 | */ |
530 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/locale/site/standard/subparts', [] ); |
|
530 | + return $this->getContext()->getConfig()->get('admin/jqadm/locale/site/standard/subparts', []); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | |
@@ -538,38 +538,38 @@ discard block |
||
538 | 538 | * @param boolean $super If current user is a super user |
539 | 539 | * @return \Aimeos\MShop\Locale\Item\Iface New locale item object |
540 | 540 | */ |
541 | - protected function fromArray( array $data, $super ) |
|
541 | + protected function fromArray(array $data, $super) |
|
542 | 542 | { |
543 | 543 | $conf = []; |
544 | 544 | |
545 | - if( isset( $data['config']['key'] ) ) |
|
545 | + if (isset($data['config']['key'])) |
|
546 | 546 | { |
547 | - foreach( (array) $data['config']['key'] as $idx => $key ) |
|
547 | + foreach ((array) $data['config']['key'] as $idx => $key) |
|
548 | 548 | { |
549 | - if( trim( $key ) !== '' && isset( $data['config']['val'][$idx] ) ) { |
|
549 | + if (trim($key) !== '' && isset($data['config']['val'][$idx])) { |
|
550 | 550 | $conf[$key] = $data['config']['val'][$idx]; |
551 | 551 | } |
552 | 552 | } |
553 | 553 | } |
554 | 554 | |
555 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'locale/site' ); |
|
555 | + $manager = \Aimeos\MShop::create($this->getContext(), 'locale/site'); |
|
556 | 556 | |
557 | - if( isset( $data['locale.site.id'] ) && $data['locale.site.id'] != '' ) |
|
557 | + if (isset($data['locale.site.id']) && $data['locale.site.id'] != '') |
|
558 | 558 | { |
559 | - $this->checkSite( $super, $data['locale.site.id'] ); |
|
560 | - $item = $manager->getItem( $data['locale.site.id'] ); |
|
559 | + $this->checkSite($super, $data['locale.site.id']); |
|
560 | + $item = $manager->getItem($data['locale.site.id']); |
|
561 | 561 | } |
562 | 562 | else |
563 | 563 | { |
564 | - $this->checkSite( $super ); |
|
564 | + $this->checkSite($super); |
|
565 | 565 | $item = $manager->createItem(); |
566 | 566 | } |
567 | 567 | |
568 | - $item->fromArray( $data ); |
|
569 | - $item->setConfig( $conf ); |
|
568 | + $item->fromArray($data); |
|
569 | + $item->setConfig($conf); |
|
570 | 570 | |
571 | - if( $item->getId() == null ) { |
|
572 | - return $manager->insertItem( $item ); |
|
571 | + if ($item->getId() == null) { |
|
572 | + return $manager->insertItem($item); |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | return $item; |
@@ -582,18 +582,18 @@ discard block |
||
582 | 582 | * @param \Aimeos\MShop\Locale\Item\Iface $item Locale item object |
583 | 583 | * @return string[] Multi-dimensional associative list of item data |
584 | 584 | */ |
585 | - protected function toArray( \Aimeos\MShop\Locale\Item\Site\Iface $item, $copy = false ) |
|
585 | + protected function toArray(\Aimeos\MShop\Locale\Item\Site\Iface $item, $copy = false) |
|
586 | 586 | { |
587 | - $data = $item->toArray( true ); |
|
587 | + $data = $item->toArray(true); |
|
588 | 588 | $data['config'] = []; |
589 | 589 | |
590 | - if( $copy === true ) |
|
590 | + if ($copy === true) |
|
591 | 591 | { |
592 | 592 | $data['locale.site.code'] = $data['locale.site.code'] . '_copy'; |
593 | 593 | $data['locale.site.id'] = ''; |
594 | 594 | } |
595 | 595 | |
596 | - foreach( $item->getConfig() as $key => $value ) |
|
596 | + foreach ($item->getConfig() as $key => $value) |
|
597 | 597 | { |
598 | 598 | $data['config']['key'][] = $key; |
599 | 599 | $data['config']['val'][] = $value; |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | * |
609 | 609 | * @return string HTML output |
610 | 610 | */ |
611 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
611 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
612 | 612 | { |
613 | 613 | /** admin/jqadm/locale/site/template-item |
614 | 614 | * Relative path to the HTML body template for the locale item. |
@@ -632,6 +632,6 @@ discard block |
||
632 | 632 | $tplconf = 'admin/jqadm/locale/site/template-item'; |
633 | 633 | $default = 'locale/site/item-standard'; |
634 | 634 | |
635 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
635 | + return $view->render($view->config($tplconf, $default)); |
|
636 | 636 | } |
637 | 637 | } |