@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Product\Media; |
12 | 12 | |
13 | -sprintf( 'media' ); // for translation |
|
13 | +sprintf('media'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -42,16 +42,16 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function copy() |
44 | 44 | { |
45 | - $view = $this->addViewData( $this->getView() ); |
|
45 | + $view = $this->addViewData($this->getView()); |
|
46 | 46 | |
47 | - $view->mediaData = $this->toArray( $view->item, true ); |
|
47 | + $view->mediaData = $this->toArray($view->item, true); |
|
48 | 48 | $view->mediaBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->mediaBody .= $client->copy(); |
52 | 52 | } |
53 | 53 | |
54 | - return $this->render( $view ); |
|
54 | + return $this->render($view); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function create() |
64 | 64 | { |
65 | - $view = $this->addViewData( $this->getView() ); |
|
65 | + $view = $this->addViewData($this->getView()); |
|
66 | 66 | $siteid = $this->getContext()->getLocale()->getSiteId(); |
67 | 67 | |
68 | - $itemData = $this->toArray( $view->item ); |
|
69 | - $data = array_replace_recursive( $itemData, $view->param( 'media', [] ) ); |
|
68 | + $itemData = $this->toArray($view->item); |
|
69 | + $data = array_replace_recursive($itemData, $view->param('media', [])); |
|
70 | 70 | |
71 | - foreach( $data as $idx => $entry ) |
|
71 | + foreach ($data as $idx => $entry) |
|
72 | 72 | { |
73 | 73 | $data[$idx]['media.siteid'] = $siteid; |
74 | 74 | $data[$idx]['media.url'] = $itemData[$idx]['media.url']; |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | $view->mediaData = $data; |
80 | 80 | $view->mediaBody = ''; |
81 | 81 | |
82 | - foreach( $this->getSubClients() as $client ) { |
|
82 | + foreach ($this->getSubClients() as $client) { |
|
83 | 83 | $view->mediaBody .= $client->create(); |
84 | 84 | } |
85 | 85 | |
86 | - return $this->render( $view ); |
|
86 | + return $this->render($view); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | |
@@ -95,15 +95,15 @@ discard block |
||
95 | 95 | parent::delete(); |
96 | 96 | |
97 | 97 | $item = $this->getView()->item; |
98 | - $cntl = \Aimeos\Controller\Common\Media\Factory::create( $this->getContext() ); |
|
98 | + $cntl = \Aimeos\Controller\Common\Media\Factory::create($this->getContext()); |
|
99 | 99 | |
100 | - foreach( $item->getListItems( 'media', null, null, false ) as $listItem ) |
|
100 | + foreach ($item->getListItems('media', null, null, false) as $listItem) |
|
101 | 101 | { |
102 | - if( ( $refItem = $listItem->getRefItem() ) !== null ) { |
|
103 | - $cntl->delete( $refItem ); |
|
102 | + if (($refItem = $listItem->getRefItem()) !== null) { |
|
103 | + $cntl->delete($refItem); |
|
104 | 104 | } |
105 | 105 | |
106 | - $item->deleteListItem( 'media', $listItem, $refItem ); |
|
106 | + $item->deleteListItem('media', $listItem, $refItem); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
@@ -115,16 +115,16 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function get() |
117 | 117 | { |
118 | - $view = $this->addViewData( $this->getView() ); |
|
118 | + $view = $this->addViewData($this->getView()); |
|
119 | 119 | |
120 | - $view->mediaData = $this->toArray( $view->item ); |
|
120 | + $view->mediaData = $this->toArray($view->item); |
|
121 | 121 | $view->mediaBody = ''; |
122 | 122 | |
123 | - foreach( $this->getSubClients() as $client ) { |
|
123 | + foreach ($this->getSubClients() as $client) { |
|
124 | 124 | $view->mediaBody .= $client->get(); |
125 | 125 | } |
126 | 126 | |
127 | - return $this->render( $view ); |
|
127 | + return $this->render($view); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | |
@@ -137,26 +137,26 @@ discard block |
||
137 | 137 | |
138 | 138 | try |
139 | 139 | { |
140 | - $view->item = $this->fromArray( $view->item, $view->param( 'media', [] ) ); |
|
140 | + $view->item = $this->fromArray($view->item, $view->param('media', [])); |
|
141 | 141 | $view->mediaBody = ''; |
142 | 142 | |
143 | - foreach( $this->getSubClients() as $client ) { |
|
143 | + foreach ($this->getSubClients() as $client) { |
|
144 | 144 | $view->mediaBody .= $client->save(); |
145 | 145 | } |
146 | 146 | |
147 | 147 | return; |
148 | 148 | } |
149 | - catch( \Aimeos\MShop\Exception $e ) |
|
149 | + catch (\Aimeos\MShop\Exception $e) |
|
150 | 150 | { |
151 | - $error = array( 'product-item-media' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
152 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
153 | - $this->logException( $e ); |
|
151 | + $error = array('product-item-media' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
152 | + $view->errors = $view->get('errors', []) + $error; |
|
153 | + $this->logException($e); |
|
154 | 154 | } |
155 | - catch( \Exception $e ) |
|
155 | + catch (\Exception $e) |
|
156 | 156 | { |
157 | - $error = array( 'product-item-media' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
158 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
159 | - $this->logException( $e ); |
|
157 | + $error = array('product-item-media' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
158 | + $view->errors = $view->get('errors', []) + $error; |
|
159 | + $this->logException($e); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | throw new \Aimeos\Admin\JQAdm\Exception(); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @param string|null $name Name of the sub-client (Default if null) |
171 | 171 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
172 | 172 | */ |
173 | - public function getSubClient( $type, $name = null ) |
|
173 | + public function getSubClient($type, $name = null) |
|
174 | 174 | { |
175 | 175 | /** admin/jqadm/product/media/decorators/excludes |
176 | 176 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @see admin/jqadm/product/media/decorators/excludes |
246 | 246 | * @see admin/jqadm/product/media/decorators/global |
247 | 247 | */ |
248 | - return $this->createSubClient( 'product/media/' . $type, $name ); |
|
248 | + return $this->createSubClient('product/media/' . $type, $name); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | |
@@ -257,24 +257,24 @@ discard block |
||
257 | 257 | * @param \Aimeos\MShop\Common\Item\Lists\Iface[] $attrListItems Product list items referencing variant attributes |
258 | 258 | * @return \Aimeos\MShop\Media\Item\Iface Modified media item |
259 | 259 | */ |
260 | - protected function addMediaAttributes( \Aimeos\MShop\Media\Item\Iface $mediaItem, array $attrListItems ) |
|
260 | + protected function addMediaAttributes(\Aimeos\MShop\Media\Item\Iface $mediaItem, array $attrListItems) |
|
261 | 261 | { |
262 | - $listManager = \Aimeos\MShop::create( $this->getContext(), 'media/lists' ); |
|
263 | - $listItems = $mediaItem->getListItems( 'attribute', 'variant', null, false ); |
|
262 | + $listManager = \Aimeos\MShop::create($this->getContext(), 'media/lists'); |
|
263 | + $listItems = $mediaItem->getListItems('attribute', 'variant', null, false); |
|
264 | 264 | |
265 | - foreach( $attrListItems as $listItem ) |
|
265 | + foreach ($attrListItems as $listItem) |
|
266 | 266 | { |
267 | - if( ( $litem = $mediaItem->getListItem( 'attribute', 'variant', $listItem->getRefId(), false ) ) !== null ) |
|
267 | + if (($litem = $mediaItem->getListItem('attribute', 'variant', $listItem->getRefId(), false)) !== null) |
|
268 | 268 | { |
269 | - unset( $listItems[$litem->getId()] ); |
|
269 | + unset($listItems[$litem->getId()]); |
|
270 | 270 | continue; |
271 | 271 | } |
272 | 272 | |
273 | - $litem = $listManager->createItem()->setType( 'variant' )->setRefId( $listItem->getRefId() ); |
|
274 | - $mediaItem->addListItem( 'attribute', $litem ); |
|
273 | + $litem = $listManager->createItem()->setType('variant')->setRefId($listItem->getRefId()); |
|
274 | + $mediaItem->addListItem('attribute', $litem); |
|
275 | 275 | } |
276 | 276 | |
277 | - return $mediaItem->deleteListItems( $listItems ); |
|
277 | + return $mediaItem->deleteListItems($listItems); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | |
@@ -284,23 +284,23 @@ discard block |
||
284 | 284 | * @param \Aimeos\MW\View\Iface $view View object |
285 | 285 | * @return \Aimeos\MW\View\Iface View object with assigned parameters |
286 | 286 | */ |
287 | - protected function addViewData( \Aimeos\MW\View\Iface $view ) |
|
287 | + protected function addViewData(\Aimeos\MW\View\Iface $view) |
|
288 | 288 | { |
289 | 289 | $context = $this->getContext(); |
290 | 290 | |
291 | - $typeManager = \Aimeos\MShop::create( $this->getContext(), 'media/type' ); |
|
292 | - $listTypeManager = \Aimeos\MShop::create( $this->getContext(), 'product/lists/type' ); |
|
291 | + $typeManager = \Aimeos\MShop::create($this->getContext(), 'media/type'); |
|
292 | + $listTypeManager = \Aimeos\MShop::create($this->getContext(), 'product/lists/type'); |
|
293 | 293 | |
294 | - $search = $typeManager->createSearch( true )->setSlice( 0, 10000 ); |
|
295 | - $search->setConditions( $search->compare( '==', 'media.type.domain', 'product' ) ); |
|
296 | - $search->setSortations( [$search->sort( '+', 'media.type.position' )] ); |
|
294 | + $search = $typeManager->createSearch(true)->setSlice(0, 10000); |
|
295 | + $search->setConditions($search->compare('==', 'media.type.domain', 'product')); |
|
296 | + $search->setSortations([$search->sort('+', 'media.type.position')]); |
|
297 | 297 | |
298 | - $listSearch = $listTypeManager->createSearch( true )->setSlice( 0, 10000 ); |
|
299 | - $listSearch->setConditions( $listSearch->compare( '==', 'product.lists.type.domain', 'media' ) ); |
|
300 | - $listSearch->setSortations( [$listSearch->sort( '+', 'product.lists.type.position' )] ); |
|
298 | + $listSearch = $listTypeManager->createSearch(true)->setSlice(0, 10000); |
|
299 | + $listSearch->setConditions($listSearch->compare('==', 'product.lists.type.domain', 'media')); |
|
300 | + $listSearch->setSortations([$listSearch->sort('+', 'product.lists.type.position')]); |
|
301 | 301 | |
302 | - $view->mediaListTypes = $this->map( $listTypeManager->searchItems( $listSearch ) ); |
|
303 | - $view->mediaTypes = $this->map( $typeManager->searchItems( $search ) ); |
|
302 | + $view->mediaListTypes = $this->map($listTypeManager->searchItems($listSearch)); |
|
303 | + $view->mediaTypes = $this->map($typeManager->searchItems($search)); |
|
304 | 304 | |
305 | 305 | return $view; |
306 | 306 | } |
@@ -313,25 +313,25 @@ discard block |
||
313 | 313 | * @param array $listItems Media list items to be removed |
314 | 314 | * @return \Aimeos\MShop\Product\Item\Iface Modified product item |
315 | 315 | */ |
316 | - protected function deleteMediaItems( \Aimeos\MShop\Product\Item\Iface $item, array $listItems ) |
|
316 | + protected function deleteMediaItems(\Aimeos\MShop\Product\Item\Iface $item, array $listItems) |
|
317 | 317 | { |
318 | 318 | $context = $this->getContext(); |
319 | - $cntl = \Aimeos\Controller\Common\Media\Factory::create( $context ); |
|
320 | - $manager = \Aimeos\MShop::create( $context, 'product' ); |
|
319 | + $cntl = \Aimeos\Controller\Common\Media\Factory::create($context); |
|
320 | + $manager = \Aimeos\MShop::create($context, 'product'); |
|
321 | 321 | $search = $manager->createSearch(); |
322 | 322 | |
323 | - foreach( $listItems as $listItem ) |
|
323 | + foreach ($listItems as $listItem) |
|
324 | 324 | { |
325 | - $func = $search->createFunction( 'product:has', ['media', $listItem->getType(), $listItem->getRefId()] ); |
|
326 | - $search->setConditions( $search->compare( '!=', $func, null ) ); |
|
327 | - $items = $manager->searchItems( $search ); |
|
325 | + $func = $search->createFunction('product:has', ['media', $listItem->getType(), $listItem->getRefId()]); |
|
326 | + $search->setConditions($search->compare('!=', $func, null)); |
|
327 | + $items = $manager->searchItems($search); |
|
328 | 328 | $refItem = null; |
329 | 329 | |
330 | - if( count( $items ) === 1 && ( $refItem = $listItem->getRefItem() ) !== null ) { |
|
331 | - $cntl->delete( $refItem ); |
|
330 | + if (count($items) === 1 && ($refItem = $listItem->getRefItem()) !== null) { |
|
331 | + $cntl->delete($refItem); |
|
332 | 332 | } |
333 | 333 | |
334 | - $item->deleteListItem( 'media', $listItem, $refItem ); |
|
334 | + $item->deleteListItem('media', $listItem, $refItem); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | return $item; |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | * @since 2017.07 |
379 | 379 | * @category Developer |
380 | 380 | */ |
381 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/product/media/standard/subparts', [] ); |
|
381 | + return $this->getContext()->getConfig()->get('admin/jqadm/product/media/standard/subparts', []); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | |
@@ -388,58 +388,58 @@ discard block |
||
388 | 388 | * @param \Aimeos\MShop\Product\Item\Iface $item Product item object without referenced domain items |
389 | 389 | * @param string[] $data Data array |
390 | 390 | */ |
391 | - protected function fromArray( \Aimeos\MShop\Product\Item\Iface $item, array $data ) |
|
391 | + protected function fromArray(\Aimeos\MShop\Product\Item\Iface $item, array $data) |
|
392 | 392 | { |
393 | 393 | $context = $this->getContext(); |
394 | 394 | |
395 | - $mediaManager = \Aimeos\MShop::create( $context, 'media' ); |
|
396 | - $listManager = \Aimeos\MShop::create( $context, 'product/lists' ); |
|
397 | - $cntl = \Aimeos\Controller\Common\Media\Factory::create( $context ); |
|
395 | + $mediaManager = \Aimeos\MShop::create($context, 'media'); |
|
396 | + $listManager = \Aimeos\MShop::create($context, 'product/lists'); |
|
397 | + $cntl = \Aimeos\Controller\Common\Media\Factory::create($context); |
|
398 | 398 | |
399 | - $listItems = $item->getListItems( 'media', null, null, false ); |
|
399 | + $listItems = $item->getListItems('media', null, null, false); |
|
400 | 400 | $files = (array) $this->getView()->request()->getUploadedFiles(); |
401 | 401 | |
402 | - foreach( $data as $idx => $entry ) |
|
402 | + foreach ($data as $idx => $entry) |
|
403 | 403 | { |
404 | 404 | $listType = $entry['product.lists.type']; |
405 | 405 | |
406 | - if( ( $listItem = $item->getListItem( 'media', $listType, $entry['media.id'], false ) ) === null ) { |
|
406 | + if (($listItem = $item->getListItem('media', $listType, $entry['media.id'], false)) === null) { |
|
407 | 407 | $listItem = $listManager->createItem(); |
408 | 408 | } |
409 | 409 | |
410 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
410 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
411 | 411 | $refItem = $mediaManager->createItem(); |
412 | 412 | } |
413 | 413 | |
414 | - $refItem->fromArray( $entry ); |
|
414 | + $refItem->fromArray($entry); |
|
415 | 415 | |
416 | - if( ( $file = $this->getValue( $files, 'media/' . $idx . '/file' ) ) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE ) |
|
416 | + if (($file = $this->getValue($files, 'media/' . $idx . '/file')) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE) |
|
417 | 417 | { |
418 | - $refItem->getId() ?: $refItem->setUrl( '' )->setPreview( '' ); // keep copied media |
|
419 | - $cntl->add( $refItem, $file ); |
|
418 | + $refItem->getId() ?: $refItem->setUrl('')->setPreview(''); // keep copied media |
|
419 | + $cntl->add($refItem, $file); |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | $conf = []; |
423 | 423 | |
424 | - foreach( (array) $this->getValue( $entry, 'config/key' ) as $num => $key ) |
|
424 | + foreach ((array) $this->getValue($entry, 'config/key') as $num => $key) |
|
425 | 425 | { |
426 | - if( trim( $key ) !== '' && ( $val = $this->getValue( $entry, 'config/val/' . $num ) ) !== null ) { |
|
427 | - $conf[$key] = trim( $val ); |
|
426 | + if (trim($key) !== '' && ($val = $this->getValue($entry, 'config/val/' . $num)) !== null) { |
|
427 | + $conf[$key] = trim($val); |
|
428 | 428 | } |
429 | 429 | } |
430 | 430 | |
431 | - $listItem->fromArray( $entry ); |
|
432 | - $listItem->setPosition( $idx ); |
|
433 | - $listItem->setConfig( $conf ); |
|
431 | + $listItem->fromArray($entry); |
|
432 | + $listItem->setPosition($idx); |
|
433 | + $listItem->setConfig($conf); |
|
434 | 434 | |
435 | - $attrListItems = $item->getListItems( 'attribute', 'variant', null, false ); |
|
436 | - $refItem = $this->addMediaAttributes( $refItem, $attrListItems ); |
|
437 | - $item->addListItem( 'media', $listItem, $refItem ); |
|
435 | + $attrListItems = $item->getListItems('attribute', 'variant', null, false); |
|
436 | + $refItem = $this->addMediaAttributes($refItem, $attrListItems); |
|
437 | + $item->addListItem('media', $listItem, $refItem); |
|
438 | 438 | |
439 | - unset( $listItems[$listItem->getId()] ); |
|
439 | + unset($listItems[$listItem->getId()]); |
|
440 | 440 | } |
441 | 441 | |
442 | - return $this->deleteMediaItems( $item, $listItems ); |
|
442 | + return $this->deleteMediaItems($item, $listItems); |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | |
@@ -450,20 +450,20 @@ discard block |
||
450 | 450 | * @param boolean $copy True if items should be copied, false if not |
451 | 451 | * @return string[] Multi-dimensional associative list of item data |
452 | 452 | */ |
453 | - protected function toArray( \Aimeos\MShop\Product\Item\Iface $item, $copy = false ) |
|
453 | + protected function toArray(\Aimeos\MShop\Product\Item\Iface $item, $copy = false) |
|
454 | 454 | { |
455 | 455 | $data = []; |
456 | 456 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
457 | 457 | |
458 | - foreach( $item->getListItems( 'media', null, null, false ) as $listItem ) |
|
458 | + foreach ($item->getListItems('media', null, null, false) as $listItem) |
|
459 | 459 | { |
460 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
460 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
461 | 461 | continue; |
462 | 462 | } |
463 | 463 | |
464 | - $list = $listItem->toArray( true ) + $refItem->toArray( true ); |
|
464 | + $list = $listItem->toArray(true) + $refItem->toArray(true); |
|
465 | 465 | |
466 | - if( $copy === true ) |
|
466 | + if ($copy === true) |
|
467 | 467 | { |
468 | 468 | $list['product.lists.siteid'] = $siteId; |
469 | 469 | $list['product.lists.id'] = ''; |
@@ -471,10 +471,10 @@ discard block |
||
471 | 471 | $list['media.id'] = null; |
472 | 472 | } |
473 | 473 | |
474 | - $list['product.lists.datestart'] = str_replace( ' ', 'T', $list['product.lists.datestart'] ); |
|
475 | - $list['product.lists.dateend'] = str_replace( ' ', 'T', $list['product.lists.dateend'] ); |
|
474 | + $list['product.lists.datestart'] = str_replace(' ', 'T', $list['product.lists.datestart']); |
|
475 | + $list['product.lists.dateend'] = str_replace(' ', 'T', $list['product.lists.dateend']); |
|
476 | 476 | |
477 | - foreach( $list['product.lists.config'] as $key => $val ) |
|
477 | + foreach ($list['product.lists.config'] as $key => $val) |
|
478 | 478 | { |
479 | 479 | $list['config']['key'][] = $key; |
480 | 480 | $list['config']['val'][] = $val; |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
494 | 494 | * @return string HTML output |
495 | 495 | */ |
496 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
496 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
497 | 497 | { |
498 | 498 | /** admin/jqadm/product/media/template-item |
499 | 499 | * Relative path to the HTML body template of the media subpart for products. |
@@ -517,6 +517,6 @@ discard block |
||
517 | 517 | $tplconf = 'admin/jqadm/product/media/template-item'; |
518 | 518 | $default = 'product/item-media-standard'; |
519 | 519 | |
520 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
520 | + return $view->render($view->config($tplconf, $default)); |
|
521 | 521 | } |
522 | 522 | } |
523 | 523 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Product\Price; |
12 | 12 | |
13 | -sprintf( 'price' ); // for translation |
|
13 | +sprintf('price'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -42,16 +42,16 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function copy() |
44 | 44 | { |
45 | - $view = $this->addViewData( $this->getView() ); |
|
45 | + $view = $this->addViewData($this->getView()); |
|
46 | 46 | |
47 | - $view->priceData = $this->toArray( $view->item, true ); |
|
47 | + $view->priceData = $this->toArray($view->item, true); |
|
48 | 48 | $view->priceBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->priceBody .= $client->copy(); |
52 | 52 | } |
53 | 53 | |
54 | - return $this->render( $view ); |
|
54 | + return $this->render($view); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function create() |
64 | 64 | { |
65 | - $view = $this->addViewData( $this->getView() ); |
|
65 | + $view = $this->addViewData($this->getView()); |
|
66 | 66 | $siteid = $this->getContext()->getLocale()->getSiteId(); |
67 | - $data = $view->param( 'price', [] ); |
|
67 | + $data = $view->param('price', []); |
|
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]['price.siteid'] = $siteid; |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | $view->priceData = $data; |
76 | 76 | $view->priceBody = ''; |
77 | 77 | |
78 | - foreach( $this->getSubClients() as $client ) { |
|
78 | + foreach ($this->getSubClients() as $client) { |
|
79 | 79 | $view->priceBody .= $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( 'price', null, null, false ), true ); |
|
94 | + $item->deleteListItems($item->getListItems('price', null, null, false), true); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
@@ -102,16 +102,16 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function get() |
104 | 104 | { |
105 | - $view = $this->addViewData( $this->getView() ); |
|
105 | + $view = $this->addViewData($this->getView()); |
|
106 | 106 | |
107 | - $view->priceData = $this->toArray( $view->item ); |
|
107 | + $view->priceData = $this->toArray($view->item); |
|
108 | 108 | $view->priceBody = ''; |
109 | 109 | |
110 | - foreach( $this->getSubClients() as $client ) { |
|
110 | + foreach ($this->getSubClients() as $client) { |
|
111 | 111 | $view->priceBody .= $client->get(); |
112 | 112 | } |
113 | 113 | |
114 | - return $this->render( $view ); |
|
114 | + return $this->render($view); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -124,26 +124,26 @@ discard block |
||
124 | 124 | |
125 | 125 | try |
126 | 126 | { |
127 | - $view->item = $this->fromArray( $view->item, $view->param( 'price', [] ) ); |
|
127 | + $view->item = $this->fromArray($view->item, $view->param('price', [])); |
|
128 | 128 | $view->priceBody = ''; |
129 | 129 | |
130 | - foreach( $this->getSubClients() as $client ) { |
|
130 | + foreach ($this->getSubClients() as $client) { |
|
131 | 131 | $view->priceBody .= $client->save(); |
132 | 132 | } |
133 | 133 | |
134 | 134 | return; |
135 | 135 | } |
136 | - catch( \Aimeos\MShop\Exception $e ) |
|
136 | + catch (\Aimeos\MShop\Exception $e) |
|
137 | 137 | { |
138 | - $error = array( 'product-item-price' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
139 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
140 | - $this->logException( $e ); |
|
138 | + $error = array('product-item-price' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
139 | + $view->errors = $view->get('errors', []) + $error; |
|
140 | + $this->logException($e); |
|
141 | 141 | } |
142 | - catch( \Exception $e ) |
|
142 | + catch (\Exception $e) |
|
143 | 143 | { |
144 | - $error = array( 'product-item-price' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
145 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
146 | - $this->logException( $e ); |
|
144 | + $error = array('product-item-price' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
145 | + $view->errors = $view->get('errors', []) + $error; |
|
146 | + $this->logException($e); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | throw new \Aimeos\Admin\JQAdm\Exception(); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @param string|null $name Name of the sub-client (Default if null) |
158 | 158 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
159 | 159 | */ |
160 | - public function getSubClient( $type, $name = null ) |
|
160 | + public function getSubClient($type, $name = null) |
|
161 | 161 | { |
162 | 162 | /** admin/jqadm/product/price/decorators/excludes |
163 | 163 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @see admin/jqadm/product/price/decorators/excludes |
233 | 233 | * @see admin/jqadm/product/price/decorators/global |
234 | 234 | */ |
235 | - return $this->createSubClient( 'product/price/' . $type, $name ); |
|
235 | + return $this->createSubClient('product/price/' . $type, $name); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * @since 2016.01 |
277 | 277 | * @category Developer |
278 | 278 | */ |
279 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/product/price/standard/subparts', [] ); |
|
279 | + return $this->getContext()->getConfig()->get('admin/jqadm/product/price/standard/subparts', []); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | |
@@ -286,28 +286,28 @@ discard block |
||
286 | 286 | * @param \Aimeos\MW\View\Iface $view View object |
287 | 287 | * @return \Aimeos\MW\View\Iface View object with assigned parameters |
288 | 288 | */ |
289 | - protected function addViewData( \Aimeos\MW\View\Iface $view ) |
|
289 | + protected function addViewData(\Aimeos\MW\View\Iface $view) |
|
290 | 290 | { |
291 | 291 | $context = $this->getContext(); |
292 | 292 | |
293 | - $priceTypeManager = \Aimeos\MShop::create( $context, 'price/type' ); |
|
294 | - $listTypeManager = \Aimeos\MShop::create( $context, 'product/lists/type' ); |
|
295 | - $currencyManager = \Aimeos\MShop::create( $context, 'locale/currency' ); |
|
293 | + $priceTypeManager = \Aimeos\MShop::create($context, 'price/type'); |
|
294 | + $listTypeManager = \Aimeos\MShop::create($context, 'product/lists/type'); |
|
295 | + $currencyManager = \Aimeos\MShop::create($context, 'locale/currency'); |
|
296 | 296 | |
297 | - $search = $priceTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff ); |
|
298 | - $search->setConditions( $search->compare( '==', 'price.type.domain', 'product' ) ); |
|
299 | - $search->setSortations( array( $search->sort( '+', 'price.type.position' ) ) ); |
|
297 | + $search = $priceTypeManager->createSearch(true)->setSlice(0, 0x7fffffff); |
|
298 | + $search->setConditions($search->compare('==', 'price.type.domain', 'product')); |
|
299 | + $search->setSortations(array($search->sort('+', 'price.type.position'))); |
|
300 | 300 | |
301 | - $listSearch = $listTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff ); |
|
302 | - $listSearch->setConditions( $listSearch->compare( '==', 'product.lists.type.domain', 'price' ) ); |
|
303 | - $listSearch->setSortations( array( $listSearch->sort( '+', 'product.lists.type.position' ) ) ); |
|
301 | + $listSearch = $listTypeManager->createSearch(true)->setSlice(0, 0x7fffffff); |
|
302 | + $listSearch->setConditions($listSearch->compare('==', 'product.lists.type.domain', 'price')); |
|
303 | + $listSearch->setSortations(array($listSearch->sort('+', 'product.lists.type.position'))); |
|
304 | 304 | |
305 | - $view->priceTypes = $this->map( $priceTypeManager->searchItems( $search ) ); |
|
306 | - $view->priceListTypes = $this->map( $listTypeManager->searchItems( $listSearch ) ); |
|
307 | - $view->priceCurrencies = $currencyManager->searchItems( $currencyManager->createSearch( true )->setSlice( 0, 0x7fffffff ) ); |
|
305 | + $view->priceTypes = $this->map($priceTypeManager->searchItems($search)); |
|
306 | + $view->priceListTypes = $this->map($listTypeManager->searchItems($listSearch)); |
|
307 | + $view->priceCurrencies = $currencyManager->searchItems($currencyManager->createSearch(true)->setSlice(0, 0x7fffffff)); |
|
308 | 308 | |
309 | - if( $view->priceCurrencies === [] ) { |
|
310 | - throw new \Aimeos\Admin\JQAdm\Exception( 'No currencies available. Please enable at least one currency' ); |
|
309 | + if ($view->priceCurrencies === []) { |
|
310 | + throw new \Aimeos\Admin\JQAdm\Exception('No currencies available. Please enable at least one currency'); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | return $view; |
@@ -320,48 +320,48 @@ discard block |
||
320 | 320 | * @param \Aimeos\MShop\Product\Item\Iface $item Product item object without referenced domain items |
321 | 321 | * @param string[] $data Data array |
322 | 322 | */ |
323 | - protected function fromArray( \Aimeos\MShop\Product\Item\Iface $item, array $data ) |
|
323 | + protected function fromArray(\Aimeos\MShop\Product\Item\Iface $item, array $data) |
|
324 | 324 | { |
325 | 325 | $context = $this->getContext(); |
326 | 326 | |
327 | - $priceManager = \Aimeos\MShop::create( $context, 'price' ); |
|
328 | - $listManager = \Aimeos\MShop::create( $context, 'product/lists' ); |
|
327 | + $priceManager = \Aimeos\MShop::create($context, 'price'); |
|
328 | + $listManager = \Aimeos\MShop::create($context, 'product/lists'); |
|
329 | 329 | |
330 | - $listItems = $item->getListItems( 'price', null, null, false ); |
|
330 | + $listItems = $item->getListItems('price', null, null, false); |
|
331 | 331 | |
332 | 332 | |
333 | - foreach( $data as $idx => $entry ) |
|
333 | + foreach ($data as $idx => $entry) |
|
334 | 334 | { |
335 | 335 | $listType = $entry['product.lists.type']; |
336 | 336 | |
337 | - if( ( $listItem = $item->getListItem( 'price', $listType, $entry['price.id'], false ) ) === null ) { |
|
337 | + if (($listItem = $item->getListItem('price', $listType, $entry['price.id'], false)) === null) { |
|
338 | 338 | $listItem = $listManager->createItem(); |
339 | 339 | } |
340 | 340 | |
341 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
341 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
342 | 342 | $refItem = $priceManager->createItem(); |
343 | 343 | } |
344 | 344 | |
345 | - $refItem->fromArray( $entry ); |
|
345 | + $refItem->fromArray($entry); |
|
346 | 346 | $conf = []; |
347 | 347 | |
348 | - foreach( (array) $this->getValue( $entry, 'config/key' ) as $num => $key ) |
|
348 | + foreach ((array) $this->getValue($entry, 'config/key') as $num => $key) |
|
349 | 349 | { |
350 | - if( trim( $key ) !== '' && ( $val = $this->getValue( $entry, 'config/val/' . $num ) ) !== null ) { |
|
351 | - $conf[$key] = trim( $val ); |
|
350 | + if (trim($key) !== '' && ($val = $this->getValue($entry, 'config/val/' . $num)) !== null) { |
|
351 | + $conf[$key] = trim($val); |
|
352 | 352 | } |
353 | 353 | } |
354 | 354 | |
355 | - $listItem->fromArray( $entry ); |
|
356 | - $listItem->setPosition( $idx ); |
|
357 | - $listItem->setConfig( $conf ); |
|
355 | + $listItem->fromArray($entry); |
|
356 | + $listItem->setPosition($idx); |
|
357 | + $listItem->setConfig($conf); |
|
358 | 358 | |
359 | - $item->addListItem( 'price', $listItem, $refItem ); |
|
359 | + $item->addListItem('price', $listItem, $refItem); |
|
360 | 360 | |
361 | - unset( $listItems[$listItem->getId()] ); |
|
361 | + unset($listItems[$listItem->getId()]); |
|
362 | 362 | } |
363 | 363 | |
364 | - return $item->deleteListItems( $listItems, true ); |
|
364 | + return $item->deleteListItems($listItems, true); |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | |
@@ -372,20 +372,20 @@ discard block |
||
372 | 372 | * @param boolean $copy True if items should be copied, false if not |
373 | 373 | * @return string[] Multi-dimensional associative list of item data |
374 | 374 | */ |
375 | - protected function toArray( \Aimeos\MShop\Product\Item\Iface $item, $copy = false ) |
|
375 | + protected function toArray(\Aimeos\MShop\Product\Item\Iface $item, $copy = false) |
|
376 | 376 | { |
377 | 377 | $data = []; |
378 | 378 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
379 | 379 | |
380 | - foreach( $item->getListItems( 'price', null, null, false ) as $listItem ) |
|
380 | + foreach ($item->getListItems('price', null, null, false) as $listItem) |
|
381 | 381 | { |
382 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
382 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
383 | 383 | continue; |
384 | 384 | } |
385 | 385 | |
386 | - $list = $listItem->toArray( true ) + $refItem->toArray( true ); |
|
386 | + $list = $listItem->toArray(true) + $refItem->toArray(true); |
|
387 | 387 | |
388 | - if( $copy === true ) |
|
388 | + if ($copy === true) |
|
389 | 389 | { |
390 | 390 | $list['product.lists.siteid'] = $siteId; |
391 | 391 | $list['product.lists.id'] = ''; |
@@ -393,10 +393,10 @@ discard block |
||
393 | 393 | $list['price.id'] = null; |
394 | 394 | } |
395 | 395 | |
396 | - $list['product.lists.datestart'] = str_replace( ' ', 'T', $list['product.lists.datestart'] ); |
|
397 | - $list['product.lists.dateend'] = str_replace( ' ', 'T', $list['product.lists.dateend'] ); |
|
396 | + $list['product.lists.datestart'] = str_replace(' ', 'T', $list['product.lists.datestart']); |
|
397 | + $list['product.lists.dateend'] = str_replace(' ', 'T', $list['product.lists.dateend']); |
|
398 | 398 | |
399 | - foreach( $list['product.lists.config'] as $key => $val ) |
|
399 | + foreach ($list['product.lists.config'] as $key => $val) |
|
400 | 400 | { |
401 | 401 | $list['config']['key'][] = $key; |
402 | 402 | $list['config']['val'][] = $val; |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
416 | 416 | * @return string HTML output |
417 | 417 | */ |
418 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
418 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
419 | 419 | { |
420 | 420 | /** admin/jqadm/product/price/template-item |
421 | 421 | * Relative path to the HTML body template of the price subpart for products. |
@@ -439,6 +439,6 @@ discard block |
||
439 | 439 | $tplconf = 'admin/jqadm/product/price/template-item'; |
440 | 440 | $default = 'product/item-price-standard'; |
441 | 441 | |
442 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
442 | + return $view->render($view->config($tplconf, $default)); |
|
443 | 443 | } |
444 | 444 | } |
445 | 445 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Product\Text; |
12 | 12 | |
13 | -sprintf( 'text' ); // for translation |
|
13 | +sprintf('text'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -42,16 +42,16 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function copy() |
44 | 44 | { |
45 | - $view = $this->addViewData( $this->getView() ); |
|
45 | + $view = $this->addViewData($this->getView()); |
|
46 | 46 | |
47 | - $view->textData = $this->toArray( $view->item, true ); |
|
47 | + $view->textData = $this->toArray($view->item, true); |
|
48 | 48 | $view->textBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->textBody .= $client->copy(); |
52 | 52 | } |
53 | 53 | |
54 | - return $this->render( $view ); |
|
54 | + return $this->render($view); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function create() |
64 | 64 | { |
65 | - $view = $this->addViewData( $this->getView() ); |
|
65 | + $view = $this->addViewData($this->getView()); |
|
66 | 66 | $siteid = $this->getContext()->getLocale()->getSiteId(); |
67 | - $data = $view->param( 'text', [] ); |
|
67 | + $data = $view->param('text', []); |
|
68 | 68 | |
69 | - foreach( $data as $idx => $entry ) |
|
69 | + foreach ($data as $idx => $entry) |
|
70 | 70 | { |
71 | 71 | $data[$idx]['product.lists.siteid'] = $siteid; |
72 | 72 | $data[$idx]['text.siteid'] = $siteid; |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | $view->textData = $data; |
76 | 76 | $view->textBody = ''; |
77 | 77 | |
78 | - foreach( $this->getSubClients() as $client ) { |
|
78 | + foreach ($this->getSubClients() as $client) { |
|
79 | 79 | $view->textBody .= $client->create(); |
80 | 80 | } |
81 | 81 | |
82 | - return $this->render( $view ); |
|
82 | + return $this->render($view); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | parent::delete(); |
92 | 92 | |
93 | 93 | $item = $this->getView()->item; |
94 | - $item->deleteListItems( $item->getListItems( 'text', null, null, false ), true ); |
|
94 | + $item->deleteListItems($item->getListItems('text', null, null, false), true); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
@@ -102,16 +102,16 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function get() |
104 | 104 | { |
105 | - $view = $this->addViewData( $this->getView() ); |
|
105 | + $view = $this->addViewData($this->getView()); |
|
106 | 106 | |
107 | - $view->textData = $this->toArray( $view->item ); |
|
107 | + $view->textData = $this->toArray($view->item); |
|
108 | 108 | $view->textBody = ''; |
109 | 109 | |
110 | - foreach( $this->getSubClients() as $client ) { |
|
110 | + foreach ($this->getSubClients() as $client) { |
|
111 | 111 | $view->textBody .= $client->get(); |
112 | 112 | } |
113 | 113 | |
114 | - return $this->render( $view ); |
|
114 | + return $this->render($view); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -124,26 +124,26 @@ discard block |
||
124 | 124 | |
125 | 125 | try |
126 | 126 | { |
127 | - $view->item = $this->fromArray( $view->item, $view->param( 'text', [] ) ); |
|
127 | + $view->item = $this->fromArray($view->item, $view->param('text', [])); |
|
128 | 128 | $view->textBody = ''; |
129 | 129 | |
130 | - foreach( $this->getSubClients() as $client ) { |
|
130 | + foreach ($this->getSubClients() as $client) { |
|
131 | 131 | $view->textBody .= $client->save(); |
132 | 132 | } |
133 | 133 | |
134 | 134 | return; |
135 | 135 | } |
136 | - catch( \Aimeos\MShop\Exception $e ) |
|
136 | + catch (\Aimeos\MShop\Exception $e) |
|
137 | 137 | { |
138 | - $error = array( 'product-item-text' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
139 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
140 | - $this->logException( $e ); |
|
138 | + $error = array('product-item-text' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
139 | + $view->errors = $view->get('errors', []) + $error; |
|
140 | + $this->logException($e); |
|
141 | 141 | } |
142 | - catch( \Exception $e ) |
|
142 | + catch (\Exception $e) |
|
143 | 143 | { |
144 | - $error = array( 'product-item-text' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
145 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
146 | - $this->logException( $e ); |
|
144 | + $error = array('product-item-text' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
145 | + $view->errors = $view->get('errors', []) + $error; |
|
146 | + $this->logException($e); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | throw new \Aimeos\Admin\JQAdm\Exception(); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @param string|null $name Name of the sub-client (Default if null) |
158 | 158 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
159 | 159 | */ |
160 | - public function getSubClient( $type, $name = null ) |
|
160 | + public function getSubClient($type, $name = null) |
|
161 | 161 | { |
162 | 162 | /** admin/jqadm/product/text/decorators/excludes |
163 | 163 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @see admin/jqadm/product/text/decorators/excludes |
233 | 233 | * @see admin/jqadm/product/text/decorators/global |
234 | 234 | */ |
235 | - return $this->createSubClient( 'product/text/' . $type, $name ); |
|
235 | + return $this->createSubClient('product/text/' . $type, $name); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * @since 2017.07 |
277 | 277 | * @category Developer |
278 | 278 | */ |
279 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/product/text/standard/subparts', [] ); |
|
279 | + return $this->getContext()->getConfig()->get('admin/jqadm/product/text/standard/subparts', []); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | |
@@ -286,23 +286,23 @@ discard block |
||
286 | 286 | * @param \Aimeos\MW\View\Iface $view View object |
287 | 287 | * @return \Aimeos\MW\View\Iface View object with assigned parameters |
288 | 288 | */ |
289 | - protected function addViewData( \Aimeos\MW\View\Iface $view ) |
|
289 | + protected function addViewData(\Aimeos\MW\View\Iface $view) |
|
290 | 290 | { |
291 | 291 | $context = $this->getContext(); |
292 | 292 | |
293 | - $textTypeManager = \Aimeos\MShop::create( $context, 'text/type' ); |
|
294 | - $listTypeManager = \Aimeos\MShop::create( $context, 'product/lists/type' ); |
|
293 | + $textTypeManager = \Aimeos\MShop::create($context, 'text/type'); |
|
294 | + $listTypeManager = \Aimeos\MShop::create($context, 'product/lists/type'); |
|
295 | 295 | |
296 | - $search = $textTypeManager->createSearch( true )->setSlice( 0, 10000 ); |
|
297 | - $search->setConditions( $search->compare( '==', 'text.type.domain', 'product' ) ); |
|
298 | - $search->setSortations( array( $search->sort( '+', 'text.type.position' ) ) ); |
|
296 | + $search = $textTypeManager->createSearch(true)->setSlice(0, 10000); |
|
297 | + $search->setConditions($search->compare('==', 'text.type.domain', 'product')); |
|
298 | + $search->setSortations(array($search->sort('+', 'text.type.position'))); |
|
299 | 299 | |
300 | - $listSearch = $listTypeManager->createSearch( true )->setSlice( 0, 10000 ); |
|
301 | - $listSearch->setConditions( $listSearch->compare( '==', 'product.lists.type.domain', 'text' ) ); |
|
302 | - $listSearch->setSortations( array( $listSearch->sort( '+', 'product.lists.type.position' ) ) ); |
|
300 | + $listSearch = $listTypeManager->createSearch(true)->setSlice(0, 10000); |
|
301 | + $listSearch->setConditions($listSearch->compare('==', 'product.lists.type.domain', 'text')); |
|
302 | + $listSearch->setSortations(array($listSearch->sort('+', 'product.lists.type.position'))); |
|
303 | 303 | |
304 | - $view->textTypes = $this->map( $textTypeManager->searchItems( $search ) ); |
|
305 | - $view->textListTypes = $this->map( $listTypeManager->searchItems( $listSearch ) ); |
|
304 | + $view->textTypes = $this->map($textTypeManager->searchItems($search)); |
|
305 | + $view->textListTypes = $this->map($listTypeManager->searchItems($listSearch)); |
|
306 | 306 | |
307 | 307 | return $view; |
308 | 308 | } |
@@ -314,52 +314,52 @@ discard block |
||
314 | 314 | * @param \Aimeos\MShop\Product\Item\Iface $item Product item object without referenced domain items |
315 | 315 | * @param string[] $data Data array |
316 | 316 | */ |
317 | - protected function fromArray( \Aimeos\MShop\Product\Item\Iface $item, array $data ) |
|
317 | + protected function fromArray(\Aimeos\MShop\Product\Item\Iface $item, array $data) |
|
318 | 318 | { |
319 | 319 | $context = $this->getContext(); |
320 | 320 | |
321 | - $textManager = \Aimeos\MShop::create( $context, 'text' ); |
|
322 | - $listManager = \Aimeos\MShop::create( $context, 'product/lists' ); |
|
321 | + $textManager = \Aimeos\MShop::create($context, 'text'); |
|
322 | + $listManager = \Aimeos\MShop::create($context, 'product/lists'); |
|
323 | 323 | |
324 | - $listItems = $item->getListItems( 'text', null, null, false ); |
|
324 | + $listItems = $item->getListItems('text', null, null, false); |
|
325 | 325 | |
326 | 326 | |
327 | - foreach( $data as $idx => $entry ) |
|
327 | + foreach ($data as $idx => $entry) |
|
328 | 328 | { |
329 | - if( trim( $this->getValue( $entry, 'text.content', '' ) ) === '' ) { |
|
329 | + if (trim($this->getValue($entry, 'text.content', '')) === '') { |
|
330 | 330 | continue; |
331 | 331 | } |
332 | 332 | |
333 | 333 | $listType = $entry['product.lists.type']; |
334 | 334 | |
335 | - if( ( $listItem = $item->getListItem( 'text', $listType, $entry['text.id'], false ) ) === null ) { |
|
335 | + if (($listItem = $item->getListItem('text', $listType, $entry['text.id'], false)) === null) { |
|
336 | 336 | $listItem = $listManager->createItem(); |
337 | 337 | } |
338 | 338 | |
339 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
339 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
340 | 340 | $refItem = $textManager->createItem(); |
341 | 341 | } |
342 | 342 | |
343 | - $refItem->fromArray( $entry ); |
|
343 | + $refItem->fromArray($entry); |
|
344 | 344 | $conf = []; |
345 | 345 | |
346 | - foreach( (array) $this->getValue( $entry, 'config/key' ) as $num => $key ) |
|
346 | + foreach ((array) $this->getValue($entry, 'config/key') as $num => $key) |
|
347 | 347 | { |
348 | - if( trim( $key ) !== '' && ( $val = $this->getValue( $entry, 'config/val/' . $num ) ) !== null ) { |
|
349 | - $conf[$key] = trim( $val ); |
|
348 | + if (trim($key) !== '' && ($val = $this->getValue($entry, 'config/val/' . $num)) !== null) { |
|
349 | + $conf[$key] = trim($val); |
|
350 | 350 | } |
351 | 351 | } |
352 | 352 | |
353 | - $listItem->fromArray( $entry ); |
|
354 | - $listItem->setPosition( $idx ); |
|
355 | - $listItem->setConfig( $conf ); |
|
353 | + $listItem->fromArray($entry); |
|
354 | + $listItem->setPosition($idx); |
|
355 | + $listItem->setConfig($conf); |
|
356 | 356 | |
357 | - $item->addListItem( 'text', $listItem, $refItem ); |
|
357 | + $item->addListItem('text', $listItem, $refItem); |
|
358 | 358 | |
359 | - unset( $listItems[$listItem->getId()] ); |
|
359 | + unset($listItems[$listItem->getId()]); |
|
360 | 360 | } |
361 | 361 | |
362 | - return $item->deleteListItems( $listItems, true ); |
|
362 | + return $item->deleteListItems($listItems, true); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | |
@@ -370,20 +370,20 @@ discard block |
||
370 | 370 | * @param boolean $copy True if items should be copied, false if not |
371 | 371 | * @return string[] Multi-dimensional associative list of item data |
372 | 372 | */ |
373 | - protected function toArray( \Aimeos\MShop\Product\Item\Iface $item, $copy = false ) |
|
373 | + protected function toArray(\Aimeos\MShop\Product\Item\Iface $item, $copy = false) |
|
374 | 374 | { |
375 | 375 | $data = []; |
376 | 376 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
377 | 377 | |
378 | - foreach( $item->getListItems( 'text', null, null, false ) as $listItem ) |
|
378 | + foreach ($item->getListItems('text', null, null, false) as $listItem) |
|
379 | 379 | { |
380 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
380 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
381 | 381 | continue; |
382 | 382 | } |
383 | 383 | |
384 | - $list = $listItem->toArray( true ) + $refItem->toArray( true ); |
|
384 | + $list = $listItem->toArray(true) + $refItem->toArray(true); |
|
385 | 385 | |
386 | - if( $copy === true ) |
|
386 | + if ($copy === true) |
|
387 | 387 | { |
388 | 388 | $list['product.lists.siteid'] = $siteId; |
389 | 389 | $list['product.lists.id'] = ''; |
@@ -391,10 +391,10 @@ discard block |
||
391 | 391 | $list['text.id'] = null; |
392 | 392 | } |
393 | 393 | |
394 | - $list['product.lists.datestart'] = str_replace( ' ', 'T', $list['product.lists.datestart'] ); |
|
395 | - $list['product.lists.dateend'] = str_replace( ' ', 'T', $list['product.lists.dateend'] ); |
|
394 | + $list['product.lists.datestart'] = str_replace(' ', 'T', $list['product.lists.datestart']); |
|
395 | + $list['product.lists.dateend'] = str_replace(' ', 'T', $list['product.lists.dateend']); |
|
396 | 396 | |
397 | - foreach( $list['product.lists.config'] as $key => $val ) |
|
397 | + foreach ($list['product.lists.config'] as $key => $val) |
|
398 | 398 | { |
399 | 399 | $list['config']['key'][] = $key; |
400 | 400 | $list['config']['val'][] = $val; |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
414 | 414 | * @return string HTML output |
415 | 415 | */ |
416 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
416 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
417 | 417 | { |
418 | 418 | /** admin/jqadm/product/text/template-item |
419 | 419 | * Relative path to the HTML body template of the text subpart for products. |
@@ -437,6 +437,6 @@ discard block |
||
437 | 437 | $tplconf = 'admin/jqadm/product/text/template-item'; |
438 | 438 | $default = 'product/item-text-standard'; |
439 | 439 | |
440 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
440 | + return $view->render($view->config($tplconf, $default)); |
|
441 | 441 | } |
442 | 442 | } |
443 | 443 | \ No newline at end of file |
@@ -42,15 +42,15 @@ discard block |
||
42 | 42 | { |
43 | 43 | $view = $this->getView(); |
44 | 44 | |
45 | - $view->propertyData = $this->toArray( $view->item, true ); |
|
45 | + $view->propertyData = $this->toArray($view->item, true); |
|
46 | 46 | $view->propertyTypes = $this->getPropertyTypes(); |
47 | 47 | $view->propertyBody = ''; |
48 | 48 | |
49 | - foreach( $this->getSubClients() as $client ) { |
|
49 | + foreach ($this->getSubClients() as $client) { |
|
50 | 50 | $view->propertyBody .= $client->copy(); |
51 | 51 | } |
52 | 52 | |
53 | - return $this->render( $view ); |
|
53 | + return $this->render($view); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | { |
64 | 64 | $view = $this->getView(); |
65 | 65 | $siteid = $this->getContext()->getLocale()->getSiteId(); |
66 | - $data = $view->param( 'characteristic/property', [] ); |
|
66 | + $data = $view->param('characteristic/property', []); |
|
67 | 67 | |
68 | - foreach( $data as $idx => $entry ) { |
|
68 | + foreach ($data as $idx => $entry) { |
|
69 | 69 | $data[$idx]['product.lists.siteid'] = $siteid; |
70 | 70 | } |
71 | 71 | |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | $view->propertyData = $data; |
74 | 74 | $view->propertyBody = ''; |
75 | 75 | |
76 | - foreach( $this->getSubClients() as $client ) { |
|
76 | + foreach ($this->getSubClients() as $client) { |
|
77 | 77 | $view->propertyBody .= $client->create(); |
78 | 78 | } |
79 | 79 | |
80 | - return $this->render( $view ); |
|
80 | + return $this->render($view); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -90,15 +90,15 @@ discard block |
||
90 | 90 | { |
91 | 91 | $view = $this->getView(); |
92 | 92 | |
93 | - $view->propertyData = $this->toArray( $view->item ); |
|
93 | + $view->propertyData = $this->toArray($view->item); |
|
94 | 94 | $view->propertyTypes = $this->getPropertyTypes(); |
95 | 95 | $view->propertyBody = ''; |
96 | 96 | |
97 | - foreach( $this->getSubClients() as $client ) { |
|
97 | + foreach ($this->getSubClients() as $client) { |
|
98 | 98 | $view->propertyBody .= $client->get(); |
99 | 99 | } |
100 | 100 | |
101 | - return $this->render( $view ); |
|
101 | + return $this->render($view); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | { |
110 | 110 | $view = $this->getView(); |
111 | 111 | |
112 | - $this->fromArray( $view->item, $view->param( 'characteristic/property', [] ) ); |
|
112 | + $this->fromArray($view->item, $view->param('characteristic/property', [])); |
|
113 | 113 | $view->propertyBody = ''; |
114 | 114 | |
115 | - foreach( $this->getSubClients() as $client ) { |
|
115 | + foreach ($this->getSubClients() as $client) { |
|
116 | 116 | $view->propertyBody .= $client->save(); |
117 | 117 | } |
118 | 118 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @param string|null $name Name of the sub-client (Default if null) |
126 | 126 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
127 | 127 | */ |
128 | - public function getSubClient( $type, $name = null ) |
|
128 | + public function getSubClient($type, $name = null) |
|
129 | 129 | { |
130 | 130 | /** admin/jqadm/product/characteristic/property/decorators/excludes |
131 | 131 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * @see admin/jqadm/product/characteristic/property/decorators/excludes |
201 | 201 | * @see admin/jqadm/product/characteristic/property/decorators/global |
202 | 202 | */ |
203 | - return $this->createSubClient( 'product/characteristic/property/' . $type, $name ); |
|
203 | + return $this->createSubClient('product/characteristic/property/' . $type, $name); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | |
@@ -210,14 +210,14 @@ discard block |
||
210 | 210 | * @param \Aimeos\MShop\Common\Item\Property\Iface[] $propItems List of property items |
211 | 211 | * @return \Aimeos\MShop\Common\Item\Property\Iface[] Filtered list of property items |
212 | 212 | */ |
213 | - protected function excludeItems( array $propItems ) |
|
213 | + protected function excludeItems(array $propItems) |
|
214 | 214 | { |
215 | - $excludes = array( 'package-length', 'package-height', 'package-width', 'package-weight' ); |
|
215 | + $excludes = array('package-length', 'package-height', 'package-width', 'package-weight'); |
|
216 | 216 | |
217 | - foreach( $propItems as $key => $propItem ) |
|
217 | + foreach ($propItems as $key => $propItem) |
|
218 | 218 | { |
219 | - if( in_array( $propItem->getType(), $excludes ) ) { |
|
220 | - unset( $propItems[$key] ); |
|
219 | + if (in_array($propItem->getType(), $excludes)) { |
|
220 | + unset($propItems[$key]); |
|
221 | 221 | } |
222 | 222 | } |
223 | 223 | |
@@ -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/characteristic/property/standard/subparts', [] ); |
|
268 | + return $this->getContext()->getConfig()->get('admin/jqadm/product/characteristic/property/standard/subparts', []); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | |
@@ -276,14 +276,14 @@ discard block |
||
276 | 276 | */ |
277 | 277 | protected function getPropertyTypes() |
278 | 278 | { |
279 | - $excludes = array( 'package-length', 'package-height', 'package-width', 'package-weight' ); |
|
280 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'product/property/type' ); |
|
279 | + $excludes = array('package-length', 'package-height', 'package-width', 'package-weight'); |
|
280 | + $manager = \Aimeos\MShop::create($this->getContext(), 'product/property/type'); |
|
281 | 281 | |
282 | - $search = $manager->createSearch( true )->setSlice( 0, 10000 ); |
|
283 | - $search->setConditions( $search->compare( '!=', 'product.property.type.code', $excludes ) ); |
|
284 | - $search->setSortations( [$search->sort( '+', 'product.property.type.position')] ); |
|
282 | + $search = $manager->createSearch(true)->setSlice(0, 10000); |
|
283 | + $search->setConditions($search->compare('!=', 'product.property.type.code', $excludes)); |
|
284 | + $search->setSortations([$search->sort('+', 'product.property.type.position')]); |
|
285 | 285 | |
286 | - return $this->map( $manager->searchItems( $search ) ); |
|
286 | + return $this->map($manager->searchItems($search)); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | |
@@ -293,28 +293,28 @@ discard block |
||
293 | 293 | * @param \Aimeos\MShop\Product\Item\Iface $item Product item object without referenced domain items |
294 | 294 | * @param string[] $data Data array |
295 | 295 | */ |
296 | - protected function fromArray( \Aimeos\MShop\Product\Item\Iface $item, array $data ) |
|
296 | + protected function fromArray(\Aimeos\MShop\Product\Item\Iface $item, array $data) |
|
297 | 297 | { |
298 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'product/property' ); |
|
299 | - $propItems = $this->excludeItems( $item->getPropertyItems( null, false ) ); |
|
298 | + $manager = \Aimeos\MShop::create($this->getContext(), 'product/property'); |
|
299 | + $propItems = $this->excludeItems($item->getPropertyItems(null, false)); |
|
300 | 300 | |
301 | - foreach( $data as $entry ) |
|
301 | + foreach ($data as $entry) |
|
302 | 302 | { |
303 | - if( isset( $propItems[$entry['product.property.id']] ) ) |
|
303 | + if (isset($propItems[$entry['product.property.id']])) |
|
304 | 304 | { |
305 | 305 | $propItem = $propItems[$entry['product.property.id']]; |
306 | - unset( $propItems[$entry['product.property.id']] ); |
|
306 | + unset($propItems[$entry['product.property.id']]); |
|
307 | 307 | } |
308 | 308 | else |
309 | 309 | { |
310 | 310 | $propItem = $manager->createItem(); |
311 | 311 | } |
312 | 312 | |
313 | - $propItem->fromArray( $entry ); |
|
314 | - $item->addPropertyItem( $propItem ); |
|
313 | + $propItem->fromArray($entry); |
|
314 | + $item->addPropertyItem($propItem); |
|
315 | 315 | } |
316 | 316 | |
317 | - $item->deletePropertyItems( $propItems ); |
|
317 | + $item->deletePropertyItems($propItems); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | |
@@ -325,16 +325,16 @@ discard block |
||
325 | 325 | * @param boolean $copy True if items should be copied, false if not |
326 | 326 | * @return string[] Multi-dimensional associative list of item data |
327 | 327 | */ |
328 | - protected function toArray( \Aimeos\MShop\Product\Item\Iface $item, $copy = false ) |
|
328 | + protected function toArray(\Aimeos\MShop\Product\Item\Iface $item, $copy = false) |
|
329 | 329 | { |
330 | 330 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
331 | 331 | $data = []; |
332 | 332 | |
333 | - foreach( $this->excludeItems( $item->getPropertyItems( null, false ) ) as $item ) |
|
333 | + foreach ($this->excludeItems($item->getPropertyItems(null, false)) as $item) |
|
334 | 334 | { |
335 | - $list = $item->toArray( true ); |
|
335 | + $list = $item->toArray(true); |
|
336 | 336 | |
337 | - if( $copy === true ) |
|
337 | + if ($copy === true) |
|
338 | 338 | { |
339 | 339 | $list['product.property.siteid'] = $siteId; |
340 | 340 | $list['product.property.id'] = ''; |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
354 | 354 | * @return string HTML output |
355 | 355 | */ |
356 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
356 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
357 | 357 | { |
358 | 358 | /** admin/jqadm/product/characteristic/property/template-item |
359 | 359 | * Relative path to the HTML body template of the property characteristic subpart for products. |
@@ -377,6 +377,6 @@ discard block |
||
377 | 377 | $tplconf = 'admin/jqadm/product/characteristic/property/template-item'; |
378 | 378 | $default = 'product/item-characteristic-property-standard'; |
379 | 379 | |
380 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
380 | + return $view->render($view->config($tplconf, $default)); |
|
381 | 381 | } |
382 | 382 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Product\Stock; |
12 | 12 | |
13 | -sprintf( 'stock' ); // for translation |
|
13 | +sprintf('stock'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -42,16 +42,16 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function copy() |
44 | 44 | { |
45 | - $view = $this->addViewData( $this->getView() ); |
|
45 | + $view = $this->addViewData($this->getView()); |
|
46 | 46 | |
47 | - $view->stockData = $this->toArray( $view->item, true ); |
|
47 | + $view->stockData = $this->toArray($view->item, true); |
|
48 | 48 | $view->stockBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->stockBody .= $client->copy(); |
52 | 52 | } |
53 | 53 | |
54 | - return $this->render( $view ); |
|
54 | + return $this->render($view); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -62,22 +62,22 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function create() |
64 | 64 | { |
65 | - $view = $this->addViewData( $this->getView() ); |
|
65 | + $view = $this->addViewData($this->getView()); |
|
66 | 66 | $siteid = $this->getContext()->getLocale()->getSiteId(); |
67 | - $data = $view->param( 'stock', [] ); |
|
67 | + $data = $view->param('stock', []); |
|
68 | 68 | |
69 | - foreach( $view->value( $data, 'stock.id', [] ) as $idx => $value ) { |
|
69 | + foreach ($view->value($data, 'stock.id', []) as $idx => $value) { |
|
70 | 70 | $data['stock.siteid'][$idx] = $siteid; |
71 | 71 | } |
72 | 72 | |
73 | 73 | $view->stockData = $data; |
74 | 74 | $view->stockBody = ''; |
75 | 75 | |
76 | - foreach( $this->getSubClients() as $client ) { |
|
76 | + foreach ($this->getSubClients() as $client) { |
|
77 | 77 | $view->stockBody .= $client->create(); |
78 | 78 | } |
79 | 79 | |
80 | - return $this->render( $view ); |
|
80 | + return $this->render($view); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -88,13 +88,13 @@ discard block |
||
88 | 88 | { |
89 | 89 | parent::delete(); |
90 | 90 | |
91 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'stock' ); |
|
91 | + $manager = \Aimeos\MShop::create($this->getContext(), 'stock'); |
|
92 | 92 | |
93 | 93 | $code = $this->getView()->item->getCode(); |
94 | 94 | $search = $manager->createSearch(); |
95 | - $search->setConditions( $search->compare( '==', 'stock.productcode', $code ) ); |
|
95 | + $search->setConditions($search->compare('==', 'stock.productcode', $code)); |
|
96 | 96 | |
97 | - $manager->deleteItems( array_keys( $manager->searchItems( $search ) ) ); |
|
97 | + $manager->deleteItems(array_keys($manager->searchItems($search))); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
@@ -105,16 +105,16 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public function get() |
107 | 107 | { |
108 | - $view = $this->addViewData( $this->getView() ); |
|
108 | + $view = $this->addViewData($this->getView()); |
|
109 | 109 | |
110 | - $view->stockData = $this->toArray( $view->item ); |
|
110 | + $view->stockData = $this->toArray($view->item); |
|
111 | 111 | $view->stockBody = ''; |
112 | 112 | |
113 | - foreach( $this->getSubClients() as $client ) { |
|
113 | + foreach ($this->getSubClients() as $client) { |
|
114 | 114 | $view->stockBody .= $client->get(); |
115 | 115 | } |
116 | 116 | |
117 | - return $this->render( $view ); |
|
117 | + return $this->render($view); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | |
@@ -126,32 +126,32 @@ discard block |
||
126 | 126 | $view = $this->getView(); |
127 | 127 | $context = $this->getContext(); |
128 | 128 | |
129 | - $manager = \Aimeos\MShop::create( $context, 'stock' ); |
|
129 | + $manager = \Aimeos\MShop::create($context, 'stock'); |
|
130 | 130 | $manager->begin(); |
131 | 131 | |
132 | 132 | try |
133 | 133 | { |
134 | - $this->fromArray( $view->item, $view->param( 'stock', [] ) ); |
|
134 | + $this->fromArray($view->item, $view->param('stock', [])); |
|
135 | 135 | $view->stockBody = ''; |
136 | 136 | |
137 | - foreach( $this->getSubClients() as $client ) { |
|
137 | + foreach ($this->getSubClients() as $client) { |
|
138 | 138 | $view->stockBody .= $client->save(); |
139 | 139 | } |
140 | 140 | |
141 | 141 | $manager->commit(); |
142 | 142 | return; |
143 | 143 | } |
144 | - catch( \Aimeos\MShop\Exception $e ) |
|
144 | + catch (\Aimeos\MShop\Exception $e) |
|
145 | 145 | { |
146 | - $error = array( 'product-item-stock' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
147 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
148 | - $this->logException( $e ); |
|
146 | + $error = array('product-item-stock' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
147 | + $view->errors = $view->get('errors', []) + $error; |
|
148 | + $this->logException($e); |
|
149 | 149 | } |
150 | - catch( \Exception $e ) |
|
150 | + catch (\Exception $e) |
|
151 | 151 | { |
152 | - $error = array( 'product-item-stock' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
153 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
154 | - $this->logException( $e ); |
|
152 | + $error = array('product-item-stock' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
153 | + $view->errors = $view->get('errors', []) + $error; |
|
154 | + $this->logException($e); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | $manager->rollback(); |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @param string|null $name Name of the sub-client (Default if null) |
168 | 168 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
169 | 169 | */ |
170 | - public function getSubClient( $type, $name = null ) |
|
170 | + public function getSubClient($type, $name = null) |
|
171 | 171 | { |
172 | 172 | /** admin/jqadm/product/stock/decorators/excludes |
173 | 173 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * @see admin/jqadm/product/stock/decorators/excludes |
243 | 243 | * @see admin/jqadm/product/stock/decorators/global |
244 | 244 | */ |
245 | - return $this->createSubClient( 'product/stock/' . $type, $name ); |
|
245 | + return $this->createSubClient('product/stock/' . $type, $name); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | |
@@ -252,15 +252,15 @@ discard block |
||
252 | 252 | * @param \Aimeos\MW\View\Iface $view View object |
253 | 253 | * @return \Aimeos\MW\View\Iface View object with assigned parameters |
254 | 254 | */ |
255 | - protected function addViewData( \Aimeos\MW\View\Iface $view ) |
|
255 | + protected function addViewData(\Aimeos\MW\View\Iface $view) |
|
256 | 256 | { |
257 | - $typeManager = \Aimeos\MShop::create( $this->getContext(), 'stock/type' ); |
|
257 | + $typeManager = \Aimeos\MShop::create($this->getContext(), 'stock/type'); |
|
258 | 258 | |
259 | - $search = $typeManager->createSearch( true )->setSlice( 0, 10000 ); |
|
260 | - $search->setConditions( $search->compare( '==', 'stock.type.domain', 'product' ) ); |
|
261 | - $search->setSortations( [$search->sort( '+', 'stock.type.position' )] ); |
|
259 | + $search = $typeManager->createSearch(true)->setSlice(0, 10000); |
|
260 | + $search->setConditions($search->compare('==', 'stock.type.domain', 'product')); |
|
261 | + $search->setSortations([$search->sort('+', 'stock.type.position')]); |
|
262 | 262 | |
263 | - $view->stockTypes = $this->map( $typeManager->searchItems( $search ) ); |
|
263 | + $view->stockTypes = $this->map($typeManager->searchItems($search)); |
|
264 | 264 | |
265 | 265 | return $view; |
266 | 266 | } |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * @since 2016.01 |
307 | 307 | * @category Developer |
308 | 308 | */ |
309 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/product/stock/standard/subparts', [] ); |
|
309 | + return $this->getContext()->getConfig()->get('admin/jqadm/product/stock/standard/subparts', []); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | |
@@ -316,38 +316,38 @@ discard block |
||
316 | 316 | * @param \Aimeos\MShop\Product\Item\Iface $item Product item object without referenced domain items |
317 | 317 | * @param string[] $data Data array |
318 | 318 | */ |
319 | - protected function fromArray( \Aimeos\MShop\Product\Item\Iface $item, array $data ) |
|
319 | + protected function fromArray(\Aimeos\MShop\Product\Item\Iface $item, array $data) |
|
320 | 320 | { |
321 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'stock' ); |
|
321 | + $manager = \Aimeos\MShop::create($this->getContext(), 'stock'); |
|
322 | 322 | |
323 | 323 | $search = $manager->createSearch(); |
324 | - $search->setConditions( $search->compare( '==', 'stock.productcode', $item->getCode() ) ); |
|
325 | - $stockItems = $manager->searchitems( $search ); |
|
324 | + $search->setConditions($search->compare('==', 'stock.productcode', $item->getCode())); |
|
325 | + $stockItems = $manager->searchitems($search); |
|
326 | 326 | |
327 | - $list = (array) $this->getValue( $data, 'stock.id', [] ); |
|
327 | + $list = (array) $this->getValue($data, 'stock.id', []); |
|
328 | 328 | |
329 | - foreach( $list as $idx => $id ) |
|
329 | + foreach ($list as $idx => $id) |
|
330 | 330 | { |
331 | - $type = $this->getValue( $data, 'stock.type/' . $idx ); |
|
331 | + $type = $this->getValue($data, 'stock.type/' . $idx); |
|
332 | 332 | |
333 | - if( isset( $stockItems[$id] ) && $stockItems[$id]->getType() == $type ) |
|
333 | + if (isset($stockItems[$id]) && $stockItems[$id]->getType() == $type) |
|
334 | 334 | { |
335 | 335 | $stockItem = $stockItems[$id]; |
336 | - unset( $stockItems[$id] ); |
|
336 | + unset($stockItems[$id]); |
|
337 | 337 | } |
338 | 338 | else |
339 | 339 | { |
340 | - $stockItem = $manager->createItem()->setType( $type ); |
|
340 | + $stockItem = $manager->createItem()->setType($type); |
|
341 | 341 | } |
342 | 342 | |
343 | - $stockItem->setProductCode( $item->getCode() ); |
|
344 | - $stockItem->setStocklevel( $this->getValue( $data, 'stock.stocklevel/' . $idx ) ); |
|
345 | - $stockItem->setDateBack( $this->getValue( $data, 'stock.dateback/' . $idx ) ); |
|
343 | + $stockItem->setProductCode($item->getCode()); |
|
344 | + $stockItem->setStocklevel($this->getValue($data, 'stock.stocklevel/' . $idx)); |
|
345 | + $stockItem->setDateBack($this->getValue($data, 'stock.dateback/' . $idx)); |
|
346 | 346 | |
347 | - $manager->saveItem( $stockItem, false ); |
|
347 | + $manager->saveItem($stockItem, false); |
|
348 | 348 | } |
349 | 349 | |
350 | - $manager->deleteItems( array_keys( $stockItems ) ); |
|
350 | + $manager->deleteItems(array_keys($stockItems)); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | |
@@ -358,30 +358,30 @@ discard block |
||
358 | 358 | * @param boolean $copy True if items should be copied, false if not |
359 | 359 | * @return string[] Multi-dimensional associative list of item data |
360 | 360 | */ |
361 | - protected function toArray( \Aimeos\MShop\Product\Item\Iface $item, $copy = false ) |
|
361 | + protected function toArray(\Aimeos\MShop\Product\Item\Iface $item, $copy = false) |
|
362 | 362 | { |
363 | 363 | $data = []; |
364 | 364 | $context = $this->getContext(); |
365 | 365 | $siteId = $context->getLocale()->getSiteId(); |
366 | - $manager = \Aimeos\MShop::create( $context, 'stock' ); |
|
366 | + $manager = \Aimeos\MShop::create($context, 'stock'); |
|
367 | 367 | |
368 | 368 | $search = $manager->createSearch(); |
369 | - $search->setConditions( $search->compare( '==', 'stock.productcode', $item->getCode() ) ); |
|
370 | - $search->setSortations( array( $search->sort( '+', 'stock.type' ) ) ); |
|
369 | + $search->setConditions($search->compare('==', 'stock.productcode', $item->getCode())); |
|
370 | + $search->setSortations(array($search->sort('+', 'stock.type'))); |
|
371 | 371 | |
372 | - foreach( $manager->searchItems( $search ) as $stockItem ) |
|
372 | + foreach ($manager->searchItems($search) as $stockItem) |
|
373 | 373 | { |
374 | - $list = $stockItem->toArray( true ); |
|
374 | + $list = $stockItem->toArray(true); |
|
375 | 375 | |
376 | - if( $copy === true ) |
|
376 | + if ($copy === true) |
|
377 | 377 | { |
378 | 378 | $list['stock.siteid'] = $siteId; |
379 | 379 | $list['stock.id'] = ''; |
380 | 380 | } |
381 | 381 | |
382 | - $list['stock.dateback'] = str_replace( ' ', 'T', $list['stock.dateback'] ); |
|
382 | + $list['stock.dateback'] = str_replace(' ', 'T', $list['stock.dateback']); |
|
383 | 383 | |
384 | - foreach( $list as $key => $value ) { |
|
384 | + foreach ($list as $key => $value) { |
|
385 | 385 | $data[$key][] = $value; |
386 | 386 | } |
387 | 387 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
397 | 397 | * @return string HTML output |
398 | 398 | */ |
399 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
399 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
400 | 400 | { |
401 | 401 | /** admin/jqadm/product/stock/template-item |
402 | 402 | * Relative path to the HTML body template of the stock subpart for products. |
@@ -420,6 +420,6 @@ discard block |
||
420 | 420 | $tplconf = 'admin/jqadm/product/stock/template-item'; |
421 | 421 | $default = 'product/item-stock-standard'; |
422 | 422 | |
423 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
423 | + return $view->render($view->config($tplconf, $default)); |
|
424 | 424 | } |
425 | 425 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Product; |
12 | 12 | |
13 | -sprintf( 'product' ); // for translation |
|
13 | +sprintf('product'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -35,38 +35,38 @@ 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, 'product' ); |
|
43 | - $view->item = $manager->getItem( $id, $this->getDomains() ); |
|
42 | + $manager = \Aimeos\MShop::create($context, 'product'); |
|
43 | + $view->item = $manager->getItem($id, $this->getDomains()); |
|
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->itemTypes = $this->getTypeItems(); |
48 | 48 | $view->itemBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $idx => $client ) |
|
50 | + foreach ($this->getSubClients() as $idx => $client) |
|
51 | 51 | { |
52 | 52 | $view->tabindex = ++$idx + 1; |
53 | 53 | $view->itemBody .= $client->copy(); |
54 | 54 | } |
55 | 55 | } |
56 | - catch( \Aimeos\MShop\Exception $e ) |
|
56 | + catch (\Aimeos\MShop\Exception $e) |
|
57 | 57 | { |
58 | - $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
59 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
60 | - $this->logException( $e ); |
|
58 | + $error = array('product-item' => $context->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( 'product-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
65 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
66 | - $this->logException( $e ); |
|
64 | + $error = array('product-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
65 | + $view->errors = $view->get('errors', []) + $error; |
|
66 | + $this->logException($e); |
|
67 | 67 | } |
68 | 68 | |
69 | - return $this->render( $view ); |
|
69 | + return $this->render($view); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | |
83 | 83 | try |
84 | 84 | { |
85 | - $data = $view->param( 'item', [] ); |
|
85 | + $data = $view->param('item', []); |
|
86 | 86 | |
87 | - if( !isset( $view->item ) ) { |
|
88 | - $view->item = \Aimeos\MShop::create( $context, 'product' )->createItem(); |
|
87 | + if (!isset($view->item)) { |
|
88 | + $view->item = \Aimeos\MShop::create($context, 'product')->createItem(); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | $data['product.siteid'] = $view->item->getSiteId(); |
@@ -95,26 +95,26 @@ discard block |
||
95 | 95 | $view->itemData = $data; |
96 | 96 | $view->itemBody = ''; |
97 | 97 | |
98 | - foreach( $this->getSubClients() as $idx => $client ) |
|
98 | + foreach ($this->getSubClients() as $idx => $client) |
|
99 | 99 | { |
100 | 100 | $view->tabindex = ++$idx + 1; |
101 | 101 | $view->itemBody .= $client->create(); |
102 | 102 | } |
103 | 103 | } |
104 | - catch( \Aimeos\MShop\Exception $e ) |
|
104 | + catch (\Aimeos\MShop\Exception $e) |
|
105 | 105 | { |
106 | - $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
107 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
108 | - $this->logException( $e ); |
|
106 | + $error = array('product-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
107 | + $view->errors = $view->get('errors', []) + $error; |
|
108 | + $this->logException($e); |
|
109 | 109 | } |
110 | - catch( \Exception $e ) |
|
110 | + catch (\Exception $e) |
|
111 | 111 | { |
112 | - $error = array( 'product-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
113 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
114 | - $this->logException( $e ); |
|
112 | + $error = array('product-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
113 | + $view->errors = $view->get('errors', []) + $error; |
|
114 | + $this->logException($e); |
|
115 | 115 | } |
116 | 116 | |
117 | - return $this->render( $view ); |
|
117 | + return $this->render($view); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | |
@@ -128,39 +128,39 @@ discard block |
||
128 | 128 | $view = $this->getView(); |
129 | 129 | $context = $this->getContext(); |
130 | 130 | |
131 | - $manager = \Aimeos\MShop::create( $context, 'product' ); |
|
131 | + $manager = \Aimeos\MShop::create($context, 'product'); |
|
132 | 132 | $manager->begin(); |
133 | 133 | |
134 | 134 | try |
135 | 135 | { |
136 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
137 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
136 | + if (($id = $view->param('id')) === null) { |
|
137 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
138 | 138 | } |
139 | 139 | |
140 | - $view->item = $manager->getItem( $id, $this->getDomains() ); |
|
140 | + $view->item = $manager->getItem($id, $this->getDomains()); |
|
141 | 141 | |
142 | - foreach( $this->getSubClients() as $client ) { |
|
142 | + foreach ($this->getSubClients() as $client) { |
|
143 | 143 | $client->delete(); |
144 | 144 | } |
145 | 145 | |
146 | - $manager->saveItem( $view->item ); |
|
147 | - $manager->deleteItem( $id ); |
|
146 | + $manager->saveItem($view->item); |
|
147 | + $manager->deleteItem($id); |
|
148 | 148 | $manager->commit(); |
149 | 149 | |
150 | - $this->nextAction( $view, 'search', 'product', null, 'delete' ); |
|
150 | + $this->nextAction($view, 'search', 'product', null, 'delete'); |
|
151 | 151 | return; |
152 | 152 | } |
153 | - catch( \Aimeos\MShop\Exception $e ) |
|
153 | + catch (\Aimeos\MShop\Exception $e) |
|
154 | 154 | { |
155 | - $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
156 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
157 | - $this->logException( $e ); |
|
155 | + $error = array('product-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
156 | + $view->errors = $view->get('errors', []) + $error; |
|
157 | + $this->logException($e); |
|
158 | 158 | } |
159 | - catch( \Exception $e ) |
|
159 | + catch (\Exception $e) |
|
160 | 160 | { |
161 | - $error = array( 'product-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
162 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
163 | - $this->logException( $e ); |
|
161 | + $error = array('product-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
162 | + $view->errors = $view->get('errors', []) + $error; |
|
163 | + $this->logException($e); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | $manager->rollback(); |
@@ -181,38 +181,38 @@ discard block |
||
181 | 181 | |
182 | 182 | try |
183 | 183 | { |
184 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
185 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
184 | + if (($id = $view->param('id')) === null) { |
|
185 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
186 | 186 | } |
187 | 187 | |
188 | - $manager = \Aimeos\MShop::create( $context, 'product' ); |
|
188 | + $manager = \Aimeos\MShop::create($context, 'product'); |
|
189 | 189 | |
190 | - $view->item = $manager->getItem( $id, $this->getDomains() ); |
|
190 | + $view->item = $manager->getItem($id, $this->getDomains()); |
|
191 | 191 | $view->itemSubparts = $this->getSubClientNames(); |
192 | - $view->itemData = $this->toArray( $view->item ); |
|
192 | + $view->itemData = $this->toArray($view->item); |
|
193 | 193 | $view->itemTypes = $this->getTypeItems(); |
194 | 194 | $view->itemBody = ''; |
195 | 195 | |
196 | - foreach( $this->getSubClients() as $idx => $client ) |
|
196 | + foreach ($this->getSubClients() as $idx => $client) |
|
197 | 197 | { |
198 | 198 | $view->tabindex = ++$idx + 1; |
199 | 199 | $view->itemBody .= $client->get(); |
200 | 200 | } |
201 | 201 | } |
202 | - catch( \Aimeos\MShop\Exception $e ) |
|
202 | + catch (\Aimeos\MShop\Exception $e) |
|
203 | 203 | { |
204 | - $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
205 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
206 | - $this->logException( $e ); |
|
204 | + $error = array('product-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
205 | + $view->errors = $view->get('errors', []) + $error; |
|
206 | + $this->logException($e); |
|
207 | 207 | } |
208 | - catch( \Exception $e ) |
|
208 | + catch (\Exception $e) |
|
209 | 209 | { |
210 | - $error = array( 'product-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
211 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
212 | - $this->logException( $e ); |
|
210 | + $error = array('product-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
211 | + $view->errors = $view->get('errors', []) + $error; |
|
212 | + $this->logException($e); |
|
213 | 213 | } |
214 | 214 | |
215 | - return $this->render( $view ); |
|
215 | + return $this->render($view); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | |
@@ -226,40 +226,40 @@ discard block |
||
226 | 226 | $view = $this->getView(); |
227 | 227 | $context = $this->getContext(); |
228 | 228 | |
229 | - $manager = \Aimeos\MShop::create( $context, 'product' ); |
|
229 | + $manager = \Aimeos\MShop::create($context, 'product'); |
|
230 | 230 | $manager->begin(); |
231 | 231 | |
232 | 232 | try |
233 | 233 | { |
234 | - $item = $this->fromArray( $view->param( 'item', [] ) ); |
|
235 | - $view->item = $item->getId() ? $item : $manager->saveItem( $item ); |
|
234 | + $item = $this->fromArray($view->param('item', [])); |
|
235 | + $view->item = $item->getId() ? $item : $manager->saveItem($item); |
|
236 | 236 | $view->itemBody = ''; |
237 | 237 | |
238 | - foreach( $this->getSubClients() as $client ) { |
|
238 | + foreach ($this->getSubClients() as $client) { |
|
239 | 239 | $view->itemBody .= $client->save(); |
240 | 240 | } |
241 | 241 | |
242 | - $manager->saveItem( clone $view->item ); |
|
242 | + $manager->saveItem(clone $view->item); |
|
243 | 243 | $manager->commit(); |
244 | 244 | |
245 | - $this->nextAction( $view, $view->param( 'next' ), 'product', $view->item->getId(), 'save' ); |
|
245 | + $this->nextAction($view, $view->param('next'), 'product', $view->item->getId(), 'save'); |
|
246 | 246 | return; |
247 | 247 | } |
248 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
248 | + catch (\Aimeos\Admin\JQAdm\Exception $e) |
|
249 | 249 | { |
250 | 250 | // fall through to create |
251 | 251 | } |
252 | - catch( \Aimeos\MShop\Exception $e ) |
|
252 | + catch (\Aimeos\MShop\Exception $e) |
|
253 | 253 | { |
254 | - $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
255 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
256 | - $this->logException( $e ); |
|
254 | + $error = array('product-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
255 | + $view->errors = $view->get('errors', []) + $error; |
|
256 | + $this->logException($e); |
|
257 | 257 | } |
258 | - catch( \Exception $e ) |
|
258 | + catch (\Exception $e) |
|
259 | 259 | { |
260 | - $error = array( 'product-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
261 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
262 | - $this->logException( $e ); |
|
260 | + $error = array('product-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
261 | + $view->errors = $view->get('errors', []) + $error; |
|
262 | + $this->logException($e); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | $manager->rollback(); |
@@ -281,35 +281,35 @@ discard block |
||
281 | 281 | try |
282 | 282 | { |
283 | 283 | $total = 0; |
284 | - $params = $this->storeSearchParams( $view->param(), 'product' ); |
|
285 | - $manager = \Aimeos\MShop::create( $context, 'product' ); |
|
284 | + $params = $this->storeSearchParams($view->param(), 'product'); |
|
285 | + $manager = \Aimeos\MShop::create($context, 'product'); |
|
286 | 286 | |
287 | 287 | $search = $manager->createSearch(); |
288 | - $search->setSortations( [$search->sort( '+', 'product.id')] ); |
|
289 | - $search = $this->initCriteria( $search, $params ); |
|
288 | + $search->setSortations([$search->sort('+', 'product.id')]); |
|
289 | + $search = $this->initCriteria($search, $params); |
|
290 | 290 | |
291 | - $view->items = $manager->searchItems( $search, array_diff( $this->getDomains(), ['product'] ), $total ); |
|
292 | - $view->filterAttributes = $manager->getSearchAttributes( true ); |
|
291 | + $view->items = $manager->searchItems($search, array_diff($this->getDomains(), ['product']), $total); |
|
292 | + $view->filterAttributes = $manager->getSearchAttributes(true); |
|
293 | 293 | $view->filterOperators = $search->getOperators(); |
294 | 294 | $view->itemTypes = $this->getTypeItems(); |
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( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
305 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
306 | - $this->logException( $e ); |
|
304 | + $error = array('product-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( 'product-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
311 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
312 | - $this->logException( $e ); |
|
310 | + $error = array('product-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/product/template-list |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | $tplconf = 'admin/jqadm/product/template-list'; |
335 | 335 | $default = 'product/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/product/decorators/excludes |
351 | 351 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | * @see admin/jqadm/product/decorators/excludes |
421 | 421 | * @see admin/jqadm/product/decorators/global |
422 | 422 | */ |
423 | - return $this->createSubClient( 'product/' . $type, $name ); |
|
423 | + return $this->createSubClient('product/' . $type, $name); |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | |
@@ -442,9 +442,9 @@ discard block |
||
442 | 442 | * @since 2016.01 |
443 | 443 | * @category Developer |
444 | 444 | */ |
445 | - $domains = array( 'attribute', 'media', 'price', 'product', 'product/property', 'text' ); |
|
445 | + $domains = array('attribute', 'media', 'price', 'product', 'product/property', 'text'); |
|
446 | 446 | |
447 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/product/domains', $domains ); |
|
447 | + return $this->getContext()->getConfig()->get('admin/jqadm/product/domains', $domains); |
|
448 | 448 | } |
449 | 449 | |
450 | 450 | |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | * @since 2016.01 |
489 | 489 | * @category Developer |
490 | 490 | */ |
491 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/product/standard/subparts', [] ); |
|
491 | + return $this->getContext()->getConfig()->get('admin/jqadm/product/standard/subparts', []); |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | |
@@ -499,12 +499,12 @@ discard block |
||
499 | 499 | */ |
500 | 500 | protected function getTypeItems() |
501 | 501 | { |
502 | - $typeManager = \Aimeos\MShop::create( $this->getContext(), 'product/type' ); |
|
502 | + $typeManager = \Aimeos\MShop::create($this->getContext(), 'product/type'); |
|
503 | 503 | |
504 | - $search = $typeManager->createSearch( true )->setSlice( 0, 10000 ); |
|
505 | - $search->setSortations( [$search->sort( '+', 'product.type.position' )] ); |
|
504 | + $search = $typeManager->createSearch(true)->setSlice(0, 10000); |
|
505 | + $search->setSortations([$search->sort('+', 'product.type.position')]); |
|
506 | 506 | |
507 | - return $this->map( $typeManager->searchItems( $search ) ); |
|
507 | + return $this->map($typeManager->searchItems($search)); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | |
@@ -514,30 +514,30 @@ discard block |
||
514 | 514 | * @param string[] Data array |
515 | 515 | * @return \Aimeos\MShop\Product\Item\Iface New product item object |
516 | 516 | */ |
517 | - protected function fromArray( array $data ) |
|
517 | + protected function fromArray(array $data) |
|
518 | 518 | { |
519 | 519 | $conf = []; |
520 | 520 | |
521 | - if( isset( $data['config']['key'] ) ) |
|
521 | + if (isset($data['config']['key'])) |
|
522 | 522 | { |
523 | - foreach( (array) $data['config']['key'] as $idx => $key ) |
|
523 | + foreach ((array) $data['config']['key'] as $idx => $key) |
|
524 | 524 | { |
525 | - if( trim( $key ) !== '' && isset( $data['config']['val'][$idx] ) ) { |
|
525 | + if (trim($key) !== '' && isset($data['config']['val'][$idx])) { |
|
526 | 526 | $conf[$key] = $data['config']['val'][$idx]; |
527 | 527 | } |
528 | 528 | } |
529 | 529 | } |
530 | 530 | |
531 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'product' ); |
|
531 | + $manager = \Aimeos\MShop::create($this->getContext(), 'product'); |
|
532 | 532 | |
533 | - if( isset( $data['product.id'] ) && $data['product.id'] != '' ) { |
|
534 | - $item = $manager->getItem( $data['product.id'], $this->getDomains() ); |
|
533 | + if (isset($data['product.id']) && $data['product.id'] != '') { |
|
534 | + $item = $manager->getItem($data['product.id'], $this->getDomains()); |
|
535 | 535 | } else { |
536 | 536 | $item = $manager->createItem(); |
537 | 537 | } |
538 | 538 | |
539 | - $item->fromArray( $data ); |
|
540 | - $item->setConfig( $conf ); |
|
539 | + $item->fromArray($data); |
|
540 | + $item->setConfig($conf); |
|
541 | 541 | |
542 | 542 | return $item; |
543 | 543 | } |
@@ -549,19 +549,19 @@ discard block |
||
549 | 549 | * @param \Aimeos\MShop\Product\Item\Iface $item Product item object |
550 | 550 | * @return string[] Multi-dimensional associative list of item data |
551 | 551 | */ |
552 | - protected function toArray( \Aimeos\MShop\Product\Item\Iface $item, $copy = false ) |
|
552 | + protected function toArray(\Aimeos\MShop\Product\Item\Iface $item, $copy = false) |
|
553 | 553 | { |
554 | - $data = $item->toArray( true ); |
|
554 | + $data = $item->toArray(true); |
|
555 | 555 | $data['config'] = []; |
556 | 556 | |
557 | - if( $copy === true ) |
|
557 | + if ($copy === true) |
|
558 | 558 | { |
559 | 559 | $data['product.siteid'] = $this->getContext()->getLocale()->getSiteId(); |
560 | 560 | $data['product.code'] = $data['product.code'] . '_copy'; |
561 | 561 | $data['product.id'] = ''; |
562 | 562 | } |
563 | 563 | |
564 | - foreach( $item->getConfig() as $key => $value ) |
|
564 | + foreach ($item->getConfig() as $key => $value) |
|
565 | 565 | { |
566 | 566 | $data['config']['key'][] = $key; |
567 | 567 | $data['config']['val'][] = $value; |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
578 | 578 | * @return string HTML output |
579 | 579 | */ |
580 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
580 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
581 | 581 | { |
582 | 582 | /** admin/jqadm/product/template-item |
583 | 583 | * Relative path to the HTML body template for the product item. |
@@ -601,6 +601,6 @@ discard block |
||
601 | 601 | $tplconf = 'admin/jqadm/product/template-item'; |
602 | 602 | $default = 'product/item-standard'; |
603 | 603 | |
604 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
604 | + return $view->render($view->config($tplconf, $default)); |
|
605 | 605 | } |
606 | 606 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Service\Media\Property; |
12 | 12 | |
13 | -sprintf( 'property' ); // for translation |
|
13 | +sprintf('property'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -42,16 +42,16 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function copy() |
44 | 44 | { |
45 | - $view = $this->addViewData( $this->getView() ); |
|
45 | + $view = $this->addViewData($this->getView()); |
|
46 | 46 | |
47 | - $view->mediaData = $this->toArray( $view->item, $view->get( 'mediaData', [] ), true ); |
|
47 | + $view->mediaData = $this->toArray($view->item, $view->get('mediaData', []), true); |
|
48 | 48 | $view->propertyBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->propertyBody .= $client->copy(); |
52 | 52 | } |
53 | 53 | |
54 | - return $this->render( $view ); |
|
54 | + return $this->render($view); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function create() |
64 | 64 | { |
65 | - $view = $this->addViewData( $this->getView() ); |
|
65 | + $view = $this->addViewData($this->getView()); |
|
66 | 66 | $siteid = $this->getContext()->getLocale()->getSiteId(); |
67 | - $data = $view->get( 'mediaData', [] ); |
|
67 | + $data = $view->get('mediaData', []); |
|
68 | 68 | |
69 | - foreach( $data as $index => $entry ) |
|
69 | + foreach ($data as $index => $entry) |
|
70 | 70 | { |
71 | - foreach( $view->value( $entry, 'property', [] ) as $idx => $y ) { |
|
71 | + foreach ($view->value($entry, 'property', []) as $idx => $y) { |
|
72 | 72 | $data[$index]['property'][$idx]['service.lists.siteid'] = $siteid; |
73 | 73 | } |
74 | 74 | } |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | $view->propertyData = $data; |
77 | 77 | $view->propertyBody = ''; |
78 | 78 | |
79 | - foreach( $this->getSubClients() as $client ) { |
|
79 | + foreach ($this->getSubClients() as $client) { |
|
80 | 80 | $view->propertyBody .= $client->create(); |
81 | 81 | } |
82 | 82 | |
83 | - return $this->render( $view ); |
|
83 | + return $this->render($view); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -91,16 +91,16 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function get() |
93 | 93 | { |
94 | - $view = $this->addViewData( $this->getView() ); |
|
94 | + $view = $this->addViewData($this->getView()); |
|
95 | 95 | |
96 | - $view->mediaData = $this->toArray( $view->item, $view->get( 'mediaData', [] ) ); |
|
96 | + $view->mediaData = $this->toArray($view->item, $view->get('mediaData', [])); |
|
97 | 97 | $view->propertyBody = ''; |
98 | 98 | |
99 | - foreach( $this->getSubClients() as $client ) { |
|
99 | + foreach ($this->getSubClients() as $client) { |
|
100 | 100 | $view->propertyBody .= $client->get(); |
101 | 101 | } |
102 | 102 | |
103 | - return $this->render( $view ); |
|
103 | + return $this->render($view); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -111,10 +111,10 @@ discard block |
||
111 | 111 | { |
112 | 112 | $view = $this->getView(); |
113 | 113 | |
114 | - $view->item = $this->fromArray( $view->item, $view->param( 'media', [] ) ); |
|
114 | + $view->item = $this->fromArray($view->item, $view->param('media', [])); |
|
115 | 115 | $view->propertyBody = ''; |
116 | 116 | |
117 | - foreach( $this->getSubClients() as $client ) { |
|
117 | + foreach ($this->getSubClients() as $client) { |
|
118 | 118 | $view->propertyBody .= $client->save(); |
119 | 119 | } |
120 | 120 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @param string|null $name Name of the sub-client (Default if null) |
128 | 128 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
129 | 129 | */ |
130 | - public function getSubClient( $type, $name = null ) |
|
130 | + public function getSubClient($type, $name = null) |
|
131 | 131 | { |
132 | 132 | /** admin/jqadm/service/media/property/decorators/excludes |
133 | 133 | * Excludes decorators added by the "common" option from the service JQAdm client |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @see admin/jqadm/service/media/property/decorators/excludes |
203 | 203 | * @see admin/jqadm/service/media/property/decorators/global |
204 | 204 | */ |
205 | - return $this->createSubClient( 'service/media/property/' . $type, $name ); |
|
205 | + return $this->createSubClient('service/media/property/' . $type, $name); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -212,15 +212,15 @@ discard block |
||
212 | 212 | * @param \Aimeos\MW\View\Iface $view View object |
213 | 213 | * @return \Aimeos\MW\View\Iface View object with assigned parameters |
214 | 214 | */ |
215 | - protected function addViewData( \Aimeos\MW\View\Iface $view ) |
|
215 | + protected function addViewData(\Aimeos\MW\View\Iface $view) |
|
216 | 216 | { |
217 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'media/property/type' ); |
|
217 | + $manager = \Aimeos\MShop::create($this->getContext(), 'media/property/type'); |
|
218 | 218 | |
219 | - $search = $manager->createSearch( true )->setSlice( 0, 10000 ); |
|
220 | - $search->setConditions( $search->compare( '==', 'media.property.type.domain', 'service' ) ); |
|
221 | - $search->setSortations( [$search->sort( '+', 'media.property.type.position')] ); |
|
219 | + $search = $manager->createSearch(true)->setSlice(0, 10000); |
|
220 | + $search->setConditions($search->compare('==', 'media.property.type.domain', 'service')); |
|
221 | + $search->setSortations([$search->sort('+', 'media.property.type.position')]); |
|
222 | 222 | |
223 | - $view->propertyTypes = $this->map( $manager->searchItems( $search ) ); |
|
223 | + $view->propertyTypes = $this->map($manager->searchItems($search)); |
|
224 | 224 | |
225 | 225 | return $view; |
226 | 226 | } |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | * @since 2018.01 |
267 | 267 | * @category Developer |
268 | 268 | */ |
269 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/service/media/property/standard/subparts', [] ); |
|
269 | + return $this->getContext()->getConfig()->get('admin/jqadm/service/media/property/standard/subparts', []); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | |
@@ -276,32 +276,32 @@ discard block |
||
276 | 276 | * @param \Aimeos\MShop\Service\Item\Iface $item Service item object without referenced domain items |
277 | 277 | * @param string[] $data Data array |
278 | 278 | */ |
279 | - protected function fromArray( \Aimeos\MShop\Service\Item\Iface $item, array $data ) |
|
279 | + protected function fromArray(\Aimeos\MShop\Service\Item\Iface $item, array $data) |
|
280 | 280 | { |
281 | - $propManager = \Aimeos\MShop::create( $this->getContext(), 'media/property' ); |
|
281 | + $propManager = \Aimeos\MShop::create($this->getContext(), 'media/property'); |
|
282 | 282 | $index = 0; |
283 | 283 | |
284 | - foreach( $item->getRefItems( 'media', null, null, false ) as $refItem ) |
|
284 | + foreach ($item->getRefItems('media', null, null, false) as $refItem) |
|
285 | 285 | { |
286 | - $propItems = $refItem->getPropertyItems( null, false ); |
|
286 | + $propItems = $refItem->getPropertyItems(null, false); |
|
287 | 287 | |
288 | - foreach( (array) $this->getValue( $data, $index . '/property', [] ) as $entry ) |
|
288 | + foreach ((array) $this->getValue($data, $index . '/property', []) as $entry) |
|
289 | 289 | { |
290 | - if( isset( $propItems[$entry['media.property.id']] ) ) |
|
290 | + if (isset($propItems[$entry['media.property.id']])) |
|
291 | 291 | { |
292 | 292 | $propItem = $propItems[$entry['media.property.id']]; |
293 | - unset( $propItems[$entry['media.property.id']] ); |
|
293 | + unset($propItems[$entry['media.property.id']]); |
|
294 | 294 | } |
295 | 295 | else |
296 | 296 | { |
297 | 297 | $propItem = $propManager->createItem(); |
298 | 298 | } |
299 | 299 | |
300 | - $propItem->fromArray( $entry ); |
|
301 | - $refItem->addPropertyItem( $propItem ); |
|
300 | + $propItem->fromArray($entry); |
|
301 | + $refItem->addPropertyItem($propItem); |
|
302 | 302 | } |
303 | 303 | |
304 | - $refItem->deletePropertyItems( $propItems ); |
|
304 | + $refItem->deletePropertyItems($propItems); |
|
305 | 305 | $index++; |
306 | 306 | } |
307 | 307 | |
@@ -317,18 +317,18 @@ discard block |
||
317 | 317 | * @param boolean $copy True if items should be copied, false if not |
318 | 318 | * @return string[] Multi-dimensional associative list of item data |
319 | 319 | */ |
320 | - protected function toArray( \Aimeos\MShop\Service\Item\Iface $item, array $data, $copy = false ) |
|
320 | + protected function toArray(\Aimeos\MShop\Service\Item\Iface $item, array $data, $copy = false) |
|
321 | 321 | { |
322 | 322 | $idx = 0; |
323 | 323 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
324 | 324 | |
325 | - foreach( $item->getRefItems( 'media', null, null, false ) as $mediaItem ) |
|
325 | + foreach ($item->getRefItems('media', null, null, false) as $mediaItem) |
|
326 | 326 | { |
327 | - foreach( $mediaItem->getPropertyItems( null, false ) as $propItem ) |
|
327 | + foreach ($mediaItem->getPropertyItems(null, false) as $propItem) |
|
328 | 328 | { |
329 | - $list = $propItem->toArray( true ); |
|
329 | + $list = $propItem->toArray(true); |
|
330 | 330 | |
331 | - if( $copy === true ) |
|
331 | + if ($copy === true) |
|
332 | 332 | { |
333 | 333 | $list['media.property.siteid'] = $siteId; |
334 | 334 | $list['media.property.id'] = ''; |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
351 | 351 | * @return string HTML output |
352 | 352 | */ |
353 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
353 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
354 | 354 | { |
355 | 355 | /** admin/jqadm/service/media/property/template-item |
356 | 356 | * Relative path to the HTML body template of the media subpart for services. |
@@ -374,6 +374,6 @@ discard block |
||
374 | 374 | $tplconf = 'admin/jqadm/service/media/property/template-item'; |
375 | 375 | $default = 'service/item-media-property-standard'; |
376 | 376 | |
377 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
377 | + return $view->render($view->config($tplconf, $default)); |
|
378 | 378 | } |
379 | 379 | } |
380 | 380 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Service\Media; |
12 | 12 | |
13 | -sprintf( 'media' ); // for translation |
|
13 | +sprintf('media'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -42,16 +42,16 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function copy() |
44 | 44 | { |
45 | - $view = $this->addViewData( $this->getView() ); |
|
45 | + $view = $this->addViewData($this->getView()); |
|
46 | 46 | |
47 | - $view->mediaData = $this->toArray( $view->item, true ); |
|
47 | + $view->mediaData = $this->toArray($view->item, true); |
|
48 | 48 | $view->mediaBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->mediaBody .= $client->copy(); |
52 | 52 | } |
53 | 53 | |
54 | - return $this->render( $view ); |
|
54 | + return $this->render($view); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function create() |
64 | 64 | { |
65 | - $view = $this->addViewData( $this->getView() ); |
|
65 | + $view = $this->addViewData($this->getView()); |
|
66 | 66 | $siteid = $this->getContext()->getLocale()->getSiteId(); |
67 | 67 | |
68 | - $itemData = $this->toArray( $view->item ); |
|
69 | - $data = array_replace_recursive( $itemData, $view->param( 'media', [] ) ); |
|
68 | + $itemData = $this->toArray($view->item); |
|
69 | + $data = array_replace_recursive($itemData, $view->param('media', [])); |
|
70 | 70 | |
71 | - foreach( $data as $idx => $entry ) |
|
71 | + foreach ($data as $idx => $entry) |
|
72 | 72 | { |
73 | 73 | $data[$idx]['media.siteid'] = $siteid; |
74 | 74 | $data[$idx]['media.url'] = $itemData[$idx]['media.url']; |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | $view->mediaData = $data; |
80 | 80 | $view->mediaBody = ''; |
81 | 81 | |
82 | - foreach( $this->getSubClients() as $client ) { |
|
82 | + foreach ($this->getSubClients() as $client) { |
|
83 | 83 | $view->mediaBody .= $client->create(); |
84 | 84 | } |
85 | 85 | |
86 | - return $this->render( $view ); |
|
86 | + return $this->render($view); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | |
@@ -95,15 +95,15 @@ discard block |
||
95 | 95 | parent::delete(); |
96 | 96 | |
97 | 97 | $item = $this->getView()->item; |
98 | - $cntl = \Aimeos\Controller\Common\Media\Factory::create( $this->getContext() ); |
|
98 | + $cntl = \Aimeos\Controller\Common\Media\Factory::create($this->getContext()); |
|
99 | 99 | |
100 | - foreach( $item->getListItems( 'media', null, null, false ) as $listItem ) |
|
100 | + foreach ($item->getListItems('media', null, null, false) as $listItem) |
|
101 | 101 | { |
102 | - if( ( $refItem = $listItem->getRefItem() ) !== null ) { |
|
103 | - $cntl->delete( $refItem ); |
|
102 | + if (($refItem = $listItem->getRefItem()) !== null) { |
|
103 | + $cntl->delete($refItem); |
|
104 | 104 | } |
105 | 105 | |
106 | - $item->deleteListItem( 'media', $listItem, $refItem ); |
|
106 | + $item->deleteListItem('media', $listItem, $refItem); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
@@ -115,16 +115,16 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function get() |
117 | 117 | { |
118 | - $view = $this->addViewData( $this->getView() ); |
|
118 | + $view = $this->addViewData($this->getView()); |
|
119 | 119 | |
120 | - $view->mediaData = $this->toArray( $view->item ); |
|
120 | + $view->mediaData = $this->toArray($view->item); |
|
121 | 121 | $view->mediaBody = ''; |
122 | 122 | |
123 | - foreach( $this->getSubClients() as $client ) { |
|
123 | + foreach ($this->getSubClients() as $client) { |
|
124 | 124 | $view->mediaBody .= $client->get(); |
125 | 125 | } |
126 | 126 | |
127 | - return $this->render( $view ); |
|
127 | + return $this->render($view); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | |
@@ -137,26 +137,26 @@ discard block |
||
137 | 137 | |
138 | 138 | try |
139 | 139 | { |
140 | - $view->item = $this->fromArray( $view->item, $view->param( 'media', [] ) ); |
|
140 | + $view->item = $this->fromArray($view->item, $view->param('media', [])); |
|
141 | 141 | $view->mediaBody = ''; |
142 | 142 | |
143 | - foreach( $this->getSubClients() as $client ) { |
|
143 | + foreach ($this->getSubClients() as $client) { |
|
144 | 144 | $view->mediaBody .= $client->save(); |
145 | 145 | } |
146 | 146 | |
147 | 147 | return; |
148 | 148 | } |
149 | - catch( \Aimeos\MShop\Exception $e ) |
|
149 | + catch (\Aimeos\MShop\Exception $e) |
|
150 | 150 | { |
151 | - $error = array( 'service-item-media' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
152 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
153 | - $this->logException( $e ); |
|
151 | + $error = array('service-item-media' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
152 | + $view->errors = $view->get('errors', []) + $error; |
|
153 | + $this->logException($e); |
|
154 | 154 | } |
155 | - catch( \Exception $e ) |
|
155 | + catch (\Exception $e) |
|
156 | 156 | { |
157 | - $error = array( 'service-item-media' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
158 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
159 | - $this->logException( $e ); |
|
157 | + $error = array('service-item-media' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
158 | + $view->errors = $view->get('errors', []) + $error; |
|
159 | + $this->logException($e); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | throw new \Aimeos\Admin\JQAdm\Exception(); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @param string|null $name Name of the sub-client (Default if null) |
171 | 171 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
172 | 172 | */ |
173 | - public function getSubClient( $type, $name = null ) |
|
173 | + public function getSubClient($type, $name = null) |
|
174 | 174 | { |
175 | 175 | /** admin/jqadm/service/media/decorators/excludes |
176 | 176 | * Excludes decorators added by the "common" option from the service JQAdm client |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @see admin/jqadm/service/media/decorators/excludes |
246 | 246 | * @see admin/jqadm/service/media/decorators/global |
247 | 247 | */ |
248 | - return $this->createSubClient( 'service/media/' . $type, $name ); |
|
248 | + return $this->createSubClient('service/media/' . $type, $name); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | |
@@ -255,23 +255,23 @@ discard block |
||
255 | 255 | * @param \Aimeos\MW\View\Iface $view View object |
256 | 256 | * @return \Aimeos\MW\View\Iface View object with assigned parameters |
257 | 257 | */ |
258 | - protected function addViewData( \Aimeos\MW\View\Iface $view ) |
|
258 | + protected function addViewData(\Aimeos\MW\View\Iface $view) |
|
259 | 259 | { |
260 | 260 | $context = $this->getContext(); |
261 | 261 | |
262 | - $typeManager = \Aimeos\MShop::create( $this->getContext(), 'media/type' ); |
|
263 | - $listTypeManager = \Aimeos\MShop::create( $this->getContext(), 'service/lists/type' ); |
|
262 | + $typeManager = \Aimeos\MShop::create($this->getContext(), 'media/type'); |
|
263 | + $listTypeManager = \Aimeos\MShop::create($this->getContext(), 'service/lists/type'); |
|
264 | 264 | |
265 | - $search = $typeManager->createSearch( true )->setSlice( 0, 10000 ); |
|
266 | - $search->setConditions( $search->compare( '==', 'media.type.domain', 'service' ) ); |
|
267 | - $search->setSortations( [$search->sort( '+', 'media.type.position' )] ); |
|
265 | + $search = $typeManager->createSearch(true)->setSlice(0, 10000); |
|
266 | + $search->setConditions($search->compare('==', 'media.type.domain', 'service')); |
|
267 | + $search->setSortations([$search->sort('+', 'media.type.position')]); |
|
268 | 268 | |
269 | - $listSearch = $listTypeManager->createSearch( true )->setSlice( 0, 10000 ); |
|
270 | - $listSearch->setConditions( $listSearch->compare( '==', 'service.lists.type.domain', 'media' ) ); |
|
271 | - $listSearch->setSortations( [$listSearch->sort( '+', 'service.lists.type.position' )] ); |
|
269 | + $listSearch = $listTypeManager->createSearch(true)->setSlice(0, 10000); |
|
270 | + $listSearch->setConditions($listSearch->compare('==', 'service.lists.type.domain', 'media')); |
|
271 | + $listSearch->setSortations([$listSearch->sort('+', 'service.lists.type.position')]); |
|
272 | 272 | |
273 | - $view->mediaListTypes = $this->map( $listTypeManager->searchItems( $listSearch ) ); |
|
274 | - $view->mediaTypes = $this->map( $typeManager->searchItems( $search ) ); |
|
273 | + $view->mediaListTypes = $this->map($listTypeManager->searchItems($listSearch)); |
|
274 | + $view->mediaTypes = $this->map($typeManager->searchItems($search)); |
|
275 | 275 | |
276 | 276 | return $view; |
277 | 277 | } |
@@ -284,29 +284,29 @@ discard block |
||
284 | 284 | * @param array $listItems Media list items to be removed |
285 | 285 | * @return \Aimeos\MShop\Service\Item\Iface Modified service item |
286 | 286 | */ |
287 | - protected function deleteMediaItems( \Aimeos\MShop\Service\Item\Iface $item, array $listItems ) |
|
287 | + protected function deleteMediaItems(\Aimeos\MShop\Service\Item\Iface $item, array $listItems) |
|
288 | 288 | { |
289 | 289 | $context = $this->getContext(); |
290 | - $cntl = \Aimeos\Controller\Common\Media\Factory::create( $context ); |
|
291 | - $manager = \Aimeos\MShop::create( $context, 'service' ); |
|
290 | + $cntl = \Aimeos\Controller\Common\Media\Factory::create($context); |
|
291 | + $manager = \Aimeos\MShop::create($context, 'service'); |
|
292 | 292 | $search = $manager->createSearch(); |
293 | 293 | |
294 | - foreach( $listItems as $listItem ) |
|
294 | + foreach ($listItems as $listItem) |
|
295 | 295 | { |
296 | 296 | $expr = [ |
297 | - $search->compare( '==', 'service.lists.domain', 'media' ), |
|
298 | - $search->compare( '==', 'service.lists.type', $listItem->getType() ), |
|
299 | - $search->compare( '==', 'service.lists.refid', $listItem->getRefId() ), |
|
297 | + $search->compare('==', 'service.lists.domain', 'media'), |
|
298 | + $search->compare('==', 'service.lists.type', $listItem->getType()), |
|
299 | + $search->compare('==', 'service.lists.refid', $listItem->getRefId()), |
|
300 | 300 | ]; |
301 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
302 | - $items = $manager->searchItems( $search ); |
|
301 | + $search->setConditions($search->combine('&&', $expr)); |
|
302 | + $items = $manager->searchItems($search); |
|
303 | 303 | $refItem = null; |
304 | 304 | |
305 | - if( count( $items ) === 1 && ( $refItem = $listItem->getRefItem() ) !== null ) { |
|
306 | - $cntl->delete( $refItem ); |
|
305 | + if (count($items) === 1 && ($refItem = $listItem->getRefItem()) !== null) { |
|
306 | + $cntl->delete($refItem); |
|
307 | 307 | } |
308 | 308 | |
309 | - $item->deleteListItem( 'media', $listItem, $refItem ); |
|
309 | + $item->deleteListItem('media', $listItem, $refItem); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | return $item; |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | * @since 2017.07 |
354 | 354 | * @category Developer |
355 | 355 | */ |
356 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/service/media/standard/subparts', [] ); |
|
356 | + return $this->getContext()->getConfig()->get('admin/jqadm/service/media/standard/subparts', []); |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | |
@@ -363,54 +363,54 @@ discard block |
||
363 | 363 | * @param \Aimeos\MShop\Service\Item\Iface $item Service item object without referenced domain items |
364 | 364 | * @param string[] $data Data array |
365 | 365 | */ |
366 | - protected function fromArray( \Aimeos\MShop\Service\Item\Iface $item, array $data ) |
|
366 | + protected function fromArray(\Aimeos\MShop\Service\Item\Iface $item, array $data) |
|
367 | 367 | { |
368 | 368 | $context = $this->getContext(); |
369 | 369 | |
370 | - $mediaManager = \Aimeos\MShop::create( $context, 'media' ); |
|
371 | - $listManager = \Aimeos\MShop::create( $context, 'service/lists' ); |
|
372 | - $cntl = \Aimeos\Controller\Common\Media\Factory::create( $context ); |
|
370 | + $mediaManager = \Aimeos\MShop::create($context, 'media'); |
|
371 | + $listManager = \Aimeos\MShop::create($context, 'service/lists'); |
|
372 | + $cntl = \Aimeos\Controller\Common\Media\Factory::create($context); |
|
373 | 373 | |
374 | - $listItems = $item->getListItems( 'media', null, null, false ); |
|
374 | + $listItems = $item->getListItems('media', null, null, false); |
|
375 | 375 | $files = (array) $this->getView()->request()->getUploadedFiles(); |
376 | 376 | |
377 | - foreach( $data as $idx => $entry ) |
|
377 | + foreach ($data as $idx => $entry) |
|
378 | 378 | { |
379 | - if( ( $listItem = $item->getListItem( 'media', $entry['service.lists.type'], $entry['media.id'], false ) ) === null ) { |
|
379 | + if (($listItem = $item->getListItem('media', $entry['service.lists.type'], $entry['media.id'], false)) === null) { |
|
380 | 380 | $listItem = $listManager->createItem(); |
381 | 381 | } |
382 | 382 | |
383 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
383 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
384 | 384 | $refItem = $mediaManager->createItem(); |
385 | 385 | } |
386 | 386 | |
387 | - $refItem->fromArray( $entry ); |
|
387 | + $refItem->fromArray($entry); |
|
388 | 388 | |
389 | - if( ( $file = $this->getValue( $files, 'media/' . $idx . '/file' ) ) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE ) |
|
389 | + if (($file = $this->getValue($files, 'media/' . $idx . '/file')) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE) |
|
390 | 390 | { |
391 | - $refItem->getId() ?: $refItem->setUrl( '' )->setPreview( '' ); // keep copied media |
|
392 | - $cntl->add( $refItem, $file ); |
|
391 | + $refItem->getId() ?: $refItem->setUrl('')->setPreview(''); // keep copied media |
|
392 | + $cntl->add($refItem, $file); |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | $conf = []; |
396 | 396 | |
397 | - foreach( (array) $this->getValue( $entry, 'config/key' ) as $num => $key ) |
|
397 | + foreach ((array) $this->getValue($entry, 'config/key') as $num => $key) |
|
398 | 398 | { |
399 | - if( trim( $key ) !== '' && ( $val = $this->getValue( $entry, 'config/val/' . $num ) ) !== null ) { |
|
400 | - $conf[$key] = trim( $val ); |
|
399 | + if (trim($key) !== '' && ($val = $this->getValue($entry, 'config/val/' . $num)) !== null) { |
|
400 | + $conf[$key] = trim($val); |
|
401 | 401 | } |
402 | 402 | } |
403 | 403 | |
404 | - $listItem->fromArray( $entry ); |
|
405 | - $listItem->setPosition( $idx ); |
|
406 | - $listItem->setConfig( $conf ); |
|
404 | + $listItem->fromArray($entry); |
|
405 | + $listItem->setPosition($idx); |
|
406 | + $listItem->setConfig($conf); |
|
407 | 407 | |
408 | - $item->addListItem( 'media', $listItem, $refItem ); |
|
408 | + $item->addListItem('media', $listItem, $refItem); |
|
409 | 409 | |
410 | - unset( $listItems[$listItem->getId()] ); |
|
410 | + unset($listItems[$listItem->getId()]); |
|
411 | 411 | } |
412 | 412 | |
413 | - return $this->deleteMediaItems( $item, $listItems ); |
|
413 | + return $this->deleteMediaItems($item, $listItems); |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | |
@@ -421,20 +421,20 @@ discard block |
||
421 | 421 | * @param boolean $copy True if items should be copied, false if not |
422 | 422 | * @return string[] Multi-dimensional associative list of item data |
423 | 423 | */ |
424 | - protected function toArray( \Aimeos\MShop\Service\Item\Iface $item, $copy = false ) |
|
424 | + protected function toArray(\Aimeos\MShop\Service\Item\Iface $item, $copy = false) |
|
425 | 425 | { |
426 | 426 | $data = []; |
427 | 427 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
428 | 428 | |
429 | - foreach( $item->getListItems( 'media', null, null, false ) as $listItem ) |
|
429 | + foreach ($item->getListItems('media', null, null, false) as $listItem) |
|
430 | 430 | { |
431 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
431 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
432 | 432 | continue; |
433 | 433 | } |
434 | 434 | |
435 | - $list = $listItem->toArray( true ) + $refItem->toArray( true ); |
|
435 | + $list = $listItem->toArray(true) + $refItem->toArray(true); |
|
436 | 436 | |
437 | - if( $copy === true ) |
|
437 | + if ($copy === true) |
|
438 | 438 | { |
439 | 439 | $list['service.lists.siteid'] = $siteId; |
440 | 440 | $list['service.lists.id'] = ''; |
@@ -442,10 +442,10 @@ discard block |
||
442 | 442 | $list['media.id'] = null; |
443 | 443 | } |
444 | 444 | |
445 | - $list['service.lists.datestart'] = str_replace( ' ', 'T', $list['service.lists.datestart'] ); |
|
446 | - $list['service.lists.dateend'] = str_replace( ' ', 'T', $list['service.lists.dateend'] ); |
|
445 | + $list['service.lists.datestart'] = str_replace(' ', 'T', $list['service.lists.datestart']); |
|
446 | + $list['service.lists.dateend'] = str_replace(' ', 'T', $list['service.lists.dateend']); |
|
447 | 447 | |
448 | - foreach( $list['service.lists.config'] as $key => $val ) |
|
448 | + foreach ($list['service.lists.config'] as $key => $val) |
|
449 | 449 | { |
450 | 450 | $list['config']['key'][] = $key; |
451 | 451 | $list['config']['val'][] = $val; |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
465 | 465 | * @return string HTML output |
466 | 466 | */ |
467 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
467 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
468 | 468 | { |
469 | 469 | /** admin/jqadm/service/media/template-item |
470 | 470 | * Relative path to the HTML body template of the media subpart for services. |
@@ -488,6 +488,6 @@ discard block |
||
488 | 488 | $tplconf = 'admin/jqadm/service/media/template-item'; |
489 | 489 | $default = 'service/item-media-standard'; |
490 | 490 | |
491 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
491 | + return $view->render($view->config($tplconf, $default)); |
|
492 | 492 | } |
493 | 493 | } |
494 | 494 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Service\Price; |
12 | 12 | |
13 | -sprintf( 'price' ); // for translation |
|
13 | +sprintf('price'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -42,16 +42,16 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function copy() |
44 | 44 | { |
45 | - $view = $this->addViewData( $this->getView() ); |
|
45 | + $view = $this->addViewData($this->getView()); |
|
46 | 46 | |
47 | - $view->priceData = $this->toArray( $view->item, true ); |
|
47 | + $view->priceData = $this->toArray($view->item, true); |
|
48 | 48 | $view->priceBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->priceBody .= $client->copy(); |
52 | 52 | } |
53 | 53 | |
54 | - return $this->render( $view ); |
|
54 | + return $this->render($view); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function create() |
64 | 64 | { |
65 | - $view = $this->addViewData( $this->getView() ); |
|
65 | + $view = $this->addViewData($this->getView()); |
|
66 | 66 | $siteid = $this->getContext()->getLocale()->getSiteId(); |
67 | - $data = $view->param( 'price', [] ); |
|
67 | + $data = $view->param('price', []); |
|
68 | 68 | |
69 | - foreach( $data as $idx => $entry ) |
|
69 | + foreach ($data as $idx => $entry) |
|
70 | 70 | { |
71 | 71 | $data[$idx]['service.lists.siteid'] = $siteid; |
72 | 72 | $data[$idx]['price.siteid'] = $siteid; |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | $view->priceData = $data; |
76 | 76 | $view->priceBody = ''; |
77 | 77 | |
78 | - foreach( $this->getSubClients() as $client ) { |
|
78 | + foreach ($this->getSubClients() as $client) { |
|
79 | 79 | $view->priceBody .= $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( 'price', null, null, false ), true ); |
|
94 | + $item->deleteListItems($item->getListItems('price', null, null, false), true); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
@@ -102,16 +102,16 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function get() |
104 | 104 | { |
105 | - $view = $this->addViewData( $this->getView() ); |
|
105 | + $view = $this->addViewData($this->getView()); |
|
106 | 106 | |
107 | - $view->priceData = $this->toArray( $view->item ); |
|
107 | + $view->priceData = $this->toArray($view->item); |
|
108 | 108 | $view->priceBody = ''; |
109 | 109 | |
110 | - foreach( $this->getSubClients() as $client ) { |
|
110 | + foreach ($this->getSubClients() as $client) { |
|
111 | 111 | $view->priceBody .= $client->get(); |
112 | 112 | } |
113 | 113 | |
114 | - return $this->render( $view ); |
|
114 | + return $this->render($view); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -124,26 +124,26 @@ discard block |
||
124 | 124 | |
125 | 125 | try |
126 | 126 | { |
127 | - $view->item = $this->fromArray( $view->item, $view->param( 'price', [] ) ); |
|
127 | + $view->item = $this->fromArray($view->item, $view->param('price', [])); |
|
128 | 128 | $view->priceBody = ''; |
129 | 129 | |
130 | - foreach( $this->getSubClients() as $client ) { |
|
130 | + foreach ($this->getSubClients() as $client) { |
|
131 | 131 | $view->priceBody .= $client->save(); |
132 | 132 | } |
133 | 133 | |
134 | 134 | return; |
135 | 135 | } |
136 | - catch( \Aimeos\MShop\Exception $e ) |
|
136 | + catch (\Aimeos\MShop\Exception $e) |
|
137 | 137 | { |
138 | - $error = array( 'service-item-price' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
139 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
140 | - $this->logException( $e ); |
|
138 | + $error = array('service-item-price' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
139 | + $view->errors = $view->get('errors', []) + $error; |
|
140 | + $this->logException($e); |
|
141 | 141 | } |
142 | - catch( \Exception $e ) |
|
142 | + catch (\Exception $e) |
|
143 | 143 | { |
144 | - $error = array( 'service-item-price' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
145 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
146 | - $this->logException( $e ); |
|
144 | + $error = array('service-item-price' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
145 | + $view->errors = $view->get('errors', []) + $error; |
|
146 | + $this->logException($e); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | throw new \Aimeos\Admin\JQAdm\Exception(); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @param string|null $name Name of the sub-client (Default if null) |
158 | 158 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
159 | 159 | */ |
160 | - public function getSubClient( $type, $name = null ) |
|
160 | + public function getSubClient($type, $name = null) |
|
161 | 161 | { |
162 | 162 | /** admin/jqadm/service/price/decorators/excludes |
163 | 163 | * Excludes decorators added by the "common" option from the service JQAdm client |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @see admin/jqadm/service/price/decorators/excludes |
233 | 233 | * @see admin/jqadm/service/price/decorators/global |
234 | 234 | */ |
235 | - return $this->createSubClient( 'service/price/' . $type, $name ); |
|
235 | + return $this->createSubClient('service/price/' . $type, $name); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * @since 2016.01 |
277 | 277 | * @category Developer |
278 | 278 | */ |
279 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/service/price/standard/subparts', [] ); |
|
279 | + return $this->getContext()->getConfig()->get('admin/jqadm/service/price/standard/subparts', []); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | |
@@ -286,28 +286,28 @@ discard block |
||
286 | 286 | * @param \Aimeos\MW\View\Iface $view View object |
287 | 287 | * @return \Aimeos\MW\View\Iface View object with assigned parameters |
288 | 288 | */ |
289 | - protected function addViewData( \Aimeos\MW\View\Iface $view ) |
|
289 | + protected function addViewData(\Aimeos\MW\View\Iface $view) |
|
290 | 290 | { |
291 | 291 | $context = $this->getContext(); |
292 | 292 | |
293 | - $priceTypeManager = \Aimeos\MShop::create( $context, 'price/type' ); |
|
294 | - $listTypeManager = \Aimeos\MShop::create( $context, 'service/lists/type' ); |
|
295 | - $currencyManager = \Aimeos\MShop::create( $context, 'locale/currency' ); |
|
293 | + $priceTypeManager = \Aimeos\MShop::create($context, 'price/type'); |
|
294 | + $listTypeManager = \Aimeos\MShop::create($context, 'service/lists/type'); |
|
295 | + $currencyManager = \Aimeos\MShop::create($context, 'locale/currency'); |
|
296 | 296 | |
297 | - $search = $priceTypeManager->createSearch( true )->setSlice( 0, 10000 ); |
|
298 | - $search->setConditions( $search->compare( '==', 'price.type.domain', 'service' ) ); |
|
299 | - $search->setSortations( [$search->sort( '+', 'price.type.position' )] ); |
|
297 | + $search = $priceTypeManager->createSearch(true)->setSlice(0, 10000); |
|
298 | + $search->setConditions($search->compare('==', 'price.type.domain', 'service')); |
|
299 | + $search->setSortations([$search->sort('+', 'price.type.position')]); |
|
300 | 300 | |
301 | - $listSearch = $listTypeManager->createSearch( true )->setSlice( 0, 10000 ); |
|
302 | - $listSearch->setConditions( $listSearch->compare( '==', 'service.lists.type.domain', 'price' ) ); |
|
303 | - $listSearch->setSortations( [$listSearch->sort( '+', 'service.lists.type.position' )] ); |
|
301 | + $listSearch = $listTypeManager->createSearch(true)->setSlice(0, 10000); |
|
302 | + $listSearch->setConditions($listSearch->compare('==', 'service.lists.type.domain', 'price')); |
|
303 | + $listSearch->setSortations([$listSearch->sort('+', 'service.lists.type.position')]); |
|
304 | 304 | |
305 | - $view->priceTypes = $this->map( $priceTypeManager->searchItems( $search ) ); |
|
306 | - $view->priceListTypes = $this->map( $listTypeManager->searchItems( $listSearch ) ); |
|
307 | - $view->priceCurrencies = $currencyManager->searchItems( $currencyManager->createSearch( true )->setSlice( 0, 10000 ) ); |
|
305 | + $view->priceTypes = $this->map($priceTypeManager->searchItems($search)); |
|
306 | + $view->priceListTypes = $this->map($listTypeManager->searchItems($listSearch)); |
|
307 | + $view->priceCurrencies = $currencyManager->searchItems($currencyManager->createSearch(true)->setSlice(0, 10000)); |
|
308 | 308 | |
309 | - if( $view->priceCurrencies === [] ) { |
|
310 | - throw new \Aimeos\Admin\JQAdm\Exception( 'No currencies available. Please enable at least one currency' ); |
|
309 | + if ($view->priceCurrencies === []) { |
|
310 | + throw new \Aimeos\Admin\JQAdm\Exception('No currencies available. Please enable at least one currency'); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | return $view; |
@@ -320,46 +320,46 @@ discard block |
||
320 | 320 | * @param \Aimeos\MShop\Service\Item\Iface $item Service item object without referenced domain items |
321 | 321 | * @param string[] $data Data array |
322 | 322 | */ |
323 | - protected function fromArray( \Aimeos\MShop\Service\Item\Iface $item, array $data ) |
|
323 | + protected function fromArray(\Aimeos\MShop\Service\Item\Iface $item, array $data) |
|
324 | 324 | { |
325 | 325 | $context = $this->getContext(); |
326 | 326 | |
327 | - $priceManager = \Aimeos\MShop::create( $context, 'price' ); |
|
328 | - $listManager = \Aimeos\MShop::create( $context, 'service/lists' ); |
|
327 | + $priceManager = \Aimeos\MShop::create($context, 'price'); |
|
328 | + $listManager = \Aimeos\MShop::create($context, 'service/lists'); |
|
329 | 329 | |
330 | - $listItems = $item->getListItems( 'price', null, null, false ); |
|
330 | + $listItems = $item->getListItems('price', null, null, false); |
|
331 | 331 | |
332 | 332 | |
333 | - foreach( $data as $idx => $entry ) |
|
333 | + foreach ($data as $idx => $entry) |
|
334 | 334 | { |
335 | - if( ( $listItem = $item->getListItem( 'price', $entry['service.lists.type'], $entry['price.id'], false ) ) === null ) { |
|
335 | + if (($listItem = $item->getListItem('price', $entry['service.lists.type'], $entry['price.id'], false)) === null) { |
|
336 | 336 | $listItem = $listManager->createItem(); |
337 | 337 | } |
338 | 338 | |
339 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
339 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
340 | 340 | $refItem = $priceManager->createItem(); |
341 | 341 | } |
342 | 342 | |
343 | - $refItem->fromArray( $entry ); |
|
343 | + $refItem->fromArray($entry); |
|
344 | 344 | $conf = []; |
345 | 345 | |
346 | - foreach( (array) $this->getValue( $entry, 'config/key' ) as $num => $key ) |
|
346 | + foreach ((array) $this->getValue($entry, 'config/key') as $num => $key) |
|
347 | 347 | { |
348 | - if( trim( $key ) !== '' && ( $val = $this->getValue( $entry, 'config/val/' . $num ) ) !== null ) { |
|
349 | - $conf[$key] = trim( $val ); |
|
348 | + if (trim($key) !== '' && ($val = $this->getValue($entry, 'config/val/' . $num)) !== null) { |
|
349 | + $conf[$key] = trim($val); |
|
350 | 350 | } |
351 | 351 | } |
352 | 352 | |
353 | - $listItem->fromArray( $entry ); |
|
354 | - $listItem->setPosition( $idx ); |
|
355 | - $listItem->setConfig( $conf ); |
|
353 | + $listItem->fromArray($entry); |
|
354 | + $listItem->setPosition($idx); |
|
355 | + $listItem->setConfig($conf); |
|
356 | 356 | |
357 | - $item->addListItem( 'price', $listItem, $refItem ); |
|
357 | + $item->addListItem('price', $listItem, $refItem); |
|
358 | 358 | |
359 | - unset( $listItems[$listItem->getId()] ); |
|
359 | + unset($listItems[$listItem->getId()]); |
|
360 | 360 | } |
361 | 361 | |
362 | - return $item->deleteListItems( $listItems, true ); |
|
362 | + return $item->deleteListItems($listItems, true); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | |
@@ -370,20 +370,20 @@ discard block |
||
370 | 370 | * @param boolean $copy True if items should be copied, false if not |
371 | 371 | * @return string[] Multi-dimensional associative list of item data |
372 | 372 | */ |
373 | - protected function toArray( \Aimeos\MShop\Service\Item\Iface $item, $copy = false ) |
|
373 | + protected function toArray(\Aimeos\MShop\Service\Item\Iface $item, $copy = false) |
|
374 | 374 | { |
375 | 375 | $data = []; |
376 | 376 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
377 | 377 | |
378 | - foreach( $item->getListItems( 'price', null, null, false ) as $listItem ) |
|
378 | + foreach ($item->getListItems('price', null, null, false) as $listItem) |
|
379 | 379 | { |
380 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
380 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
381 | 381 | continue; |
382 | 382 | } |
383 | 383 | |
384 | - $list = $listItem->toArray( true ) + $refItem->toArray( true ); |
|
384 | + $list = $listItem->toArray(true) + $refItem->toArray(true); |
|
385 | 385 | |
386 | - if( $copy === true ) |
|
386 | + if ($copy === true) |
|
387 | 387 | { |
388 | 388 | $list['service.lists.siteid'] = $siteId; |
389 | 389 | $list['service.lists.id'] = ''; |
@@ -391,10 +391,10 @@ discard block |
||
391 | 391 | $list['price.id'] = null; |
392 | 392 | } |
393 | 393 | |
394 | - $list['service.lists.datestart'] = str_replace( ' ', 'T', $list['service.lists.datestart'] ); |
|
395 | - $list['service.lists.dateend'] = str_replace( ' ', 'T', $list['service.lists.dateend'] ); |
|
394 | + $list['service.lists.datestart'] = str_replace(' ', 'T', $list['service.lists.datestart']); |
|
395 | + $list['service.lists.dateend'] = str_replace(' ', 'T', $list['service.lists.dateend']); |
|
396 | 396 | |
397 | - foreach( $list['service.lists.config'] as $key => $val ) |
|
397 | + foreach ($list['service.lists.config'] as $key => $val) |
|
398 | 398 | { |
399 | 399 | $list['config']['key'][] = $key; |
400 | 400 | $list['config']['val'][] = $val; |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
414 | 414 | * @return string HTML output |
415 | 415 | */ |
416 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
416 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
417 | 417 | { |
418 | 418 | /** admin/jqadm/service/price/template-item |
419 | 419 | * Relative path to the HTML body template of the price subpart for services. |
@@ -437,6 +437,6 @@ discard block |
||
437 | 437 | $tplconf = 'admin/jqadm/service/price/template-item'; |
438 | 438 | $default = 'service/item-price-standard'; |
439 | 439 | |
440 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
440 | + return $view->render($view->config($tplconf, $default)); |
|
441 | 441 | } |
442 | 442 | } |
443 | 443 | \ No newline at end of file |