@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @return \Aimeos\Admin\JQAdm\Iface Filter part implementing \Aimeos\Admin\JQAdm\Iface |
30 | 30 | * @throws \Aimeos\Admin\JQAdm\Exception If requested client implementation couldn't be found or initialisation fails |
31 | 31 | */ |
32 | - public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, $name = null ) |
|
32 | + public static function createClient(\Aimeos\MShop\Context\Item\Iface $context, $name = null) |
|
33 | 33 | { |
34 | 34 | /** admin/jqadm/type/customer/property/name |
35 | 35 | * Class name of the used account favorite client implementation |
@@ -64,22 +64,22 @@ discard block |
||
64 | 64 | * @since 2018.01 |
65 | 65 | * @category Developer |
66 | 66 | */ |
67 | - if( $name === null ) { |
|
68 | - $name = $context->getConfig()->get( 'admin/jqadm/type/customer/property/name', 'Standard' ); |
|
67 | + if ($name === null) { |
|
68 | + $name = $context->getConfig()->get('admin/jqadm/type/customer/property/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\\Type\\Customer\\Property\\' . $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\\Type\\Customer\\Property\\' . $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\\Type\\Customer\\Property\\' . $name; |
79 | 79 | |
80 | - $client = self::createClientBase( $context, $classname, $iface ); |
|
80 | + $client = self::createClientBase($context, $classname, $iface); |
|
81 | 81 | |
82 | - return self::addClientDecorators( $context, $client, 'type/customer/property' ); |
|
82 | + return self::addClientDecorators($context, $client, 'type/customer/property'); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | } |
86 | 86 | \ No newline at end of file |
@@ -51,14 +51,12 @@ discard block |
||
51 | 51 | $view->tabindex = ++$idx + 1; |
52 | 52 | $view->itemBody .= $client->copy(); |
53 | 53 | } |
54 | - } |
|
55 | - catch( \Aimeos\MShop\Exception $e ) |
|
54 | + } catch( \Aimeos\MShop\Exception $e ) |
|
56 | 55 | { |
57 | 56 | $error = array( 'type-customer-property-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
58 | 57 | $view->errors = $view->get( 'errors', [] ) + $error; |
59 | 58 | $this->logException( $e ); |
60 | - } |
|
61 | - catch( \Exception $e ) |
|
59 | + } catch( \Exception $e ) |
|
62 | 60 | { |
63 | 61 | $error = array( 'type-customer-property-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
64 | 62 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -100,14 +98,12 @@ discard block |
||
100 | 98 | $view->tabindex = ++$idx + 1; |
101 | 99 | $view->itemBody .= $client->create(); |
102 | 100 | } |
103 | - } |
|
104 | - catch( \Aimeos\MShop\Exception $e ) |
|
101 | + } catch( \Aimeos\MShop\Exception $e ) |
|
105 | 102 | { |
106 | 103 | $error = array( 'type-customer-property-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
107 | 104 | $view->errors = $view->get( 'errors', [] ) + $error; |
108 | 105 | $this->logException( $e ); |
109 | - } |
|
110 | - catch( \Exception $e ) |
|
106 | + } catch( \Exception $e ) |
|
111 | 107 | { |
112 | 108 | $error = array( 'type-customer-property-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
113 | 109 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -148,14 +144,12 @@ discard block |
||
148 | 144 | |
149 | 145 | $this->nextAction( $view, 'search', 'type/customer/property', null, 'delete' ); |
150 | 146 | return; |
151 | - } |
|
152 | - catch( \Aimeos\MShop\Exception $e ) |
|
147 | + } catch( \Aimeos\MShop\Exception $e ) |
|
153 | 148 | { |
154 | 149 | $error = array( 'type-customer-property-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
155 | 150 | $view->errors = $view->get( 'errors', [] ) + $error; |
156 | 151 | $this->logException( $e ); |
157 | - } |
|
158 | - catch( \Exception $e ) |
|
152 | + } catch( \Exception $e ) |
|
159 | 153 | { |
160 | 154 | $error = array( 'type-customer-property-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
161 | 155 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -196,14 +190,12 @@ discard block |
||
196 | 190 | $view->tabindex = ++$idx + 1; |
197 | 191 | $view->itemBody .= $client->get(); |
198 | 192 | } |
199 | - } |
|
200 | - catch( \Aimeos\MShop\Exception $e ) |
|
193 | + } catch( \Aimeos\MShop\Exception $e ) |
|
201 | 194 | { |
202 | 195 | $error = array( 'type-customer-property-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
203 | 196 | $view->errors = $view->get( 'errors', [] ) + $error; |
204 | 197 | $this->logException( $e ); |
205 | - } |
|
206 | - catch( \Exception $e ) |
|
198 | + } catch( \Exception $e ) |
|
207 | 199 | { |
208 | 200 | $error = array( 'type-customer-property-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
209 | 201 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -241,18 +233,15 @@ discard block |
||
241 | 233 | |
242 | 234 | $this->nextAction( $view, $view->param( 'next' ), 'type/customer/property', $view->item->getId(), 'save' ); |
243 | 235 | return; |
244 | - } |
|
245 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
236 | + } catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
246 | 237 | { |
247 | 238 | // fall through to create |
248 | - } |
|
249 | - catch( \Aimeos\MShop\Exception $e ) |
|
239 | + } catch( \Aimeos\MShop\Exception $e ) |
|
250 | 240 | { |
251 | 241 | $error = array( 'type-customer-property-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
252 | 242 | $view->errors = $view->get( 'errors', [] ) + $error; |
253 | 243 | $this->logException( $e ); |
254 | - } |
|
255 | - catch( \Exception $e ) |
|
244 | + } catch( \Exception $e ) |
|
256 | 245 | { |
257 | 246 | $error = array( 'type-customer-property-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
258 | 247 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -291,14 +280,12 @@ discard block |
||
291 | 280 | foreach( $this->getSubClients() as $client ) { |
292 | 281 | $view->itemBody .= $client->search(); |
293 | 282 | } |
294 | - } |
|
295 | - catch( \Aimeos\MShop\Exception $e ) |
|
283 | + } catch( \Aimeos\MShop\Exception $e ) |
|
296 | 284 | { |
297 | 285 | $error = array( 'type-customer-property-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
298 | 286 | $view->errors = $view->get( 'errors', [] ) + $error; |
299 | 287 | $this->logException( $e ); |
300 | - } |
|
301 | - catch( \Exception $e ) |
|
288 | + } catch( \Exception $e ) |
|
302 | 289 | { |
303 | 290 | $error = array( 'type-customer-property-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
304 | 291 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Type\Customer\Property; |
12 | 12 | |
13 | -sprintf( 'type/customer/property' ); // for translation |
|
13 | +sprintf('type/customer/property'); // for translation |
|
14 | 14 | |
15 | 15 | |
16 | 16 | /** |
@@ -35,37 +35,37 @@ discard block |
||
35 | 35 | |
36 | 36 | try |
37 | 37 | { |
38 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
39 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
38 | + if (($id = $view->param('id')) === null) { |
|
39 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
40 | 40 | } |
41 | 41 | |
42 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/property/type' ); |
|
43 | - $view->item = $manager->getItem( $id ); |
|
42 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/property/type'); |
|
43 | + $view->item = $manager->getItem($id); |
|
44 | 44 | |
45 | - $view->itemData = $this->toArray( $view->item, true ); |
|
45 | + $view->itemData = $this->toArray($view->item, true); |
|
46 | 46 | $view->itemSubparts = $this->getSubClientNames(); |
47 | 47 | $view->itemBody = ''; |
48 | 48 | |
49 | - foreach( $this->getSubClients() as $idx => $client ) |
|
49 | + foreach ($this->getSubClients() as $idx => $client) |
|
50 | 50 | { |
51 | 51 | $view->tabindex = ++$idx + 1; |
52 | 52 | $view->itemBody .= $client->copy(); |
53 | 53 | } |
54 | 54 | } |
55 | - catch( \Aimeos\MShop\Exception $e ) |
|
55 | + catch (\Aimeos\MShop\Exception $e) |
|
56 | 56 | { |
57 | - $error = array( 'type-customer-property-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
58 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
59 | - $this->logException( $e ); |
|
57 | + $error = array('type-customer-property-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
58 | + $view->errors = $view->get('errors', []) + $error; |
|
59 | + $this->logException($e); |
|
60 | 60 | } |
61 | - catch( \Exception $e ) |
|
61 | + catch (\Exception $e) |
|
62 | 62 | { |
63 | - $error = array( 'type-customer-property-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
64 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
65 | - $this->logException( $e ); |
|
63 | + $error = array('type-customer-property-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
64 | + $view->errors = $view->get('errors', []) + $error; |
|
65 | + $this->logException($e); |
|
66 | 66 | } |
67 | 67 | |
68 | - return $this->render( $view ); |
|
68 | + return $this->render($view); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | |
82 | 82 | try |
83 | 83 | { |
84 | - $data = $view->param( 'item', [] ); |
|
84 | + $data = $view->param('item', []); |
|
85 | 85 | |
86 | - if( !isset( $view->item ) ) { |
|
87 | - $view->item = \Aimeos\MShop\Factory::createManager( $context, 'customer/property/type' )->createItem(); |
|
86 | + if (!isset($view->item)) { |
|
87 | + $view->item = \Aimeos\MShop\Factory::createManager($context, 'customer/property/type')->createItem(); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | $data['customer.property.type.siteid'] = $view->item->getSiteId(); |
@@ -93,26 +93,26 @@ discard block |
||
93 | 93 | $view->itemData = $data; |
94 | 94 | $view->itemBody = ''; |
95 | 95 | |
96 | - foreach( $this->getSubClients() as $idx => $client ) |
|
96 | + foreach ($this->getSubClients() as $idx => $client) |
|
97 | 97 | { |
98 | 98 | $view->tabindex = ++$idx + 1; |
99 | 99 | $view->itemBody .= $client->create(); |
100 | 100 | } |
101 | 101 | } |
102 | - catch( \Aimeos\MShop\Exception $e ) |
|
102 | + catch (\Aimeos\MShop\Exception $e) |
|
103 | 103 | { |
104 | - $error = array( 'type-customer-property-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
105 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
106 | - $this->logException( $e ); |
|
104 | + $error = array('type-customer-property-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
105 | + $view->errors = $view->get('errors', []) + $error; |
|
106 | + $this->logException($e); |
|
107 | 107 | } |
108 | - catch( \Exception $e ) |
|
108 | + catch (\Exception $e) |
|
109 | 109 | { |
110 | - $error = array( 'type-customer-property-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
111 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
112 | - $this->logException( $e ); |
|
110 | + $error = array('type-customer-property-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
111 | + $view->errors = $view->get('errors', []) + $error; |
|
112 | + $this->logException($e); |
|
113 | 113 | } |
114 | 114 | |
115 | - return $this->render( $view ); |
|
115 | + return $this->render($view); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | |
@@ -126,38 +126,38 @@ discard block |
||
126 | 126 | $view = $this->getView(); |
127 | 127 | $context = $this->getContext(); |
128 | 128 | |
129 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/property/type' ); |
|
129 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/property/type'); |
|
130 | 130 | $manager->begin(); |
131 | 131 | |
132 | 132 | try |
133 | 133 | { |
134 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
135 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
134 | + if (($id = $view->param('id')) === null) { |
|
135 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
136 | 136 | } |
137 | 137 | |
138 | - $view->item = $manager->getItem( $id ); |
|
138 | + $view->item = $manager->getItem($id); |
|
139 | 139 | |
140 | - foreach( $this->getSubClients() as $client ) { |
|
140 | + foreach ($this->getSubClients() as $client) { |
|
141 | 141 | $client->delete(); |
142 | 142 | } |
143 | 143 | |
144 | - $manager->deleteItem( $id ); |
|
144 | + $manager->deleteItem($id); |
|
145 | 145 | $manager->commit(); |
146 | 146 | |
147 | - $this->nextAction( $view, 'search', 'type/customer/property', null, 'delete' ); |
|
147 | + $this->nextAction($view, 'search', 'type/customer/property', null, 'delete'); |
|
148 | 148 | return; |
149 | 149 | } |
150 | - catch( \Aimeos\MShop\Exception $e ) |
|
150 | + catch (\Aimeos\MShop\Exception $e) |
|
151 | 151 | { |
152 | - $error = array( 'type-customer-property-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
153 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
154 | - $this->logException( $e ); |
|
152 | + $error = array('type-customer-property-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
153 | + $view->errors = $view->get('errors', []) + $error; |
|
154 | + $this->logException($e); |
|
155 | 155 | } |
156 | - catch( \Exception $e ) |
|
156 | + catch (\Exception $e) |
|
157 | 157 | { |
158 | - $error = array( 'type-customer-property-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
159 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
160 | - $this->logException( $e ); |
|
158 | + $error = array('type-customer-property-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
159 | + $view->errors = $view->get('errors', []) + $error; |
|
160 | + $this->logException($e); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | $manager->rollback(); |
@@ -178,37 +178,37 @@ discard block |
||
178 | 178 | |
179 | 179 | try |
180 | 180 | { |
181 | - if( ( $id = $view->param( 'id' ) ) === null ) { |
|
182 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Required parameter "%1$s" is missing', 'id' ) ); |
|
181 | + if (($id = $view->param('id')) === null) { |
|
182 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Required parameter "%1$s" is missing', 'id')); |
|
183 | 183 | } |
184 | 184 | |
185 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/property/type' ); |
|
185 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/property/type'); |
|
186 | 186 | |
187 | - $view->item = $manager->getItem( $id ); |
|
187 | + $view->item = $manager->getItem($id); |
|
188 | 188 | $view->itemSubparts = $this->getSubClientNames(); |
189 | - $view->itemData = $this->toArray( $view->item ); |
|
189 | + $view->itemData = $this->toArray($view->item); |
|
190 | 190 | $view->itemBody = ''; |
191 | 191 | |
192 | - foreach( $this->getSubClients() as $idx => $client ) |
|
192 | + foreach ($this->getSubClients() as $idx => $client) |
|
193 | 193 | { |
194 | 194 | $view->tabindex = ++$idx + 1; |
195 | 195 | $view->itemBody .= $client->get(); |
196 | 196 | } |
197 | 197 | } |
198 | - catch( \Aimeos\MShop\Exception $e ) |
|
198 | + catch (\Aimeos\MShop\Exception $e) |
|
199 | 199 | { |
200 | - $error = array( 'type-customer-property-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
201 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
202 | - $this->logException( $e ); |
|
200 | + $error = array('type-customer-property-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
201 | + $view->errors = $view->get('errors', []) + $error; |
|
202 | + $this->logException($e); |
|
203 | 203 | } |
204 | - catch( \Exception $e ) |
|
204 | + catch (\Exception $e) |
|
205 | 205 | { |
206 | - $error = array( 'type-customer-property-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
207 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
208 | - $this->logException( $e ); |
|
206 | + $error = array('type-customer-property-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
207 | + $view->errors = $view->get('errors', []) + $error; |
|
208 | + $this->logException($e); |
|
209 | 209 | } |
210 | 210 | |
211 | - return $this->render( $view ); |
|
211 | + return $this->render($view); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | |
@@ -222,40 +222,40 @@ discard block |
||
222 | 222 | $view = $this->getView(); |
223 | 223 | $context = $this->getContext(); |
224 | 224 | |
225 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/property/type' ); |
|
225 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/property/type'); |
|
226 | 226 | $manager->begin(); |
227 | 227 | |
228 | 228 | try |
229 | 229 | { |
230 | - $item = $this->fromArray( $view->param( 'item', [] ) ); |
|
231 | - $view->item = $item->getId() ? $item : $manager->saveItem( $item ); |
|
230 | + $item = $this->fromArray($view->param('item', [])); |
|
231 | + $view->item = $item->getId() ? $item : $manager->saveItem($item); |
|
232 | 232 | $view->itemBody = ''; |
233 | 233 | |
234 | - foreach( $this->getSubClients() as $client ) { |
|
234 | + foreach ($this->getSubClients() as $client) { |
|
235 | 235 | $view->itemBody .= $client->save(); |
236 | 236 | } |
237 | 237 | |
238 | - $manager->saveItem( clone $view->item ); |
|
238 | + $manager->saveItem(clone $view->item); |
|
239 | 239 | $manager->commit(); |
240 | 240 | |
241 | - $this->nextAction( $view, $view->param( 'next' ), 'type/customer/property', $view->item->getId(), 'save' ); |
|
241 | + $this->nextAction($view, $view->param('next'), 'type/customer/property', $view->item->getId(), 'save'); |
|
242 | 242 | return; |
243 | 243 | } |
244 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
244 | + catch (\Aimeos\Admin\JQAdm\Exception $e) |
|
245 | 245 | { |
246 | 246 | // fall through to create |
247 | 247 | } |
248 | - catch( \Aimeos\MShop\Exception $e ) |
|
248 | + catch (\Aimeos\MShop\Exception $e) |
|
249 | 249 | { |
250 | - $error = array( 'type-customer-property-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
251 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
252 | - $this->logException( $e ); |
|
250 | + $error = array('type-customer-property-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
251 | + $view->errors = $view->get('errors', []) + $error; |
|
252 | + $this->logException($e); |
|
253 | 253 | } |
254 | - catch( \Exception $e ) |
|
254 | + catch (\Exception $e) |
|
255 | 255 | { |
256 | - $error = array( 'type-customer-property-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
257 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
258 | - $this->logException( $e ); |
|
256 | + $error = array('type-customer-property-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
257 | + $view->errors = $view->get('errors', []) + $error; |
|
258 | + $this->logException($e); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | $manager->rollback(); |
@@ -277,31 +277,31 @@ discard block |
||
277 | 277 | try |
278 | 278 | { |
279 | 279 | $total = 0; |
280 | - $params = $this->storeSearchParams( $view->param(), 'type/customer/property' ); |
|
281 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer/property/type' ); |
|
282 | - $search = $this->initCriteria( $manager->createSearch(), $params ); |
|
280 | + $params = $this->storeSearchParams($view->param(), 'type/customer/property'); |
|
281 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/property/type'); |
|
282 | + $search = $this->initCriteria($manager->createSearch(), $params); |
|
283 | 283 | |
284 | - $view->items = $manager->searchItems( $search, [], $total ); |
|
285 | - $view->filterCustomers = $manager->getSearchAttributes( true ); |
|
284 | + $view->items = $manager->searchItems($search, [], $total); |
|
285 | + $view->filterCustomers = $manager->getSearchAttributes(true); |
|
286 | 286 | $view->filterOperators = $search->getOperators(); |
287 | 287 | $view->total = $total; |
288 | 288 | $view->itemBody = ''; |
289 | 289 | |
290 | - foreach( $this->getSubClients() as $client ) { |
|
290 | + foreach ($this->getSubClients() as $client) { |
|
291 | 291 | $view->itemBody .= $client->search(); |
292 | 292 | } |
293 | 293 | } |
294 | - catch( \Aimeos\MShop\Exception $e ) |
|
294 | + catch (\Aimeos\MShop\Exception $e) |
|
295 | 295 | { |
296 | - $error = array( 'type-customer-property-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
297 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
298 | - $this->logException( $e ); |
|
296 | + $error = array('type-customer-property-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
297 | + $view->errors = $view->get('errors', []) + $error; |
|
298 | + $this->logException($e); |
|
299 | 299 | } |
300 | - catch( \Exception $e ) |
|
300 | + catch (\Exception $e) |
|
301 | 301 | { |
302 | - $error = array( 'type-customer-property-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
303 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
304 | - $this->logException( $e ); |
|
302 | + $error = array('type-customer-property-item' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
303 | + $view->errors = $view->get('errors', []) + $error; |
|
304 | + $this->logException($e); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | /** admin/jqadm/type/customer/property/template-list |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | $tplconf = 'admin/jqadm/type/customer/property/template-list'; |
327 | 327 | $default = 'type/customer/property/list-standard'; |
328 | 328 | |
329 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
329 | + return $view->render($view->config($tplconf, $default)); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | * @param string|null $name Name of the sub-client (Default if null) |
338 | 338 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
339 | 339 | */ |
340 | - public function getSubClient( $propertytype, $name = null ) |
|
340 | + public function getSubClient($propertytype, $name = null) |
|
341 | 341 | { |
342 | 342 | /** admin/jqadm/type/customer/property/decorators/excludes |
343 | 343 | * Excludes decorators added by the "common" option from the list type JQAdm client |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * @see admin/jqadm/type/customer/property/decorators/excludes |
413 | 413 | * @see admin/jqadm/type/customer/property/decorators/global |
414 | 414 | */ |
415 | - return $this->createSubClient( 'type/customer/property' . $propertytype, $name ); |
|
415 | + return $this->createSubClient('type/customer/property' . $propertytype, $name); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | * @since 2018.01 |
457 | 457 | * @category Developer |
458 | 458 | */ |
459 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/type/customer/property/standard/subparts', [] ); |
|
459 | + return $this->getContext()->getConfig()->get('admin/jqadm/type/customer/property/standard/subparts', []); |
|
460 | 460 | } |
461 | 461 | |
462 | 462 | |
@@ -467,17 +467,17 @@ discard block |
||
467 | 467 | * @param string[] Data array |
468 | 468 | * @return \Aimeos\MShop\Common\Item\Type\Iface New list type item object |
469 | 469 | */ |
470 | - protected function fromArray( array $data ) |
|
470 | + protected function fromArray(array $data) |
|
471 | 471 | { |
472 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/property/type' ); |
|
472 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/property/type'); |
|
473 | 473 | |
474 | - if( isset( $data['customer.property.type.id'] ) && $data['customer.property.type.id'] != '' ) { |
|
475 | - $item = $manager->getItem( $data['customer.property.type.id'] ); |
|
474 | + if (isset($data['customer.property.type.id']) && $data['customer.property.type.id'] != '') { |
|
475 | + $item = $manager->getItem($data['customer.property.type.id']); |
|
476 | 476 | } else { |
477 | 477 | $item = $manager->createItem(); |
478 | 478 | } |
479 | 479 | |
480 | - $item->fromArray( $data ); |
|
480 | + $item->fromArray($data); |
|
481 | 481 | |
482 | 482 | return $item; |
483 | 483 | } |
@@ -489,11 +489,11 @@ discard block |
||
489 | 489 | * @param \Aimeos\MShop\Common\Item\Type\Iface $item Type item object |
490 | 490 | * @return string[] Multi-dimensional associative list of item data |
491 | 491 | */ |
492 | - protected function toArray( \Aimeos\MShop\Common\Item\Type\Iface $item, $copy = false ) |
|
492 | + protected function toArray(\Aimeos\MShop\Common\Item\Type\Iface $item, $copy = false) |
|
493 | 493 | { |
494 | - $data = $item->toArray( true ); |
|
494 | + $data = $item->toArray(true); |
|
495 | 495 | |
496 | - if( $copy === true ) |
|
496 | + if ($copy === true) |
|
497 | 497 | { |
498 | 498 | $data['customer.property.type.code'] = $data['customer.property.type.code'] . '_copy'; |
499 | 499 | $data['customer.property.type.id'] = ''; |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
510 | 510 | * @return string HTML output |
511 | 511 | */ |
512 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
512 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
513 | 513 | { |
514 | 514 | /** admin/jqadm/type/customer/property/template-item |
515 | 515 | * Relative path to the HTML body template for the list type item. |
@@ -533,6 +533,6 @@ discard block |
||
533 | 533 | $tplconf = 'admin/jqadm/type/customer/property/template-item'; |
534 | 534 | $default = 'type/customer/property/item-standard'; |
535 | 535 | |
536 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
536 | + return $view->render($view->config($tplconf, $default)); |
|
537 | 537 | } |
538 | 538 | } |
@@ -17,42 +17,42 @@ |
||
17 | 17 | protected function setUp() |
18 | 18 | { |
19 | 19 | $this->context = \TestHelperJqadm::getContext(); |
20 | - $this->context->setView( \TestHelperJqadm::getView() ); |
|
20 | + $this->context->setView(\TestHelperJqadm::getView()); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
24 | 24 | public function testCreateClient() |
25 | 25 | { |
26 | - $client = \Aimeos\Admin\JQAdm\Type\Customer\Property\Factory::createClient( $this->context ); |
|
27 | - $this->assertInstanceOf( '\\Aimeos\\Admin\\JQAdm\\Iface', $client ); |
|
26 | + $client = \Aimeos\Admin\JQAdm\Type\Customer\Property\Factory::createClient($this->context); |
|
27 | + $this->assertInstanceOf('\\Aimeos\\Admin\\JQAdm\\Iface', $client); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
31 | 31 | public function testCreateClientName() |
32 | 32 | { |
33 | - $client = \Aimeos\Admin\JQAdm\Type\Customer\Property\Factory::createClient( $this->context, 'Standard' ); |
|
34 | - $this->assertInstanceOf( '\\Aimeos\\Admin\\JQAdm\\Iface', $client ); |
|
33 | + $client = \Aimeos\Admin\JQAdm\Type\Customer\Property\Factory::createClient($this->context, 'Standard'); |
|
34 | + $this->assertInstanceOf('\\Aimeos\\Admin\\JQAdm\\Iface', $client); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
38 | 38 | public function testCreateClientNameEmpty() |
39 | 39 | { |
40 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
41 | - \Aimeos\Admin\JQAdm\Type\Customer\Property\Factory::createClient( $this->context, '' ); |
|
40 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
41 | + \Aimeos\Admin\JQAdm\Type\Customer\Property\Factory::createClient($this->context, ''); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | |
45 | 45 | public function testCreateClientNameInvalid() |
46 | 46 | { |
47 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
48 | - \Aimeos\Admin\JQAdm\Type\Customer\Property\Factory::createClient( $this->context, '%type/customer/property' ); |
|
47 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
48 | + \Aimeos\Admin\JQAdm\Type\Customer\Property\Factory::createClient($this->context, '%type/customer/property'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
52 | 52 | public function testCreateClientNameNotFound() |
53 | 53 | { |
54 | - $this->setExpectedException( '\\Aimeos\\Admin\\JQAdm\\Exception' ); |
|
55 | - \Aimeos\Admin\JQAdm\Type\Customer\Property\Factory::createClient( $this->context, 'test' ); |
|
54 | + $this->setExpectedException('\\Aimeos\\Admin\\JQAdm\\Exception'); |
|
55 | + \Aimeos\Admin\JQAdm\Type\Customer\Property\Factory::createClient($this->context, 'test'); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | } |
@@ -138,14 +138,12 @@ |
||
138 | 138 | } |
139 | 139 | |
140 | 140 | return; |
141 | - } |
|
142 | - catch( \Aimeos\MShop\Exception $e ) |
|
141 | + } catch( \Aimeos\MShop\Exception $e ) |
|
143 | 142 | { |
144 | 143 | $error = array( 'attribute-item-image' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
145 | 144 | $view->errors = $view->get( 'errors', [] ) + $error; |
146 | 145 | $this->logException( $e ); |
147 | - } |
|
148 | - catch( \Exception $e ) |
|
146 | + } catch( \Exception $e ) |
|
149 | 147 | { |
150 | 148 | $error = array( 'attribute-item-image' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
151 | 149 | $view->errors = $view->get( 'errors', [] ) + $error; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | namespace Aimeos\Admin\JQAdm\Attribute\Image; |
12 | 12 | |
13 | -sprintf( 'image' ); // for translation |
|
13 | +sprintf('image'); // 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->imageData = $this->toArray( $view->item, true ); |
|
47 | + $view->imageData = $this->toArray($view->item, true); |
|
48 | 48 | $view->imageBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->imageBody .= $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( 'image', [] ) ); |
|
68 | + $itemData = $this->toArray($view->item); |
|
69 | + $data = array_replace_recursive($itemData, $view->param('image', [])); |
|
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->imageData = $data; |
80 | 80 | $view->imageBody = ''; |
81 | 81 | |
82 | - foreach( $this->getSubClients() as $client ) { |
|
82 | + foreach ($this->getSubClients() as $client) { |
|
83 | 83 | $view->imageBody .= $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::createController( $this->getContext() ); |
|
98 | + $cntl = \Aimeos\Controller\Common\Media\Factory::createController($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->imageData = $this->toArray( $view->item ); |
|
120 | + $view->imageData = $this->toArray($view->item); |
|
121 | 121 | $view->imageBody = ''; |
122 | 122 | |
123 | - foreach( $this->getSubClients() as $client ) { |
|
123 | + foreach ($this->getSubClients() as $client) { |
|
124 | 124 | $view->imageBody .= $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( 'image', [] ) ); |
|
140 | + $view->item = $this->fromArray($view->item, $view->param('image', [])); |
|
141 | 141 | $view->imageBody = ''; |
142 | 142 | |
143 | - foreach( $this->getSubClients() as $client ) { |
|
143 | + foreach ($this->getSubClients() as $client) { |
|
144 | 144 | $view->imageBody .= $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( 'attribute-item-image' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
152 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
153 | - $this->logException( $e ); |
|
151 | + $error = array('attribute-item-image' => $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( 'attribute-item-image' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
158 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
159 | - $this->logException( $e ); |
|
157 | + $error = array('attribute-item-image' => $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/attribute/image/decorators/excludes |
176 | 176 | * Excludes decorators added by the "common" option from the attribute JQAdm client |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @see admin/jqadm/attribute/image/decorators/excludes |
246 | 246 | * @see admin/jqadm/attribute/image/decorators/global |
247 | 247 | */ |
248 | - return $this->createSubClient( 'attribute/image/' . $type, $name ); |
|
248 | + return $this->createSubClient('attribute/image/' . $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\Factory::createManager( $this->getContext(), 'media/type' ); |
|
263 | - $listTypeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute/lists/type' ); |
|
262 | + $typeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'media/type'); |
|
263 | + $listTypeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute/lists/type'); |
|
264 | 264 | |
265 | - $search = $typeManager->createSearch()->setSlice( 0, 0x7fffffff ); |
|
266 | - $search->setConditions( $search->compare( '==', 'media.type.domain', 'attribute' ) ); |
|
267 | - $search->setSortations( array( $search->sort( '+', 'media.type.label' ) ) ); |
|
265 | + $search = $typeManager->createSearch()->setSlice(0, 0x7fffffff); |
|
266 | + $search->setConditions($search->compare('==', 'media.type.domain', 'attribute')); |
|
267 | + $search->setSortations(array($search->sort('+', 'media.type.label'))); |
|
268 | 268 | |
269 | - $listSearch = $listTypeManager->createSearch()->setSlice( 0, 0x7fffffff ); |
|
270 | - $listSearch->setConditions( $listSearch->compare( '==', 'attribute.lists.type.domain', 'media' ) ); |
|
271 | - $listSearch->setSortations( array( $listSearch->sort( '+', 'attribute.lists.type.label' ) ) ); |
|
269 | + $listSearch = $listTypeManager->createSearch()->setSlice(0, 0x7fffffff); |
|
270 | + $listSearch->setConditions($listSearch->compare('==', 'attribute.lists.type.domain', 'media')); |
|
271 | + $listSearch->setSortations(array($listSearch->sort('+', 'attribute.lists.type.label'))); |
|
272 | 272 | |
273 | - $view->imageListTypes = $this->sortType( $listTypeManager->searchItems( $listSearch ) ); |
|
274 | - $view->imageTypes = $typeManager->searchItems( $search ); |
|
273 | + $view->imageListTypes = $this->sortType($listTypeManager->searchItems($listSearch)); |
|
274 | + $view->imageTypes = $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\Attribute\Item\Iface Modified attribute item |
286 | 286 | */ |
287 | - protected function deleteMediaItems( \Aimeos\MShop\Attribute\Item\Iface $item, array $listItems ) |
|
287 | + protected function deleteMediaItems(\Aimeos\MShop\Attribute\Item\Iface $item, array $listItems) |
|
288 | 288 | { |
289 | 289 | $context = $this->getContext(); |
290 | - $cntl = \Aimeos\Controller\Common\Media\Factory::createController( $context ); |
|
291 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'attribute' ); |
|
290 | + $cntl = \Aimeos\Controller\Common\Media\Factory::createController($context); |
|
291 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'attribute'); |
|
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( '==', 'attribute.lists.domain', 'media' ), |
|
298 | - $search->compare( '==', 'attribute.lists.type', $listItem->getType() ), |
|
299 | - $search->compare( '==', 'attribute.lists.refid', $listItem->getRefId() ), |
|
297 | + $search->compare('==', 'attribute.lists.domain', 'media'), |
|
298 | + $search->compare('==', 'attribute.lists.type', $listItem->getType()), |
|
299 | + $search->compare('==', 'attribute.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/attribute/image/standard/subparts', [] ); |
|
356 | + return $this->getContext()->getConfig()->get('admin/jqadm/attribute/image/standard/subparts', []); |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | |
@@ -363,54 +363,54 @@ discard block |
||
363 | 363 | * @param \Aimeos\MShop\Attribute\Item\Iface $item Attribute item object without referenced domain items |
364 | 364 | * @param string[] $data Data array |
365 | 365 | */ |
366 | - protected function fromArray( \Aimeos\MShop\Attribute\Item\Iface $item, array $data ) |
|
366 | + protected function fromArray(\Aimeos\MShop\Attribute\Item\Iface $item, array $data) |
|
367 | 367 | { |
368 | 368 | $context = $this->getContext(); |
369 | 369 | |
370 | - $mediaManager = \Aimeos\MShop\Factory::createManager( $context, 'media' ); |
|
371 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'attribute/lists' ); |
|
372 | - $cntl = \Aimeos\Controller\Common\Media\Factory::createController( $context ); |
|
370 | + $mediaManager = \Aimeos\MShop\Factory::createManager($context, 'media'); |
|
371 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'attribute/lists'); |
|
372 | + $cntl = \Aimeos\Controller\Common\Media\Factory::createController($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['attribute.lists.type'], $entry['media.id'], false ) ) === null ) { |
|
379 | + if (($listItem = $item->getListItem('media', $entry['attribute.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, 'image/' . $idx . '/file' ) ) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE ) |
|
389 | + if (($file = $this->getValue($files, 'image/' . $idx . '/file')) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE) |
|
390 | 390 | { |
391 | - $refItem->getId() ?: $refItem->setUrl( '' )->setPreview( '' ); // keep copied image |
|
392 | - $cntl->add( $refItem, $file ); |
|
391 | + $refItem->getId() ?: $refItem->setUrl('')->setPreview(''); // keep copied image |
|
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\Attribute\Item\Iface $item, $copy = false ) |
|
424 | + protected function toArray(\Aimeos\MShop\Attribute\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['attribute.lists.siteid'] = $siteId; |
440 | 440 | $list['attribute.lists.id'] = ''; |
@@ -442,10 +442,10 @@ discard block |
||
442 | 442 | $list['media.id'] = null; |
443 | 443 | } |
444 | 444 | |
445 | - $list['attribute.lists.datestart'] = str_replace( ' ', 'T', $list['attribute.lists.datestart'] ); |
|
446 | - $list['attribute.lists.dateend'] = str_replace( ' ', 'T', $list['attribute.lists.dateend'] ); |
|
445 | + $list['attribute.lists.datestart'] = str_replace(' ', 'T', $list['attribute.lists.datestart']); |
|
446 | + $list['attribute.lists.dateend'] = str_replace(' ', 'T', $list['attribute.lists.dateend']); |
|
447 | 447 | |
448 | - foreach( $list['attribute.lists.config'] as $key => $val ) |
|
448 | + foreach ($list['attribute.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/attribute/image/template-item |
470 | 470 | * Relative path to the HTML body template of the image subpart for attributes. |
@@ -488,6 +488,6 @@ discard block |
||
488 | 488 | $tplconf = 'admin/jqadm/attribute/image/template-item'; |
489 | 489 | $default = 'attribute/item-image-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-image' => $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-image' => $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\Service\Image; |
12 | 12 | |
13 | -sprintf( 'image' ); // for translation |
|
13 | +sprintf('image'); // 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->imageData = $this->toArray( $view->item, true ); |
|
47 | + $view->imageData = $this->toArray($view->item, true); |
|
48 | 48 | $view->imageBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->imageBody .= $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( 'image', [] ) ); |
|
68 | + $itemData = $this->toArray($view->item); |
|
69 | + $data = array_replace_recursive($itemData, $view->param('image', [])); |
|
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->imageData = $data; |
80 | 80 | $view->imageBody = ''; |
81 | 81 | |
82 | - foreach( $this->getSubClients() as $client ) { |
|
82 | + foreach ($this->getSubClients() as $client) { |
|
83 | 83 | $view->imageBody .= $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::createController( $this->getContext() ); |
|
98 | + $cntl = \Aimeos\Controller\Common\Media\Factory::createController($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->imageData = $this->toArray( $view->item ); |
|
120 | + $view->imageData = $this->toArray($view->item); |
|
121 | 121 | $view->imageBody = ''; |
122 | 122 | |
123 | - foreach( $this->getSubClients() as $client ) { |
|
123 | + foreach ($this->getSubClients() as $client) { |
|
124 | 124 | $view->imageBody .= $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( 'image', [] ) ); |
|
140 | + $view->item = $this->fromArray($view->item, $view->param('image', [])); |
|
141 | 141 | $view->imageBody = ''; |
142 | 142 | |
143 | - foreach( $this->getSubClients() as $client ) { |
|
143 | + foreach ($this->getSubClients() as $client) { |
|
144 | 144 | $view->imageBody .= $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-image' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
152 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
153 | - $this->logException( $e ); |
|
151 | + $error = array('service-item-image' => $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-image' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
158 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
159 | - $this->logException( $e ); |
|
157 | + $error = array('service-item-image' => $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/image/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/image/decorators/excludes |
246 | 246 | * @see admin/jqadm/service/image/decorators/global |
247 | 247 | */ |
248 | - return $this->createSubClient( 'service/image/' . $type, $name ); |
|
248 | + return $this->createSubClient('service/image/' . $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\Factory::createManager( $this->getContext(), 'media/type' ); |
|
263 | - $listTypeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service/lists/type' ); |
|
262 | + $typeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'media/type'); |
|
263 | + $listTypeManager = \Aimeos\MShop\Factory::createManager($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->imageListTypes = $this->sortType( $listTypeManager->searchItems( $listSearch ) ); |
|
274 | - $view->imageTypes = $typeManager->searchItems( $search ); |
|
273 | + $view->imageListTypes = $this->sortType($listTypeManager->searchItems($listSearch)); |
|
274 | + $view->imageTypes = $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::createController( $context ); |
|
291 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
290 | + $cntl = \Aimeos\Controller\Common\Media\Factory::createController($context); |
|
291 | + $manager = \Aimeos\MShop\Factory::createManager($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/image/standard/subparts', [] ); |
|
356 | + return $this->getContext()->getConfig()->get('admin/jqadm/service/image/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\Factory::createManager( $context, 'media' ); |
|
371 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'service/lists' ); |
|
372 | - $cntl = \Aimeos\Controller\Common\Media\Factory::createController( $context ); |
|
370 | + $mediaManager = \Aimeos\MShop\Factory::createManager($context, 'media'); |
|
371 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'service/lists'); |
|
372 | + $cntl = \Aimeos\Controller\Common\Media\Factory::createController($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, 'image/' . $idx . '/file' ) ) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE ) |
|
389 | + if (($file = $this->getValue($files, 'image/' . $idx . '/file')) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE) |
|
390 | 390 | { |
391 | - $refItem->getId() ?: $refItem->setUrl( '' )->setPreview( '' ); // keep copied image |
|
392 | - $cntl->add( $refItem, $file ); |
|
391 | + $refItem->getId() ?: $refItem->setUrl('')->setPreview(''); // keep copied image |
|
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/image/template-item |
470 | 470 | * Relative path to the HTML body template of the image subpart for services. |
@@ -488,6 +488,6 @@ discard block |
||
488 | 488 | $tplconf = 'admin/jqadm/service/image/template-item'; |
489 | 489 | $default = 'service/item-image-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 |
@@ -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\Image\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->imageData = $this->toArray( $view->item, $view->get( 'imageData', [] ), true ); |
|
47 | + $view->imageData = $this->toArray($view->item, $view->get('imageData', []), 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( 'imageData', [] ); |
|
67 | + $data = $view->get('imageData', []); |
|
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->imageData = $this->toArray( $view->item, $view->get( 'imageData', [] ) ); |
|
96 | + $view->imageData = $this->toArray($view->item, $view->get('imageData', [])); |
|
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( 'image', [] ) ); |
|
114 | + $view->item = $this->fromArray($view->item, $view->param('image', [])); |
|
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/image/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/image/property/decorators/excludes |
203 | 203 | * @see admin/jqadm/service/image/property/decorators/global |
204 | 204 | */ |
205 | - return $this->createSubClient( 'service/image/property/' . $type, $name ); |
|
205 | + return $this->createSubClient('service/image/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\Factory::createManager( $this->getContext(), 'media/property/type' ); |
|
217 | + $manager = \Aimeos\MShop\Factory::createManager($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/image/property/standard/subparts', [] ); |
|
269 | + return $this->getContext()->getConfig()->get('admin/jqadm/service/image/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\Factory::createManager( $this->getContext(), 'media/property' ); |
|
281 | + $propManager = \Aimeos\MShop\Factory::createManager($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/image/property/template-item |
356 | 356 | * Relative path to the HTML body template of the image subpart for services. |
@@ -374,6 +374,6 @@ discard block |
||
374 | 374 | $tplconf = 'admin/jqadm/service/image/property/template-item'; |
375 | 375 | $default = 'service/item-image-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 |
@@ -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( 'product-item-image' => $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( 'product-item-image' => $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\Product\Image; |
12 | 12 | |
13 | -sprintf( 'image' ); // for translation |
|
13 | +sprintf('image'); // 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->imageData = $this->toArray( $view->item, true ); |
|
47 | + $view->imageData = $this->toArray($view->item, true); |
|
48 | 48 | $view->imageBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->imageBody .= $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( 'image', [] ) ); |
|
68 | + $itemData = $this->toArray($view->item); |
|
69 | + $data = array_replace_recursive($itemData, $view->param('image', [])); |
|
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->imageData = $data; |
80 | 80 | $view->imageBody = ''; |
81 | 81 | |
82 | - foreach( $this->getSubClients() as $client ) { |
|
82 | + foreach ($this->getSubClients() as $client) { |
|
83 | 83 | $view->imageBody .= $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::createController( $this->getContext() ); |
|
98 | + $cntl = \Aimeos\Controller\Common\Media\Factory::createController($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->imageData = $this->toArray( $view->item ); |
|
120 | + $view->imageData = $this->toArray($view->item); |
|
121 | 121 | $view->imageBody = ''; |
122 | 122 | |
123 | - foreach( $this->getSubClients() as $client ) { |
|
123 | + foreach ($this->getSubClients() as $client) { |
|
124 | 124 | $view->imageBody .= $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( 'image', [] ) ); |
|
140 | + $view->item = $this->fromArray($view->item, $view->param('image', [])); |
|
141 | 141 | $view->imageBody = ''; |
142 | 142 | |
143 | - foreach( $this->getSubClients() as $client ) { |
|
143 | + foreach ($this->getSubClients() as $client) { |
|
144 | 144 | $view->imageBody .= $client->save(); |
145 | 145 | } |
146 | 146 | |
147 | 147 | return; |
148 | 148 | } |
149 | - catch( \Aimeos\MShop\Exception $e ) |
|
149 | + catch (\Aimeos\MShop\Exception $e) |
|
150 | 150 | { |
151 | - $error = array( 'product-item-image' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
152 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
153 | - $this->logException( $e ); |
|
151 | + $error = array('product-item-image' => $this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
152 | + $view->errors = $view->get('errors', []) + $error; |
|
153 | + $this->logException($e); |
|
154 | 154 | } |
155 | - catch( \Exception $e ) |
|
155 | + catch (\Exception $e) |
|
156 | 156 | { |
157 | - $error = array( 'product-item-image' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
158 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
159 | - $this->logException( $e ); |
|
157 | + $error = array('product-item-image' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine()); |
|
158 | + $view->errors = $view->get('errors', []) + $error; |
|
159 | + $this->logException($e); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | throw new \Aimeos\Admin\JQAdm\Exception(); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @param string|null $name Name of the sub-client (Default if null) |
171 | 171 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
172 | 172 | */ |
173 | - public function getSubClient( $type, $name = null ) |
|
173 | + public function getSubClient($type, $name = null) |
|
174 | 174 | { |
175 | 175 | /** admin/jqadm/product/image/decorators/excludes |
176 | 176 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @see admin/jqadm/product/image/decorators/excludes |
246 | 246 | * @see admin/jqadm/product/image/decorators/global |
247 | 247 | */ |
248 | - return $this->createSubClient( 'product/image/' . $type, $name ); |
|
248 | + return $this->createSubClient('product/image/' . $type, $name); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | |
@@ -257,24 +257,24 @@ discard block |
||
257 | 257 | * @param \Aimeos\MShop\Common\Item\Lists\Iface[] $attrListItems Product list items referencing variant attributes |
258 | 258 | * @return \Aimeos\MShop\Media\Item\Iface Modified media item |
259 | 259 | */ |
260 | - protected function addMediaAttributes( \Aimeos\MShop\Media\Item\Iface $mediaItem, array $attrListItems ) |
|
260 | + protected function addMediaAttributes(\Aimeos\MShop\Media\Item\Iface $mediaItem, array $attrListItems) |
|
261 | 261 | { |
262 | - $listManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'media/lists' ); |
|
263 | - $listItems = $mediaItem->getListItems( 'attribute', 'variant', null, false ); |
|
262 | + $listManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'media/lists'); |
|
263 | + $listItems = $mediaItem->getListItems('attribute', 'variant', null, false); |
|
264 | 264 | |
265 | - foreach( $attrListItems as $listItem ) |
|
265 | + foreach ($attrListItems as $listItem) |
|
266 | 266 | { |
267 | - if( ( $litem = $mediaItem->getListItem( 'attribute', 'variant', $listItem->getRefId(), false ) ) !== null ) |
|
267 | + if (($litem = $mediaItem->getListItem('attribute', 'variant', $listItem->getRefId(), false)) !== null) |
|
268 | 268 | { |
269 | - unset( $listItems[$litem->getId()] ); |
|
269 | + unset($listItems[$litem->getId()]); |
|
270 | 270 | continue; |
271 | 271 | } |
272 | 272 | |
273 | - $litem = $listManager->createItem()->setType( 'variant' )->setRefId( $listItem->getRefId() ); |
|
274 | - $mediaItem->addListItem( 'attribute', $litem ); |
|
273 | + $litem = $listManager->createItem()->setType('variant')->setRefId($listItem->getRefId()); |
|
274 | + $mediaItem->addListItem('attribute', $litem); |
|
275 | 275 | } |
276 | 276 | |
277 | - return $mediaItem->deleteListItems( $listItems ); |
|
277 | + return $mediaItem->deleteListItems($listItems); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | |
@@ -284,23 +284,23 @@ discard block |
||
284 | 284 | * @param \Aimeos\MW\View\Iface $view View object |
285 | 285 | * @return \Aimeos\MW\View\Iface View object with assigned parameters |
286 | 286 | */ |
287 | - protected function addViewData( \Aimeos\MW\View\Iface $view ) |
|
287 | + protected function addViewData(\Aimeos\MW\View\Iface $view) |
|
288 | 288 | { |
289 | 289 | $context = $this->getContext(); |
290 | 290 | |
291 | - $typeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'media/type' ); |
|
292 | - $listTypeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/lists/type' ); |
|
291 | + $typeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'media/type'); |
|
292 | + $listTypeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/lists/type'); |
|
293 | 293 | |
294 | - $search = $typeManager->createSearch()->setSlice( 0, 0x7fffffff ); |
|
295 | - $search->setConditions( $search->compare( '==', 'media.type.domain', 'product' ) ); |
|
296 | - $search->setSortations( array( $search->sort( '+', 'media.type.label' ) ) ); |
|
294 | + $search = $typeManager->createSearch()->setSlice(0, 0x7fffffff); |
|
295 | + $search->setConditions($search->compare('==', 'media.type.domain', 'product')); |
|
296 | + $search->setSortations(array($search->sort('+', 'media.type.label'))); |
|
297 | 297 | |
298 | - $listSearch = $listTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff ); |
|
299 | - $listSearch->setConditions( $listSearch->compare( '==', 'product.lists.type.domain', 'media' ) ); |
|
300 | - $listSearch->setSortations( array( $listSearch->sort( '+', 'product.lists.type.label' ) ) ); |
|
298 | + $listSearch = $listTypeManager->createSearch(true)->setSlice(0, 0x7fffffff); |
|
299 | + $listSearch->setConditions($listSearch->compare('==', 'product.lists.type.domain', 'media')); |
|
300 | + $listSearch->setSortations(array($listSearch->sort('+', 'product.lists.type.label'))); |
|
301 | 301 | |
302 | - $view->imageListTypes = $this->sortType( $listTypeManager->searchItems( $listSearch ) ); |
|
303 | - $view->imageTypes = $typeManager->searchItems( $search ); |
|
302 | + $view->imageListTypes = $this->sortType($listTypeManager->searchItems($listSearch)); |
|
303 | + $view->imageTypes = $typeManager->searchItems($search); |
|
304 | 304 | |
305 | 305 | return $view; |
306 | 306 | } |
@@ -313,25 +313,25 @@ discard block |
||
313 | 313 | * @param array $listItems Media list items to be removed |
314 | 314 | * @return \Aimeos\MShop\Product\Item\Iface Modified product item |
315 | 315 | */ |
316 | - protected function deleteMediaItems( \Aimeos\MShop\Product\Item\Iface $item, array $listItems ) |
|
316 | + protected function deleteMediaItems(\Aimeos\MShop\Product\Item\Iface $item, array $listItems) |
|
317 | 317 | { |
318 | 318 | $context = $this->getContext(); |
319 | - $cntl = \Aimeos\Controller\Common\Media\Factory::createController( $context ); |
|
320 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
319 | + $cntl = \Aimeos\Controller\Common\Media\Factory::createController($context); |
|
320 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
321 | 321 | $search = $manager->createSearch(); |
322 | 322 | |
323 | - foreach( $listItems as $listItem ) |
|
323 | + foreach ($listItems as $listItem) |
|
324 | 324 | { |
325 | - $func = $search->createFunction( 'product:has', ['media', $listItem->getType(), $listItem->getRefId()] ); |
|
326 | - $search->setConditions( $search->compare( '!=', $func, null ) ); |
|
327 | - $items = $manager->searchItems( $search ); |
|
325 | + $func = $search->createFunction('product:has', ['media', $listItem->getType(), $listItem->getRefId()]); |
|
326 | + $search->setConditions($search->compare('!=', $func, null)); |
|
327 | + $items = $manager->searchItems($search); |
|
328 | 328 | $refItem = null; |
329 | 329 | |
330 | - if( count( $items ) === 1 && ( $refItem = $listItem->getRefItem() ) !== null ) { |
|
331 | - $cntl->delete( $refItem ); |
|
330 | + if (count($items) === 1 && ($refItem = $listItem->getRefItem()) !== null) { |
|
331 | + $cntl->delete($refItem); |
|
332 | 332 | } |
333 | 333 | |
334 | - $item->deleteListItem( 'media', $listItem, $refItem ); |
|
334 | + $item->deleteListItem('media', $listItem, $refItem); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | return $item; |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | * @since 2017.07 |
379 | 379 | * @category Developer |
380 | 380 | */ |
381 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/product/image/standard/subparts', [] ); |
|
381 | + return $this->getContext()->getConfig()->get('admin/jqadm/product/image/standard/subparts', []); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | |
@@ -388,58 +388,58 @@ discard block |
||
388 | 388 | * @param \Aimeos\MShop\Product\Item\Iface $item Product item object without referenced domain items |
389 | 389 | * @param string[] $data Data array |
390 | 390 | */ |
391 | - protected function fromArray( \Aimeos\MShop\Product\Item\Iface $item, array $data ) |
|
391 | + protected function fromArray(\Aimeos\MShop\Product\Item\Iface $item, array $data) |
|
392 | 392 | { |
393 | 393 | $context = $this->getContext(); |
394 | 394 | |
395 | - $mediaManager = \Aimeos\MShop\Factory::createManager( $context, 'media' ); |
|
396 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
397 | - $cntl = \Aimeos\Controller\Common\Media\Factory::createController( $context ); |
|
395 | + $mediaManager = \Aimeos\MShop\Factory::createManager($context, 'media'); |
|
396 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
397 | + $cntl = \Aimeos\Controller\Common\Media\Factory::createController($context); |
|
398 | 398 | |
399 | - $listItems = $item->getListItems( 'media', null, null, false ); |
|
399 | + $listItems = $item->getListItems('media', null, null, false); |
|
400 | 400 | $files = (array) $this->getView()->request()->getUploadedFiles(); |
401 | 401 | |
402 | - foreach( $data as $idx => $entry ) |
|
402 | + foreach ($data as $idx => $entry) |
|
403 | 403 | { |
404 | 404 | $listType = $entry['product.lists.type']; |
405 | 405 | |
406 | - if( ( $listItem = $item->getListItem( 'media', $listType, $entry['media.id'], false ) ) === null ) { |
|
406 | + if (($listItem = $item->getListItem('media', $listType, $entry['media.id'], false)) === null) { |
|
407 | 407 | $listItem = $listManager->createItem(); |
408 | 408 | } |
409 | 409 | |
410 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
410 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
411 | 411 | $refItem = $mediaManager->createItem(); |
412 | 412 | } |
413 | 413 | |
414 | - $refItem->fromArray( $entry ); |
|
414 | + $refItem->fromArray($entry); |
|
415 | 415 | |
416 | - if( ( $file = $this->getValue( $files, 'image/' . $idx . '/file' ) ) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE ) |
|
416 | + if (($file = $this->getValue($files, 'image/' . $idx . '/file')) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE) |
|
417 | 417 | { |
418 | - $refItem->getId() ?: $refItem->setUrl( '' )->setPreview( '' ); // keep copied image |
|
419 | - $cntl->add( $refItem, $file ); |
|
418 | + $refItem->getId() ?: $refItem->setUrl('')->setPreview(''); // keep copied image |
|
419 | + $cntl->add($refItem, $file); |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | $conf = []; |
423 | 423 | |
424 | - foreach( (array) $this->getValue( $entry, 'config/key' ) as $num => $key ) |
|
424 | + foreach ((array) $this->getValue($entry, 'config/key') as $num => $key) |
|
425 | 425 | { |
426 | - if( trim( $key ) !== '' && ( $val = $this->getValue( $entry, 'config/val/' . $num ) ) !== null ) { |
|
427 | - $conf[$key] = trim( $val ); |
|
426 | + if (trim($key) !== '' && ($val = $this->getValue($entry, 'config/val/' . $num)) !== null) { |
|
427 | + $conf[$key] = trim($val); |
|
428 | 428 | } |
429 | 429 | } |
430 | 430 | |
431 | - $listItem->fromArray( $entry ); |
|
432 | - $listItem->setPosition( $idx ); |
|
433 | - $listItem->setConfig( $conf ); |
|
431 | + $listItem->fromArray($entry); |
|
432 | + $listItem->setPosition($idx); |
|
433 | + $listItem->setConfig($conf); |
|
434 | 434 | |
435 | - $attrListItems = $item->getListItems( 'attribute', 'variant', null, false ); |
|
436 | - $refItem = $this->addMediaAttributes( $refItem, $attrListItems ); |
|
437 | - $item->addListItem( 'media', $listItem, $refItem ); |
|
435 | + $attrListItems = $item->getListItems('attribute', 'variant', null, false); |
|
436 | + $refItem = $this->addMediaAttributes($refItem, $attrListItems); |
|
437 | + $item->addListItem('media', $listItem, $refItem); |
|
438 | 438 | |
439 | - unset( $listItems[$listItem->getId()] ); |
|
439 | + unset($listItems[$listItem->getId()]); |
|
440 | 440 | } |
441 | 441 | |
442 | - return $this->deleteMediaItems( $item, $listItems ); |
|
442 | + return $this->deleteMediaItems($item, $listItems); |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | |
@@ -450,20 +450,20 @@ discard block |
||
450 | 450 | * @param boolean $copy True if items should be copied, false if not |
451 | 451 | * @return string[] Multi-dimensional associative list of item data |
452 | 452 | */ |
453 | - protected function toArray( \Aimeos\MShop\Product\Item\Iface $item, $copy = false ) |
|
453 | + protected function toArray(\Aimeos\MShop\Product\Item\Iface $item, $copy = false) |
|
454 | 454 | { |
455 | 455 | $data = []; |
456 | 456 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
457 | 457 | |
458 | - foreach( $item->getListItems( 'media', null, null, false ) as $listItem ) |
|
458 | + foreach ($item->getListItems('media', null, null, false) as $listItem) |
|
459 | 459 | { |
460 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
460 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
461 | 461 | continue; |
462 | 462 | } |
463 | 463 | |
464 | - $list = $listItem->toArray( true ) + $refItem->toArray( true ); |
|
464 | + $list = $listItem->toArray(true) + $refItem->toArray(true); |
|
465 | 465 | |
466 | - if( $copy === true ) |
|
466 | + if ($copy === true) |
|
467 | 467 | { |
468 | 468 | $list['product.lists.siteid'] = $siteId; |
469 | 469 | $list['product.lists.id'] = ''; |
@@ -471,10 +471,10 @@ discard block |
||
471 | 471 | $list['media.id'] = null; |
472 | 472 | } |
473 | 473 | |
474 | - $list['product.lists.datestart'] = str_replace( ' ', 'T', $list['product.lists.datestart'] ); |
|
475 | - $list['product.lists.dateend'] = str_replace( ' ', 'T', $list['product.lists.dateend'] ); |
|
474 | + $list['product.lists.datestart'] = str_replace(' ', 'T', $list['product.lists.datestart']); |
|
475 | + $list['product.lists.dateend'] = str_replace(' ', 'T', $list['product.lists.dateend']); |
|
476 | 476 | |
477 | - foreach( $list['product.lists.config'] as $key => $val ) |
|
477 | + foreach ($list['product.lists.config'] as $key => $val) |
|
478 | 478 | { |
479 | 479 | $list['config']['key'][] = $key; |
480 | 480 | $list['config']['val'][] = $val; |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
494 | 494 | * @return string HTML output |
495 | 495 | */ |
496 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
496 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
497 | 497 | { |
498 | 498 | /** admin/jqadm/product/image/template-item |
499 | 499 | * Relative path to the HTML body template of the image subpart for products. |
@@ -517,6 +517,6 @@ discard block |
||
517 | 517 | $tplconf = 'admin/jqadm/product/image/template-item'; |
518 | 518 | $default = 'product/item-image-standard'; |
519 | 519 | |
520 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
520 | + return $view->render($view->config($tplconf, $default)); |
|
521 | 521 | } |
522 | 522 | } |
523 | 523 | \ No newline at end of file |
@@ -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-image' => $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-image' => $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\Image; |
12 | 12 | |
13 | -sprintf( 'image' ); // for translation |
|
13 | +sprintf('image'); // 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->imageData = $this->toArray( $view->item, true ); |
|
47 | + $view->imageData = $this->toArray($view->item, true); |
|
48 | 48 | $view->imageBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->imageBody .= $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( 'image', [] ) ); |
|
68 | + $itemData = $this->toArray($view->item); |
|
69 | + $data = array_replace_recursive($itemData, $view->param('image', [])); |
|
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->imageData = $data; |
80 | 80 | $view->imageBody = ''; |
81 | 81 | |
82 | - foreach( $this->getSubClients() as $client ) { |
|
82 | + foreach ($this->getSubClients() as $client) { |
|
83 | 83 | $view->imageBody .= $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::createController( $this->getContext() ); |
|
98 | + $cntl = \Aimeos\Controller\Common\Media\Factory::createController($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->imageData = $this->toArray( $view->item ); |
|
120 | + $view->imageData = $this->toArray($view->item); |
|
121 | 121 | $view->imageBody = ''; |
122 | 122 | |
123 | - foreach( $this->getSubClients() as $client ) { |
|
123 | + foreach ($this->getSubClients() as $client) { |
|
124 | 124 | $view->imageBody .= $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( 'image', [] ) ); |
|
140 | + $view->item = $this->fromArray($view->item, $view->param('image', [])); |
|
141 | 141 | $view->imageBody = ''; |
142 | 142 | |
143 | - foreach( $this->getSubClients() as $client ) { |
|
143 | + foreach ($this->getSubClients() as $client) { |
|
144 | 144 | $view->imageBody .= $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-image' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
152 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
153 | - $this->logException( $e ); |
|
151 | + $error = array('supplier-item-image' => $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-image' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
158 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
159 | - $this->logException( $e ); |
|
157 | + $error = array('supplier-item-image' => $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/image/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/image/decorators/excludes |
246 | 246 | * @see admin/jqadm/supplier/image/decorators/global |
247 | 247 | */ |
248 | - return $this->createSubClient( 'supplier/image/' . $type, $name ); |
|
248 | + return $this->createSubClient('supplier/image/' . $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\Factory::createManager( $this->getContext(), 'media/type' ); |
|
263 | - $listTypeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'supplier/lists/type' ); |
|
262 | + $typeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'media/type'); |
|
263 | + $listTypeManager = \Aimeos\MShop\Factory::createManager($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->imageListTypes = $this->sortType( $listTypeManager->searchItems( $listSearch ) ); |
|
274 | - $view->imageTypes = $typeManager->searchItems( $search ); |
|
273 | + $view->imageListTypes = $this->sortType($listTypeManager->searchItems($listSearch)); |
|
274 | + $view->imageTypes = $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::createController( $context ); |
|
291 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'supplier' ); |
|
290 | + $cntl = \Aimeos\Controller\Common\Media\Factory::createController($context); |
|
291 | + $manager = \Aimeos\MShop\Factory::createManager($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/image/standard/subparts', [] ); |
|
356 | + return $this->getContext()->getConfig()->get('admin/jqadm/supplier/image/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\Factory::createManager( $context, 'media' ); |
|
371 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'supplier/lists' ); |
|
372 | - $cntl = \Aimeos\Controller\Common\Media\Factory::createController( $context ); |
|
370 | + $mediaManager = \Aimeos\MShop\Factory::createManager($context, 'media'); |
|
371 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'supplier/lists'); |
|
372 | + $cntl = \Aimeos\Controller\Common\Media\Factory::createController($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, 'image/' . $idx . '/file' ) ) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE ) |
|
389 | + if (($file = $this->getValue($files, 'image/' . $idx . '/file')) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE) |
|
390 | 390 | { |
391 | - $refItem->getId() ?: $refItem->setUrl( '' )->setPreview( '' ); // keep copied image |
|
392 | - $cntl->add( $refItem, $file ); |
|
391 | + $refItem->getId() ?: $refItem->setUrl('')->setPreview(''); // keep copied image |
|
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/image/template-item |
470 | 470 | * Relative path to the HTML body template of the image subpart for suppliers. |
@@ -488,6 +488,6 @@ discard block |
||
488 | 488 | $tplconf = 'admin/jqadm/supplier/image/template-item'; |
489 | 489 | $default = 'supplier/item-image-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( 'catalog-item-image' => $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( 'catalog-item-image' => $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\Catalog\Image; |
12 | 12 | |
13 | -sprintf( 'image' ); // for translation |
|
13 | +sprintf('image'); // 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->imageData = $this->toArray( $view->item, true ); |
|
47 | + $view->imageData = $this->toArray($view->item, true); |
|
48 | 48 | $view->imageBody = ''; |
49 | 49 | |
50 | - foreach( $this->getSubClients() as $client ) { |
|
50 | + foreach ($this->getSubClients() as $client) { |
|
51 | 51 | $view->imageBody .= $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( 'image', [] ) ); |
|
68 | + $itemData = $this->toArray($view->item); |
|
69 | + $data = array_replace_recursive($itemData, $view->param('image', [])); |
|
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->imageData = $data; |
80 | 80 | $view->imageBody = ''; |
81 | 81 | |
82 | - foreach( $this->getSubClients() as $client ) { |
|
82 | + foreach ($this->getSubClients() as $client) { |
|
83 | 83 | $view->imageBody .= $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::createController( $this->getContext() ); |
|
98 | + $cntl = \Aimeos\Controller\Common\Media\Factory::createController($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->imageData = $this->toArray( $view->item ); |
|
120 | + $view->imageData = $this->toArray($view->item); |
|
121 | 121 | $view->imageBody = ''; |
122 | 122 | |
123 | - foreach( $this->getSubClients() as $client ) { |
|
123 | + foreach ($this->getSubClients() as $client) { |
|
124 | 124 | $view->imageBody .= $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( 'image', [] ) ); |
|
140 | + $view->item = $this->fromArray($view->item, $view->param('image', [])); |
|
141 | 141 | $view->imageBody = ''; |
142 | 142 | |
143 | - foreach( $this->getSubClients() as $client ) { |
|
143 | + foreach ($this->getSubClients() as $client) { |
|
144 | 144 | $view->imageBody .= $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( 'catalog-item-image' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
152 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
153 | - $this->logException( $e ); |
|
151 | + $error = array('catalog-item-image' => $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( 'catalog-item-image' => $e->getMessage() . ', ' . $e->getFile() . ':' . $e->getLine() ); |
|
158 | - $view->errors = $view->get( 'errors', [] ) + $error; |
|
159 | - $this->logException( $e ); |
|
157 | + $error = array('catalog-item-image' => $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/catalog/image/decorators/excludes |
176 | 176 | * Excludes decorators added by the "common" option from the catalog JQAdm client |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @see admin/jqadm/catalog/image/decorators/excludes |
246 | 246 | * @see admin/jqadm/catalog/image/decorators/global |
247 | 247 | */ |
248 | - return $this->createSubClient( 'catalog/image/' . $type, $name ); |
|
248 | + return $this->createSubClient('catalog/image/' . $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\Factory::createManager( $this->getContext(), 'media/type' ); |
|
263 | - $listTypeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog/lists/type' ); |
|
262 | + $typeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'media/type'); |
|
263 | + $listTypeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog/lists/type'); |
|
264 | 264 | |
265 | - $search = $typeManager->createSearch()->setSlice( 0, 0x7fffffff ); |
|
266 | - $search->setConditions( $search->compare( '==', 'media.type.domain', 'catalog' ) ); |
|
267 | - $search->setSortations( array( $search->sort( '+', 'media.type.label' ) ) ); |
|
265 | + $search = $typeManager->createSearch()->setSlice(0, 0x7fffffff); |
|
266 | + $search->setConditions($search->compare('==', 'media.type.domain', 'catalog')); |
|
267 | + $search->setSortations(array($search->sort('+', 'media.type.label'))); |
|
268 | 268 | |
269 | - $listSearch = $listTypeManager->createSearch( true )->setSlice( 0, 0x7fffffff ); |
|
270 | - $listSearch->setConditions( $listSearch->compare( '==', 'catalog.lists.type.domain', 'media' ) ); |
|
271 | - $listSearch->setSortations( array( $listSearch->sort( '+', 'catalog.lists.type.label' ) ) ); |
|
269 | + $listSearch = $listTypeManager->createSearch(true)->setSlice(0, 0x7fffffff); |
|
270 | + $listSearch->setConditions($listSearch->compare('==', 'catalog.lists.type.domain', 'media')); |
|
271 | + $listSearch->setSortations(array($listSearch->sort('+', 'catalog.lists.type.label'))); |
|
272 | 272 | |
273 | - $view->imageListTypes = $this->sortType( $listTypeManager->searchItems( $listSearch ) ); |
|
274 | - $view->imageTypes = $typeManager->searchItems( $search ); |
|
273 | + $view->imageListTypes = $this->sortType($listTypeManager->searchItems($listSearch)); |
|
274 | + $view->imageTypes = $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\Catalog\Item\Iface Modified catalog item |
286 | 286 | */ |
287 | - protected function deleteMediaItems( \Aimeos\MShop\Catalog\Item\Iface $item, array $listItems ) |
|
287 | + protected function deleteMediaItems(\Aimeos\MShop\Catalog\Item\Iface $item, array $listItems) |
|
288 | 288 | { |
289 | 289 | $context = $this->getContext(); |
290 | - $cntl = \Aimeos\Controller\Common\Media\Factory::createController( $context ); |
|
291 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'catalog' ); |
|
290 | + $cntl = \Aimeos\Controller\Common\Media\Factory::createController($context); |
|
291 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'catalog'); |
|
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( '==', 'catalog.lists.domain', 'media' ), |
|
298 | - $search->compare( '==', 'catalog.lists.type', $listItem->getType() ), |
|
299 | - $search->compare( '==', 'catalog.lists.refid', $listItem->getRefId() ), |
|
297 | + $search->compare('==', 'catalog.lists.domain', 'media'), |
|
298 | + $search->compare('==', 'catalog.lists.type', $listItem->getType()), |
|
299 | + $search->compare('==', 'catalog.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/catalog/image/standard/subparts', [] ); |
|
356 | + return $this->getContext()->getConfig()->get('admin/jqadm/catalog/image/standard/subparts', []); |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | |
@@ -363,54 +363,54 @@ discard block |
||
363 | 363 | * @param \Aimeos\MShop\Catalog\Item\Iface $item Catalog item object without referenced domain items |
364 | 364 | * @param string[] $data Data array |
365 | 365 | */ |
366 | - protected function fromArray( \Aimeos\MShop\Catalog\Item\Iface $item, array $data ) |
|
366 | + protected function fromArray(\Aimeos\MShop\Catalog\Item\Iface $item, array $data) |
|
367 | 367 | { |
368 | 368 | $context = $this->getContext(); |
369 | 369 | |
370 | - $mediaManager = \Aimeos\MShop\Factory::createManager( $context, 'media' ); |
|
371 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'catalog/lists' ); |
|
372 | - $cntl = \Aimeos\Controller\Common\Media\Factory::createController( $context ); |
|
370 | + $mediaManager = \Aimeos\MShop\Factory::createManager($context, 'media'); |
|
371 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'catalog/lists'); |
|
372 | + $cntl = \Aimeos\Controller\Common\Media\Factory::createController($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['catalog.lists.type'], $entry['media.id'], false ) ) === null ) { |
|
379 | + if (($listItem = $item->getListItem('media', $entry['catalog.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, 'image/' . $idx . '/file' ) ) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE ) |
|
389 | + if (($file = $this->getValue($files, 'image/' . $idx . '/file')) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE) |
|
390 | 390 | { |
391 | - $refItem->getId() ?: $refItem->setUrl( '' )->setPreview( '' ); // keep copied image |
|
392 | - $cntl->add( $refItem, $file ); |
|
391 | + $refItem->getId() ?: $refItem->setUrl('')->setPreview(''); // keep copied image |
|
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\Catalog\Item\Iface $item, $copy = false ) |
|
424 | + protected function toArray(\Aimeos\MShop\Catalog\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['catalog.lists.siteid'] = $siteId; |
440 | 440 | $list['catalog.lists.id'] = ''; |
@@ -442,10 +442,10 @@ discard block |
||
442 | 442 | $list['media.id'] = null; |
443 | 443 | } |
444 | 444 | |
445 | - $list['catalog.lists.datestart'] = str_replace( ' ', 'T', $list['catalog.lists.datestart'] ); |
|
446 | - $list['catalog.lists.dateend'] = str_replace( ' ', 'T', $list['catalog.lists.dateend'] ); |
|
445 | + $list['catalog.lists.datestart'] = str_replace(' ', 'T', $list['catalog.lists.datestart']); |
|
446 | + $list['catalog.lists.dateend'] = str_replace(' ', 'T', $list['catalog.lists.dateend']); |
|
447 | 447 | |
448 | - foreach( $list['catalog.lists.config'] as $key => $val ) |
|
448 | + foreach ($list['catalog.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/catalog/image/template-item |
470 | 470 | * Relative path to the HTML body template of the image subpart for catalogs. |
@@ -488,6 +488,6 @@ discard block |
||
488 | 488 | $tplconf = 'admin/jqadm/catalog/image/template-item'; |
489 | 489 | $default = 'catalog/item-image-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 |