@@ -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 create( \Aimeos\MShop\Context\Item\Iface $context, $name = null ) |
|
32 | + public static function create(\Aimeos\MShop\Context\Item\Iface $context, $name = null) |
|
33 | 33 | { |
34 | 34 | /** admin/jqadm/catalog/name |
35 | 35 | * Class name of the used account favorite client implementation |
@@ -64,22 +64,22 @@ discard block |
||
64 | 64 | * @since 2016.01 |
65 | 65 | * @category Developer |
66 | 66 | */ |
67 | - if( $name === null ) { |
|
68 | - $name = $context->getConfig()->get( 'admin/jqadm/catalog/name', 'Standard' ); |
|
67 | + if ($name === null) { |
|
68 | + $name = $context->getConfig()->get('admin/jqadm/catalog/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\\Catalog\\' . $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\\Catalog\\' . $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\\Catalog\\' . $name; |
79 | 79 | |
80 | - $client = self::createAdmin( $context, $classname, $iface ); |
|
80 | + $client = self::createAdmin($context, $classname, $iface); |
|
81 | 81 | |
82 | - return self::addClientDecorators( $context, $client, 'catalog' ); |
|
82 | + return self::addClientDecorators($context, $client, 'catalog'); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | } |
86 | 86 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Service\Media\Property; |
12 | 12 | |
13 | -sprintf( 'property' ); // for translation |
|
13 | +sprintf('property'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -42,16 +42,16 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function copy() |
44 | 44 | { |
45 | - $view = $this->addViewData( $this->getView() ); |
|
45 | + $view = $this->addViewData($this->getView()); |
|
46 | 46 | |
47 | - $view->mediaData = $this->toArray( $view->item, $view->get( 'mediaData', [] ), true ); |
|
47 | + $view->mediaData = $this->toArray($view->item, $view->get('mediaData', []), true); |
|
48 | 48 | $view->propertyBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->propertyBody .= $client->copy(); |
52 | 52 | } |
53 | 53 | |
54 | - return $this->render( $view ); |
|
54 | + return $this->render($view); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function create() |
64 | 64 | { |
65 | - $view = $this->addViewData( $this->getView() ); |
|
65 | + $view = $this->addViewData($this->getView()); |
|
66 | 66 | $siteid = $this->getContext()->getLocale()->getSiteId(); |
67 | - $data = $view->get( 'mediaData', [] ); |
|
67 | + $data = $view->get('mediaData', []); |
|
68 | 68 | |
69 | - foreach( $data as $index => $entry ) |
|
69 | + foreach ($data as $index => $entry) |
|
70 | 70 | { |
71 | - foreach( $view->value( $entry, 'property', [] ) as $idx => $y ) { |
|
71 | + foreach ($view->value($entry, 'property', []) as $idx => $y) { |
|
72 | 72 | $data[$index]['property'][$idx]['service.lists.siteid'] = $siteid; |
73 | 73 | } |
74 | 74 | } |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | $view->propertyData = $data; |
77 | 77 | $view->propertyBody = ''; |
78 | 78 | |
79 | - foreach( $this->getSubClients() as $client ) { |
|
79 | + foreach ($this->getSubClients() as $client) { |
|
80 | 80 | $view->propertyBody .= $client->create(); |
81 | 81 | } |
82 | 82 | |
83 | - return $this->render( $view ); |
|
83 | + return $this->render($view); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -91,16 +91,16 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function get() |
93 | 93 | { |
94 | - $view = $this->addViewData( $this->getView() ); |
|
94 | + $view = $this->addViewData($this->getView()); |
|
95 | 95 | |
96 | - $view->mediaData = $this->toArray( $view->item, $view->get( 'mediaData', [] ) ); |
|
96 | + $view->mediaData = $this->toArray($view->item, $view->get('mediaData', [])); |
|
97 | 97 | $view->propertyBody = ''; |
98 | 98 | |
99 | - foreach( $this->getSubClients() as $client ) { |
|
99 | + foreach ($this->getSubClients() as $client) { |
|
100 | 100 | $view->propertyBody .= $client->get(); |
101 | 101 | } |
102 | 102 | |
103 | - return $this->render( $view ); |
|
103 | + return $this->render($view); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -111,10 +111,10 @@ discard block |
||
111 | 111 | { |
112 | 112 | $view = $this->getView(); |
113 | 113 | |
114 | - $view->item = $this->fromArray( $view->item, $view->param( 'media', [] ) ); |
|
114 | + $view->item = $this->fromArray($view->item, $view->param('media', [])); |
|
115 | 115 | $view->propertyBody = ''; |
116 | 116 | |
117 | - foreach( $this->getSubClients() as $client ) { |
|
117 | + foreach ($this->getSubClients() as $client) { |
|
118 | 118 | $view->propertyBody .= $client->save(); |
119 | 119 | } |
120 | 120 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @param string|null $name Name of the sub-client (Default if null) |
128 | 128 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
129 | 129 | */ |
130 | - public function getSubClient( $type, $name = null ) |
|
130 | + public function getSubClient($type, $name = null) |
|
131 | 131 | { |
132 | 132 | /** admin/jqadm/service/media/property/decorators/excludes |
133 | 133 | * Excludes decorators added by the "common" option from the service JQAdm client |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @see admin/jqadm/service/media/property/decorators/excludes |
203 | 203 | * @see admin/jqadm/service/media/property/decorators/global |
204 | 204 | */ |
205 | - return $this->createSubClient( 'service/media/property/' . $type, $name ); |
|
205 | + return $this->createSubClient('service/media/property/' . $type, $name); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -212,15 +212,15 @@ discard block |
||
212 | 212 | * @param \Aimeos\MW\View\Iface $view View object |
213 | 213 | * @return \Aimeos\MW\View\Iface View object with assigned parameters |
214 | 214 | */ |
215 | - protected function addViewData( \Aimeos\MW\View\Iface $view ) |
|
215 | + protected function addViewData(\Aimeos\MW\View\Iface $view) |
|
216 | 216 | { |
217 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'media/property/type' ); |
|
217 | + $manager = \Aimeos\MShop::create($this->getContext(), 'media/property/type'); |
|
218 | 218 | |
219 | 219 | $search = $manager->createSearch(); |
220 | - $search->setConditions( $search->compare( '==', 'media.property.type.domain', 'service' ) ); |
|
221 | - $search->setSlice( 0, 0x7fffffff ); |
|
220 | + $search->setConditions($search->compare('==', 'media.property.type.domain', 'service')); |
|
221 | + $search->setSlice(0, 0x7fffffff); |
|
222 | 222 | |
223 | - $view->propertyTypes = $manager->searchItems( $search ); |
|
223 | + $view->propertyTypes = $manager->searchItems($search); |
|
224 | 224 | |
225 | 225 | return $view; |
226 | 226 | } |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | * @since 2018.01 |
267 | 267 | * @category Developer |
268 | 268 | */ |
269 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/service/media/property/standard/subparts', [] ); |
|
269 | + return $this->getContext()->getConfig()->get('admin/jqadm/service/media/property/standard/subparts', []); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | |
@@ -276,32 +276,32 @@ discard block |
||
276 | 276 | * @param \Aimeos\MShop\Service\Item\Iface $item Service item object without referenced domain items |
277 | 277 | * @param string[] $data Data array |
278 | 278 | */ |
279 | - protected function fromArray( \Aimeos\MShop\Service\Item\Iface $item, array $data ) |
|
279 | + protected function fromArray(\Aimeos\MShop\Service\Item\Iface $item, array $data) |
|
280 | 280 | { |
281 | - $propManager = \Aimeos\MShop::create( $this->getContext(), 'media/property' ); |
|
281 | + $propManager = \Aimeos\MShop::create($this->getContext(), 'media/property'); |
|
282 | 282 | $index = 0; |
283 | 283 | |
284 | - foreach( $item->getRefItems( 'media', null, null, false ) as $refItem ) |
|
284 | + foreach ($item->getRefItems('media', null, null, false) as $refItem) |
|
285 | 285 | { |
286 | - $propItems = $refItem->getPropertyItems( null, false ); |
|
286 | + $propItems = $refItem->getPropertyItems(null, false); |
|
287 | 287 | |
288 | - foreach( (array) $this->getValue( $data, $index . '/property', [] ) as $entry ) |
|
288 | + foreach ((array) $this->getValue($data, $index . '/property', []) as $entry) |
|
289 | 289 | { |
290 | - if( isset( $propItems[$entry['media.property.id']] ) ) |
|
290 | + if (isset($propItems[$entry['media.property.id']])) |
|
291 | 291 | { |
292 | 292 | $propItem = $propItems[$entry['media.property.id']]; |
293 | - unset( $propItems[$entry['media.property.id']] ); |
|
293 | + unset($propItems[$entry['media.property.id']]); |
|
294 | 294 | } |
295 | 295 | else |
296 | 296 | { |
297 | 297 | $propItem = $propManager->createItem(); |
298 | 298 | } |
299 | 299 | |
300 | - $propItem->fromArray( $entry ); |
|
301 | - $refItem->addPropertyItem( $propItem ); |
|
300 | + $propItem->fromArray($entry); |
|
301 | + $refItem->addPropertyItem($propItem); |
|
302 | 302 | } |
303 | 303 | |
304 | - $refItem->deletePropertyItems( $propItems ); |
|
304 | + $refItem->deletePropertyItems($propItems); |
|
305 | 305 | $index++; |
306 | 306 | } |
307 | 307 | |
@@ -317,18 +317,18 @@ discard block |
||
317 | 317 | * @param boolean $copy True if items should be copied, false if not |
318 | 318 | * @return string[] Multi-dimensional associative list of item data |
319 | 319 | */ |
320 | - protected function toArray( \Aimeos\MShop\Service\Item\Iface $item, array $data, $copy = false ) |
|
320 | + protected function toArray(\Aimeos\MShop\Service\Item\Iface $item, array $data, $copy = false) |
|
321 | 321 | { |
322 | 322 | $idx = 0; |
323 | 323 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
324 | 324 | |
325 | - foreach( $item->getRefItems( 'media', null, null, false ) as $mediaItem ) |
|
325 | + foreach ($item->getRefItems('media', null, null, false) as $mediaItem) |
|
326 | 326 | { |
327 | - foreach( $mediaItem->getPropertyItems( null, false ) as $propItem ) |
|
327 | + foreach ($mediaItem->getPropertyItems(null, false) as $propItem) |
|
328 | 328 | { |
329 | - $list = $propItem->toArray( true ); |
|
329 | + $list = $propItem->toArray(true); |
|
330 | 330 | |
331 | - if( $copy === true ) |
|
331 | + if ($copy === true) |
|
332 | 332 | { |
333 | 333 | $list['media.property.siteid'] = $siteId; |
334 | 334 | $list['media.property.id'] = ''; |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
351 | 351 | * @return string HTML output |
352 | 352 | */ |
353 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
353 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
354 | 354 | { |
355 | 355 | /** admin/jqadm/service/media/property/template-item |
356 | 356 | * Relative path to the HTML body template of the media subpart for services. |
@@ -374,6 +374,6 @@ discard block |
||
374 | 374 | $tplconf = 'admin/jqadm/service/media/property/template-item'; |
375 | 375 | $default = 'service/item-media-property-standard'; |
376 | 376 | |
377 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
377 | + return $view->render($view->config($tplconf, $default)); |
|
378 | 378 | } |
379 | 379 | } |
380 | 380 | \ No newline at end of file |
@@ -291,8 +291,7 @@ |
||
291 | 291 | { |
292 | 292 | $propItem = $propItems[$entry['media.property.id']]; |
293 | 293 | unset( $propItems[$entry['media.property.id']] ); |
294 | - } |
|
295 | - else |
|
294 | + } else |
|
296 | 295 | { |
297 | 296 | $propItem = $propManager->createItem(); |
298 | 297 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Service\Media; |
12 | 12 | |
13 | -sprintf( 'media' ); // for translation |
|
13 | +sprintf('media'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -42,16 +42,16 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function copy() |
44 | 44 | { |
45 | - $view = $this->addViewData( $this->getView() ); |
|
45 | + $view = $this->addViewData($this->getView()); |
|
46 | 46 | |
47 | - $view->mediaData = $this->toArray( $view->item, true ); |
|
47 | + $view->mediaData = $this->toArray($view->item, true); |
|
48 | 48 | $view->mediaBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->mediaBody .= $client->copy(); |
52 | 52 | } |
53 | 53 | |
54 | - return $this->render( $view ); |
|
54 | + return $this->render($view); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function create() |
64 | 64 | { |
65 | - $view = $this->addViewData( $this->getView() ); |
|
65 | + $view = $this->addViewData($this->getView()); |
|
66 | 66 | $siteid = $this->getContext()->getLocale()->getSiteId(); |
67 | 67 | |
68 | - $itemData = $this->toArray( $view->item ); |
|
69 | - $data = array_replace_recursive( $itemData, $view->param( 'media', [] ) ); |
|
68 | + $itemData = $this->toArray($view->item); |
|
69 | + $data = array_replace_recursive($itemData, $view->param('media', [])); |
|
70 | 70 | |
71 | - foreach( $data as $idx => $entry ) |
|
71 | + foreach ($data as $idx => $entry) |
|
72 | 72 | { |
73 | 73 | $data[$idx]['media.siteid'] = $siteid; |
74 | 74 | $data[$idx]['media.url'] = $itemData[$idx]['media.url']; |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | $view->mediaData = $data; |
80 | 80 | $view->mediaBody = ''; |
81 | 81 | |
82 | - foreach( $this->getSubClients() as $client ) { |
|
82 | + foreach ($this->getSubClients() as $client) { |
|
83 | 83 | $view->mediaBody .= $client->create(); |
84 | 84 | } |
85 | 85 | |
86 | - return $this->render( $view ); |
|
86 | + return $this->render($view); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | |
@@ -95,15 +95,15 @@ discard block |
||
95 | 95 | parent::delete(); |
96 | 96 | |
97 | 97 | $item = $this->getView()->item; |
98 | - $cntl = \Aimeos\Controller\Common\Media\Factory::create( $this->getContext() ); |
|
98 | + $cntl = \Aimeos\Controller\Common\Media\Factory::create($this->getContext()); |
|
99 | 99 | |
100 | - foreach( $item->getListItems( 'media', null, null, false ) as $listItem ) |
|
100 | + foreach ($item->getListItems('media', null, null, false) as $listItem) |
|
101 | 101 | { |
102 | - if( ( $refItem = $listItem->getRefItem() ) !== null ) { |
|
103 | - $cntl->delete( $refItem ); |
|
102 | + if (($refItem = $listItem->getRefItem()) !== null) { |
|
103 | + $cntl->delete($refItem); |
|
104 | 104 | } |
105 | 105 | |
106 | - $item->deleteListItem( 'media', $listItem, $refItem ); |
|
106 | + $item->deleteListItem('media', $listItem, $refItem); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
@@ -115,16 +115,16 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function get() |
117 | 117 | { |
118 | - $view = $this->addViewData( $this->getView() ); |
|
118 | + $view = $this->addViewData($this->getView()); |
|
119 | 119 | |
120 | - $view->mediaData = $this->toArray( $view->item ); |
|
120 | + $view->mediaData = $this->toArray($view->item); |
|
121 | 121 | $view->mediaBody = ''; |
122 | 122 | |
123 | - foreach( $this->getSubClients() as $client ) { |
|
123 | + foreach ($this->getSubClients() as $client) { |
|
124 | 124 | $view->mediaBody .= $client->get(); |
125 | 125 | } |
126 | 126 | |
127 | - return $this->render( $view ); |
|
127 | + return $this->render($view); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | |
@@ -137,26 +137,26 @@ discard block |
||
137 | 137 | |
138 | 138 | try |
139 | 139 | { |
140 | - $view->item = $this->fromArray( $view->item, $view->param( 'media', [] ) ); |
|
140 | + $view->item = $this->fromArray($view->item, $view->param('media', [])); |
|
141 | 141 | $view->mediaBody = ''; |
142 | 142 | |
143 | - foreach( $this->getSubClients() as $client ) { |
|
143 | + foreach ($this->getSubClients() as $client) { |
|
144 | 144 | $view->mediaBody .= $client->save(); |
145 | 145 | } |
146 | 146 | |
147 | 147 | return; |
148 | 148 | } |
149 | - catch( \Aimeos\MShop\Exception $e ) |
|
149 | + catch (\Aimeos\MShop\Exception $e) |
|
150 | 150 | { |
151 | - $error = array( 'service-item-media' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
152 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
153 | - $this->logException( $e ); |
|
151 | + $error = array('service-item-media' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
152 | + $view->errors = $view->get('errors', []) + $error; |
|
153 | + $this->logException($e); |
|
154 | 154 | } |
155 | - catch( \Exception $e ) |
|
155 | + catch (\Exception $e) |
|
156 | 156 | { |
157 | - $error = array( 'service-item-media' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
158 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
159 | - $this->logException( $e ); |
|
157 | + $error = array('service-item-media' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
158 | + $view->errors = $view->get('errors', []) + $error; |
|
159 | + $this->logException($e); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | throw new \Aimeos\Admin\JQAdm\Exception(); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @param string|null $name Name of the sub-client (Default if null) |
171 | 171 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
172 | 172 | */ |
173 | - public function getSubClient( $type, $name = null ) |
|
173 | + public function getSubClient($type, $name = null) |
|
174 | 174 | { |
175 | 175 | /** admin/jqadm/service/media/decorators/excludes |
176 | 176 | * Excludes decorators added by the "common" option from the service JQAdm client |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @see admin/jqadm/service/media/decorators/excludes |
246 | 246 | * @see admin/jqadm/service/media/decorators/global |
247 | 247 | */ |
248 | - return $this->createSubClient( 'service/media/' . $type, $name ); |
|
248 | + return $this->createSubClient('service/media/' . $type, $name); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | |
@@ -255,23 +255,23 @@ discard block |
||
255 | 255 | * @param \Aimeos\MW\View\Iface $view View object |
256 | 256 | * @return \Aimeos\MW\View\Iface View object with assigned parameters |
257 | 257 | */ |
258 | - protected function addViewData( \Aimeos\MW\View\Iface $view ) |
|
258 | + protected function addViewData(\Aimeos\MW\View\Iface $view) |
|
259 | 259 | { |
260 | 260 | $context = $this->getContext(); |
261 | 261 | |
262 | - $typeManager = \Aimeos\MShop::create( $this->getContext(), 'media/type' ); |
|
263 | - $listTypeManager = \Aimeos\MShop::create( $this->getContext(), 'service/lists/type' ); |
|
262 | + $typeManager = \Aimeos\MShop::create($this->getContext(), 'media/type'); |
|
263 | + $listTypeManager = \Aimeos\MShop::create($this->getContext(), 'service/lists/type'); |
|
264 | 264 | |
265 | - $search = $typeManager->createSearch()->setSlice( 0, 0x7fffffff ); |
|
266 | - $search->setConditions( $search->compare( '==', 'media.type.domain', 'service' ) ); |
|
267 | - $search->setSortations( array( $search->sort( '+', 'media.type.label' ) ) ); |
|
265 | + $search = $typeManager->createSearch()->setSlice(0, 0x7fffffff); |
|
266 | + $search->setConditions($search->compare('==', 'media.type.domain', 'service')); |
|
267 | + $search->setSortations(array($search->sort('+', 'media.type.label'))); |
|
268 | 268 | |
269 | - $listSearch = $listTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff ); |
|
270 | - $listSearch->setConditions( $listSearch->compare( '==', 'service.lists.type.domain', 'media' ) ); |
|
271 | - $listSearch->setSortations( array( $listSearch->sort( '+', 'service.lists.type.label' ) ) ); |
|
269 | + $listSearch = $listTypeManager->createSearch(true)->setSlice(0, 0x7fffffff); |
|
270 | + $listSearch->setConditions($listSearch->compare('==', 'service.lists.type.domain', 'media')); |
|
271 | + $listSearch->setSortations(array($listSearch->sort('+', 'service.lists.type.label'))); |
|
272 | 272 | |
273 | - $view->mediaListTypes = $this->sortType( $listTypeManager->searchItems( $listSearch ) ); |
|
274 | - $view->mediaTypes = $typeManager->searchItems( $search ); |
|
273 | + $view->mediaListTypes = $this->sortType($listTypeManager->searchItems($listSearch)); |
|
274 | + $view->mediaTypes = $typeManager->searchItems($search); |
|
275 | 275 | |
276 | 276 | return $view; |
277 | 277 | } |
@@ -284,29 +284,29 @@ discard block |
||
284 | 284 | * @param array $listItems Media list items to be removed |
285 | 285 | * @return \Aimeos\MShop\Service\Item\Iface Modified service item |
286 | 286 | */ |
287 | - protected function deleteMediaItems( \Aimeos\MShop\Service\Item\Iface $item, array $listItems ) |
|
287 | + protected function deleteMediaItems(\Aimeos\MShop\Service\Item\Iface $item, array $listItems) |
|
288 | 288 | { |
289 | 289 | $context = $this->getContext(); |
290 | - $cntl = \Aimeos\Controller\Common\Media\Factory::create( $context ); |
|
291 | - $manager = \Aimeos\MShop::create( $context, 'service' ); |
|
290 | + $cntl = \Aimeos\Controller\Common\Media\Factory::create($context); |
|
291 | + $manager = \Aimeos\MShop::create($context, 'service'); |
|
292 | 292 | $search = $manager->createSearch(); |
293 | 293 | |
294 | - foreach( $listItems as $listItem ) |
|
294 | + foreach ($listItems as $listItem) |
|
295 | 295 | { |
296 | 296 | $expr = [ |
297 | - $search->compare( '==', 'service.lists.domain', 'media' ), |
|
298 | - $search->compare( '==', 'service.lists.type', $listItem->getType() ), |
|
299 | - $search->compare( '==', 'service.lists.refid', $listItem->getRefId() ), |
|
297 | + $search->compare('==', 'service.lists.domain', 'media'), |
|
298 | + $search->compare('==', 'service.lists.type', $listItem->getType()), |
|
299 | + $search->compare('==', 'service.lists.refid', $listItem->getRefId()), |
|
300 | 300 | ]; |
301 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
302 | - $items = $manager->searchItems( $search ); |
|
301 | + $search->setConditions($search->combine('&&', $expr)); |
|
302 | + $items = $manager->searchItems($search); |
|
303 | 303 | $refItem = null; |
304 | 304 | |
305 | - if( count( $items ) === 1 && ( $refItem = $listItem->getRefItem() ) !== null ) { |
|
306 | - $cntl->delete( $refItem ); |
|
305 | + if (count($items) === 1 && ($refItem = $listItem->getRefItem()) !== null) { |
|
306 | + $cntl->delete($refItem); |
|
307 | 307 | } |
308 | 308 | |
309 | - $item->deleteListItem( 'media', $listItem, $refItem ); |
|
309 | + $item->deleteListItem('media', $listItem, $refItem); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | return $item; |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | * @since 2017.07 |
354 | 354 | * @category Developer |
355 | 355 | */ |
356 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/service/media/standard/subparts', [] ); |
|
356 | + return $this->getContext()->getConfig()->get('admin/jqadm/service/media/standard/subparts', []); |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | |
@@ -363,54 +363,54 @@ discard block |
||
363 | 363 | * @param \Aimeos\MShop\Service\Item\Iface $item Service item object without referenced domain items |
364 | 364 | * @param string[] $data Data array |
365 | 365 | */ |
366 | - protected function fromArray( \Aimeos\MShop\Service\Item\Iface $item, array $data ) |
|
366 | + protected function fromArray(\Aimeos\MShop\Service\Item\Iface $item, array $data) |
|
367 | 367 | { |
368 | 368 | $context = $this->getContext(); |
369 | 369 | |
370 | - $mediaManager = \Aimeos\MShop::create( $context, 'media' ); |
|
371 | - $listManager = \Aimeos\MShop::create( $context, 'service/lists' ); |
|
372 | - $cntl = \Aimeos\Controller\Common\Media\Factory::create( $context ); |
|
370 | + $mediaManager = \Aimeos\MShop::create($context, 'media'); |
|
371 | + $listManager = \Aimeos\MShop::create($context, 'service/lists'); |
|
372 | + $cntl = \Aimeos\Controller\Common\Media\Factory::create($context); |
|
373 | 373 | |
374 | - $listItems = $item->getListItems( 'media', null, null, false ); |
|
374 | + $listItems = $item->getListItems('media', null, null, false); |
|
375 | 375 | $files = (array) $this->getView()->request()->getUploadedFiles(); |
376 | 376 | |
377 | - foreach( $data as $idx => $entry ) |
|
377 | + foreach ($data as $idx => $entry) |
|
378 | 378 | { |
379 | - if( ( $listItem = $item->getListItem( 'media', $entry['service.lists.type'], $entry['media.id'], false ) ) === null ) { |
|
379 | + if (($listItem = $item->getListItem('media', $entry['service.lists.type'], $entry['media.id'], false)) === null) { |
|
380 | 380 | $listItem = $listManager->createItem(); |
381 | 381 | } |
382 | 382 | |
383 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
383 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
384 | 384 | $refItem = $mediaManager->createItem(); |
385 | 385 | } |
386 | 386 | |
387 | - $refItem->fromArray( $entry ); |
|
387 | + $refItem->fromArray($entry); |
|
388 | 388 | |
389 | - if( ( $file = $this->getValue( $files, 'media/' . $idx . '/file' ) ) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE ) |
|
389 | + if (($file = $this->getValue($files, 'media/' . $idx . '/file')) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE) |
|
390 | 390 | { |
391 | - $refItem->getId() ?: $refItem->setUrl( '' )->setPreview( '' ); // keep copied media |
|
392 | - $cntl->add( $refItem, $file ); |
|
391 | + $refItem->getId() ?: $refItem->setUrl('')->setPreview(''); // keep copied media |
|
392 | + $cntl->add($refItem, $file); |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | $conf = []; |
396 | 396 | |
397 | - foreach( (array) $this->getValue( $entry, 'config/key' ) as $num => $key ) |
|
397 | + foreach ((array) $this->getValue($entry, 'config/key') as $num => $key) |
|
398 | 398 | { |
399 | - if( trim( $key ) !== '' && ( $val = $this->getValue( $entry, 'config/val/' . $num ) ) !== null ) { |
|
400 | - $conf[$key] = trim( $val ); |
|
399 | + if (trim($key) !== '' && ($val = $this->getValue($entry, 'config/val/' . $num)) !== null) { |
|
400 | + $conf[$key] = trim($val); |
|
401 | 401 | } |
402 | 402 | } |
403 | 403 | |
404 | - $listItem->fromArray( $entry ); |
|
405 | - $listItem->setPosition( $idx ); |
|
406 | - $listItem->setConfig( $conf ); |
|
404 | + $listItem->fromArray($entry); |
|
405 | + $listItem->setPosition($idx); |
|
406 | + $listItem->setConfig($conf); |
|
407 | 407 | |
408 | - $item->addListItem( 'media', $listItem, $refItem ); |
|
408 | + $item->addListItem('media', $listItem, $refItem); |
|
409 | 409 | |
410 | - unset( $listItems[$listItem->getId()] ); |
|
410 | + unset($listItems[$listItem->getId()]); |
|
411 | 411 | } |
412 | 412 | |
413 | - return $this->deleteMediaItems( $item, $listItems ); |
|
413 | + return $this->deleteMediaItems($item, $listItems); |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | |
@@ -421,20 +421,20 @@ discard block |
||
421 | 421 | * @param boolean $copy True if items should be copied, false if not |
422 | 422 | * @return string[] Multi-dimensional associative list of item data |
423 | 423 | */ |
424 | - protected function toArray( \Aimeos\MShop\Service\Item\Iface $item, $copy = false ) |
|
424 | + protected function toArray(\Aimeos\MShop\Service\Item\Iface $item, $copy = false) |
|
425 | 425 | { |
426 | 426 | $data = []; |
427 | 427 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
428 | 428 | |
429 | - foreach( $item->getListItems( 'media', null, null, false ) as $listItem ) |
|
429 | + foreach ($item->getListItems('media', null, null, false) as $listItem) |
|
430 | 430 | { |
431 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
431 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
432 | 432 | continue; |
433 | 433 | } |
434 | 434 | |
435 | - $list = $listItem->toArray( true ) + $refItem->toArray( true ); |
|
435 | + $list = $listItem->toArray(true) + $refItem->toArray(true); |
|
436 | 436 | |
437 | - if( $copy === true ) |
|
437 | + if ($copy === true) |
|
438 | 438 | { |
439 | 439 | $list['service.lists.siteid'] = $siteId; |
440 | 440 | $list['service.lists.id'] = ''; |
@@ -442,10 +442,10 @@ discard block |
||
442 | 442 | $list['media.id'] = null; |
443 | 443 | } |
444 | 444 | |
445 | - $list['service.lists.datestart'] = str_replace( ' ', 'T', $list['service.lists.datestart'] ); |
|
446 | - $list['service.lists.dateend'] = str_replace( ' ', 'T', $list['service.lists.dateend'] ); |
|
445 | + $list['service.lists.datestart'] = str_replace(' ', 'T', $list['service.lists.datestart']); |
|
446 | + $list['service.lists.dateend'] = str_replace(' ', 'T', $list['service.lists.dateend']); |
|
447 | 447 | |
448 | - foreach( $list['service.lists.config'] as $key => $val ) |
|
448 | + foreach ($list['service.lists.config'] as $key => $val) |
|
449 | 449 | { |
450 | 450 | $list['config']['key'][] = $key; |
451 | 451 | $list['config']['val'][] = $val; |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
465 | 465 | * @return string HTML output |
466 | 466 | */ |
467 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
467 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
468 | 468 | { |
469 | 469 | /** admin/jqadm/service/media/template-item |
470 | 470 | * Relative path to the HTML body template of the media subpart for services. |
@@ -488,6 +488,6 @@ discard block |
||
488 | 488 | $tplconf = 'admin/jqadm/service/media/template-item'; |
489 | 489 | $default = 'service/item-media-standard'; |
490 | 490 | |
491 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
491 | + return $view->render($view->config($tplconf, $default)); |
|
492 | 492 | } |
493 | 493 | } |
494 | 494 | \ No newline at end of file |
@@ -145,14 +145,12 @@ |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | return; |
148 | - } |
|
149 | - catch( \Aimeos\MShop\Exception $e ) |
|
148 | + } catch( \Aimeos\MShop\Exception $e ) |
|
150 | 149 | { |
151 | 150 | $error = array( 'service-item-media' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
152 | 151 | $view->errors = $view->get( 'errors', [] ) + $error; |
153 | 152 | $this->logException( $e ); |
154 | - } |
|
155 | - catch( \Exception $e ) |
|
153 | + } catch( \Exception $e ) |
|
156 | 154 | { |
157 | 155 | $error = array( 'service-item-media' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
158 | 156 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -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 create( \Aimeos\MShop\Context\Item\Iface $context, $name = null ) |
|
32 | + public static function create(\Aimeos\MShop\Context\Item\Iface $context, $name = null) |
|
33 | 33 | { |
34 | 34 | /** admin/jqadm/service/name |
35 | 35 | * Class name of the used account favorite client implementation |
@@ -64,22 +64,22 @@ discard block |
||
64 | 64 | * @since 2017.07 |
65 | 65 | * @category Developer |
66 | 66 | */ |
67 | - if( $name === null ) { |
|
68 | - $name = $context->getConfig()->get( 'admin/jqadm/service/name', 'Standard' ); |
|
67 | + if ($name === null) { |
|
68 | + $name = $context->getConfig()->get('admin/jqadm/service/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\\Service\\' . $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\\Service\\' . $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\\Service\\' . $name; |
79 | 79 | |
80 | - $client = self::createAdmin( $context, $classname, $iface ); |
|
80 | + $client = self::createAdmin($context, $classname, $iface); |
|
81 | 81 | |
82 | - return self::addClientDecorators( $context, $client, 'service' ); |
|
82 | + return self::addClientDecorators($context, $client, 'service'); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | } |
86 | 86 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Customer\Product; |
12 | 12 | |
13 | -sprintf( 'product' ); // for translation |
|
13 | +sprintf('product'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -49,24 +49,24 @@ discard block |
||
49 | 49 | $view->productListTypes = $this->getListTypes(); |
50 | 50 | $view->productBody = ''; |
51 | 51 | |
52 | - foreach( $this->getSubClients() as $client ) { |
|
52 | + foreach ($this->getSubClients() as $client) { |
|
53 | 53 | $view->productBody .= $client->copy(); |
54 | 54 | } |
55 | 55 | } |
56 | - catch( \Aimeos\MShop\Exception $e ) |
|
56 | + catch (\Aimeos\MShop\Exception $e) |
|
57 | 57 | { |
58 | - $error = array( 'customer-product' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
59 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
60 | - $this->logException( $e ); |
|
58 | + $error = array('customer-product' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
59 | + $view->errors = $view->get('errors', []) + $error; |
|
60 | + $this->logException($e); |
|
61 | 61 | } |
62 | - catch( \Exception $e ) |
|
62 | + catch (\Exception $e) |
|
63 | 63 | { |
64 | - $error = array( 'customer-product' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
65 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
66 | - $this->logException( $e ); |
|
64 | + $error = array('customer-product' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
65 | + $view->errors = $view->get('errors', []) + $error; |
|
66 | + $this->logException($e); |
|
67 | 67 | } |
68 | 68 | |
69 | - return $this->render( $view ); |
|
69 | + return $this->render($view); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | |
@@ -84,24 +84,24 @@ discard block |
||
84 | 84 | $view->productListTypes = $this->getListTypes(); |
85 | 85 | $view->productBody = ''; |
86 | 86 | |
87 | - foreach( $this->getSubClients() as $client ) { |
|
87 | + foreach ($this->getSubClients() as $client) { |
|
88 | 88 | $view->productBody .= $client->create(); |
89 | 89 | } |
90 | 90 | } |
91 | - catch( \Aimeos\MShop\Exception $e ) |
|
91 | + catch (\Aimeos\MShop\Exception $e) |
|
92 | 92 | { |
93 | - $error = array( 'customer-product' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
94 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
95 | - $this->logException( $e ); |
|
93 | + $error = array('customer-product' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
94 | + $view->errors = $view->get('errors', []) + $error; |
|
95 | + $this->logException($e); |
|
96 | 96 | } |
97 | - catch( \Exception $e ) |
|
97 | + catch (\Exception $e) |
|
98 | 98 | { |
99 | - $error = array( 'customer-product' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
100 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
101 | - $this->logException( $e ); |
|
99 | + $error = array('customer-product' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
100 | + $view->errors = $view->get('errors', []) + $error; |
|
101 | + $this->logException($e); |
|
102 | 102 | } |
103 | 103 | |
104 | - return $this->render( $view ); |
|
104 | + return $this->render($view); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
@@ -117,33 +117,33 @@ discard block |
||
117 | 117 | try |
118 | 118 | { |
119 | 119 | $total = 0; |
120 | - $params = $this->storeSearchParams( $view->param( 'up', [] ), 'customerproduct' ); |
|
121 | - $listItems = $this->getListItems( $view->item, $params, $total ); |
|
120 | + $params = $this->storeSearchParams($view->param('up', []), 'customerproduct'); |
|
121 | + $listItems = $this->getListItems($view->item, $params, $total); |
|
122 | 122 | |
123 | - $view->productItems = $this->getProductItems( $listItems ); |
|
124 | - $view->productData = $this->toArray( $listItems ); |
|
123 | + $view->productItems = $this->getProductItems($listItems); |
|
124 | + $view->productData = $this->toArray($listItems); |
|
125 | 125 | $view->productListTypes = $this->getListTypes(); |
126 | 126 | $view->productTotal = $total; |
127 | 127 | $view->productBody = ''; |
128 | 128 | |
129 | - foreach( $this->getSubClients() as $client ) { |
|
129 | + foreach ($this->getSubClients() as $client) { |
|
130 | 130 | $view->productBody .= $client->search(); |
131 | 131 | } |
132 | 132 | } |
133 | - catch( \Aimeos\MShop\Exception $e ) |
|
133 | + catch (\Aimeos\MShop\Exception $e) |
|
134 | 134 | { |
135 | - $error = array( 'customer-product' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
136 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
137 | - $this->logException( $e ); |
|
135 | + $error = array('customer-product' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
136 | + $view->errors = $view->get('errors', []) + $error; |
|
137 | + $this->logException($e); |
|
138 | 138 | } |
139 | - catch( \Exception $e ) |
|
139 | + catch (\Exception $e) |
|
140 | 140 | { |
141 | - $error = array( 'customer-product' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
142 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
143 | - $this->logException( $e ); |
|
141 | + $error = array('customer-product' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
142 | + $view->errors = $view->get('errors', []) + $error; |
|
143 | + $this->logException($e); |
|
144 | 144 | } |
145 | 145 | |
146 | - return $this->render( $view ); |
|
146 | + return $this->render($view); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
@@ -155,34 +155,34 @@ discard block |
||
155 | 155 | $view = $this->getView(); |
156 | 156 | $context = $this->getContext(); |
157 | 157 | |
158 | - $manager = \Aimeos\MShop::create( $context, 'customer/lists' ); |
|
158 | + $manager = \Aimeos\MShop::create($context, 'customer/lists'); |
|
159 | 159 | |
160 | 160 | $manager->begin(); |
161 | 161 | |
162 | 162 | try |
163 | 163 | { |
164 | - $this->storeSearchParams( $view->param( 'up', [] ), 'customerproduct' ); |
|
165 | - $this->fromArray( $view->item, $view->param( 'product', [] ) ); |
|
164 | + $this->storeSearchParams($view->param('up', []), 'customerproduct'); |
|
165 | + $this->fromArray($view->item, $view->param('product', [])); |
|
166 | 166 | $view->productBody = ''; |
167 | 167 | |
168 | - foreach( $this->getSubClients() as $client ) { |
|
168 | + foreach ($this->getSubClients() as $client) { |
|
169 | 169 | $view->productBody .= $client->save(); |
170 | 170 | } |
171 | 171 | |
172 | 172 | $manager->commit(); |
173 | 173 | return; |
174 | 174 | } |
175 | - catch( \Aimeos\MShop\Exception $e ) |
|
175 | + catch (\Aimeos\MShop\Exception $e) |
|
176 | 176 | { |
177 | - $error = array( 'customer-item-media' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
178 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
179 | - $this->logException( $e ); |
|
177 | + $error = array('customer-item-media' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
178 | + $view->errors = $view->get('errors', []) + $error; |
|
179 | + $this->logException($e); |
|
180 | 180 | } |
181 | - catch( \Exception $e ) |
|
181 | + catch (\Exception $e) |
|
182 | 182 | { |
183 | - $error = array( 'customer-item-media' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
184 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
185 | - $this->logException( $e ); |
|
183 | + $error = array('customer-item-media' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
184 | + $view->errors = $view->get('errors', []) + $error; |
|
185 | + $this->logException($e); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | $manager->rollback(); |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @param string|null $name Name of the sub-client (Default if null) |
199 | 199 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
200 | 200 | */ |
201 | - public function getSubClient( $type, $name = null ) |
|
201 | + public function getSubClient($type, $name = null) |
|
202 | 202 | { |
203 | 203 | /** admin/jqadm/customer/product/decorators/excludes |
204 | 204 | * Excludes decorators added by the "common" option from the customer JQAdm client |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @see admin/jqadm/customer/product/decorators/excludes |
274 | 274 | * @see admin/jqadm/customer/product/decorators/global |
275 | 275 | */ |
276 | - return $this->createSubClient( 'customer/product/' . $type, $name ); |
|
276 | + return $this->createSubClient('customer/product/' . $type, $name); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | |
@@ -285,22 +285,22 @@ discard block |
||
285 | 285 | * @param integer $total Value/result parameter that will contain the item total afterwards |
286 | 286 | * @return \Aimeos\MShop\Common\Item\List\Iface[] Customer list items referencing the products |
287 | 287 | */ |
288 | - protected function getListItems( \Aimeos\MShop\Customer\Item\Iface $item, array $params = [], &$total ) |
|
288 | + protected function getListItems(\Aimeos\MShop\Customer\Item\Iface $item, array $params = [], &$total) |
|
289 | 289 | { |
290 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'customer/lists' ); |
|
290 | + $manager = \Aimeos\MShop::create($this->getContext(), 'customer/lists'); |
|
291 | 291 | |
292 | 292 | $search = $manager->createSearch(); |
293 | - $search->setSortations( [$search->sort( '-', 'customer.lists.ctime' )] ); |
|
293 | + $search->setSortations([$search->sort('-', 'customer.lists.ctime')]); |
|
294 | 294 | |
295 | - $search = $this->initCriteria( $search, $params ); |
|
295 | + $search = $this->initCriteria($search, $params); |
|
296 | 296 | $expr = [ |
297 | 297 | $search->getConditions(), |
298 | - $search->compare( '==', 'customer.lists.parentid', $item->getId() ), |
|
299 | - $search->compare( '==', 'customer.lists.domain', 'product' ), |
|
298 | + $search->compare('==', 'customer.lists.parentid', $item->getId()), |
|
299 | + $search->compare('==', 'customer.lists.domain', 'product'), |
|
300 | 300 | ]; |
301 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
301 | + $search->setConditions($search->combine('&&', $expr)); |
|
302 | 302 | |
303 | - return $manager->searchItems( $search, [], $total ); |
|
303 | + return $manager->searchItems($search, [], $total); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | |
@@ -312,13 +312,13 @@ discard block |
||
312 | 312 | protected function getListTypes() |
313 | 313 | { |
314 | 314 | $list = []; |
315 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'customer/lists/type' ); |
|
315 | + $manager = \Aimeos\MShop::create($this->getContext(), 'customer/lists/type'); |
|
316 | 316 | |
317 | - $search = $manager->createSearch()->setSlice( 0, 0x7fffffff ); |
|
318 | - $search->setConditions( $search->compare( '==', 'customer.lists.type.domain', 'product' ) ); |
|
319 | - $search->setSortations( [$search->sort( '+', 'customer.lists.type.code' )] ); |
|
317 | + $search = $manager->createSearch()->setSlice(0, 0x7fffffff); |
|
318 | + $search->setConditions($search->compare('==', 'customer.lists.type.domain', 'product')); |
|
319 | + $search->setSortations([$search->sort('+', 'customer.lists.type.code')]); |
|
320 | 320 | |
321 | - foreach( $manager->searchItems( $search ) as $id => $item ) { |
|
321 | + foreach ($manager->searchItems($search) as $id => $item) { |
|
322 | 322 | $list[$id] = $item->getCode(); |
323 | 323 | } |
324 | 324 | |
@@ -332,20 +332,20 @@ discard block |
||
332 | 332 | * @param \Aimeos\MShop\Common\Item\List\Iface[] $listItems Customer list items referencing the products |
333 | 333 | * @return \Aimeos\MShop\Product\Item\Iface[] Associative list of product IDs as keys and items as values |
334 | 334 | */ |
335 | - protected function getProductItems( array $listItems ) |
|
335 | + protected function getProductItems(array $listItems) |
|
336 | 336 | { |
337 | 337 | $list = []; |
338 | 338 | |
339 | - foreach( $listItems as $listItem ) { |
|
339 | + foreach ($listItems as $listItem) { |
|
340 | 340 | $list[] = $listItem->getRefId(); |
341 | 341 | } |
342 | 342 | |
343 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'product' ); |
|
343 | + $manager = \Aimeos\MShop::create($this->getContext(), 'product'); |
|
344 | 344 | |
345 | - $search = $manager->createSearch()->setSlice( 0, count( $list ) ); |
|
346 | - $search->setConditions( $search->compare( '==', 'product.id', $list ) ); |
|
345 | + $search = $manager->createSearch()->setSlice(0, count($list)); |
|
346 | + $search->setConditions($search->compare('==', 'product.id', $list)); |
|
347 | 347 | |
348 | - return $manager->searchItems( $search ); |
|
348 | + return $manager->searchItems($search); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | * @since 2017.07 |
390 | 390 | * @category Developer |
391 | 391 | */ |
392 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/customer/product/standard/subparts', [] ); |
|
392 | + return $this->getContext()->getConfig()->get('admin/jqadm/customer/product/standard/subparts', []); |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | |
@@ -399,75 +399,75 @@ discard block |
||
399 | 399 | * @param \Aimeos\MShop\Customer\Item\Iface $item Customer item object without referenced domain items |
400 | 400 | * @param string[] $data Data array |
401 | 401 | */ |
402 | - protected function fromArray( \Aimeos\MShop\Customer\Item\Iface $item, array $data ) |
|
402 | + protected function fromArray(\Aimeos\MShop\Customer\Item\Iface $item, array $data) |
|
403 | 403 | { |
404 | 404 | $context = $this->getContext(); |
405 | - $listIds = $this->getValue( $data, 'customer.lists.id', [] ); |
|
405 | + $listIds = $this->getValue($data, 'customer.lists.id', []); |
|
406 | 406 | |
407 | - $listManager = \Aimeos\MShop::create( $context, 'customer/lists' ); |
|
407 | + $listManager = \Aimeos\MShop::create($context, 'customer/lists'); |
|
408 | 408 | |
409 | - $search = $listManager->createSearch()->setSlice( 0, count( $listIds ) ); |
|
410 | - $search->setConditions( $search->compare( '==', 'customer.lists.id', $listIds ) ); |
|
409 | + $search = $listManager->createSearch()->setSlice(0, count($listIds)); |
|
410 | + $search->setConditions($search->compare('==', 'customer.lists.id', $listIds)); |
|
411 | 411 | |
412 | - $listItems = $listManager->searchItems( $search ); |
|
412 | + $listItems = $listManager->searchItems($search); |
|
413 | 413 | |
414 | 414 | |
415 | - foreach( (array) $listIds as $idx => $listid ) |
|
415 | + foreach ((array) $listIds as $idx => $listid) |
|
416 | 416 | { |
417 | - if( isset( $listItems[$listid] ) ) { |
|
417 | + if (isset($listItems[$listid])) { |
|
418 | 418 | $litem = $listItems[$listid]; |
419 | 419 | } else { |
420 | 420 | $litem = $listManager->createItem(); |
421 | 421 | } |
422 | 422 | |
423 | - $litem->setParentId( $item->getId() ); |
|
424 | - $litem->setDomain( 'product' ); |
|
423 | + $litem->setParentId($item->getId()); |
|
424 | + $litem->setDomain('product'); |
|
425 | 425 | |
426 | - if( isset( $data['customer.lists.refid'][$idx] ) ) { |
|
427 | - $litem->setRefId( $this->getValue( $data, 'customer.lists.refid/' . $idx ) ); |
|
426 | + if (isset($data['customer.lists.refid'][$idx])) { |
|
427 | + $litem->setRefId($this->getValue($data, 'customer.lists.refid/' . $idx)); |
|
428 | 428 | } |
429 | 429 | |
430 | - if( isset( $data['customer.lists.status'][$idx] ) ) { |
|
431 | - $litem->setStatus( $this->getValue( $data, 'customer.lists.status/' . $idx ) ); |
|
430 | + if (isset($data['customer.lists.status'][$idx])) { |
|
431 | + $litem->setStatus($this->getValue($data, 'customer.lists.status/' . $idx)); |
|
432 | 432 | } |
433 | 433 | |
434 | - if( isset( $data['customer.lists.type'][$idx] ) ) { |
|
435 | - $litem->setType( $this->getValue( $data, 'customer.lists.type/' . $idx ) ); |
|
434 | + if (isset($data['customer.lists.type'][$idx])) { |
|
435 | + $litem->setType($this->getValue($data, 'customer.lists.type/' . $idx)); |
|
436 | 436 | } |
437 | 437 | |
438 | - if( isset( $data['customer.lists.position'][$idx] ) ) { |
|
439 | - $litem->setPosition( $this->getValue( $data, 'customer.lists.position/' . $idx ) ); |
|
438 | + if (isset($data['customer.lists.position'][$idx])) { |
|
439 | + $litem->setPosition($this->getValue($data, 'customer.lists.position/' . $idx)); |
|
440 | 440 | } |
441 | 441 | |
442 | - if( isset( $data['customer.lists.datestart'][$idx] ) ) { |
|
443 | - $litem->setDateStart( $this->getValue( $data, 'customer.lists.datestart/' . $idx ) ); |
|
442 | + if (isset($data['customer.lists.datestart'][$idx])) { |
|
443 | + $litem->setDateStart($this->getValue($data, 'customer.lists.datestart/' . $idx)); |
|
444 | 444 | } |
445 | 445 | |
446 | - if( isset( $data['customer.lists.dateend'][$idx] ) ) { |
|
447 | - $litem->setDateEnd( $this->getValue( $data, 'customer.lists.dateend/' . $idx ) ); |
|
446 | + if (isset($data['customer.lists.dateend'][$idx])) { |
|
447 | + $litem->setDateEnd($this->getValue($data, 'customer.lists.dateend/' . $idx)); |
|
448 | 448 | } |
449 | 449 | |
450 | - if( isset( $data['customer.lists.config'][$idx] ) |
|
451 | - && ( $conf = json_decode( $this->getValue( $data, 'customer.lists.config/' . $idx ), true ) ) !== null |
|
450 | + if (isset($data['customer.lists.config'][$idx]) |
|
451 | + && ($conf = json_decode($this->getValue($data, 'customer.lists.config/' . $idx), true)) !== null |
|
452 | 452 | ) { |
453 | - $litem->setConfig( $conf ); |
|
453 | + $litem->setConfig($conf); |
|
454 | 454 | } |
455 | 455 | |
456 | - if( $litem->getId() === null && isset( $data['config'][$idx]['key'] ) ) |
|
456 | + if ($litem->getId() === null && isset($data['config'][$idx]['key'])) |
|
457 | 457 | { |
458 | 458 | $conf = []; |
459 | 459 | |
460 | - foreach( (array) $data['config'][$idx]['key'] as $pos => $key ) |
|
460 | + foreach ((array) $data['config'][$idx]['key'] as $pos => $key) |
|
461 | 461 | { |
462 | - if( trim( $key ) !== '' && isset( $data['config'][$idx]['val'][$pos] ) ) { |
|
462 | + if (trim($key) !== '' && isset($data['config'][$idx]['val'][$pos])) { |
|
463 | 463 | $conf[$key] = $data['config'][$idx]['val'][$pos]; |
464 | 464 | } |
465 | 465 | } |
466 | 466 | |
467 | - $litem->setConfig( $conf ); |
|
467 | + $litem->setConfig($conf); |
|
468 | 468 | } |
469 | 469 | |
470 | - $listManager->saveItem( $litem, false ); |
|
470 | + $listManager->saveItem($litem, false); |
|
471 | 471 | } |
472 | 472 | } |
473 | 473 | |
@@ -478,13 +478,13 @@ discard block |
||
478 | 478 | * @param \Aimeos\MShop\Common\Item\Lists\Iface[] $listItems Customer list items referencing the products |
479 | 479 | * @return string[] Multi-dimensional associative list of item data |
480 | 480 | */ |
481 | - protected function toArray( array $listItems ) |
|
481 | + protected function toArray(array $listItems) |
|
482 | 482 | { |
483 | 483 | $data = []; |
484 | 484 | |
485 | - foreach( $listItems as $listItem ) |
|
485 | + foreach ($listItems as $listItem) |
|
486 | 486 | { |
487 | - foreach( $listItem->toArray( true ) as $key => $value ) { |
|
487 | + foreach ($listItem->toArray(true) as $key => $value) { |
|
488 | 488 | $data[$key][] = $value; |
489 | 489 | } |
490 | 490 | } |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
500 | 500 | * @return string HTML output |
501 | 501 | */ |
502 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
502 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
503 | 503 | { |
504 | 504 | /** admin/jqadm/customer/product/template-item |
505 | 505 | * Relative path to the HTML body template of the product subpart for customers. |
@@ -523,6 +523,6 @@ discard block |
||
523 | 523 | $tplconf = 'admin/jqadm/customer/product/template-item'; |
524 | 524 | $default = 'customer/item-product-standard'; |
525 | 525 | |
526 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
526 | + return $view->render($view->config($tplconf, $default)); |
|
527 | 527 | } |
528 | 528 | } |
@@ -52,14 +52,12 @@ discard block |
||
52 | 52 | foreach( $this->getSubClients() as $client ) { |
53 | 53 | $view->productBody .= $client->copy(); |
54 | 54 | } |
55 | - } |
|
56 | - catch( \Aimeos\MShop\Exception $e ) |
|
55 | + } catch( \Aimeos\MShop\Exception $e ) |
|
57 | 56 | { |
58 | 57 | $error = array( 'customer-product' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
59 | 58 | $view->errors = $view->get( 'errors', [] ) + $error; |
60 | 59 | $this->logException( $e ); |
61 | - } |
|
62 | - catch( \Exception $e ) |
|
60 | + } catch( \Exception $e ) |
|
63 | 61 | { |
64 | 62 | $error = array( 'customer-product' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
65 | 63 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -87,14 +85,12 @@ discard block |
||
87 | 85 | foreach( $this->getSubClients() as $client ) { |
88 | 86 | $view->productBody .= $client->create(); |
89 | 87 | } |
90 | - } |
|
91 | - catch( \Aimeos\MShop\Exception $e ) |
|
88 | + } catch( \Aimeos\MShop\Exception $e ) |
|
92 | 89 | { |
93 | 90 | $error = array( 'customer-product' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
94 | 91 | $view->errors = $view->get( 'errors', [] ) + $error; |
95 | 92 | $this->logException( $e ); |
96 | - } |
|
97 | - catch( \Exception $e ) |
|
93 | + } catch( \Exception $e ) |
|
98 | 94 | { |
99 | 95 | $error = array( 'customer-product' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
100 | 96 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -129,14 +125,12 @@ discard block |
||
129 | 125 | foreach( $this->getSubClients() as $client ) { |
130 | 126 | $view->productBody .= $client->search(); |
131 | 127 | } |
132 | - } |
|
133 | - catch( \Aimeos\MShop\Exception $e ) |
|
128 | + } catch( \Aimeos\MShop\Exception $e ) |
|
134 | 129 | { |
135 | 130 | $error = array( 'customer-product' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
136 | 131 | $view->errors = $view->get( 'errors', [] ) + $error; |
137 | 132 | $this->logException( $e ); |
138 | - } |
|
139 | - catch( \Exception $e ) |
|
133 | + } catch( \Exception $e ) |
|
140 | 134 | { |
141 | 135 | $error = array( 'customer-product' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
142 | 136 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -171,14 +165,12 @@ discard block |
||
171 | 165 | |
172 | 166 | $manager->commit(); |
173 | 167 | return; |
174 | - } |
|
175 | - catch( \Aimeos\MShop\Exception $e ) |
|
168 | + } catch( \Aimeos\MShop\Exception $e ) |
|
176 | 169 | { |
177 | 170 | $error = array( 'customer-item-media' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
178 | 171 | $view->errors = $view->get( 'errors', [] ) + $error; |
179 | 172 | $this->logException( $e ); |
180 | - } |
|
181 | - catch( \Exception $e ) |
|
173 | + } catch( \Exception $e ) |
|
182 | 174 | { |
183 | 175 | $error = array( 'customer-item-media' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
184 | 176 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -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 create( \Aimeos\MShop\Context\Item\Iface $context, $name = null ) |
|
32 | + public static function create(\Aimeos\MShop\Context\Item\Iface $context, $name = null) |
|
33 | 33 | { |
34 | 34 | /** admin/jqadm/customer/name |
35 | 35 | * Class name of the used account favorite client implementation |
@@ -64,22 +64,22 @@ discard block |
||
64 | 64 | * @since 2016.01 |
65 | 65 | * @category Developer |
66 | 66 | */ |
67 | - if( $name === null ) { |
|
68 | - $name = $context->getConfig()->get( 'admin/jqadm/customer/name', 'Standard' ); |
|
67 | + if ($name === null) { |
|
68 | + $name = $context->getConfig()->get('admin/jqadm/customer/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\\Customer\\' . $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\\Customer\\' . $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\\Customer\\' . $name; |
79 | 79 | |
80 | - $client = self::createAdmin( $context, $classname, $iface ); |
|
80 | + $client = self::createAdmin($context, $classname, $iface); |
|
81 | 81 | |
82 | - return self::addClientDecorators( $context, $client, 'customer' ); |
|
82 | + return self::addClientDecorators($context, $client, 'customer'); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | } |
86 | 86 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Supplier\Media\Property; |
12 | 12 | |
13 | -sprintf( 'property' ); // for translation |
|
13 | +sprintf('property'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -42,16 +42,16 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function copy() |
44 | 44 | { |
45 | - $view = $this->addViewData( $this->getView() ); |
|
45 | + $view = $this->addViewData($this->getView()); |
|
46 | 46 | |
47 | - $view->mediaData = $this->toArray( $view->item, $view->get( 'mediaData', [] ), true ); |
|
47 | + $view->mediaData = $this->toArray($view->item, $view->get('mediaData', []), true); |
|
48 | 48 | $view->propertyBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->propertyBody .= $client->copy(); |
52 | 52 | } |
53 | 53 | |
54 | - return $this->render( $view ); |
|
54 | + return $this->render($view); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function create() |
64 | 64 | { |
65 | - $view = $this->addViewData( $this->getView() ); |
|
65 | + $view = $this->addViewData($this->getView()); |
|
66 | 66 | $siteid = $this->getContext()->getLocale()->getSiteId(); |
67 | - $data = $view->get( 'mediaData', [] ); |
|
67 | + $data = $view->get('mediaData', []); |
|
68 | 68 | |
69 | - foreach( $data as $index => $entry ) |
|
69 | + foreach ($data as $index => $entry) |
|
70 | 70 | { |
71 | - foreach( $view->value( $entry, 'property', [] ) as $idx => $y ) { |
|
71 | + foreach ($view->value($entry, 'property', []) as $idx => $y) { |
|
72 | 72 | $data[$index]['property'][$idx]['supplier.lists.siteid'] = $siteid; |
73 | 73 | } |
74 | 74 | } |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | $view->propertyData = $data; |
77 | 77 | $view->propertyBody = ''; |
78 | 78 | |
79 | - foreach( $this->getSubClients() as $client ) { |
|
79 | + foreach ($this->getSubClients() as $client) { |
|
80 | 80 | $view->propertyBody .= $client->create(); |
81 | 81 | } |
82 | 82 | |
83 | - return $this->render( $view ); |
|
83 | + return $this->render($view); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -91,16 +91,16 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function get() |
93 | 93 | { |
94 | - $view = $this->addViewData( $this->getView() ); |
|
94 | + $view = $this->addViewData($this->getView()); |
|
95 | 95 | |
96 | - $view->mediaData = $this->toArray( $view->item, $view->get( 'mediaData', [] ) ); |
|
96 | + $view->mediaData = $this->toArray($view->item, $view->get('mediaData', [])); |
|
97 | 97 | $view->propertyBody = ''; |
98 | 98 | |
99 | - foreach( $this->getSubClients() as $client ) { |
|
99 | + foreach ($this->getSubClients() as $client) { |
|
100 | 100 | $view->propertyBody .= $client->get(); |
101 | 101 | } |
102 | 102 | |
103 | - return $this->render( $view ); |
|
103 | + return $this->render($view); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -111,10 +111,10 @@ discard block |
||
111 | 111 | { |
112 | 112 | $view = $this->getView(); |
113 | 113 | |
114 | - $view->item = $this->fromArray( $view->item, $view->param( 'media', [] ) ); |
|
114 | + $view->item = $this->fromArray($view->item, $view->param('media', [])); |
|
115 | 115 | $view->propertyBody = ''; |
116 | 116 | |
117 | - foreach( $this->getSubClients() as $client ) { |
|
117 | + foreach ($this->getSubClients() as $client) { |
|
118 | 118 | $view->propertyBody .= $client->save(); |
119 | 119 | } |
120 | 120 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @param string|null $name Name of the sub-client (Default if null) |
128 | 128 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
129 | 129 | */ |
130 | - public function getSubClient( $type, $name = null ) |
|
130 | + public function getSubClient($type, $name = null) |
|
131 | 131 | { |
132 | 132 | /** admin/jqadm/supplier/media/property/decorators/excludes |
133 | 133 | * Excludes decorators added by the "common" option from the supplier JQAdm client |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @see admin/jqadm/supplier/media/property/decorators/excludes |
203 | 203 | * @see admin/jqadm/supplier/media/property/decorators/global |
204 | 204 | */ |
205 | - return $this->createSubClient( 'supplier/media/property/' . $type, $name ); |
|
205 | + return $this->createSubClient('supplier/media/property/' . $type, $name); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -212,15 +212,15 @@ discard block |
||
212 | 212 | * @param \Aimeos\MW\View\Iface $view View object |
213 | 213 | * @return \Aimeos\MW\View\Iface View object with assigned parameters |
214 | 214 | */ |
215 | - protected function addViewData( \Aimeos\MW\View\Iface $view ) |
|
215 | + protected function addViewData(\Aimeos\MW\View\Iface $view) |
|
216 | 216 | { |
217 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'media/property/type' ); |
|
217 | + $manager = \Aimeos\MShop::create($this->getContext(), 'media/property/type'); |
|
218 | 218 | |
219 | 219 | $search = $manager->createSearch(); |
220 | - $search->setConditions( $search->compare( '==', 'media.property.type.domain', 'supplier' ) ); |
|
221 | - $search->setSlice( 0, 0x7fffffff ); |
|
220 | + $search->setConditions($search->compare('==', 'media.property.type.domain', 'supplier')); |
|
221 | + $search->setSlice(0, 0x7fffffff); |
|
222 | 222 | |
223 | - $view->propertyTypes = $manager->searchItems( $search ); |
|
223 | + $view->propertyTypes = $manager->searchItems($search); |
|
224 | 224 | |
225 | 225 | return $view; |
226 | 226 | } |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | * @since 2018.01 |
267 | 267 | * @category Developer |
268 | 268 | */ |
269 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/supplier/media/property/standard/subparts', [] ); |
|
269 | + return $this->getContext()->getConfig()->get('admin/jqadm/supplier/media/property/standard/subparts', []); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | |
@@ -276,32 +276,32 @@ discard block |
||
276 | 276 | * @param \Aimeos\MShop\Supplier\Item\Iface $item Supplier item object without referenced domain items |
277 | 277 | * @param string[] $data Data array |
278 | 278 | */ |
279 | - protected function fromArray( \Aimeos\MShop\Supplier\Item\Iface $item, array $data ) |
|
279 | + protected function fromArray(\Aimeos\MShop\Supplier\Item\Iface $item, array $data) |
|
280 | 280 | { |
281 | - $propManager = \Aimeos\MShop::create( $this->getContext(), 'media/property' ); |
|
281 | + $propManager = \Aimeos\MShop::create($this->getContext(), 'media/property'); |
|
282 | 282 | $index = 0; |
283 | 283 | |
284 | - foreach( $item->getRefItems( 'media', null, null, false ) as $refItem ) |
|
284 | + foreach ($item->getRefItems('media', null, null, false) as $refItem) |
|
285 | 285 | { |
286 | - $propItems = $refItem->getPropertyItems( null, false ); |
|
286 | + $propItems = $refItem->getPropertyItems(null, false); |
|
287 | 287 | |
288 | - foreach( (array) $this->getValue( $data, $index . '/property', [] ) as $entry ) |
|
288 | + foreach ((array) $this->getValue($data, $index . '/property', []) as $entry) |
|
289 | 289 | { |
290 | - if( isset( $propItems[$entry['media.property.id']] ) ) |
|
290 | + if (isset($propItems[$entry['media.property.id']])) |
|
291 | 291 | { |
292 | 292 | $propItem = $propItems[$entry['media.property.id']]; |
293 | - unset( $propItems[$entry['media.property.id']] ); |
|
293 | + unset($propItems[$entry['media.property.id']]); |
|
294 | 294 | } |
295 | 295 | else |
296 | 296 | { |
297 | 297 | $propItem = $propManager->createItem(); |
298 | 298 | } |
299 | 299 | |
300 | - $propItem->fromArray( $entry ); |
|
301 | - $refItem->addPropertyItem( $propItem ); |
|
300 | + $propItem->fromArray($entry); |
|
301 | + $refItem->addPropertyItem($propItem); |
|
302 | 302 | } |
303 | 303 | |
304 | - $refItem->deletePropertyItems( $propItems ); |
|
304 | + $refItem->deletePropertyItems($propItems); |
|
305 | 305 | $index++; |
306 | 306 | } |
307 | 307 | |
@@ -317,18 +317,18 @@ discard block |
||
317 | 317 | * @param boolean $copy True if items should be copied, false if not |
318 | 318 | * @return string[] Multi-dimensional associative list of item data |
319 | 319 | */ |
320 | - protected function toArray( \Aimeos\MShop\Supplier\Item\Iface $item, array $data, $copy = false ) |
|
320 | + protected function toArray(\Aimeos\MShop\Supplier\Item\Iface $item, array $data, $copy = false) |
|
321 | 321 | { |
322 | 322 | $idx = 0; |
323 | 323 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
324 | 324 | |
325 | - foreach( $item->getRefItems( 'media', null, null, false ) as $mediaItem ) |
|
325 | + foreach ($item->getRefItems('media', null, null, false) as $mediaItem) |
|
326 | 326 | { |
327 | - foreach( $mediaItem->getPropertyItems( null, false ) as $propItem ) |
|
327 | + foreach ($mediaItem->getPropertyItems(null, false) as $propItem) |
|
328 | 328 | { |
329 | - $list = $propItem->toArray( true ); |
|
329 | + $list = $propItem->toArray(true); |
|
330 | 330 | |
331 | - if( $copy === true ) |
|
331 | + if ($copy === true) |
|
332 | 332 | { |
333 | 333 | $list['media.property.siteid'] = $siteId; |
334 | 334 | $list['media.property.id'] = ''; |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
351 | 351 | * @return string HTML output |
352 | 352 | */ |
353 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
353 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
354 | 354 | { |
355 | 355 | /** admin/jqadm/supplier/media/property/template-item |
356 | 356 | * Relative path to the HTML body template of the media subpart for suppliers. |
@@ -374,6 +374,6 @@ discard block |
||
374 | 374 | $tplconf = 'admin/jqadm/supplier/media/property/template-item'; |
375 | 375 | $default = 'supplier/item-media-property-standard'; |
376 | 376 | |
377 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
377 | + return $view->render($view->config($tplconf, $default)); |
|
378 | 378 | } |
379 | 379 | } |
380 | 380 | \ No newline at end of file |
@@ -291,8 +291,7 @@ |
||
291 | 291 | { |
292 | 292 | $propItem = $propItems[$entry['media.property.id']]; |
293 | 293 | unset( $propItems[$entry['media.property.id']] ); |
294 | - } |
|
295 | - else |
|
294 | + } else |
|
296 | 295 | { |
297 | 296 | $propItem = $propManager->createItem(); |
298 | 297 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Supplier\Media; |
12 | 12 | |
13 | -sprintf( 'media' ); // for translation |
|
13 | +sprintf('media'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -42,16 +42,16 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function copy() |
44 | 44 | { |
45 | - $view = $this->addViewData( $this->getView() ); |
|
45 | + $view = $this->addViewData($this->getView()); |
|
46 | 46 | |
47 | - $view->mediaData = $this->toArray( $view->item, true ); |
|
47 | + $view->mediaData = $this->toArray($view->item, true); |
|
48 | 48 | $view->mediaBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->mediaBody .= $client->copy(); |
52 | 52 | } |
53 | 53 | |
54 | - return $this->render( $view ); |
|
54 | + return $this->render($view); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function create() |
64 | 64 | { |
65 | - $view = $this->addViewData( $this->getView() ); |
|
65 | + $view = $this->addViewData($this->getView()); |
|
66 | 66 | $siteid = $this->getContext()->getLocale()->getSiteId(); |
67 | 67 | |
68 | - $itemData = $this->toArray( $view->item ); |
|
69 | - $data = array_replace_recursive( $itemData, $view->param( 'media', [] ) ); |
|
68 | + $itemData = $this->toArray($view->item); |
|
69 | + $data = array_replace_recursive($itemData, $view->param('media', [])); |
|
70 | 70 | |
71 | - foreach( $data as $idx => $entry ) |
|
71 | + foreach ($data as $idx => $entry) |
|
72 | 72 | { |
73 | 73 | $data[$idx]['media.siteid'] = $siteid; |
74 | 74 | $data[$idx]['media.url'] = $itemData[$idx]['media.url']; |
@@ -79,11 +79,11 @@ discard block |
||
79 | 79 | $view->mediaData = $data; |
80 | 80 | $view->mediaBody = ''; |
81 | 81 | |
82 | - foreach( $this->getSubClients() as $client ) { |
|
82 | + foreach ($this->getSubClients() as $client) { |
|
83 | 83 | $view->mediaBody .= $client->create(); |
84 | 84 | } |
85 | 85 | |
86 | - return $this->render( $view ); |
|
86 | + return $this->render($view); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | |
@@ -95,15 +95,15 @@ discard block |
||
95 | 95 | parent::delete(); |
96 | 96 | |
97 | 97 | $item = $this->getView()->item; |
98 | - $cntl = \Aimeos\Controller\Common\Media\Factory::create( $this->getContext() ); |
|
98 | + $cntl = \Aimeos\Controller\Common\Media\Factory::create($this->getContext()); |
|
99 | 99 | |
100 | - foreach( $item->getListItems( 'media', null, null, false ) as $listItem ) |
|
100 | + foreach ($item->getListItems('media', null, null, false) as $listItem) |
|
101 | 101 | { |
102 | - if( ( $refItem = $listItem->getRefItem() ) !== null ) { |
|
103 | - $cntl->delete( $refItem ); |
|
102 | + if (($refItem = $listItem->getRefItem()) !== null) { |
|
103 | + $cntl->delete($refItem); |
|
104 | 104 | } |
105 | 105 | |
106 | - $item->deleteListItem( 'media', $listItem, $refItem ); |
|
106 | + $item->deleteListItem('media', $listItem, $refItem); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
@@ -115,16 +115,16 @@ discard block |
||
115 | 115 | */ |
116 | 116 | public function get() |
117 | 117 | { |
118 | - $view = $this->addViewData( $this->getView() ); |
|
118 | + $view = $this->addViewData($this->getView()); |
|
119 | 119 | |
120 | - $view->mediaData = $this->toArray( $view->item ); |
|
120 | + $view->mediaData = $this->toArray($view->item); |
|
121 | 121 | $view->mediaBody = ''; |
122 | 122 | |
123 | - foreach( $this->getSubClients() as $client ) { |
|
123 | + foreach ($this->getSubClients() as $client) { |
|
124 | 124 | $view->mediaBody .= $client->get(); |
125 | 125 | } |
126 | 126 | |
127 | - return $this->render( $view ); |
|
127 | + return $this->render($view); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | |
@@ -137,26 +137,26 @@ discard block |
||
137 | 137 | |
138 | 138 | try |
139 | 139 | { |
140 | - $view->item = $this->fromArray( $view->item, $view->param( 'media', [] ) ); |
|
140 | + $view->item = $this->fromArray($view->item, $view->param('media', [])); |
|
141 | 141 | $view->mediaBody = ''; |
142 | 142 | |
143 | - foreach( $this->getSubClients() as $client ) { |
|
143 | + foreach ($this->getSubClients() as $client) { |
|
144 | 144 | $view->mediaBody .= $client->save(); |
145 | 145 | } |
146 | 146 | |
147 | 147 | return; |
148 | 148 | } |
149 | - catch( \Aimeos\MShop\Exception $e ) |
|
149 | + catch (\Aimeos\MShop\Exception $e) |
|
150 | 150 | { |
151 | - $error = array( 'supplier-item-media' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
152 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
153 | - $this->logException( $e ); |
|
151 | + $error = array('supplier-item-media' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
152 | + $view->errors = $view->get('errors', []) + $error; |
|
153 | + $this->logException($e); |
|
154 | 154 | } |
155 | - catch( \Exception $e ) |
|
155 | + catch (\Exception $e) |
|
156 | 156 | { |
157 | - $error = array( 'supplier-item-media' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
158 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
159 | - $this->logException( $e ); |
|
157 | + $error = array('supplier-item-media' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
158 | + $view->errors = $view->get('errors', []) + $error; |
|
159 | + $this->logException($e); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | throw new \Aimeos\Admin\JQAdm\Exception(); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @param string|null $name Name of the sub-client (Default if null) |
171 | 171 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
172 | 172 | */ |
173 | - public function getSubClient( $type, $name = null ) |
|
173 | + public function getSubClient($type, $name = null) |
|
174 | 174 | { |
175 | 175 | /** admin/jqadm/supplier/media/decorators/excludes |
176 | 176 | * Excludes decorators added by the "common" option from the supplier JQAdm client |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @see admin/jqadm/supplier/media/decorators/excludes |
246 | 246 | * @see admin/jqadm/supplier/media/decorators/global |
247 | 247 | */ |
248 | - return $this->createSubClient( 'supplier/media/' . $type, $name ); |
|
248 | + return $this->createSubClient('supplier/media/' . $type, $name); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | |
@@ -255,23 +255,23 @@ discard block |
||
255 | 255 | * @param \Aimeos\MW\View\Iface $view View object |
256 | 256 | * @return \Aimeos\MW\View\Iface View object with assigned parameters |
257 | 257 | */ |
258 | - protected function addViewData( \Aimeos\MW\View\Iface $view ) |
|
258 | + protected function addViewData(\Aimeos\MW\View\Iface $view) |
|
259 | 259 | { |
260 | 260 | $context = $this->getContext(); |
261 | 261 | |
262 | - $typeManager = \Aimeos\MShop::create( $this->getContext(), 'media/type' ); |
|
263 | - $listTypeManager = \Aimeos\MShop::create( $this->getContext(), 'supplier/lists/type' ); |
|
262 | + $typeManager = \Aimeos\MShop::create($this->getContext(), 'media/type'); |
|
263 | + $listTypeManager = \Aimeos\MShop::create($this->getContext(), 'supplier/lists/type'); |
|
264 | 264 | |
265 | - $search = $typeManager->createSearch()->setSlice( 0, 0x7fffffff ); |
|
266 | - $search->setConditions( $search->compare( '==', 'media.type.domain', 'supplier' ) ); |
|
267 | - $search->setSortations( array( $search->sort( '+', 'media.type.label' ) ) ); |
|
265 | + $search = $typeManager->createSearch()->setSlice(0, 0x7fffffff); |
|
266 | + $search->setConditions($search->compare('==', 'media.type.domain', 'supplier')); |
|
267 | + $search->setSortations(array($search->sort('+', 'media.type.label'))); |
|
268 | 268 | |
269 | - $listSearch = $listTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff ); |
|
270 | - $listSearch->setConditions( $listSearch->compare( '==', 'supplier.lists.type.domain', 'media' ) ); |
|
271 | - $listSearch->setSortations( array( $listSearch->sort( '+', 'supplier.lists.type.label' ) ) ); |
|
269 | + $listSearch = $listTypeManager->createSearch(true)->setSlice(0, 0x7fffffff); |
|
270 | + $listSearch->setConditions($listSearch->compare('==', 'supplier.lists.type.domain', 'media')); |
|
271 | + $listSearch->setSortations(array($listSearch->sort('+', 'supplier.lists.type.label'))); |
|
272 | 272 | |
273 | - $view->mediaListTypes = $this->sortType( $listTypeManager->searchItems( $listSearch ) ); |
|
274 | - $view->mediaTypes = $typeManager->searchItems( $search ); |
|
273 | + $view->mediaListTypes = $this->sortType($listTypeManager->searchItems($listSearch)); |
|
274 | + $view->mediaTypes = $typeManager->searchItems($search); |
|
275 | 275 | |
276 | 276 | return $view; |
277 | 277 | } |
@@ -284,29 +284,29 @@ discard block |
||
284 | 284 | * @param array $listItems Media list items to be removed |
285 | 285 | * @return \Aimeos\MShop\Supplier\Item\Iface Modified supplier item |
286 | 286 | */ |
287 | - protected function deleteMediaItems( \Aimeos\MShop\Supplier\Item\Iface $item, array $listItems ) |
|
287 | + protected function deleteMediaItems(\Aimeos\MShop\Supplier\Item\Iface $item, array $listItems) |
|
288 | 288 | { |
289 | 289 | $context = $this->getContext(); |
290 | - $cntl = \Aimeos\Controller\Common\Media\Factory::create( $context ); |
|
291 | - $manager = \Aimeos\MShop::create( $context, 'supplier' ); |
|
290 | + $cntl = \Aimeos\Controller\Common\Media\Factory::create($context); |
|
291 | + $manager = \Aimeos\MShop::create($context, 'supplier'); |
|
292 | 292 | $search = $manager->createSearch(); |
293 | 293 | |
294 | - foreach( $listItems as $listItem ) |
|
294 | + foreach ($listItems as $listItem) |
|
295 | 295 | { |
296 | 296 | $expr = [ |
297 | - $search->compare( '==', 'supplier.lists.domain', 'media' ), |
|
298 | - $search->compare( '==', 'supplier.lists.type', $listItem->getType() ), |
|
299 | - $search->compare( '==', 'supplier.lists.refid', $listItem->getRefId() ), |
|
297 | + $search->compare('==', 'supplier.lists.domain', 'media'), |
|
298 | + $search->compare('==', 'supplier.lists.type', $listItem->getType()), |
|
299 | + $search->compare('==', 'supplier.lists.refid', $listItem->getRefId()), |
|
300 | 300 | ]; |
301 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
302 | - $items = $manager->searchItems( $search ); |
|
301 | + $search->setConditions($search->combine('&&', $expr)); |
|
302 | + $items = $manager->searchItems($search); |
|
303 | 303 | $refItem = null; |
304 | 304 | |
305 | - if( count( $items ) === 1 && ( $refItem = $listItem->getRefItem() ) !== null ) { |
|
306 | - $cntl->delete( $refItem ); |
|
305 | + if (count($items) === 1 && ($refItem = $listItem->getRefItem()) !== null) { |
|
306 | + $cntl->delete($refItem); |
|
307 | 307 | } |
308 | 308 | |
309 | - $item->deleteListItem( 'media', $listItem, $refItem ); |
|
309 | + $item->deleteListItem('media', $listItem, $refItem); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | return $item; |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | * @since 2017.07 |
354 | 354 | * @category Developer |
355 | 355 | */ |
356 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/supplier/media/standard/subparts', [] ); |
|
356 | + return $this->getContext()->getConfig()->get('admin/jqadm/supplier/media/standard/subparts', []); |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | |
@@ -363,54 +363,54 @@ discard block |
||
363 | 363 | * @param \Aimeos\MShop\Supplier\Item\Iface $item Supplier item object without referenced domain items |
364 | 364 | * @param string[] $data Data array |
365 | 365 | */ |
366 | - protected function fromArray( \Aimeos\MShop\Supplier\Item\Iface $item, array $data ) |
|
366 | + protected function fromArray(\Aimeos\MShop\Supplier\Item\Iface $item, array $data) |
|
367 | 367 | { |
368 | 368 | $context = $this->getContext(); |
369 | 369 | |
370 | - $mediaManager = \Aimeos\MShop::create( $context, 'media' ); |
|
371 | - $listManager = \Aimeos\MShop::create( $context, 'supplier/lists' ); |
|
372 | - $cntl = \Aimeos\Controller\Common\Media\Factory::create( $context ); |
|
370 | + $mediaManager = \Aimeos\MShop::create($context, 'media'); |
|
371 | + $listManager = \Aimeos\MShop::create($context, 'supplier/lists'); |
|
372 | + $cntl = \Aimeos\Controller\Common\Media\Factory::create($context); |
|
373 | 373 | |
374 | - $listItems = $item->getListItems( 'media', null, null, false ); |
|
374 | + $listItems = $item->getListItems('media', null, null, false); |
|
375 | 375 | $files = (array) $this->getView()->request()->getUploadedFiles(); |
376 | 376 | |
377 | - foreach( $data as $idx => $entry ) |
|
377 | + foreach ($data as $idx => $entry) |
|
378 | 378 | { |
379 | - if( ( $listItem = $item->getListItem( 'media', $entry['supplier.lists.type'], $entry['media.id'], false ) ) === null ) { |
|
379 | + if (($listItem = $item->getListItem('media', $entry['supplier.lists.type'], $entry['media.id'], false)) === null) { |
|
380 | 380 | $listItem = $listManager->createItem(); |
381 | 381 | } |
382 | 382 | |
383 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
383 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
384 | 384 | $refItem = $mediaManager->createItem(); |
385 | 385 | } |
386 | 386 | |
387 | - $refItem->fromArray( $entry ); |
|
387 | + $refItem->fromArray($entry); |
|
388 | 388 | |
389 | - if( ( $file = $this->getValue( $files, 'media/' . $idx . '/file' ) ) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE ) |
|
389 | + if (($file = $this->getValue($files, 'media/' . $idx . '/file')) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE) |
|
390 | 390 | { |
391 | - $refItem->getId() ?: $refItem->setUrl( '' )->setPreview( '' ); // keep copied media |
|
392 | - $cntl->add( $refItem, $file ); |
|
391 | + $refItem->getId() ?: $refItem->setUrl('')->setPreview(''); // keep copied media |
|
392 | + $cntl->add($refItem, $file); |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | $conf = []; |
396 | 396 | |
397 | - foreach( (array) $this->getValue( $entry, 'config/key' ) as $num => $key ) |
|
397 | + foreach ((array) $this->getValue($entry, 'config/key') as $num => $key) |
|
398 | 398 | { |
399 | - if( trim( $key ) !== '' && ( $val = $this->getValue( $entry, 'config/val/' . $num ) ) !== null ) { |
|
400 | - $conf[$key] = trim( $val ); |
|
399 | + if (trim($key) !== '' && ($val = $this->getValue($entry, 'config/val/' . $num)) !== null) { |
|
400 | + $conf[$key] = trim($val); |
|
401 | 401 | } |
402 | 402 | } |
403 | 403 | |
404 | - $listItem->fromArray( $entry ); |
|
405 | - $listItem->setPosition( $idx ); |
|
406 | - $listItem->setConfig( $conf ); |
|
404 | + $listItem->fromArray($entry); |
|
405 | + $listItem->setPosition($idx); |
|
406 | + $listItem->setConfig($conf); |
|
407 | 407 | |
408 | - $item->addListItem( 'media', $listItem, $refItem ); |
|
408 | + $item->addListItem('media', $listItem, $refItem); |
|
409 | 409 | |
410 | - unset( $listItems[$listItem->getId()] ); |
|
410 | + unset($listItems[$listItem->getId()]); |
|
411 | 411 | } |
412 | 412 | |
413 | - return $this->deleteMediaItems( $item, $listItems ); |
|
413 | + return $this->deleteMediaItems($item, $listItems); |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | |
@@ -421,20 +421,20 @@ discard block |
||
421 | 421 | * @param boolean $copy True if items should be copied, false if not |
422 | 422 | * @return string[] Multi-dimensional associative list of item data |
423 | 423 | */ |
424 | - protected function toArray( \Aimeos\MShop\Supplier\Item\Iface $item, $copy = false ) |
|
424 | + protected function toArray(\Aimeos\MShop\Supplier\Item\Iface $item, $copy = false) |
|
425 | 425 | { |
426 | 426 | $data = []; |
427 | 427 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
428 | 428 | |
429 | - foreach( $item->getListItems( 'media', null, null, false ) as $listItem ) |
|
429 | + foreach ($item->getListItems('media', null, null, false) as $listItem) |
|
430 | 430 | { |
431 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
431 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
432 | 432 | continue; |
433 | 433 | } |
434 | 434 | |
435 | - $list = $listItem->toArray( true ) + $refItem->toArray( true ); |
|
435 | + $list = $listItem->toArray(true) + $refItem->toArray(true); |
|
436 | 436 | |
437 | - if( $copy === true ) |
|
437 | + if ($copy === true) |
|
438 | 438 | { |
439 | 439 | $list['supplier.lists.siteid'] = $siteId; |
440 | 440 | $list['supplier.lists.id'] = ''; |
@@ -442,10 +442,10 @@ discard block |
||
442 | 442 | $list['media.id'] = null; |
443 | 443 | } |
444 | 444 | |
445 | - $list['supplier.lists.datestart'] = str_replace( ' ', 'T', $list['supplier.lists.datestart'] ); |
|
446 | - $list['supplier.lists.dateend'] = str_replace( ' ', 'T', $list['supplier.lists.dateend'] ); |
|
445 | + $list['supplier.lists.datestart'] = str_replace(' ', 'T', $list['supplier.lists.datestart']); |
|
446 | + $list['supplier.lists.dateend'] = str_replace(' ', 'T', $list['supplier.lists.dateend']); |
|
447 | 447 | |
448 | - foreach( $list['supplier.lists.config'] as $key => $val ) |
|
448 | + foreach ($list['supplier.lists.config'] as $key => $val) |
|
449 | 449 | { |
450 | 450 | $list['config']['key'][] = $key; |
451 | 451 | $list['config']['val'][] = $val; |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
465 | 465 | * @return string HTML output |
466 | 466 | */ |
467 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
467 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
468 | 468 | { |
469 | 469 | /** admin/jqadm/supplier/media/template-item |
470 | 470 | * Relative path to the HTML body template of the media subpart for suppliers. |
@@ -488,6 +488,6 @@ discard block |
||
488 | 488 | $tplconf = 'admin/jqadm/supplier/media/template-item'; |
489 | 489 | $default = 'supplier/item-media-standard'; |
490 | 490 | |
491 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
491 | + return $view->render($view->config($tplconf, $default)); |
|
492 | 492 | } |
493 | 493 | } |
494 | 494 | \ No newline at end of file |
@@ -145,14 +145,12 @@ |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | return; |
148 | - } |
|
149 | - catch( \Aimeos\MShop\Exception $e ) |
|
148 | + } catch( \Aimeos\MShop\Exception $e ) |
|
150 | 149 | { |
151 | 150 | $error = array( 'supplier-item-media' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
152 | 151 | $view->errors = $view->get( 'errors', [] ) + $error; |
153 | 152 | $this->logException( $e ); |
154 | - } |
|
155 | - catch( \Exception $e ) |
|
153 | + } catch( \Exception $e ) |
|
156 | 154 | { |
157 | 155 | $error = array( 'supplier-item-media' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
158 | 156 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Supplier\Product; |
12 | 12 | |
13 | -sprintf( 'product' ); // for translation |
|
13 | +sprintf('product'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -49,24 +49,24 @@ discard block |
||
49 | 49 | $view->productListTypes = $this->getListTypes(); |
50 | 50 | $view->productBody = ''; |
51 | 51 | |
52 | - foreach( $this->getSubClients() as $client ) { |
|
52 | + foreach ($this->getSubClients() as $client) { |
|
53 | 53 | $view->productBody .= $client->copy(); |
54 | 54 | } |
55 | 55 | } |
56 | - catch( \Aimeos\MShop\Exception $e ) |
|
56 | + catch (\Aimeos\MShop\Exception $e) |
|
57 | 57 | { |
58 | - $error = array( 'supplier-product' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
59 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
60 | - $this->logException( $e ); |
|
58 | + $error = array('supplier-product' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
59 | + $view->errors = $view->get('errors', []) + $error; |
|
60 | + $this->logException($e); |
|
61 | 61 | } |
62 | - catch( \Exception $e ) |
|
62 | + catch (\Exception $e) |
|
63 | 63 | { |
64 | - $error = array( 'supplier-product' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
65 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
66 | - $this->logException( $e ); |
|
64 | + $error = array('supplier-product' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
65 | + $view->errors = $view->get('errors', []) + $error; |
|
66 | + $this->logException($e); |
|
67 | 67 | } |
68 | 68 | |
69 | - return $this->render( $view ); |
|
69 | + return $this->render($view); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | |
@@ -84,24 +84,24 @@ discard block |
||
84 | 84 | $view->productListTypes = $this->getListTypes(); |
85 | 85 | $view->productBody = ''; |
86 | 86 | |
87 | - foreach( $this->getSubClients() as $client ) { |
|
87 | + foreach ($this->getSubClients() as $client) { |
|
88 | 88 | $view->productBody .= $client->create(); |
89 | 89 | } |
90 | 90 | } |
91 | - catch( \Aimeos\MShop\Exception $e ) |
|
91 | + catch (\Aimeos\MShop\Exception $e) |
|
92 | 92 | { |
93 | - $error = array( 'supplier-product' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
94 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
95 | - $this->logException( $e ); |
|
93 | + $error = array('supplier-product' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
94 | + $view->errors = $view->get('errors', []) + $error; |
|
95 | + $this->logException($e); |
|
96 | 96 | } |
97 | - catch( \Exception $e ) |
|
97 | + catch (\Exception $e) |
|
98 | 98 | { |
99 | - $error = array( 'supplier-product' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
100 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
101 | - $this->logException( $e ); |
|
99 | + $error = array('supplier-product' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
100 | + $view->errors = $view->get('errors', []) + $error; |
|
101 | + $this->logException($e); |
|
102 | 102 | } |
103 | 103 | |
104 | - return $this->render( $view ); |
|
104 | + return $this->render($view); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
@@ -117,33 +117,33 @@ discard block |
||
117 | 117 | try |
118 | 118 | { |
119 | 119 | $total = 0; |
120 | - $params = $this->storeSearchParams( $view->param( 'sp', [] ), 'supplierproduct' ); |
|
121 | - $listItems = $this->getListItems( $view->item, $params, $total ); |
|
120 | + $params = $this->storeSearchParams($view->param('sp', []), 'supplierproduct'); |
|
121 | + $listItems = $this->getListItems($view->item, $params, $total); |
|
122 | 122 | |
123 | - $view->productItems = $this->getProductItems( $listItems ); |
|
124 | - $view->productData = $this->toArray( $listItems ); |
|
123 | + $view->productItems = $this->getProductItems($listItems); |
|
124 | + $view->productData = $this->toArray($listItems); |
|
125 | 125 | $view->productListTypes = $this->getListTypes(); |
126 | 126 | $view->productTotal = $total; |
127 | 127 | $view->productBody = ''; |
128 | 128 | |
129 | - foreach( $this->getSubClients() as $client ) { |
|
129 | + foreach ($this->getSubClients() as $client) { |
|
130 | 130 | $view->productBody .= $client->search(); |
131 | 131 | } |
132 | 132 | } |
133 | - catch( \Aimeos\MShop\Exception $e ) |
|
133 | + catch (\Aimeos\MShop\Exception $e) |
|
134 | 134 | { |
135 | - $error = array( 'supplier-product' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
136 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
137 | - $this->logException( $e ); |
|
135 | + $error = array('supplier-product' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
136 | + $view->errors = $view->get('errors', []) + $error; |
|
137 | + $this->logException($e); |
|
138 | 138 | } |
139 | - catch( \Exception $e ) |
|
139 | + catch (\Exception $e) |
|
140 | 140 | { |
141 | - $error = array( 'supplier-product' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
142 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
143 | - $this->logException( $e ); |
|
141 | + $error = array('supplier-product' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
142 | + $view->errors = $view->get('errors', []) + $error; |
|
143 | + $this->logException($e); |
|
144 | 144 | } |
145 | 145 | |
146 | - return $this->render( $view ); |
|
146 | + return $this->render($view); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
@@ -155,34 +155,34 @@ discard block |
||
155 | 155 | $view = $this->getView(); |
156 | 156 | $context = $this->getContext(); |
157 | 157 | |
158 | - $manager = \Aimeos\MShop::create( $context, 'supplier/lists' ); |
|
158 | + $manager = \Aimeos\MShop::create($context, 'supplier/lists'); |
|
159 | 159 | |
160 | 160 | $manager->begin(); |
161 | 161 | |
162 | 162 | try |
163 | 163 | { |
164 | - $this->storeSearchParams( $view->param( 'sp', [] ), 'supplierproduct' ); |
|
165 | - $this->fromArray( $view->item, $view->param( 'product', [] ) ); |
|
164 | + $this->storeSearchParams($view->param('sp', []), 'supplierproduct'); |
|
165 | + $this->fromArray($view->item, $view->param('product', [])); |
|
166 | 166 | $view->productBody = ''; |
167 | 167 | |
168 | - foreach( $this->getSubClients() as $client ) { |
|
168 | + foreach ($this->getSubClients() as $client) { |
|
169 | 169 | $view->productBody .= $client->save(); |
170 | 170 | } |
171 | 171 | |
172 | 172 | $manager->commit(); |
173 | 173 | return; |
174 | 174 | } |
175 | - catch( \Aimeos\MShop\Exception $e ) |
|
175 | + catch (\Aimeos\MShop\Exception $e) |
|
176 | 176 | { |
177 | - $error = array( 'supplier-item-media' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
178 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
179 | - $this->logException( $e ); |
|
177 | + $error = array('supplier-item-media' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
178 | + $view->errors = $view->get('errors', []) + $error; |
|
179 | + $this->logException($e); |
|
180 | 180 | } |
181 | - catch( \Exception $e ) |
|
181 | + catch (\Exception $e) |
|
182 | 182 | { |
183 | - $error = array( 'supplier-item-media' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
184 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
185 | - $this->logException( $e ); |
|
183 | + $error = array('supplier-item-media' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
184 | + $view->errors = $view->get('errors', []) + $error; |
|
185 | + $this->logException($e); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | $manager->rollback(); |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @param string|null $name Name of the sub-client (Default if null) |
199 | 199 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
200 | 200 | */ |
201 | - public function getSubClient( $type, $name = null ) |
|
201 | + public function getSubClient($type, $name = null) |
|
202 | 202 | { |
203 | 203 | /** admin/jqadm/supplier/product/decorators/excludes |
204 | 204 | * Excludes decorators added by the "common" option from the supplier JQAdm client |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @see admin/jqadm/supplier/product/decorators/excludes |
274 | 274 | * @see admin/jqadm/supplier/product/decorators/global |
275 | 275 | */ |
276 | - return $this->createSubClient( 'supplier/product/' . $type, $name ); |
|
276 | + return $this->createSubClient('supplier/product/' . $type, $name); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | |
@@ -285,22 +285,22 @@ discard block |
||
285 | 285 | * @param integer $total Value/result parameter that will contain the item total afterwards |
286 | 286 | * @return \Aimeos\MShop\Common\Item\List\Iface[] Supplier list items referencing the products |
287 | 287 | */ |
288 | - protected function getListItems( \Aimeos\MShop\Supplier\Item\Iface $item, array $params = [], &$total ) |
|
288 | + protected function getListItems(\Aimeos\MShop\Supplier\Item\Iface $item, array $params = [], &$total) |
|
289 | 289 | { |
290 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'supplier/lists' ); |
|
290 | + $manager = \Aimeos\MShop::create($this->getContext(), 'supplier/lists'); |
|
291 | 291 | |
292 | 292 | $search = $manager->createSearch(); |
293 | - $search->setSortations( [$search->sort( '-', 'supplier.lists.ctime' )] ); |
|
293 | + $search->setSortations([$search->sort('-', 'supplier.lists.ctime')]); |
|
294 | 294 | |
295 | - $search = $this->initCriteria( $search, $params ); |
|
295 | + $search = $this->initCriteria($search, $params); |
|
296 | 296 | $expr = [ |
297 | 297 | $search->getConditions(), |
298 | - $search->compare( '==', 'supplier.lists.parentid', $item->getId() ), |
|
299 | - $search->compare( '==', 'supplier.lists.domain', 'product' ), |
|
298 | + $search->compare('==', 'supplier.lists.parentid', $item->getId()), |
|
299 | + $search->compare('==', 'supplier.lists.domain', 'product'), |
|
300 | 300 | ]; |
301 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
301 | + $search->setConditions($search->combine('&&', $expr)); |
|
302 | 302 | |
303 | - return $manager->searchItems( $search, [], $total ); |
|
303 | + return $manager->searchItems($search, [], $total); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | |
@@ -312,13 +312,13 @@ discard block |
||
312 | 312 | protected function getListTypes() |
313 | 313 | { |
314 | 314 | $list = []; |
315 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'supplier/lists/type' ); |
|
315 | + $manager = \Aimeos\MShop::create($this->getContext(), 'supplier/lists/type'); |
|
316 | 316 | |
317 | - $search = $manager->createSearch()->setSlice( 0, 0x7fffffff ); |
|
318 | - $search->setConditions( $search->compare( '==', 'supplier.lists.type.domain', 'product' ) ); |
|
319 | - $search->setSortations( [$search->sort( '+', 'supplier.lists.type.code' )] ); |
|
317 | + $search = $manager->createSearch()->setSlice(0, 0x7fffffff); |
|
318 | + $search->setConditions($search->compare('==', 'supplier.lists.type.domain', 'product')); |
|
319 | + $search->setSortations([$search->sort('+', 'supplier.lists.type.code')]); |
|
320 | 320 | |
321 | - foreach( $manager->searchItems( $search ) as $id => $item ) { |
|
321 | + foreach ($manager->searchItems($search) as $id => $item) { |
|
322 | 322 | $list[$id] = $item->getCode(); |
323 | 323 | } |
324 | 324 | |
@@ -332,20 +332,20 @@ discard block |
||
332 | 332 | * @param \Aimeos\MShop\Common\Item\List\Iface[] $listItems Supplier list items referencing the products |
333 | 333 | * @return \Aimeos\MShop\Product\Item\Iface[] Associative list of product IDs as keys and items as values |
334 | 334 | */ |
335 | - protected function getProductItems( array $listItems ) |
|
335 | + protected function getProductItems(array $listItems) |
|
336 | 336 | { |
337 | 337 | $list = []; |
338 | 338 | |
339 | - foreach( $listItems as $listItem ) { |
|
339 | + foreach ($listItems as $listItem) { |
|
340 | 340 | $list[] = $listItem->getRefId(); |
341 | 341 | } |
342 | 342 | |
343 | - $manager = \Aimeos\MShop::create( $this->getContext(), 'product' ); |
|
343 | + $manager = \Aimeos\MShop::create($this->getContext(), 'product'); |
|
344 | 344 | |
345 | - $search = $manager->createSearch()->setSlice( 0, count( $list ) ); |
|
346 | - $search->setConditions( $search->compare( '==', 'product.id', $list ) ); |
|
345 | + $search = $manager->createSearch()->setSlice(0, count($list)); |
|
346 | + $search->setConditions($search->compare('==', 'product.id', $list)); |
|
347 | 347 | |
348 | - return $manager->searchItems( $search ); |
|
348 | + return $manager->searchItems($search); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | * @since 2017.07 |
390 | 390 | * @category Developer |
391 | 391 | */ |
392 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/supplier/product/standard/subparts', [] ); |
|
392 | + return $this->getContext()->getConfig()->get('admin/jqadm/supplier/product/standard/subparts', []); |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | |
@@ -399,75 +399,75 @@ discard block |
||
399 | 399 | * @param \Aimeos\MShop\Supplier\Item\Iface $item Supplier item object without referenced domain items |
400 | 400 | * @param string[] $data Data array |
401 | 401 | */ |
402 | - protected function fromArray( \Aimeos\MShop\Supplier\Item\Iface $item, array $data ) |
|
402 | + protected function fromArray(\Aimeos\MShop\Supplier\Item\Iface $item, array $data) |
|
403 | 403 | { |
404 | 404 | $context = $this->getContext(); |
405 | - $listIds = $this->getValue( $data, 'supplier.lists.id', [] ); |
|
405 | + $listIds = $this->getValue($data, 'supplier.lists.id', []); |
|
406 | 406 | |
407 | - $listManager = \Aimeos\MShop::create( $context, 'supplier/lists' ); |
|
407 | + $listManager = \Aimeos\MShop::create($context, 'supplier/lists'); |
|
408 | 408 | |
409 | - $search = $listManager->createSearch()->setSlice( 0, count( $listIds ) ); |
|
410 | - $search->setConditions( $search->compare( '==', 'supplier.lists.id', $listIds ) ); |
|
409 | + $search = $listManager->createSearch()->setSlice(0, count($listIds)); |
|
410 | + $search->setConditions($search->compare('==', 'supplier.lists.id', $listIds)); |
|
411 | 411 | |
412 | - $listItems = $listManager->searchItems( $search ); |
|
412 | + $listItems = $listManager->searchItems($search); |
|
413 | 413 | |
414 | 414 | |
415 | - foreach( (array) $listIds as $idx => $listid ) |
|
415 | + foreach ((array) $listIds as $idx => $listid) |
|
416 | 416 | { |
417 | - if( isset( $listItems[$listid] ) ) { |
|
417 | + if (isset($listItems[$listid])) { |
|
418 | 418 | $litem = $listItems[$listid]; |
419 | 419 | } else { |
420 | 420 | $litem = $listManager->createItem(); |
421 | 421 | } |
422 | 422 | |
423 | - $litem->setParentId( $item->getId() ); |
|
424 | - $litem->setDomain( 'product' ); |
|
423 | + $litem->setParentId($item->getId()); |
|
424 | + $litem->setDomain('product'); |
|
425 | 425 | |
426 | - if( isset( $data['supplier.lists.refid'][$idx] ) ) { |
|
427 | - $litem->setRefId( $this->getValue( $data, 'supplier.lists.refid/' . $idx ) ); |
|
426 | + if (isset($data['supplier.lists.refid'][$idx])) { |
|
427 | + $litem->setRefId($this->getValue($data, 'supplier.lists.refid/' . $idx)); |
|
428 | 428 | } |
429 | 429 | |
430 | - if( isset( $data['supplier.lists.status'][$idx] ) ) { |
|
431 | - $litem->setStatus( $this->getValue( $data, 'supplier.lists.status/' . $idx ) ); |
|
430 | + if (isset($data['supplier.lists.status'][$idx])) { |
|
431 | + $litem->setStatus($this->getValue($data, 'supplier.lists.status/' . $idx)); |
|
432 | 432 | } |
433 | 433 | |
434 | - if( isset( $data['supplier.lists.type'][$idx] ) ) { |
|
435 | - $litem->setType( $this->getValue( $data, 'supplier.lists.type/' . $idx ) ); |
|
434 | + if (isset($data['supplier.lists.type'][$idx])) { |
|
435 | + $litem->setType($this->getValue($data, 'supplier.lists.type/' . $idx)); |
|
436 | 436 | } |
437 | 437 | |
438 | - if( isset( $data['supplier.lists.position'][$idx] ) ) { |
|
439 | - $litem->setPosition( $this->getValue( $data, 'supplier.lists.position/' . $idx ) ); |
|
438 | + if (isset($data['supplier.lists.position'][$idx])) { |
|
439 | + $litem->setPosition($this->getValue($data, 'supplier.lists.position/' . $idx)); |
|
440 | 440 | } |
441 | 441 | |
442 | - if( isset( $data['supplier.lists.datestart'][$idx] ) ) { |
|
443 | - $litem->setDateStart( $this->getValue( $data, 'supplier.lists.datestart/' . $idx ) ); |
|
442 | + if (isset($data['supplier.lists.datestart'][$idx])) { |
|
443 | + $litem->setDateStart($this->getValue($data, 'supplier.lists.datestart/' . $idx)); |
|
444 | 444 | } |
445 | 445 | |
446 | - if( isset( $data['supplier.lists.dateend'][$idx] ) ) { |
|
447 | - $litem->setDateEnd( $this->getValue( $data, 'supplier.lists.dateend/' . $idx ) ); |
|
446 | + if (isset($data['supplier.lists.dateend'][$idx])) { |
|
447 | + $litem->setDateEnd($this->getValue($data, 'supplier.lists.dateend/' . $idx)); |
|
448 | 448 | } |
449 | 449 | |
450 | - if( isset( $data['supplier.lists.config'][$idx] ) |
|
451 | - && ( $conf = json_decode( $this->getValue( $data, 'supplier.lists.config/' . $idx ), true ) ) !== null |
|
450 | + if (isset($data['supplier.lists.config'][$idx]) |
|
451 | + && ($conf = json_decode($this->getValue($data, 'supplier.lists.config/' . $idx), true)) !== null |
|
452 | 452 | ) { |
453 | - $litem->setConfig( $conf ); |
|
453 | + $litem->setConfig($conf); |
|
454 | 454 | } |
455 | 455 | |
456 | - if( $litem->getId() === null && isset( $data['config'][$idx]['key'] ) ) |
|
456 | + if ($litem->getId() === null && isset($data['config'][$idx]['key'])) |
|
457 | 457 | { |
458 | 458 | $conf = []; |
459 | 459 | |
460 | - foreach( (array) $data['config'][$idx]['key'] as $pos => $key ) |
|
460 | + foreach ((array) $data['config'][$idx]['key'] as $pos => $key) |
|
461 | 461 | { |
462 | - if( trim( $key ) !== '' && isset( $data['config'][$idx]['val'][$pos] ) ) { |
|
462 | + if (trim($key) !== '' && isset($data['config'][$idx]['val'][$pos])) { |
|
463 | 463 | $conf[$key] = $data['config'][$idx]['val'][$pos]; |
464 | 464 | } |
465 | 465 | } |
466 | 466 | |
467 | - $litem->setConfig( $conf ); |
|
467 | + $litem->setConfig($conf); |
|
468 | 468 | } |
469 | 469 | |
470 | - $listManager->saveItem( $litem, false ); |
|
470 | + $listManager->saveItem($litem, false); |
|
471 | 471 | } |
472 | 472 | } |
473 | 473 | |
@@ -478,13 +478,13 @@ discard block |
||
478 | 478 | * @param \Aimeos\MShop\Common\Item\Lists\Iface[] $listItems Supplier list items referencing the products |
479 | 479 | * @return string[] Multi-dimensional associative list of item data |
480 | 480 | */ |
481 | - protected function toArray( array $listItems ) |
|
481 | + protected function toArray(array $listItems) |
|
482 | 482 | { |
483 | 483 | $data = []; |
484 | 484 | |
485 | - foreach( $listItems as $listItem ) |
|
485 | + foreach ($listItems as $listItem) |
|
486 | 486 | { |
487 | - foreach( $listItem->toArray( true ) as $key => $value ) { |
|
487 | + foreach ($listItem->toArray(true) as $key => $value) { |
|
488 | 488 | $data[$key][] = $value; |
489 | 489 | } |
490 | 490 | } |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
500 | 500 | * @return string HTML output |
501 | 501 | */ |
502 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
502 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
503 | 503 | { |
504 | 504 | /** admin/jqadm/supplier/product/template-item |
505 | 505 | * Relative path to the HTML body template of the product subpart for suppliers. |
@@ -523,6 +523,6 @@ discard block |
||
523 | 523 | $tplconf = 'admin/jqadm/supplier/product/template-item'; |
524 | 524 | $default = 'supplier/item-product-standard'; |
525 | 525 | |
526 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
526 | + return $view->render($view->config($tplconf, $default)); |
|
527 | 527 | } |
528 | 528 | } |
@@ -52,14 +52,12 @@ discard block |
||
52 | 52 | foreach( $this->getSubClients() as $client ) { |
53 | 53 | $view->productBody .= $client->copy(); |
54 | 54 | } |
55 | - } |
|
56 | - catch( \Aimeos\MShop\Exception $e ) |
|
55 | + } catch( \Aimeos\MShop\Exception $e ) |
|
57 | 56 | { |
58 | 57 | $error = array( 'supplier-product' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
59 | 58 | $view->errors = $view->get( 'errors', [] ) + $error; |
60 | 59 | $this->logException( $e ); |
61 | - } |
|
62 | - catch( \Exception $e ) |
|
60 | + } catch( \Exception $e ) |
|
63 | 61 | { |
64 | 62 | $error = array( 'supplier-product' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
65 | 63 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -87,14 +85,12 @@ discard block |
||
87 | 85 | foreach( $this->getSubClients() as $client ) { |
88 | 86 | $view->productBody .= $client->create(); |
89 | 87 | } |
90 | - } |
|
91 | - catch( \Aimeos\MShop\Exception $e ) |
|
88 | + } catch( \Aimeos\MShop\Exception $e ) |
|
92 | 89 | { |
93 | 90 | $error = array( 'supplier-product' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
94 | 91 | $view->errors = $view->get( 'errors', [] ) + $error; |
95 | 92 | $this->logException( $e ); |
96 | - } |
|
97 | - catch( \Exception $e ) |
|
93 | + } catch( \Exception $e ) |
|
98 | 94 | { |
99 | 95 | $error = array( 'supplier-product' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
100 | 96 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -129,14 +125,12 @@ discard block |
||
129 | 125 | foreach( $this->getSubClients() as $client ) { |
130 | 126 | $view->productBody .= $client->search(); |
131 | 127 | } |
132 | - } |
|
133 | - catch( \Aimeos\MShop\Exception $e ) |
|
128 | + } catch( \Aimeos\MShop\Exception $e ) |
|
134 | 129 | { |
135 | 130 | $error = array( 'supplier-product' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
136 | 131 | $view->errors = $view->get( 'errors', [] ) + $error; |
137 | 132 | $this->logException( $e ); |
138 | - } |
|
139 | - catch( \Exception $e ) |
|
133 | + } catch( \Exception $e ) |
|
140 | 134 | { |
141 | 135 | $error = array( 'supplier-product' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
142 | 136 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -171,14 +165,12 @@ discard block |
||
171 | 165 | |
172 | 166 | $manager->commit(); |
173 | 167 | return; |
174 | - } |
|
175 | - catch( \Aimeos\MShop\Exception $e ) |
|
168 | + } catch( \Aimeos\MShop\Exception $e ) |
|
176 | 169 | { |
177 | 170 | $error = array( 'supplier-item-media' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
178 | 171 | $view->errors = $view->get( 'errors', [] ) + $error; |
179 | 172 | $this->logException( $e ); |
180 | - } |
|
181 | - catch( \Exception $e ) |
|
173 | + } catch( \Exception $e ) |
|
182 | 174 | { |
183 | 175 | $error = array( 'supplier-item-media' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
184 | 176 | $view->errors = $view->get( 'errors', [] ) + $error; |