@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @return \Aimeos\Admin\JQAdm\Iface Filter part implementing \Aimeos\Admin\JQAdm\Iface |
30 | 30 | * @throws \Aimeos\Admin\JQAdm\Exception If requested client implementation couldn't be found or initialisation fails |
31 | 31 | */ |
32 | - public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, $name = null ) |
|
32 | + public static function createClient(\Aimeos\MShop\Context\Item\Iface $context, $name = null) |
|
33 | 33 | { |
34 | 34 | /** admin/jqadm/group/name |
35 | 35 | * Class name of the used account favorite client implementation |
@@ -64,22 +64,22 @@ discard block |
||
64 | 64 | * @since 2018.07 |
65 | 65 | * @category Developer |
66 | 66 | */ |
67 | - if( $name === null ) { |
|
68 | - $name = $context->getConfig()->get( 'admin/jqadm/group/name', 'Standard' ); |
|
67 | + if ($name === null) { |
|
68 | + $name = $context->getConfig()->get('admin/jqadm/group/name', 'Standard'); |
|
69 | 69 | } |
70 | 70 | |
71 | - if( ctype_alnum( $name ) === false ) |
|
71 | + if (ctype_alnum($name) === false) |
|
72 | 72 | { |
73 | - $classname = is_string( $name ) ? '\\Aimeos\\Admin\\JQAdm\\Group\\' . $name : '<not a string>'; |
|
74 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
73 | + $classname = is_string($name) ? '\\Aimeos\\Admin\\JQAdm\\Group\\' . $name : '<not a string>'; |
|
74 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | $iface = '\\Aimeos\\Admin\\JQAdm\\Iface'; |
78 | 78 | $classname = '\\Aimeos\\Admin\\JQAdm\\Group\\' . $name; |
79 | 79 | |
80 | - $client = self::createClientBase( $context, $classname, $iface ); |
|
80 | + $client = self::createClientBase($context, $classname, $iface); |
|
81 | 81 | |
82 | - return self::addClientDecorators( $context, $client, 'group' ); |
|
82 | + return self::addClientDecorators($context, $client, 'group'); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | } |
86 | 86 | \ No newline at end of file |
@@ -17,42 +17,42 @@ |
||
17 | 17 | protected function setUp() |
18 | 18 | { |
19 | 19 | $this->context = \TestHelperJqadm::getContext(); |
20 | - $this->context->setView( \TestHelperJqadm::getView() ); |
|
20 | + $this->context->setView(\TestHelperJqadm::getView()); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
24 | 24 | public function testCreateClient() |
25 | 25 | { |
26 | - $client = \Aimeos\Admin\JQAdm\Group\Factory::createClient( $this->context ); |
|
27 | - $this->assertInstanceOf( '\\Aimeos\\Admin\\JQAdm\\Iface', $client ); |
|
26 | + $client = \Aimeos\Admin\JQAdm\Group\Factory::createClient($this->context); |
|
27 | + $this->assertInstanceOf('\\Aimeos\\Admin\\JQAdm\\Iface', $client); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
31 | 31 | public function testCreateClientName() |
32 | 32 | { |
33 | - $client = \Aimeos\Admin\JQAdm\Group\Factory::createClient( $this->context, 'Standard' ); |
|
34 | - $this->assertInstanceOf( '\\Aimeos\\Admin\\JQAdm\\Iface', $client ); |
|
33 | + $client = \Aimeos\Admin\JQAdm\Group\Factory::createClient($this->context, 'Standard'); |
|
34 | + $this->assertInstanceOf('\\Aimeos\\Admin\\JQAdm\\Iface', $client); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | 38 | public function testCreateClientNameEmpty() |
39 | 39 | { |
40 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
41 | - \Aimeos\Admin\JQAdm\Group\Factory::createClient( $this->context, '' ); |
|
40 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
41 | + \Aimeos\Admin\JQAdm\Group\Factory::createClient($this->context, ''); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
45 | 45 | public function testCreateClientNameInvalid() |
46 | 46 | { |
47 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
48 | - \Aimeos\Admin\JQAdm\Group\Factory::createClient( $this->context, '%group' ); |
|
47 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
48 | + \Aimeos\Admin\JQAdm\Group\Factory::createClient($this->context, '%group'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
52 | 52 | public function testCreateClientNameNotFound() |
53 | 53 | { |
54 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
55 | - \Aimeos\Admin\JQAdm\Group\Factory::createClient( $this->context, 'test' ); |
|
54 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
55 | + \Aimeos\Admin\JQAdm\Group\Factory::createClient($this->context, 'test'); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | } |
@@ -160,14 +160,12 @@ |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | return; |
163 | - } |
|
164 | - catch( \Aimeos\MShop\Exception $e ) |
|
163 | + } catch( \Aimeos\MShop\Exception $e ) |
|
165 | 164 | { |
166 | 165 | $error = array( 'attribute-item-text' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
167 | 166 | $view->errors = $view->get( 'errors', [] ) + $error; |
168 | 167 | $this->logException( $e ); |
169 | - } |
|
170 | - catch( \Exception $e ) |
|
168 | + } catch( \Exception $e ) |
|
171 | 169 | { |
172 | 170 | $error = array( 'attribute-item-text' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
173 | 171 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Attribute\Text; |
12 | 12 | |
13 | -sprintf( 'text' ); // for translation |
|
13 | +sprintf('text'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -42,16 +42,16 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function copy() |
44 | 44 | { |
45 | - $view = $this->addViewData( $this->getView() ); |
|
45 | + $view = $this->addViewData($this->getView()); |
|
46 | 46 | |
47 | - $view->textData = $this->toArray( $view->item, true ); |
|
47 | + $view->textData = $this->toArray($view->item, true); |
|
48 | 48 | $view->textBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->textBody .= $client->copy(); |
52 | 52 | } |
53 | 53 | |
54 | - return $this->render( $view ); |
|
54 | + return $this->render($view); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function create() |
64 | 64 | { |
65 | - $view = $this->addViewData( $this->getView() ); |
|
65 | + $view = $this->addViewData($this->getView()); |
|
66 | 66 | $siteid = $this->getContext()->getLocale()->getSiteId(); |
67 | - $data = $view->param( 'text', [] ); |
|
67 | + $data = $view->param('text', []); |
|
68 | 68 | |
69 | - foreach( $data as $idx => $entry ) |
|
69 | + foreach ($data as $idx => $entry) |
|
70 | 70 | { |
71 | 71 | $data[$idx]['attribute.lists.siteid'] = $siteid; |
72 | 72 | $data[$idx]['text.siteid'] = $siteid; |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | $view->textData = $data; |
76 | 76 | $view->textBody = ''; |
77 | 77 | |
78 | - foreach( $this->getSubClients() as $client ) { |
|
78 | + foreach ($this->getSubClients() as $client) { |
|
79 | 79 | $view->textBody .= $client->create(); |
80 | 80 | } |
81 | 81 | |
82 | - return $this->render( $view ); |
|
82 | + return $this->render($view); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | parent::delete(); |
92 | 92 | |
93 | 93 | $item = $this->getView()->item; |
94 | - $item->deleteListItems( $item->getListItems( 'text', null, null, false ), true ); |
|
94 | + $item->deleteListItems($item->getListItems('text', null, null, false), true); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
@@ -102,16 +102,16 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function get() |
104 | 104 | { |
105 | - $view = $this->addViewData( $this->getView() ); |
|
105 | + $view = $this->addViewData($this->getView()); |
|
106 | 106 | |
107 | - $view->textData = $this->toArray( $view->item ); |
|
107 | + $view->textData = $this->toArray($view->item); |
|
108 | 108 | $view->textBody = ''; |
109 | 109 | |
110 | - foreach( $this->getSubClients() as $client ) { |
|
110 | + foreach ($this->getSubClients() as $client) { |
|
111 | 111 | $view->textBody .= $client->get(); |
112 | 112 | } |
113 | 113 | |
114 | - return $this->render( $view ); |
|
114 | + return $this->render($view); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -124,26 +124,26 @@ discard block |
||
124 | 124 | |
125 | 125 | try |
126 | 126 | { |
127 | - $view->item = $this->fromArray( $view->item, $view->param( 'text', [] ) ); |
|
127 | + $view->item = $this->fromArray($view->item, $view->param('text', [])); |
|
128 | 128 | $view->textBody = ''; |
129 | 129 | |
130 | - foreach( $this->getSubClients() as $client ) { |
|
130 | + foreach ($this->getSubClients() as $client) { |
|
131 | 131 | $view->textBody .= $client->save(); |
132 | 132 | } |
133 | 133 | |
134 | 134 | return; |
135 | 135 | } |
136 | - catch( \Aimeos\MShop\Exception $e ) |
|
136 | + catch (\Aimeos\MShop\Exception $e) |
|
137 | 137 | { |
138 | - $error = array( 'attribute-item-text' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
139 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
140 | - $this->logException( $e ); |
|
138 | + $error = array('attribute-item-text' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
139 | + $view->errors = $view->get('errors', []) + $error; |
|
140 | + $this->logException($e); |
|
141 | 141 | } |
142 | - catch( \Exception $e ) |
|
142 | + catch (\Exception $e) |
|
143 | 143 | { |
144 | - $error = array( 'attribute-item-text' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
145 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
146 | - $this->logException( $e ); |
|
144 | + $error = array('attribute-item-text' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
145 | + $view->errors = $view->get('errors', []) + $error; |
|
146 | + $this->logException($e); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | throw new \Aimeos\Admin\JQAdm\Exception(); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @param string|null $name Name of the sub-client (Default if null) |
158 | 158 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
159 | 159 | */ |
160 | - public function getSubClient( $type, $name = null ) |
|
160 | + public function getSubClient($type, $name = null) |
|
161 | 161 | { |
162 | 162 | /** admin/jqadm/attribute/text/decorators/excludes |
163 | 163 | * Excludes decorators added by the "common" option from the attribute JQAdm client |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @see admin/jqadm/attribute/text/decorators/excludes |
233 | 233 | * @see admin/jqadm/attribute/text/decorators/global |
234 | 234 | */ |
235 | - return $this->createSubClient( 'attribute/text/' . $type, $name ); |
|
235 | + return $this->createSubClient('attribute/text/' . $type, $name); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * @since 2017.07 |
277 | 277 | * @category Developer |
278 | 278 | */ |
279 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/attribute/text/standard/subparts', [] ); |
|
279 | + return $this->getContext()->getConfig()->get('admin/jqadm/attribute/text/standard/subparts', []); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | |
@@ -286,23 +286,23 @@ discard block |
||
286 | 286 | * @param \Aimeos\MW\View\Iface $view View object |
287 | 287 | * @return \Aimeos\MW\View\Iface View object with assigned parameters |
288 | 288 | */ |
289 | - protected function addViewData( \Aimeos\MW\View\Iface $view ) |
|
289 | + protected function addViewData(\Aimeos\MW\View\Iface $view) |
|
290 | 290 | { |
291 | 291 | $context = $this->getContext(); |
292 | 292 | |
293 | - $textTypeManager = \Aimeos\MShop\Factory::createManager( $context, 'text/type' ); |
|
294 | - $listTypeManager = \Aimeos\MShop\Factory::createManager( $context, 'attribute/lists/type' ); |
|
293 | + $textTypeManager = \Aimeos\MShop\Factory::createManager($context, 'text/type'); |
|
294 | + $listTypeManager = \Aimeos\MShop\Factory::createManager($context, 'attribute/lists/type'); |
|
295 | 295 | |
296 | - $search = $textTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff ); |
|
297 | - $search->setConditions( $search->compare( '==', 'text.type.domain', 'attribute' ) ); |
|
298 | - $search->setSortations( array( $search->sort( '+', 'text.type.label' ) ) ); |
|
296 | + $search = $textTypeManager->createSearch(true)->setSlice(0, 0x7fffffff); |
|
297 | + $search->setConditions($search->compare('==', 'text.type.domain', 'attribute')); |
|
298 | + $search->setSortations(array($search->sort('+', 'text.type.label'))); |
|
299 | 299 | |
300 | - $listSearch = $listTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff ); |
|
301 | - $listSearch->setConditions( $listSearch->compare( '==', 'attribute.lists.type.domain', 'text' ) ); |
|
302 | - $listSearch->setSortations( array( $listSearch->sort( '+', 'attribute.lists.type.label' ) ) ); |
|
300 | + $listSearch = $listTypeManager->createSearch(true)->setSlice(0, 0x7fffffff); |
|
301 | + $listSearch->setConditions($listSearch->compare('==', 'attribute.lists.type.domain', 'text')); |
|
302 | + $listSearch->setSortations(array($listSearch->sort('+', 'attribute.lists.type.label'))); |
|
303 | 303 | |
304 | - $view->textTypes = $textTypeManager->searchItems( $search ); |
|
305 | - $view->textListTypes = $this->sortType( $listTypeManager->searchItems( $listSearch ) ); |
|
304 | + $view->textTypes = $textTypeManager->searchItems($search); |
|
305 | + $view->textListTypes = $this->sortType($listTypeManager->searchItems($listSearch)); |
|
306 | 306 | |
307 | 307 | return $view; |
308 | 308 | } |
@@ -314,50 +314,50 @@ discard block |
||
314 | 314 | * @param \Aimeos\MShop\Attribute\Item\Iface $item Attribute item object without referenced domain items |
315 | 315 | * @param string[] $data Data array |
316 | 316 | */ |
317 | - protected function fromArray( \Aimeos\MShop\Attribute\Item\Iface $item, array $data ) |
|
317 | + protected function fromArray(\Aimeos\MShop\Attribute\Item\Iface $item, array $data) |
|
318 | 318 | { |
319 | 319 | $context = $this->getContext(); |
320 | 320 | |
321 | - $textManager = \Aimeos\MShop\Factory::createManager( $context, 'text' ); |
|
322 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'attribute/lists' ); |
|
321 | + $textManager = \Aimeos\MShop\Factory::createManager($context, 'text'); |
|
322 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'attribute/lists'); |
|
323 | 323 | |
324 | - $listItems = $item->getListItems( 'text', null, null, false ); |
|
324 | + $listItems = $item->getListItems('text', null, null, false); |
|
325 | 325 | |
326 | 326 | |
327 | - foreach( $data as $idx => $entry ) |
|
327 | + foreach ($data as $idx => $entry) |
|
328 | 328 | { |
329 | - if( trim( $this->getValue( $entry, 'text.content', '' ) ) === '' ) { |
|
329 | + if (trim($this->getValue($entry, 'text.content', '')) === '') { |
|
330 | 330 | continue; |
331 | 331 | } |
332 | 332 | |
333 | - if( ( $listItem = $item->getListItem( 'text', $entry['attribute.lists.type'], $entry['text.id'], false ) ) === null ) { |
|
333 | + if (($listItem = $item->getListItem('text', $entry['attribute.lists.type'], $entry['text.id'], false)) === null) { |
|
334 | 334 | $listItem = $listManager->createItem(); |
335 | 335 | } |
336 | 336 | |
337 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
337 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
338 | 338 | $refItem = $textManager->createItem(); |
339 | 339 | } |
340 | 340 | |
341 | - $refItem->fromArray( $entry ); |
|
341 | + $refItem->fromArray($entry); |
|
342 | 342 | $conf = []; |
343 | 343 | |
344 | - foreach( (array) $this->getValue( $entry, 'config/key' ) as $num => $key ) |
|
344 | + foreach ((array) $this->getValue($entry, 'config/key') as $num => $key) |
|
345 | 345 | { |
346 | - if( trim( $key ) !== '' && ( $val = $this->getValue( $entry, 'config/val/' . $num ) ) !== null ) { |
|
347 | - $conf[$key] = trim( $val ); |
|
346 | + if (trim($key) !== '' && ($val = $this->getValue($entry, 'config/val/' . $num)) !== null) { |
|
347 | + $conf[$key] = trim($val); |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | |
351 | - $listItem->fromArray( $entry ); |
|
352 | - $listItem->setPosition( $idx ); |
|
353 | - $listItem->setConfig( $conf ); |
|
351 | + $listItem->fromArray($entry); |
|
352 | + $listItem->setPosition($idx); |
|
353 | + $listItem->setConfig($conf); |
|
354 | 354 | |
355 | - $item->addListItem( 'text', $listItem, $refItem ); |
|
355 | + $item->addListItem('text', $listItem, $refItem); |
|
356 | 356 | |
357 | - unset( $listItems[$listItem->getId()] ); |
|
357 | + unset($listItems[$listItem->getId()]); |
|
358 | 358 | } |
359 | 359 | |
360 | - return $item->deleteListItems( $listItems, true ); |
|
360 | + return $item->deleteListItems($listItems, true); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | |
@@ -368,20 +368,20 @@ discard block |
||
368 | 368 | * @param boolean $copy True if items should be copied, false if not |
369 | 369 | * @return string[] Multi-dimensional associative list of item data |
370 | 370 | */ |
371 | - protected function toArray( \Aimeos\MShop\Attribute\Item\Iface $item, $copy = false ) |
|
371 | + protected function toArray(\Aimeos\MShop\Attribute\Item\Iface $item, $copy = false) |
|
372 | 372 | { |
373 | 373 | $data = []; |
374 | 374 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
375 | 375 | |
376 | - foreach( $item->getListItems( 'text', null, null, false ) as $listItem ) |
|
376 | + foreach ($item->getListItems('text', null, null, false) as $listItem) |
|
377 | 377 | { |
378 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
378 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
379 | 379 | continue; |
380 | 380 | } |
381 | 381 | |
382 | - $list = $listItem->toArray( true ) + $refItem->toArray( true ); |
|
382 | + $list = $listItem->toArray(true) + $refItem->toArray(true); |
|
383 | 383 | |
384 | - if( $copy === true ) |
|
384 | + if ($copy === true) |
|
385 | 385 | { |
386 | 386 | $list['attribute.lists.siteid'] = $siteId; |
387 | 387 | $list['attribute.lists.id'] = ''; |
@@ -389,10 +389,10 @@ discard block |
||
389 | 389 | $list['text.id'] = null; |
390 | 390 | } |
391 | 391 | |
392 | - $list['attribute.lists.datestart'] = str_replace( ' ', 'T', $list['attribute.lists.datestart'] ); |
|
393 | - $list['attribute.lists.dateend'] = str_replace( ' ', 'T', $list['attribute.lists.dateend'] ); |
|
392 | + $list['attribute.lists.datestart'] = str_replace(' ', 'T', $list['attribute.lists.datestart']); |
|
393 | + $list['attribute.lists.dateend'] = str_replace(' ', 'T', $list['attribute.lists.dateend']); |
|
394 | 394 | |
395 | - foreach( $list['attribute.lists.config'] as $key => $val ) |
|
395 | + foreach ($list['attribute.lists.config'] as $key => $val) |
|
396 | 396 | { |
397 | 397 | $list['config']['key'][] = $key; |
398 | 398 | $list['config']['val'][] = $val; |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
412 | 412 | * @return string HTML output |
413 | 413 | */ |
414 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
414 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
415 | 415 | { |
416 | 416 | /** admin/jqadm/attribute/text/template-item |
417 | 417 | * Relative path to the HTML body template of the text subpart for attributes. |
@@ -435,6 +435,6 @@ discard block |
||
435 | 435 | $tplconf = 'admin/jqadm/attribute/text/template-item'; |
436 | 436 | $default = 'attribute/item-text-standard'; |
437 | 437 | |
438 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
438 | + return $view->render($view->config($tplconf, $default)); |
|
439 | 439 | } |
440 | 440 | } |
441 | 441 | \ No newline at end of file |
@@ -160,14 +160,12 @@ |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | return; |
163 | - } |
|
164 | - catch( \Aimeos\MShop\Exception $e ) |
|
163 | + } catch( \Aimeos\MShop\Exception $e ) |
|
165 | 164 | { |
166 | 165 | $error = array( 'product-item-text' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
167 | 166 | $view->errors = $view->get( 'errors', [] ) + $error; |
168 | 167 | $this->logException( $e ); |
169 | - } |
|
170 | - catch( \Exception $e ) |
|
168 | + } catch( \Exception $e ) |
|
171 | 169 | { |
172 | 170 | $error = array( 'product-item-text' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
173 | 171 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Product\Text; |
12 | 12 | |
13 | -sprintf( 'text' ); // for translation |
|
13 | +sprintf('text'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -42,16 +42,16 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function copy() |
44 | 44 | { |
45 | - $view = $this->addViewData( $this->getView() ); |
|
45 | + $view = $this->addViewData($this->getView()); |
|
46 | 46 | |
47 | - $view->textData = $this->toArray( $view->item, true ); |
|
47 | + $view->textData = $this->toArray($view->item, true); |
|
48 | 48 | $view->textBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->textBody .= $client->copy(); |
52 | 52 | } |
53 | 53 | |
54 | - return $this->render( $view ); |
|
54 | + return $this->render($view); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function create() |
64 | 64 | { |
65 | - $view = $this->addViewData( $this->getView() ); |
|
65 | + $view = $this->addViewData($this->getView()); |
|
66 | 66 | $siteid = $this->getContext()->getLocale()->getSiteId(); |
67 | - $data = $view->param( 'text', [] ); |
|
67 | + $data = $view->param('text', []); |
|
68 | 68 | |
69 | - foreach( $data as $idx => $entry ) |
|
69 | + foreach ($data as $idx => $entry) |
|
70 | 70 | { |
71 | 71 | $data[$idx]['product.lists.siteid'] = $siteid; |
72 | 72 | $data[$idx]['text.siteid'] = $siteid; |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | $view->textData = $data; |
76 | 76 | $view->textBody = ''; |
77 | 77 | |
78 | - foreach( $this->getSubClients() as $client ) { |
|
78 | + foreach ($this->getSubClients() as $client) { |
|
79 | 79 | $view->textBody .= $client->create(); |
80 | 80 | } |
81 | 81 | |
82 | - return $this->render( $view ); |
|
82 | + return $this->render($view); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | parent::delete(); |
92 | 92 | |
93 | 93 | $item = $this->getView()->item; |
94 | - $item->deleteListItems( $item->getListItems( 'text', null, null, false ), true ); |
|
94 | + $item->deleteListItems($item->getListItems('text', null, null, false), true); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
@@ -102,16 +102,16 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function get() |
104 | 104 | { |
105 | - $view = $this->addViewData( $this->getView() ); |
|
105 | + $view = $this->addViewData($this->getView()); |
|
106 | 106 | |
107 | - $view->textData = $this->toArray( $view->item ); |
|
107 | + $view->textData = $this->toArray($view->item); |
|
108 | 108 | $view->textBody = ''; |
109 | 109 | |
110 | - foreach( $this->getSubClients() as $client ) { |
|
110 | + foreach ($this->getSubClients() as $client) { |
|
111 | 111 | $view->textBody .= $client->get(); |
112 | 112 | } |
113 | 113 | |
114 | - return $this->render( $view ); |
|
114 | + return $this->render($view); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -124,26 +124,26 @@ discard block |
||
124 | 124 | |
125 | 125 | try |
126 | 126 | { |
127 | - $view->item = $this->fromArray( $view->item, $view->param( 'text', [] ) ); |
|
127 | + $view->item = $this->fromArray($view->item, $view->param('text', [])); |
|
128 | 128 | $view->textBody = ''; |
129 | 129 | |
130 | - foreach( $this->getSubClients() as $client ) { |
|
130 | + foreach ($this->getSubClients() as $client) { |
|
131 | 131 | $view->textBody .= $client->save(); |
132 | 132 | } |
133 | 133 | |
134 | 134 | return; |
135 | 135 | } |
136 | - catch( \Aimeos\MShop\Exception $e ) |
|
136 | + catch (\Aimeos\MShop\Exception $e) |
|
137 | 137 | { |
138 | - $error = array( 'product-item-text' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
139 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
140 | - $this->logException( $e ); |
|
138 | + $error = array('product-item-text' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
139 | + $view->errors = $view->get('errors', []) + $error; |
|
140 | + $this->logException($e); |
|
141 | 141 | } |
142 | - catch( \Exception $e ) |
|
142 | + catch (\Exception $e) |
|
143 | 143 | { |
144 | - $error = array( 'product-item-text' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
145 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
146 | - $this->logException( $e ); |
|
144 | + $error = array('product-item-text' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
145 | + $view->errors = $view->get('errors', []) + $error; |
|
146 | + $this->logException($e); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | throw new \Aimeos\Admin\JQAdm\Exception(); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @param string|null $name Name of the sub-client (Default if null) |
158 | 158 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
159 | 159 | */ |
160 | - public function getSubClient( $type, $name = null ) |
|
160 | + public function getSubClient($type, $name = null) |
|
161 | 161 | { |
162 | 162 | /** admin/jqadm/product/text/decorators/excludes |
163 | 163 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @see admin/jqadm/product/text/decorators/excludes |
233 | 233 | * @see admin/jqadm/product/text/decorators/global |
234 | 234 | */ |
235 | - return $this->createSubClient( 'product/text/' . $type, $name ); |
|
235 | + return $this->createSubClient('product/text/' . $type, $name); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * @since 2017.07 |
277 | 277 | * @category Developer |
278 | 278 | */ |
279 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/product/text/standard/subparts', [] ); |
|
279 | + return $this->getContext()->getConfig()->get('admin/jqadm/product/text/standard/subparts', []); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | |
@@ -286,23 +286,23 @@ discard block |
||
286 | 286 | * @param \Aimeos\MW\View\Iface $view View object |
287 | 287 | * @return \Aimeos\MW\View\Iface View object with assigned parameters |
288 | 288 | */ |
289 | - protected function addViewData( \Aimeos\MW\View\Iface $view ) |
|
289 | + protected function addViewData(\Aimeos\MW\View\Iface $view) |
|
290 | 290 | { |
291 | 291 | $context = $this->getContext(); |
292 | 292 | |
293 | - $textTypeManager = \Aimeos\MShop\Factory::createManager( $context, 'text/type' ); |
|
294 | - $listTypeManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists/type' ); |
|
293 | + $textTypeManager = \Aimeos\MShop\Factory::createManager($context, 'text/type'); |
|
294 | + $listTypeManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists/type'); |
|
295 | 295 | |
296 | - $search = $textTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff ); |
|
297 | - $search->setConditions( $search->compare( '==', 'text.type.domain', 'product' ) ); |
|
298 | - $search->setSortations( array( $search->sort( '+', 'text.type.label' ) ) ); |
|
296 | + $search = $textTypeManager->createSearch(true)->setSlice(0, 0x7fffffff); |
|
297 | + $search->setConditions($search->compare('==', 'text.type.domain', 'product')); |
|
298 | + $search->setSortations(array($search->sort('+', 'text.type.label'))); |
|
299 | 299 | |
300 | - $listSearch = $listTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff ); |
|
301 | - $listSearch->setConditions( $listSearch->compare( '==', 'product.lists.type.domain', 'text' ) ); |
|
302 | - $listSearch->setSortations( array( $listSearch->sort( '+', 'product.lists.type.label' ) ) ); |
|
300 | + $listSearch = $listTypeManager->createSearch(true)->setSlice(0, 0x7fffffff); |
|
301 | + $listSearch->setConditions($listSearch->compare('==', 'product.lists.type.domain', 'text')); |
|
302 | + $listSearch->setSortations(array($listSearch->sort('+', 'product.lists.type.label'))); |
|
303 | 303 | |
304 | - $view->textTypes = $textTypeManager->searchItems( $search ); |
|
305 | - $view->textListTypes = $this->sortType( $listTypeManager->searchItems( $listSearch ) ); |
|
304 | + $view->textTypes = $textTypeManager->searchItems($search); |
|
305 | + $view->textListTypes = $this->sortType($listTypeManager->searchItems($listSearch)); |
|
306 | 306 | |
307 | 307 | return $view; |
308 | 308 | } |
@@ -314,52 +314,52 @@ discard block |
||
314 | 314 | * @param \Aimeos\MShop\Product\Item\Iface $item Product item object without referenced domain items |
315 | 315 | * @param string[] $data Data array |
316 | 316 | */ |
317 | - protected function fromArray( \Aimeos\MShop\Product\Item\Iface $item, array $data ) |
|
317 | + protected function fromArray(\Aimeos\MShop\Product\Item\Iface $item, array $data) |
|
318 | 318 | { |
319 | 319 | $context = $this->getContext(); |
320 | 320 | |
321 | - $textManager = \Aimeos\MShop\Factory::createManager( $context, 'text' ); |
|
322 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
321 | + $textManager = \Aimeos\MShop\Factory::createManager($context, 'text'); |
|
322 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
323 | 323 | |
324 | - $listItems = $item->getListItems( 'text', null, null, false ); |
|
324 | + $listItems = $item->getListItems('text', null, null, false); |
|
325 | 325 | |
326 | 326 | |
327 | - foreach( $data as $idx => $entry ) |
|
327 | + foreach ($data as $idx => $entry) |
|
328 | 328 | { |
329 | - if( trim( $this->getValue( $entry, 'text.content', '' ) ) === '' ) { |
|
329 | + if (trim($this->getValue($entry, 'text.content', '')) === '') { |
|
330 | 330 | continue; |
331 | 331 | } |
332 | 332 | |
333 | 333 | $listType = $entry['product.lists.type']; |
334 | 334 | |
335 | - if( ( $listItem = $item->getListItem( 'text', $listType, $entry['text.id'], false ) ) === null ) { |
|
335 | + if (($listItem = $item->getListItem('text', $listType, $entry['text.id'], false)) === null) { |
|
336 | 336 | $listItem = $listManager->createItem(); |
337 | 337 | } |
338 | 338 | |
339 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
339 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
340 | 340 | $refItem = $textManager->createItem(); |
341 | 341 | } |
342 | 342 | |
343 | - $refItem->fromArray( $entry ); |
|
343 | + $refItem->fromArray($entry); |
|
344 | 344 | $conf = []; |
345 | 345 | |
346 | - foreach( (array) $this->getValue( $entry, 'config/key' ) as $num => $key ) |
|
346 | + foreach ((array) $this->getValue($entry, 'config/key') as $num => $key) |
|
347 | 347 | { |
348 | - if( trim( $key ) !== '' && ( $val = $this->getValue( $entry, 'config/val/' . $num ) ) !== null ) { |
|
349 | - $conf[$key] = trim( $val ); |
|
348 | + if (trim($key) !== '' && ($val = $this->getValue($entry, 'config/val/' . $num)) !== null) { |
|
349 | + $conf[$key] = trim($val); |
|
350 | 350 | } |
351 | 351 | } |
352 | 352 | |
353 | - $listItem->fromArray( $entry ); |
|
354 | - $listItem->setPosition( $idx ); |
|
355 | - $listItem->setConfig( $conf ); |
|
353 | + $listItem->fromArray($entry); |
|
354 | + $listItem->setPosition($idx); |
|
355 | + $listItem->setConfig($conf); |
|
356 | 356 | |
357 | - $item->addListItem( 'text', $listItem, $refItem ); |
|
357 | + $item->addListItem('text', $listItem, $refItem); |
|
358 | 358 | |
359 | - unset( $listItems[$listItem->getId()] ); |
|
359 | + unset($listItems[$listItem->getId()]); |
|
360 | 360 | } |
361 | 361 | |
362 | - return $item->deleteListItems( $listItems, true ); |
|
362 | + return $item->deleteListItems($listItems, true); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | |
@@ -370,20 +370,20 @@ discard block |
||
370 | 370 | * @param boolean $copy True if items should be copied, false if not |
371 | 371 | * @return string[] Multi-dimensional associative list of item data |
372 | 372 | */ |
373 | - protected function toArray( \Aimeos\MShop\Product\Item\Iface $item, $copy = false ) |
|
373 | + protected function toArray(\Aimeos\MShop\Product\Item\Iface $item, $copy = false) |
|
374 | 374 | { |
375 | 375 | $data = []; |
376 | 376 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
377 | 377 | |
378 | - foreach( $item->getListItems( 'text', null, null, false ) as $listItem ) |
|
378 | + foreach ($item->getListItems('text', null, null, false) as $listItem) |
|
379 | 379 | { |
380 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
380 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
381 | 381 | continue; |
382 | 382 | } |
383 | 383 | |
384 | - $list = $listItem->toArray( true ) + $refItem->toArray( true ); |
|
384 | + $list = $listItem->toArray(true) + $refItem->toArray(true); |
|
385 | 385 | |
386 | - if( $copy === true ) |
|
386 | + if ($copy === true) |
|
387 | 387 | { |
388 | 388 | $list['product.lists.siteid'] = $siteId; |
389 | 389 | $list['product.lists.id'] = ''; |
@@ -391,10 +391,10 @@ discard block |
||
391 | 391 | $list['text.id'] = null; |
392 | 392 | } |
393 | 393 | |
394 | - $list['product.lists.datestart'] = str_replace( ' ', 'T', $list['product.lists.datestart'] ); |
|
395 | - $list['product.lists.dateend'] = str_replace( ' ', 'T', $list['product.lists.dateend'] ); |
|
394 | + $list['product.lists.datestart'] = str_replace(' ', 'T', $list['product.lists.datestart']); |
|
395 | + $list['product.lists.dateend'] = str_replace(' ', 'T', $list['product.lists.dateend']); |
|
396 | 396 | |
397 | - foreach( $list['product.lists.config'] as $key => $val ) |
|
397 | + foreach ($list['product.lists.config'] as $key => $val) |
|
398 | 398 | { |
399 | 399 | $list['config']['key'][] = $key; |
400 | 400 | $list['config']['val'][] = $val; |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
414 | 414 | * @return string HTML output |
415 | 415 | */ |
416 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
416 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
417 | 417 | { |
418 | 418 | /** admin/jqadm/product/text/template-item |
419 | 419 | * Relative path to the HTML body template of the text subpart for products. |
@@ -437,6 +437,6 @@ discard block |
||
437 | 437 | $tplconf = 'admin/jqadm/product/text/template-item'; |
438 | 438 | $default = 'product/item-text-standard'; |
439 | 439 | |
440 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
440 | + return $view->render($view->config($tplconf, $default)); |
|
441 | 441 | } |
442 | 442 | } |
443 | 443 | \ No newline at end of file |
@@ -160,14 +160,12 @@ |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | return; |
163 | - } |
|
164 | - catch( \Aimeos\MShop\Exception $e ) |
|
163 | + } catch( \Aimeos\MShop\Exception $e ) |
|
165 | 164 | { |
166 | 165 | $error = array( 'service-item-text' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
167 | 166 | $view->errors = $view->get( 'errors', [] ) + $error; |
168 | 167 | $this->logException( $e ); |
169 | - } |
|
170 | - catch( \Exception $e ) |
|
168 | + } catch( \Exception $e ) |
|
171 | 169 | { |
172 | 170 | $error = array( 'service-item-text' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
173 | 171 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Service\Text; |
12 | 12 | |
13 | -sprintf( 'text' ); // for translation |
|
13 | +sprintf('text'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -42,16 +42,16 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function copy() |
44 | 44 | { |
45 | - $view = $this->addViewData( $this->getView() ); |
|
45 | + $view = $this->addViewData($this->getView()); |
|
46 | 46 | |
47 | - $view->textData = $this->toArray( $view->item, true ); |
|
47 | + $view->textData = $this->toArray($view->item, true); |
|
48 | 48 | $view->textBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->textBody .= $client->copy(); |
52 | 52 | } |
53 | 53 | |
54 | - return $this->render( $view ); |
|
54 | + return $this->render($view); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function create() |
64 | 64 | { |
65 | - $view = $this->addViewData( $this->getView() ); |
|
65 | + $view = $this->addViewData($this->getView()); |
|
66 | 66 | $siteid = $this->getContext()->getLocale()->getSiteId(); |
67 | - $data = $view->param( 'text', [] ); |
|
67 | + $data = $view->param('text', []); |
|
68 | 68 | |
69 | - foreach( $data as $idx => $entry ) |
|
69 | + foreach ($data as $idx => $entry) |
|
70 | 70 | { |
71 | 71 | $data[$idx]['service.lists.siteid'] = $siteid; |
72 | 72 | $data[$idx]['text.siteid'] = $siteid; |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | $view->textData = $data; |
76 | 76 | $view->textBody = ''; |
77 | 77 | |
78 | - foreach( $this->getSubClients() as $client ) { |
|
78 | + foreach ($this->getSubClients() as $client) { |
|
79 | 79 | $view->textBody .= $client->create(); |
80 | 80 | } |
81 | 81 | |
82 | - return $this->render( $view ); |
|
82 | + return $this->render($view); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | parent::delete(); |
92 | 92 | |
93 | 93 | $item = $this->getView()->item; |
94 | - $item->deleteListItems( $item->getListItems( 'text', null, null, false ), true ); |
|
94 | + $item->deleteListItems($item->getListItems('text', null, null, false), true); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
@@ -102,16 +102,16 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function get() |
104 | 104 | { |
105 | - $view = $this->addViewData( $this->getView() ); |
|
105 | + $view = $this->addViewData($this->getView()); |
|
106 | 106 | |
107 | - $view->textData = $this->toArray( $view->item ); |
|
107 | + $view->textData = $this->toArray($view->item); |
|
108 | 108 | $view->textBody = ''; |
109 | 109 | |
110 | - foreach( $this->getSubClients() as $client ) { |
|
110 | + foreach ($this->getSubClients() as $client) { |
|
111 | 111 | $view->textBody .= $client->get(); |
112 | 112 | } |
113 | 113 | |
114 | - return $this->render( $view ); |
|
114 | + return $this->render($view); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -124,26 +124,26 @@ discard block |
||
124 | 124 | |
125 | 125 | try |
126 | 126 | { |
127 | - $view->item = $this->fromArray( $view->item, $view->param( 'text', [] ) ); |
|
127 | + $view->item = $this->fromArray($view->item, $view->param('text', [])); |
|
128 | 128 | $view->textBody = ''; |
129 | 129 | |
130 | - foreach( $this->getSubClients() as $client ) { |
|
130 | + foreach ($this->getSubClients() as $client) { |
|
131 | 131 | $view->textBody .= $client->save(); |
132 | 132 | } |
133 | 133 | |
134 | 134 | return; |
135 | 135 | } |
136 | - catch( \Aimeos\MShop\Exception $e ) |
|
136 | + catch (\Aimeos\MShop\Exception $e) |
|
137 | 137 | { |
138 | - $error = array( 'service-item-text' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
139 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
140 | - $this->logException( $e ); |
|
138 | + $error = array('service-item-text' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
139 | + $view->errors = $view->get('errors', []) + $error; |
|
140 | + $this->logException($e); |
|
141 | 141 | } |
142 | - catch( \Exception $e ) |
|
142 | + catch (\Exception $e) |
|
143 | 143 | { |
144 | - $error = array( 'service-item-text' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
145 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
146 | - $this->logException( $e ); |
|
144 | + $error = array('service-item-text' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
145 | + $view->errors = $view->get('errors', []) + $error; |
|
146 | + $this->logException($e); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | throw new \Aimeos\Admin\JQAdm\Exception(); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @param string|null $name Name of the sub-client (Default if null) |
158 | 158 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
159 | 159 | */ |
160 | - public function getSubClient( $type, $name = null ) |
|
160 | + public function getSubClient($type, $name = null) |
|
161 | 161 | { |
162 | 162 | /** admin/jqadm/service/text/decorators/excludes |
163 | 163 | * Excludes decorators added by the "common" option from the service JQAdm client |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @see admin/jqadm/service/text/decorators/excludes |
233 | 233 | * @see admin/jqadm/service/text/decorators/global |
234 | 234 | */ |
235 | - return $this->createSubClient( 'service/text/' . $type, $name ); |
|
235 | + return $this->createSubClient('service/text/' . $type, $name); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * @since 2017.07 |
277 | 277 | * @category Developer |
278 | 278 | */ |
279 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/service/text/standard/subparts', [] ); |
|
279 | + return $this->getContext()->getConfig()->get('admin/jqadm/service/text/standard/subparts', []); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | |
@@ -286,23 +286,23 @@ discard block |
||
286 | 286 | * @param \Aimeos\MW\View\Iface $view View object |
287 | 287 | * @return \Aimeos\MW\View\Iface View object with assigned parameters |
288 | 288 | */ |
289 | - protected function addViewData( \Aimeos\MW\View\Iface $view ) |
|
289 | + protected function addViewData(\Aimeos\MW\View\Iface $view) |
|
290 | 290 | { |
291 | 291 | $context = $this->getContext(); |
292 | 292 | |
293 | - $textTypeManager = \Aimeos\MShop\Factory::createManager( $context, 'text/type' ); |
|
294 | - $listTypeManager = \Aimeos\MShop\Factory::createManager( $context, 'service/lists/type' ); |
|
293 | + $textTypeManager = \Aimeos\MShop\Factory::createManager($context, 'text/type'); |
|
294 | + $listTypeManager = \Aimeos\MShop\Factory::createManager($context, 'service/lists/type'); |
|
295 | 295 | |
296 | - $search = $textTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff ); |
|
297 | - $search->setConditions( $search->compare( '==', 'text.type.domain', 'service' ) ); |
|
298 | - $search->setSortations( array( $search->sort( '+', 'text.type.label' ) ) ); |
|
296 | + $search = $textTypeManager->createSearch(true)->setSlice(0, 0x7fffffff); |
|
297 | + $search->setConditions($search->compare('==', 'text.type.domain', 'service')); |
|
298 | + $search->setSortations(array($search->sort('+', 'text.type.label'))); |
|
299 | 299 | |
300 | - $listSearch = $listTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff ); |
|
301 | - $listSearch->setConditions( $listSearch->compare( '==', 'service.lists.type.domain', 'text' ) ); |
|
302 | - $listSearch->setSortations( array( $listSearch->sort( '+', 'service.lists.type.label' ) ) ); |
|
300 | + $listSearch = $listTypeManager->createSearch(true)->setSlice(0, 0x7fffffff); |
|
301 | + $listSearch->setConditions($listSearch->compare('==', 'service.lists.type.domain', 'text')); |
|
302 | + $listSearch->setSortations(array($listSearch->sort('+', 'service.lists.type.label'))); |
|
303 | 303 | |
304 | - $view->textTypes = $textTypeManager->searchItems( $search ); |
|
305 | - $view->textListTypes = $this->sortType( $listTypeManager->searchItems( $listSearch ) ); |
|
304 | + $view->textTypes = $textTypeManager->searchItems($search); |
|
305 | + $view->textListTypes = $this->sortType($listTypeManager->searchItems($listSearch)); |
|
306 | 306 | |
307 | 307 | return $view; |
308 | 308 | } |
@@ -314,50 +314,50 @@ discard block |
||
314 | 314 | * @param \Aimeos\MShop\Service\Item\Iface $item Service item object without referenced domain items |
315 | 315 | * @param string[] $data Data array |
316 | 316 | */ |
317 | - protected function fromArray( \Aimeos\MShop\Service\Item\Iface $item, array $data ) |
|
317 | + protected function fromArray(\Aimeos\MShop\Service\Item\Iface $item, array $data) |
|
318 | 318 | { |
319 | 319 | $context = $this->getContext(); |
320 | 320 | |
321 | - $textManager = \Aimeos\MShop\Factory::createManager( $context, 'text' ); |
|
322 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'service/lists' ); |
|
321 | + $textManager = \Aimeos\MShop\Factory::createManager($context, 'text'); |
|
322 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'service/lists'); |
|
323 | 323 | |
324 | - $listItems = $item->getListItems( 'text', null, null, false ); |
|
324 | + $listItems = $item->getListItems('text', null, null, false); |
|
325 | 325 | |
326 | 326 | |
327 | - foreach( $data as $idx => $entry ) |
|
327 | + foreach ($data as $idx => $entry) |
|
328 | 328 | { |
329 | - if( trim( $this->getValue( $entry, 'text.content', '' ) ) === '' ) { |
|
329 | + if (trim($this->getValue($entry, 'text.content', '')) === '') { |
|
330 | 330 | continue; |
331 | 331 | } |
332 | 332 | |
333 | - if( ( $listItem = $item->getListItem( 'text', $entry['service.lists.type'], $entry['text.id'], false ) ) === null ) { |
|
333 | + if (($listItem = $item->getListItem('text', $entry['service.lists.type'], $entry['text.id'], false)) === null) { |
|
334 | 334 | $listItem = $listManager->createItem(); |
335 | 335 | } |
336 | 336 | |
337 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
337 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
338 | 338 | $refItem = $textManager->createItem(); |
339 | 339 | } |
340 | 340 | |
341 | - $refItem->fromArray( $entry ); |
|
341 | + $refItem->fromArray($entry); |
|
342 | 342 | $conf = []; |
343 | 343 | |
344 | - foreach( (array) $this->getValue( $entry, 'config/key' ) as $num => $key ) |
|
344 | + foreach ((array) $this->getValue($entry, 'config/key') as $num => $key) |
|
345 | 345 | { |
346 | - if( trim( $key ) !== '' && ( $val = $this->getValue( $entry, 'config/val/' . $num ) ) !== null ) { |
|
347 | - $conf[$key] = trim( $val ); |
|
346 | + if (trim($key) !== '' && ($val = $this->getValue($entry, 'config/val/' . $num)) !== null) { |
|
347 | + $conf[$key] = trim($val); |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | |
351 | - $listItem->fromArray( $entry ); |
|
352 | - $listItem->setPosition( $idx ); |
|
353 | - $listItem->setConfig( $conf ); |
|
351 | + $listItem->fromArray($entry); |
|
352 | + $listItem->setPosition($idx); |
|
353 | + $listItem->setConfig($conf); |
|
354 | 354 | |
355 | - $item->addListItem( 'text', $listItem, $refItem ); |
|
355 | + $item->addListItem('text', $listItem, $refItem); |
|
356 | 356 | |
357 | - unset( $listItems[$listItem->getId()] ); |
|
357 | + unset($listItems[$listItem->getId()]); |
|
358 | 358 | } |
359 | 359 | |
360 | - return $item->deleteListItems( $listItems, true ); |
|
360 | + return $item->deleteListItems($listItems, true); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | |
@@ -368,20 +368,20 @@ discard block |
||
368 | 368 | * @param boolean $copy True if items should be copied, false if not |
369 | 369 | * @return string[] Multi-dimensional associative list of item data |
370 | 370 | */ |
371 | - protected function toArray( \Aimeos\MShop\Service\Item\Iface $item, $copy = false ) |
|
371 | + protected function toArray(\Aimeos\MShop\Service\Item\Iface $item, $copy = false) |
|
372 | 372 | { |
373 | 373 | $data = []; |
374 | 374 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
375 | 375 | |
376 | - foreach( $item->getListItems( 'text', null, null, false ) as $listItem ) |
|
376 | + foreach ($item->getListItems('text', null, null, false) as $listItem) |
|
377 | 377 | { |
378 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
378 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
379 | 379 | continue; |
380 | 380 | } |
381 | 381 | |
382 | - $list = $listItem->toArray( true ) + $refItem->toArray( true ); |
|
382 | + $list = $listItem->toArray(true) + $refItem->toArray(true); |
|
383 | 383 | |
384 | - if( $copy === true ) |
|
384 | + if ($copy === true) |
|
385 | 385 | { |
386 | 386 | $list['service.lists.siteid'] = $siteId; |
387 | 387 | $list['service.lists.id'] = ''; |
@@ -389,10 +389,10 @@ discard block |
||
389 | 389 | $list['text.id'] = null; |
390 | 390 | } |
391 | 391 | |
392 | - $list['service.lists.datestart'] = str_replace( ' ', 'T', $list['service.lists.datestart'] ); |
|
393 | - $list['service.lists.dateend'] = str_replace( ' ', 'T', $list['service.lists.dateend'] ); |
|
392 | + $list['service.lists.datestart'] = str_replace(' ', 'T', $list['service.lists.datestart']); |
|
393 | + $list['service.lists.dateend'] = str_replace(' ', 'T', $list['service.lists.dateend']); |
|
394 | 394 | |
395 | - foreach( $list['service.lists.config'] as $key => $val ) |
|
395 | + foreach ($list['service.lists.config'] as $key => $val) |
|
396 | 396 | { |
397 | 397 | $list['config']['key'][] = $key; |
398 | 398 | $list['config']['val'][] = $val; |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
412 | 412 | * @return string HTML output |
413 | 413 | */ |
414 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
414 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
415 | 415 | { |
416 | 416 | /** admin/jqadm/service/text/template-item |
417 | 417 | * Relative path to the HTML body template of the text subpart for services. |
@@ -435,6 +435,6 @@ discard block |
||
435 | 435 | $tplconf = 'admin/jqadm/service/text/template-item'; |
436 | 436 | $default = 'service/item-text-standard'; |
437 | 437 | |
438 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
438 | + return $view->render($view->config($tplconf, $default)); |
|
439 | 439 | } |
440 | 440 | } |
441 | 441 | \ No newline at end of file |
@@ -160,14 +160,12 @@ |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | return; |
163 | - } |
|
164 | - catch( \Aimeos\MShop\Exception $e ) |
|
163 | + } catch( \Aimeos\MShop\Exception $e ) |
|
165 | 164 | { |
166 | 165 | $error = array( 'catalog-item-text' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
167 | 166 | $view->errors = $view->get( 'errors', [] ) + $error; |
168 | 167 | $this->logException( $e ); |
169 | - } |
|
170 | - catch( \Exception $e ) |
|
168 | + } catch( \Exception $e ) |
|
171 | 169 | { |
172 | 170 | $error = array( 'catalog-item-text' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
173 | 171 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Catalog\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]['catalog.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( 'catalog-item-text' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
139 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
140 | - $this->logException( $e ); |
|
138 | + $error = array('catalog-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( 'catalog-item-text' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
145 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
146 | - $this->logException( $e ); |
|
144 | + $error = array('catalog-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/catalog/text/decorators/excludes |
163 | 163 | * Excludes decorators added by the "common" option from the catalog JQAdm client |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @see admin/jqadm/catalog/text/decorators/excludes |
233 | 233 | * @see admin/jqadm/catalog/text/decorators/global |
234 | 234 | */ |
235 | - return $this->createSubClient( 'catalog/text/' . $type, $name ); |
|
235 | + return $this->createSubClient('catalog/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/catalog/text/standard/subparts', [] ); |
|
279 | + return $this->getContext()->getConfig()->get('admin/jqadm/catalog/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\Factory::createManager( $context, 'text/type' ); |
|
294 | - $listTypeManager = \Aimeos\MShop\Factory::createManager( $context, 'catalog/lists/type' ); |
|
293 | + $textTypeManager = \Aimeos\MShop\Factory::createManager($context, 'text/type'); |
|
294 | + $listTypeManager = \Aimeos\MShop\Factory::createManager($context, 'catalog/lists/type'); |
|
295 | 295 | |
296 | - $search = $textTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff ); |
|
297 | - $search->setConditions( $search->compare( '==', 'text.type.domain', 'catalog' ) ); |
|
298 | - $search->setSortations( array( $search->sort( '+', 'text.type.label' ) ) ); |
|
296 | + $search = $textTypeManager->createSearch(true)->setSlice(0, 0x7fffffff); |
|
297 | + $search->setConditions($search->compare('==', 'text.type.domain', 'catalog')); |
|
298 | + $search->setSortations(array($search->sort('+', 'text.type.label'))); |
|
299 | 299 | |
300 | - $listSearch = $listTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff ); |
|
301 | - $listSearch->setConditions( $listSearch->compare( '==', 'catalog.lists.type.domain', 'text' ) ); |
|
302 | - $listSearch->setSortations( array( $listSearch->sort( '+', 'catalog.lists.type.label' ) ) ); |
|
300 | + $listSearch = $listTypeManager->createSearch(true)->setSlice(0, 0x7fffffff); |
|
301 | + $listSearch->setConditions($listSearch->compare('==', 'catalog.lists.type.domain', 'text')); |
|
302 | + $listSearch->setSortations(array($listSearch->sort('+', 'catalog.lists.type.label'))); |
|
303 | 303 | |
304 | - $view->textTypes = $textTypeManager->searchItems( $search ); |
|
305 | - $view->textListTypes = $this->sortType( $listTypeManager->searchItems( $listSearch ) ); |
|
304 | + $view->textTypes = $textTypeManager->searchItems($search); |
|
305 | + $view->textListTypes = $this->sortType($listTypeManager->searchItems($listSearch)); |
|
306 | 306 | |
307 | 307 | return $view; |
308 | 308 | } |
@@ -314,50 +314,50 @@ discard block |
||
314 | 314 | * @param \Aimeos\MShop\Catalog\Item\Iface $item Catalog item object without referenced domain items |
315 | 315 | * @param string[] $data Data array |
316 | 316 | */ |
317 | - protected function fromArray( \Aimeos\MShop\Catalog\Item\Iface $item, array $data ) |
|
317 | + protected function fromArray(\Aimeos\MShop\Catalog\Item\Iface $item, array $data) |
|
318 | 318 | { |
319 | 319 | $context = $this->getContext(); |
320 | 320 | |
321 | - $textManager = \Aimeos\MShop\Factory::createManager( $context, 'text' ); |
|
322 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'catalog/lists' ); |
|
321 | + $textManager = \Aimeos\MShop\Factory::createManager($context, 'text'); |
|
322 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'catalog/lists'); |
|
323 | 323 | |
324 | - $listItems = $item->getListItems( 'text', null, null, false ); |
|
324 | + $listItems = $item->getListItems('text', null, null, false); |
|
325 | 325 | |
326 | 326 | |
327 | - foreach( $data as $idx => $entry ) |
|
327 | + foreach ($data as $idx => $entry) |
|
328 | 328 | { |
329 | - if( trim( $this->getValue( $entry, 'text.content', '' ) ) === '' ) { |
|
329 | + if (trim($this->getValue($entry, 'text.content', '')) === '') { |
|
330 | 330 | continue; |
331 | 331 | } |
332 | 332 | |
333 | - if( ( $listItem = $item->getListItem( 'text', $entry['catalog.lists.type'], $entry['text.id'], false ) ) === null ) { |
|
333 | + if (($listItem = $item->getListItem('text', $entry['catalog.lists.type'], $entry['text.id'], false)) === null) { |
|
334 | 334 | $listItem = $listManager->createItem(); |
335 | 335 | } |
336 | 336 | |
337 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
337 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
338 | 338 | $refItem = $textManager->createItem(); |
339 | 339 | } |
340 | 340 | |
341 | - $refItem->fromArray( $entry ); |
|
341 | + $refItem->fromArray($entry); |
|
342 | 342 | $conf = []; |
343 | 343 | |
344 | - foreach( (array) $this->getValue( $entry, 'config/key' ) as $num => $key ) |
|
344 | + foreach ((array) $this->getValue($entry, 'config/key') as $num => $key) |
|
345 | 345 | { |
346 | - if( trim( $key ) !== '' && ( $val = $this->getValue( $entry, 'config/val/' . $num ) ) !== null ) { |
|
347 | - $conf[$key] = trim( $val ); |
|
346 | + if (trim($key) !== '' && ($val = $this->getValue($entry, 'config/val/' . $num)) !== null) { |
|
347 | + $conf[$key] = trim($val); |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | |
351 | - $listItem->fromArray( $entry ); |
|
352 | - $listItem->setPosition( $idx ); |
|
353 | - $listItem->setConfig( $conf ); |
|
351 | + $listItem->fromArray($entry); |
|
352 | + $listItem->setPosition($idx); |
|
353 | + $listItem->setConfig($conf); |
|
354 | 354 | |
355 | - $item->addListItem( 'text', $listItem, $refItem ); |
|
355 | + $item->addListItem('text', $listItem, $refItem); |
|
356 | 356 | |
357 | - unset( $listItems[$listItem->getId()] ); |
|
357 | + unset($listItems[$listItem->getId()]); |
|
358 | 358 | } |
359 | 359 | |
360 | - return $item->deleteListItems( $listItems, true ); |
|
360 | + return $item->deleteListItems($listItems, true); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | |
@@ -368,20 +368,20 @@ discard block |
||
368 | 368 | * @param boolean $copy True if items should be copied, false if not |
369 | 369 | * @return string[] Multi-dimensional associative list of item data |
370 | 370 | */ |
371 | - protected function toArray( \Aimeos\MShop\Catalog\Item\Iface $item, $copy = false ) |
|
371 | + protected function toArray(\Aimeos\MShop\Catalog\Item\Iface $item, $copy = false) |
|
372 | 372 | { |
373 | 373 | $data = []; |
374 | 374 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
375 | 375 | |
376 | - foreach( $item->getListItems( 'text', null, null, false ) as $listItem ) |
|
376 | + foreach ($item->getListItems('text', null, null, false) as $listItem) |
|
377 | 377 | { |
378 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
378 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
379 | 379 | continue; |
380 | 380 | } |
381 | 381 | |
382 | - $list = $listItem->toArray( true ) + $refItem->toArray( true ); |
|
382 | + $list = $listItem->toArray(true) + $refItem->toArray(true); |
|
383 | 383 | |
384 | - if( $copy === true ) |
|
384 | + if ($copy === true) |
|
385 | 385 | { |
386 | 386 | $list['catalog.lists.siteid'] = $siteId; |
387 | 387 | $list['catalog.lists.id'] = ''; |
@@ -389,10 +389,10 @@ discard block |
||
389 | 389 | $list['text.id'] = null; |
390 | 390 | } |
391 | 391 | |
392 | - $list['catalog.lists.datestart'] = str_replace( ' ', 'T', $list['catalog.lists.datestart'] ); |
|
393 | - $list['catalog.lists.dateend'] = str_replace( ' ', 'T', $list['catalog.lists.dateend'] ); |
|
392 | + $list['catalog.lists.datestart'] = str_replace(' ', 'T', $list['catalog.lists.datestart']); |
|
393 | + $list['catalog.lists.dateend'] = str_replace(' ', 'T', $list['catalog.lists.dateend']); |
|
394 | 394 | |
395 | - foreach( $list['catalog.lists.config'] as $key => $val ) |
|
395 | + foreach ($list['catalog.lists.config'] as $key => $val) |
|
396 | 396 | { |
397 | 397 | $list['config']['key'][] = $key; |
398 | 398 | $list['config']['val'][] = $val; |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
412 | 412 | * @return string HTML output |
413 | 413 | */ |
414 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
414 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
415 | 415 | { |
416 | 416 | /** admin/jqadm/catalog/text/template-item |
417 | 417 | * Relative path to the HTML body template of the text subpart for catalogs. |
@@ -435,6 +435,6 @@ discard block |
||
435 | 435 | $tplconf = 'admin/jqadm/catalog/text/template-item'; |
436 | 436 | $default = 'catalog/item-text-standard'; |
437 | 437 | |
438 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
438 | + return $view->render($view->config($tplconf, $default)); |
|
439 | 439 | } |
440 | 440 | } |
441 | 441 | \ No newline at end of file |
@@ -160,14 +160,12 @@ |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | return; |
163 | - } |
|
164 | - catch( \Aimeos\MShop\Exception $e ) |
|
163 | + } catch( \Aimeos\MShop\Exception $e ) |
|
165 | 164 | { |
166 | 165 | $error = array( 'supplier-item-text' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
167 | 166 | $view->errors = $view->get( 'errors', [] ) + $error; |
168 | 167 | $this->logException( $e ); |
169 | - } |
|
170 | - catch( \Exception $e ) |
|
168 | + } catch( \Exception $e ) |
|
171 | 169 | { |
172 | 170 | $error = array( 'supplier-item-text' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
173 | 171 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Supplier\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]['supplier.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( 'supplier-item-text' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
139 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
140 | - $this->logException( $e ); |
|
138 | + $error = array('supplier-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( 'supplier-item-text' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
145 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
146 | - $this->logException( $e ); |
|
144 | + $error = array('supplier-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/supplier/text/decorators/excludes |
163 | 163 | * Excludes decorators added by the "common" option from the supplier JQAdm client |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @see admin/jqadm/supplier/text/decorators/excludes |
233 | 233 | * @see admin/jqadm/supplier/text/decorators/global |
234 | 234 | */ |
235 | - return $this->createSubClient( 'supplier/text/' . $type, $name ); |
|
235 | + return $this->createSubClient('supplier/text/' . $type, $name); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * @since 2018.07 |
277 | 277 | * @category Developer |
278 | 278 | */ |
279 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/supplier/text/standard/subparts', [] ); |
|
279 | + return $this->getContext()->getConfig()->get('admin/jqadm/supplier/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\Factory::createManager( $context, 'text/type' ); |
|
294 | - $listTypeManager = \Aimeos\MShop\Factory::createManager( $context, 'supplier/lists/type' ); |
|
293 | + $textTypeManager = \Aimeos\MShop\Factory::createManager($context, 'text/type'); |
|
294 | + $listTypeManager = \Aimeos\MShop\Factory::createManager($context, 'supplier/lists/type'); |
|
295 | 295 | |
296 | - $search = $textTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff ); |
|
297 | - $search->setConditions( $search->compare( '==', 'text.type.domain', 'supplier' ) ); |
|
298 | - $search->setSortations( array( $search->sort( '+', 'text.type.label' ) ) ); |
|
296 | + $search = $textTypeManager->createSearch(true)->setSlice(0, 0x7fffffff); |
|
297 | + $search->setConditions($search->compare('==', 'text.type.domain', 'supplier')); |
|
298 | + $search->setSortations(array($search->sort('+', 'text.type.label'))); |
|
299 | 299 | |
300 | - $listSearch = $listTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff ); |
|
301 | - $listSearch->setConditions( $listSearch->compare( '==', 'supplier.lists.type.domain', 'text' ) ); |
|
302 | - $listSearch->setSortations( array( $listSearch->sort( '+', 'supplier.lists.type.label' ) ) ); |
|
300 | + $listSearch = $listTypeManager->createSearch(true)->setSlice(0, 0x7fffffff); |
|
301 | + $listSearch->setConditions($listSearch->compare('==', 'supplier.lists.type.domain', 'text')); |
|
302 | + $listSearch->setSortations(array($listSearch->sort('+', 'supplier.lists.type.label'))); |
|
303 | 303 | |
304 | - $view->textTypes = $textTypeManager->searchItems( $search ); |
|
305 | - $view->textListTypes = $this->sortType( $listTypeManager->searchItems( $listSearch ) ); |
|
304 | + $view->textTypes = $textTypeManager->searchItems($search); |
|
305 | + $view->textListTypes = $this->sortType($listTypeManager->searchItems($listSearch)); |
|
306 | 306 | |
307 | 307 | return $view; |
308 | 308 | } |
@@ -314,50 +314,50 @@ discard block |
||
314 | 314 | * @param \Aimeos\MShop\Supplier\Item\Iface $item Supplier item object without referenced domain items |
315 | 315 | * @param string[] $data Data array |
316 | 316 | */ |
317 | - protected function fromArray( \Aimeos\MShop\Supplier\Item\Iface $item, array $data ) |
|
317 | + protected function fromArray(\Aimeos\MShop\Supplier\Item\Iface $item, array $data) |
|
318 | 318 | { |
319 | 319 | $context = $this->getContext(); |
320 | 320 | |
321 | - $textManager = \Aimeos\MShop\Factory::createManager( $context, 'text' ); |
|
322 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'supplier/lists' ); |
|
321 | + $textManager = \Aimeos\MShop\Factory::createManager($context, 'text'); |
|
322 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'supplier/lists'); |
|
323 | 323 | |
324 | - $listItems = $item->getListItems( 'text', null, null, false ); |
|
324 | + $listItems = $item->getListItems('text', null, null, false); |
|
325 | 325 | |
326 | 326 | |
327 | - foreach( $data as $idx => $entry ) |
|
327 | + foreach ($data as $idx => $entry) |
|
328 | 328 | { |
329 | - if( trim( $this->getValue( $entry, 'text.content', '' ) ) === '' ) { |
|
329 | + if (trim($this->getValue($entry, 'text.content', '')) === '') { |
|
330 | 330 | continue; |
331 | 331 | } |
332 | 332 | |
333 | - if( ( $listItem = $item->getListItem( 'text', $entry['supplier.lists.type'], $entry['text.id'], false ) ) === null ) { |
|
333 | + if (($listItem = $item->getListItem('text', $entry['supplier.lists.type'], $entry['text.id'], false)) === null) { |
|
334 | 334 | $listItem = $listManager->createItem(); |
335 | 335 | } |
336 | 336 | |
337 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
337 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
338 | 338 | $refItem = $textManager->createItem(); |
339 | 339 | } |
340 | 340 | |
341 | - $refItem->fromArray( $entry ); |
|
341 | + $refItem->fromArray($entry); |
|
342 | 342 | $conf = []; |
343 | 343 | |
344 | - foreach( (array) $this->getValue( $entry, 'config/key' ) as $num => $key ) |
|
344 | + foreach ((array) $this->getValue($entry, 'config/key') as $num => $key) |
|
345 | 345 | { |
346 | - if( trim( $key ) !== '' && ( $val = $this->getValue( $entry, 'config/val/' . $num ) ) !== null ) { |
|
347 | - $conf[$key] = trim( $val ); |
|
346 | + if (trim($key) !== '' && ($val = $this->getValue($entry, 'config/val/' . $num)) !== null) { |
|
347 | + $conf[$key] = trim($val); |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | |
351 | - $listItem->fromArray( $entry ); |
|
352 | - $listItem->setPosition( $idx ); |
|
353 | - $listItem->setConfig( $conf ); |
|
351 | + $listItem->fromArray($entry); |
|
352 | + $listItem->setPosition($idx); |
|
353 | + $listItem->setConfig($conf); |
|
354 | 354 | |
355 | - $item->addListItem( 'text', $listItem, $refItem ); |
|
355 | + $item->addListItem('text', $listItem, $refItem); |
|
356 | 356 | |
357 | - unset( $listItems[$listItem->getId()] ); |
|
357 | + unset($listItems[$listItem->getId()]); |
|
358 | 358 | } |
359 | 359 | |
360 | - return $item->deleteListItems( $listItems, true ); |
|
360 | + return $item->deleteListItems($listItems, true); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | |
@@ -368,20 +368,20 @@ discard block |
||
368 | 368 | * @param boolean $copy True if items should be copied, false if not |
369 | 369 | * @return string[] Multi-dimensional associative list of item data |
370 | 370 | */ |
371 | - protected function toArray( \Aimeos\MShop\Supplier\Item\Iface $item, $copy = false ) |
|
371 | + protected function toArray(\Aimeos\MShop\Supplier\Item\Iface $item, $copy = false) |
|
372 | 372 | { |
373 | 373 | $data = []; |
374 | 374 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
375 | 375 | |
376 | - foreach( $item->getListItems( 'text', null, null, false ) as $listItem ) |
|
376 | + foreach ($item->getListItems('text', null, null, false) as $listItem) |
|
377 | 377 | { |
378 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
378 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
379 | 379 | continue; |
380 | 380 | } |
381 | 381 | |
382 | - $list = $listItem->toArray( true ) + $refItem->toArray( true ); |
|
382 | + $list = $listItem->toArray(true) + $refItem->toArray(true); |
|
383 | 383 | |
384 | - if( $copy === true ) |
|
384 | + if ($copy === true) |
|
385 | 385 | { |
386 | 386 | $list['supplier.lists.siteid'] = $siteId; |
387 | 387 | $list['supplier.lists.id'] = ''; |
@@ -389,10 +389,10 @@ discard block |
||
389 | 389 | $list['text.id'] = null; |
390 | 390 | } |
391 | 391 | |
392 | - $list['supplier.lists.datestart'] = str_replace( ' ', 'T', $list['supplier.lists.datestart'] ); |
|
393 | - $list['supplier.lists.dateend'] = str_replace( ' ', 'T', $list['supplier.lists.dateend'] ); |
|
392 | + $list['supplier.lists.datestart'] = str_replace(' ', 'T', $list['supplier.lists.datestart']); |
|
393 | + $list['supplier.lists.dateend'] = str_replace(' ', 'T', $list['supplier.lists.dateend']); |
|
394 | 394 | |
395 | - foreach( $list['supplier.lists.config'] as $key => $val ) |
|
395 | + foreach ($list['supplier.lists.config'] as $key => $val) |
|
396 | 396 | { |
397 | 397 | $list['config']['key'][] = $key; |
398 | 398 | $list['config']['val'][] = $val; |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
412 | 412 | * @return string HTML output |
413 | 413 | */ |
414 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
414 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
415 | 415 | { |
416 | 416 | /** admin/jqadm/supplier/text/template-item |
417 | 417 | * Relative path to the HTML body template of the text subpart for suppliers. |
@@ -435,6 +435,6 @@ discard block |
||
435 | 435 | $tplconf = 'admin/jqadm/supplier/text/template-item'; |
436 | 436 | $default = 'supplier/item-text-standard'; |
437 | 437 | |
438 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
438 | + return $view->render($view->config($tplconf, $default)); |
|
439 | 439 | } |
440 | 440 | } |
441 | 441 | \ No newline at end of file |
@@ -160,14 +160,12 @@ |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | return; |
163 | - } |
|
164 | - catch( \Aimeos\MShop\Exception $e ) |
|
163 | + } catch( \Aimeos\MShop\Exception $e ) |
|
165 | 164 | { |
166 | 165 | $error = array( 'attribute-item-price' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
167 | 166 | $view->errors = $view->get( 'errors', [] ) + $error; |
168 | 167 | $this->logException( $e ); |
169 | - } |
|
170 | - catch( \Exception $e ) |
|
168 | + } catch( \Exception $e ) |
|
171 | 169 | { |
172 | 170 | $error = array( 'attribute-item-price' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
173 | 171 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Attribute\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]['attribute.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( 'attribute-item-price' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
139 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
140 | - $this->logException( $e ); |
|
138 | + $error = array('attribute-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( 'attribute-item-price' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
145 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
146 | - $this->logException( $e ); |
|
144 | + $error = array('attribute-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/attribute/price/decorators/excludes |
163 | 163 | * Excludes decorators added by the "common" option from the attribute JQAdm client |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @see admin/jqadm/attribute/price/decorators/excludes |
233 | 233 | * @see admin/jqadm/attribute/price/decorators/global |
234 | 234 | */ |
235 | - return $this->createSubClient( 'attribute/price/' . $type, $name ); |
|
235 | + return $this->createSubClient('attribute/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/attribute/price/standard/subparts', [] ); |
|
279 | + return $this->getContext()->getConfig()->get('admin/jqadm/attribute/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\Factory::createManager( $context, 'price/type' ); |
|
294 | - $listTypeManager = \Aimeos\MShop\Factory::createManager( $context, 'attribute/lists/type' ); |
|
295 | - $currencyManager = \Aimeos\MShop\Factory::createManager( $context, 'locale/currency' ); |
|
293 | + $priceTypeManager = \Aimeos\MShop\Factory::createManager($context, 'price/type'); |
|
294 | + $listTypeManager = \Aimeos\MShop\Factory::createManager($context, 'attribute/lists/type'); |
|
295 | + $currencyManager = \Aimeos\MShop\Factory::createManager($context, 'locale/currency'); |
|
296 | 296 | |
297 | - $search = $priceTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff ); |
|
298 | - $search->setConditions( $search->compare( '==', 'price.type.domain', 'attribute' ) ); |
|
299 | - $search->setSortations( array( $search->sort( '+', 'price.type.label' ) ) ); |
|
297 | + $search = $priceTypeManager->createSearch(true)->setSlice(0, 0x7fffffff); |
|
298 | + $search->setConditions($search->compare('==', 'price.type.domain', 'attribute')); |
|
299 | + $search->setSortations(array($search->sort('+', 'price.type.label'))); |
|
300 | 300 | |
301 | - $listSearch = $listTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff ); |
|
302 | - $listSearch->setConditions( $listSearch->compare( '==', 'attribute.lists.type.domain', 'price' ) ); |
|
303 | - $listSearch->setSortations( array( $listSearch->sort( '+', 'attribute.lists.type.label' ) ) ); |
|
301 | + $listSearch = $listTypeManager->createSearch(true)->setSlice(0, 0x7fffffff); |
|
302 | + $listSearch->setConditions($listSearch->compare('==', 'attribute.lists.type.domain', 'price')); |
|
303 | + $listSearch->setSortations(array($listSearch->sort('+', 'attribute.lists.type.label'))); |
|
304 | 304 | |
305 | - $view->priceTypes = $priceTypeManager->searchItems( $search ); |
|
306 | - $view->priceListTypes = $this->sortType( $listTypeManager->searchItems( $listSearch ) ); |
|
307 | - $view->priceCurrencies = $currencyManager->searchItems( $currencyManager->createSearch( true )->setSlice( 0, 0x7fffffff ) ); |
|
305 | + $view->priceTypes = $priceTypeManager->searchItems($search); |
|
306 | + $view->priceListTypes = $this->sortType($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,46 +320,46 @@ discard block |
||
320 | 320 | * @param \Aimeos\MShop\Attribute\Item\Iface $item Attribute item object without referenced domain items |
321 | 321 | * @param string[] $data Data array |
322 | 322 | */ |
323 | - protected function fromArray( \Aimeos\MShop\Attribute\Item\Iface $item, array $data ) |
|
323 | + protected function fromArray(\Aimeos\MShop\Attribute\Item\Iface $item, array $data) |
|
324 | 324 | { |
325 | 325 | $context = $this->getContext(); |
326 | 326 | |
327 | - $priceManager = \Aimeos\MShop\Factory::createManager( $context, 'price' ); |
|
328 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'attribute/lists' ); |
|
327 | + $priceManager = \Aimeos\MShop\Factory::createManager($context, 'price'); |
|
328 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'attribute/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['attribute.lists.type'], $entry['price.id'], false ) ) === null ) { |
|
335 | + if (($listItem = $item->getListItem('price', $entry['attribute.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\Attribute\Item\Iface $item, $copy = false ) |
|
373 | + protected function toArray(\Aimeos\MShop\Attribute\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['attribute.lists.siteid'] = $siteId; |
389 | 389 | $list['attribute.lists.id'] = ''; |
@@ -391,10 +391,10 @@ discard block |
||
391 | 391 | $list['price.id'] = null; |
392 | 392 | } |
393 | 393 | |
394 | - $list['attribute.lists.datestart'] = str_replace( ' ', 'T', $list['attribute.lists.datestart'] ); |
|
395 | - $list['attribute.lists.dateend'] = str_replace( ' ', 'T', $list['attribute.lists.dateend'] ); |
|
394 | + $list['attribute.lists.datestart'] = str_replace(' ', 'T', $list['attribute.lists.datestart']); |
|
395 | + $list['attribute.lists.dateend'] = str_replace(' ', 'T', $list['attribute.lists.dateend']); |
|
396 | 396 | |
397 | - foreach( $list['attribute.lists.config'] as $key => $val ) |
|
397 | + foreach ($list['attribute.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/attribute/price/template-item |
419 | 419 | * Relative path to the HTML body template of the price subpart for attributes. |
@@ -437,6 +437,6 @@ discard block |
||
437 | 437 | $tplconf = 'admin/jqadm/attribute/price/template-item'; |
438 | 438 | $default = 'attribute/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 |
@@ -160,14 +160,12 @@ |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | return; |
163 | - } |
|
164 | - catch( \Aimeos\MShop\Exception $e ) |
|
163 | + } catch( \Aimeos\MShop\Exception $e ) |
|
165 | 164 | { |
166 | 165 | $error = array( 'service-item-price' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
167 | 166 | $view->errors = $view->get( 'errors', [] ) + $error; |
168 | 167 | $this->logException( $e ); |
169 | - } |
|
170 | - catch( \Exception $e ) |
|
168 | + } catch( \Exception $e ) |
|
171 | 169 | { |
172 | 170 | $error = array( 'service-item-price' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
173 | 171 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Service\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\Factory::createManager( $context, 'price/type' ); |
|
294 | - $listTypeManager = \Aimeos\MShop\Factory::createManager( $context, 'service/lists/type' ); |
|
295 | - $currencyManager = \Aimeos\MShop\Factory::createManager( $context, 'locale/currency' ); |
|
293 | + $priceTypeManager = \Aimeos\MShop\Factory::createManager($context, 'price/type'); |
|
294 | + $listTypeManager = \Aimeos\MShop\Factory::createManager($context, 'service/lists/type'); |
|
295 | + $currencyManager = \Aimeos\MShop\Factory::createManager($context, 'locale/currency'); |
|
296 | 296 | |
297 | - $search = $priceTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff ); |
|
298 | - $search->setConditions( $search->compare( '==', 'price.type.domain', 'service' ) ); |
|
299 | - $search->setSortations( array( $search->sort( '+', 'price.type.label' ) ) ); |
|
297 | + $search = $priceTypeManager->createSearch(true)->setSlice(0, 0x7fffffff); |
|
298 | + $search->setConditions($search->compare('==', 'price.type.domain', 'service')); |
|
299 | + $search->setSortations(array($search->sort('+', 'price.type.label'))); |
|
300 | 300 | |
301 | - $listSearch = $listTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff ); |
|
302 | - $listSearch->setConditions( $listSearch->compare( '==', 'service.lists.type.domain', 'price' ) ); |
|
303 | - $listSearch->setSortations( array( $listSearch->sort( '+', 'service.lists.type.label' ) ) ); |
|
301 | + $listSearch = $listTypeManager->createSearch(true)->setSlice(0, 0x7fffffff); |
|
302 | + $listSearch->setConditions($listSearch->compare('==', 'service.lists.type.domain', 'price')); |
|
303 | + $listSearch->setSortations(array($listSearch->sort('+', 'service.lists.type.label'))); |
|
304 | 304 | |
305 | - $view->priceTypes = $priceTypeManager->searchItems( $search ); |
|
306 | - $view->priceListTypes = $this->sortType( $listTypeManager->searchItems( $listSearch ) ); |
|
307 | - $view->priceCurrencies = $currencyManager->searchItems( $currencyManager->createSearch( true )->setSlice( 0, 0x7fffffff ) ); |
|
305 | + $view->priceTypes = $priceTypeManager->searchItems($search); |
|
306 | + $view->priceListTypes = $this->sortType($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,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\Factory::createManager( $context, 'price' ); |
|
328 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'service/lists' ); |
|
327 | + $priceManager = \Aimeos\MShop\Factory::createManager($context, 'price'); |
|
328 | + $listManager = \Aimeos\MShop\Factory::createManager($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 |