@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | <thead> |
18 | 18 | <tr> |
19 | 19 | <th colspan="3"> |
20 | - <span class="help"><?= $enc->html( $this->translate( 'admin', 'Media properties' ) ); ?></span> |
|
20 | + <span class="help"><?= $enc->html($this->translate('admin', 'Media properties')); ?></span> |
|
21 | 21 | <div class="form-text text-muted help-text"> |
22 | - <?= $enc->html( $this->translate( 'admin', 'Non-shared properties for the media item' ) ); ?> |
|
22 | + <?= $enc->html($this->translate('admin', 'Non-shared properties for the media item')); ?> |
|
23 | 23 | </div> |
24 | 24 | </th> |
25 | 25 | <th class="actions"> |
26 | - <div class="btn act-add fa" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
27 | - title="<?= $enc->attr( $this->translate( 'admin', 'Insert new entry (Ctrl+I)') ); ?>" |
|
26 | + <div class="btn act-add fa" tabindex="<?= $this->get('tabindex'); ?>" |
|
27 | + title="<?= $enc->attr($this->translate('admin', 'Insert new entry (Ctrl+I)')); ?>" |
|
28 | 28 | v-on:click="addPropertyItem(idx)"> |
29 | 29 | </div> |
30 | 30 | </th> |
@@ -37,48 +37,48 @@ discard block |
||
37 | 37 | |
38 | 38 | <td class="property-type"> |
39 | 39 | <input class="item-propertyid" type="hidden" v-bind:value="propdata['media.property.id']" |
40 | - v-bind:name="'<?= $enc->attr( $this->formparam( array( 'image', 'idx', 'property', 'propidx', 'media.property.id' ) ) ); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" /> |
|
41 | - <select class="form-control custom-select item-typeid" required="required" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
42 | - v-bind:name="'<?= $enc->attr( $this->formparam( array( 'image', 'idx', 'property', 'propidx', 'media.property.typeid' ) ) ); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
40 | + v-bind:name="'<?= $enc->attr($this->formparam(array('image', 'idx', 'property', 'propidx', 'media.property.id'))); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" /> |
|
41 | + <select class="form-control custom-select item-typeid" required="required" tabindex="<?= $this->get('tabindex'); ?>" |
|
42 | + v-bind:name="'<?= $enc->attr($this->formparam(array('image', 'idx', 'property', 'propidx', 'media.property.typeid'))); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
43 | 43 | v-bind:readonly="checkSite('media.siteid', idx)" |
44 | 44 | v-model="items[idx]['property'][propidx]['media.property.typeid']" > |
45 | 45 | |
46 | - <?php foreach( $this->get( 'propertyTypes', [] ) as $id => $item ) : ?> |
|
47 | - <option value="<?= $enc->attr( $id ); ?>" v-bind:selected="items[idx]['property'][propidx]['media.property.typeid'] == '<?= $enc->attr( $id ) ?>'" > |
|
48 | - <?= $enc->html( $item->getLabel() ); ?> |
|
46 | + <?php foreach ($this->get('propertyTypes', []) as $id => $item) : ?> |
|
47 | + <option value="<?= $enc->attr($id); ?>" v-bind:selected="items[idx]['property'][propidx]['media.property.typeid'] == '<?= $enc->attr($id) ?>'" > |
|
48 | + <?= $enc->html($item->getLabel()); ?> |
|
49 | 49 | </option> |
50 | 50 | <?php endforeach; ?> |
51 | 51 | |
52 | 52 | </select> |
53 | 53 | </td> |
54 | 54 | <td class="property-language"> |
55 | - <select class="form-control custom-select item-languageid" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
56 | - v-bind:name="'<?= $enc->attr( $this->formparam( array( 'image', 'idx', 'property', 'propidx', 'media.property.languageid' ) ) ); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
55 | + <select class="form-control custom-select item-languageid" tabindex="<?= $this->get('tabindex'); ?>" |
|
56 | + v-bind:name="'<?= $enc->attr($this->formparam(array('image', 'idx', 'property', 'propidx', 'media.property.languageid'))); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
57 | 57 | v-bind:readonly="checkSite('media.siteid', idx)" |
58 | 58 | v-model="items[idx]['property'][propidx]['media.property.languageid']" > |
59 | 59 | |
60 | 60 | <option v-bind:value="null"> |
61 | - <?= $enc->html( $this->translate( 'admin', 'All' ) ); ?> |
|
61 | + <?= $enc->html($this->translate('admin', 'All')); ?> |
|
62 | 62 | </option> |
63 | 63 | |
64 | - <?php foreach( $this->get( 'pageLangItems', [] ) as $langId => $langItem ) : ?> |
|
65 | - <option value="<?= $enc->attr( $langId ); ?>" v-bind:selected="items[idx]['property'][propidx]['media.property.languageid'] == '<?= $enc->attr( $langId ) ?>'" > |
|
66 | - <?= $enc->html( $langItem->getLabel() ); ?> |
|
64 | + <?php foreach ($this->get('pageLangItems', []) as $langId => $langItem) : ?> |
|
65 | + <option value="<?= $enc->attr($langId); ?>" v-bind:selected="items[idx]['property'][propidx]['media.property.languageid'] == '<?= $enc->attr($langId) ?>'" > |
|
66 | + <?= $enc->html($langItem->getLabel()); ?> |
|
67 | 67 | </option> |
68 | 68 | <?php endforeach; ?> |
69 | 69 | </select> |
70 | 70 | </td> |
71 | 71 | <td class="property-value"> |
72 | - <input class="form-control item-value" type="text" required="required" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
73 | - v-bind:name="'<?= $enc->attr( $this->formparam( array( 'image', 'idx', 'property', 'propidx', 'media.property.value' ) ) ); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
74 | - placeholder="<?= $enc->attr( $this->translate( 'admin', 'Property value (required)' ) ); ?>" |
|
72 | + <input class="form-control item-value" type="text" required="required" tabindex="<?= $this->get('tabindex'); ?>" |
|
73 | + v-bind:name="'<?= $enc->attr($this->formparam(array('image', 'idx', 'property', 'propidx', 'media.property.value'))); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
74 | + placeholder="<?= $enc->attr($this->translate('admin', 'Property value (required)')); ?>" |
|
75 | 75 | v-bind:readonly="checkSite('media.siteid', idx)" |
76 | 76 | v-model="items[idx]['property'][propidx]['media.property.value']" > |
77 | 77 | </td> |
78 | 78 | |
79 | 79 | <td class="actions"> |
80 | - <div v-if="!checkSite('media.siteid', idx)" class="btn act-delete fa" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
81 | - title="<?= $enc->attr( $this->translate( 'admin', 'Delete this entry') ); ?>" |
|
80 | + <div v-if="!checkSite('media.siteid', idx)" class="btn act-delete fa" tabindex="<?= $this->get('tabindex'); ?>" |
|
81 | + title="<?= $enc->attr($this->translate('admin', 'Delete this entry')); ?>" |
|
82 | 82 | v-on:click.stop="removePropertyItem(idx, propidx)"> |
83 | 83 | </div> |
84 | 84 | </td> |
@@ -87,6 +87,6 @@ discard block |
||
87 | 87 | </tbody> |
88 | 88 | </table> |
89 | 89 | |
90 | - <?= $this->get( 'propertyBody' ); ?> |
|
90 | + <?= $this->get('propertyBody'); ?> |
|
91 | 91 | |
92 | 92 | </div> |
@@ -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( true )->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(true)->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 | } |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | * @since 2017.07 |
318 | 318 | * @category Developer |
319 | 319 | */ |
320 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/attribute/image/standard/subparts', [] ); |
|
320 | + return $this->getContext()->getConfig()->get('admin/jqadm/attribute/image/standard/subparts', []); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | |
@@ -327,59 +327,59 @@ discard block |
||
327 | 327 | * @param \Aimeos\MShop\Attribute\Item\Iface $item Attribute item object without referenced domain items |
328 | 328 | * @param string[] $data Data array |
329 | 329 | */ |
330 | - protected function fromArray( \Aimeos\MShop\Attribute\Item\Iface $item, array $data ) |
|
330 | + protected function fromArray(\Aimeos\MShop\Attribute\Item\Iface $item, array $data) |
|
331 | 331 | { |
332 | 332 | $context = $this->getContext(); |
333 | 333 | |
334 | - $mediaManager = \Aimeos\MShop\Factory::createManager( $context, 'media' ); |
|
335 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'attribute/lists' ); |
|
336 | - $cntl = \Aimeos\Controller\Common\Media\Factory::createController( $context ); |
|
334 | + $mediaManager = \Aimeos\MShop\Factory::createManager($context, 'media'); |
|
335 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'attribute/lists'); |
|
336 | + $cntl = \Aimeos\Controller\Common\Media\Factory::createController($context); |
|
337 | 337 | |
338 | - $listItems = $item->getListItems( 'media', null, null, false ); |
|
338 | + $listItems = $item->getListItems('media', null, null, false); |
|
339 | 339 | $files = (array) $this->getView()->request()->getUploadedFiles(); |
340 | 340 | |
341 | - foreach( $data as $idx => $entry ) |
|
341 | + foreach ($data as $idx => $entry) |
|
342 | 342 | { |
343 | - if( ( $listItem = $item->getListItem( 'media', $entry['attribute.lists.type'], $entry['media.id'] ) ) === null ) { |
|
343 | + if (($listItem = $item->getListItem('media', $entry['attribute.lists.type'], $entry['media.id'])) === null) { |
|
344 | 344 | $listItem = $listManager->createItem(); |
345 | 345 | } |
346 | 346 | |
347 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
347 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
348 | 348 | $refItem = $mediaManager->createItem(); |
349 | 349 | } |
350 | 350 | |
351 | - $refItem->fromArray( $entry ); |
|
351 | + $refItem->fromArray($entry); |
|
352 | 352 | |
353 | - if( ( $file = $this->getValue( $files, 'image/' . $idx . '/file' ) ) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE ) { |
|
354 | - $cntl->add( $refItem, $file ); |
|
353 | + if (($file = $this->getValue($files, 'image/' . $idx . '/file')) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE) { |
|
354 | + $cntl->add($refItem, $file); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | $conf = []; |
358 | 358 | |
359 | - foreach( (array) $this->getValue( $entry, 'config/key' ) as $num => $key ) |
|
359 | + foreach ((array) $this->getValue($entry, 'config/key') as $num => $key) |
|
360 | 360 | { |
361 | - if( trim( $key ) !== '' && ( $val = $this->getValue( $entry, 'config/val/' . $num ) ) !== null ) { |
|
362 | - $conf[$key] = trim( $val ); |
|
361 | + if (trim($key) !== '' && ($val = $this->getValue($entry, 'config/val/' . $num)) !== null) { |
|
362 | + $conf[$key] = trim($val); |
|
363 | 363 | } |
364 | 364 | } |
365 | 365 | |
366 | - $listItem->fromArray( $entry ); |
|
367 | - $listItem->setPosition( $idx ); |
|
368 | - $listItem->setConfig( $conf ); |
|
366 | + $listItem->fromArray($entry); |
|
367 | + $listItem->setPosition($idx); |
|
368 | + $listItem->setConfig($conf); |
|
369 | 369 | |
370 | - $item->addListItem( 'media', $listItem, $refItem ); |
|
370 | + $item->addListItem('media', $listItem, $refItem); |
|
371 | 371 | |
372 | - unset( $listItems[$listItem->getId()] ); |
|
372 | + unset($listItems[$listItem->getId()]); |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | |
376 | - foreach( $listItems as $listItem ) |
|
376 | + foreach ($listItems as $listItem) |
|
377 | 377 | { |
378 | - if( ( $refItem = $listItem->getRefItem() ) !== null ) { |
|
379 | - $cntl->delete( $refItem ); |
|
378 | + if (($refItem = $listItem->getRefItem()) !== null) { |
|
379 | + $cntl->delete($refItem); |
|
380 | 380 | } |
381 | 381 | |
382 | - $item->deleteListItem( 'media', $listItem, $refItem ); |
|
382 | + $item->deleteListItem('media', $listItem, $refItem); |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | return $item; |
@@ -393,20 +393,20 @@ discard block |
||
393 | 393 | * @param boolean $copy True if items should be copied, false if not |
394 | 394 | * @return string[] Multi-dimensional associative list of item data |
395 | 395 | */ |
396 | - protected function toArray( \Aimeos\MShop\Attribute\Item\Iface $item, $copy = false ) |
|
396 | + protected function toArray(\Aimeos\MShop\Attribute\Item\Iface $item, $copy = false) |
|
397 | 397 | { |
398 | 398 | $data = []; |
399 | 399 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
400 | 400 | |
401 | - foreach( $item->getListItems( 'media', null, null, false ) as $listItem ) |
|
401 | + foreach ($item->getListItems('media', null, null, false) as $listItem) |
|
402 | 402 | { |
403 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
403 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
404 | 404 | continue; |
405 | 405 | } |
406 | 406 | |
407 | - $list = $listItem->toArray( true ) + $refItem->toArray( true ); |
|
407 | + $list = $listItem->toArray(true) + $refItem->toArray(true); |
|
408 | 408 | |
409 | - if( $copy === true ) |
|
409 | + if ($copy === true) |
|
410 | 410 | { |
411 | 411 | $list['attribute.lists.siteid'] = $siteId; |
412 | 412 | $list['attribute.lists.id'] = ''; |
@@ -414,10 +414,10 @@ discard block |
||
414 | 414 | $list['media.id'] = null; |
415 | 415 | } |
416 | 416 | |
417 | - $list['attribute.lists.datestart'] = str_replace( ' ', 'T', $list['attribute.lists.datestart'] ); |
|
418 | - $list['attribute.lists.dateend'] = str_replace( ' ', 'T', $list['attribute.lists.dateend'] ); |
|
417 | + $list['attribute.lists.datestart'] = str_replace(' ', 'T', $list['attribute.lists.datestart']); |
|
418 | + $list['attribute.lists.dateend'] = str_replace(' ', 'T', $list['attribute.lists.dateend']); |
|
419 | 419 | |
420 | - foreach( $list['attribute.lists.config'] as $key => $val ) |
|
420 | + foreach ($list['attribute.lists.config'] as $key => $val) |
|
421 | 421 | { |
422 | 422 | $list['config']['key'][] = $key; |
423 | 423 | $list['config']['val'][] = $val; |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
437 | 437 | * @return string HTML output |
438 | 438 | */ |
439 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
439 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
440 | 440 | { |
441 | 441 | /** admin/jqadm/attribute/image/template-item |
442 | 442 | * Relative path to the HTML body template of the image subpart for attributes. |
@@ -460,6 +460,6 @@ discard block |
||
460 | 460 | $tplconf = 'admin/jqadm/attribute/image/template-item'; |
461 | 461 | $default = 'attribute/item-image-standard.php'; |
462 | 462 | |
463 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
463 | + return $view->render($view->config($tplconf, $default)); |
|
464 | 464 | } |
465 | 465 | } |
466 | 466 | \ No newline at end of file |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | <thead> |
18 | 18 | <tr> |
19 | 19 | <th colspan="3"> |
20 | - <span class="help"><?= $enc->html( $this->translate( 'admin', 'Media properties' ) ); ?></span> |
|
20 | + <span class="help"><?= $enc->html($this->translate('admin', 'Media properties')); ?></span> |
|
21 | 21 | <div class="form-text text-muted help-text"> |
22 | - <?= $enc->html( $this->translate( 'admin', 'Non-shared properties for the media item' ) ); ?> |
|
22 | + <?= $enc->html($this->translate('admin', 'Non-shared properties for the media item')); ?> |
|
23 | 23 | </div> |
24 | 24 | </th> |
25 | 25 | <th class="actions"> |
26 | - <div class="btn act-add fa" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
27 | - title="<?= $enc->attr( $this->translate( 'admin', 'Insert new entry (Ctrl+I)') ); ?>" |
|
26 | + <div class="btn act-add fa" tabindex="<?= $this->get('tabindex'); ?>" |
|
27 | + title="<?= $enc->attr($this->translate('admin', 'Insert new entry (Ctrl+I)')); ?>" |
|
28 | 28 | v-on:click="addPropertyItem(idx)"> |
29 | 29 | </div> |
30 | 30 | </th> |
@@ -37,48 +37,48 @@ discard block |
||
37 | 37 | |
38 | 38 | <td class="property-type"> |
39 | 39 | <input class="item-propertyid" type="hidden" v-bind:value="propdata['media.property.id']" |
40 | - v-bind:name="'<?= $enc->attr( $this->formparam( array( 'image', 'idx', 'property', 'propidx', 'media.property.id' ) ) ); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" /> |
|
41 | - <select class="form-control custom-select item-typeid" required="required" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
42 | - v-bind:name="'<?= $enc->attr( $this->formparam( array( 'image', 'idx', 'property', 'propidx', 'media.property.typeid' ) ) ); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
40 | + v-bind:name="'<?= $enc->attr($this->formparam(array('image', 'idx', 'property', 'propidx', 'media.property.id'))); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" /> |
|
41 | + <select class="form-control custom-select item-typeid" required="required" tabindex="<?= $this->get('tabindex'); ?>" |
|
42 | + v-bind:name="'<?= $enc->attr($this->formparam(array('image', 'idx', 'property', 'propidx', 'media.property.typeid'))); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
43 | 43 | v-bind:readonly="checkSite('media.siteid', idx)" |
44 | 44 | v-model="items[idx]['property'][propidx]['media.property.typeid']" > |
45 | 45 | |
46 | - <?php foreach( $this->get( 'propertyTypes', [] ) as $id => $item ) : ?> |
|
47 | - <option value="<?= $enc->attr( $id ); ?>" v-bind:selected="items[idx]['property'][propidx]['media.property.typeid'] == '<?= $enc->attr( $id ) ?>'" > |
|
48 | - <?= $enc->html( $item->getLabel() ); ?> |
|
46 | + <?php foreach ($this->get('propertyTypes', []) as $id => $item) : ?> |
|
47 | + <option value="<?= $enc->attr($id); ?>" v-bind:selected="items[idx]['property'][propidx]['media.property.typeid'] == '<?= $enc->attr($id) ?>'" > |
|
48 | + <?= $enc->html($item->getLabel()); ?> |
|
49 | 49 | </option> |
50 | 50 | <?php endforeach; ?> |
51 | 51 | |
52 | 52 | </select> |
53 | 53 | </td> |
54 | 54 | <td class="property-language"> |
55 | - <select class="form-control custom-select item-languageid" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
56 | - v-bind:name="'<?= $enc->attr( $this->formparam( array( 'image', 'idx', 'property', 'propidx', 'media.property.languageid' ) ) ); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
55 | + <select class="form-control custom-select item-languageid" tabindex="<?= $this->get('tabindex'); ?>" |
|
56 | + v-bind:name="'<?= $enc->attr($this->formparam(array('image', 'idx', 'property', 'propidx', 'media.property.languageid'))); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
57 | 57 | v-bind:readonly="checkSite('media.siteid', idx)" |
58 | 58 | v-model="items[idx]['property'][propidx]['media.property.languageid']" > |
59 | 59 | |
60 | 60 | <option v-bind:value="null"> |
61 | - <?= $enc->html( $this->translate( 'admin', 'All' ) ); ?> |
|
61 | + <?= $enc->html($this->translate('admin', 'All')); ?> |
|
62 | 62 | </option> |
63 | 63 | |
64 | - <?php foreach( $this->get( 'pageLangItems', [] ) as $langId => $langItem ) : ?> |
|
65 | - <option value="<?= $enc->attr( $langId ); ?>" v-bind:selected="items[idx]['property'][propidx]['media.property.languageid'] == '<?= $enc->attr( $langId ) ?>'" > |
|
66 | - <?= $enc->html( $langItem->getLabel() ); ?> |
|
64 | + <?php foreach ($this->get('pageLangItems', []) as $langId => $langItem) : ?> |
|
65 | + <option value="<?= $enc->attr($langId); ?>" v-bind:selected="items[idx]['property'][propidx]['media.property.languageid'] == '<?= $enc->attr($langId) ?>'" > |
|
66 | + <?= $enc->html($langItem->getLabel()); ?> |
|
67 | 67 | </option> |
68 | 68 | <?php endforeach; ?> |
69 | 69 | </select> |
70 | 70 | </td> |
71 | 71 | <td class="property-value"> |
72 | - <input class="form-control item-value" type="text" required="required" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
73 | - v-bind:name="'<?= $enc->attr( $this->formparam( array( 'image', 'idx', 'property', 'propidx', 'media.property.value' ) ) ); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
74 | - placeholder="<?= $enc->attr( $this->translate( 'admin', 'Property value (required)' ) ); ?>" |
|
72 | + <input class="form-control item-value" type="text" required="required" tabindex="<?= $this->get('tabindex'); ?>" |
|
73 | + v-bind:name="'<?= $enc->attr($this->formparam(array('image', 'idx', 'property', 'propidx', 'media.property.value'))); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
74 | + placeholder="<?= $enc->attr($this->translate('admin', 'Property value (required)')); ?>" |
|
75 | 75 | v-bind:readonly="checkSite('media.siteid', idx)" |
76 | 76 | v-model="items[idx]['property'][propidx]['media.property.value']" > |
77 | 77 | </td> |
78 | 78 | |
79 | 79 | <td class="actions"> |
80 | - <div v-if="!checkSite('media.siteid', idx)" class="btn act-delete fa" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
81 | - title="<?= $enc->attr( $this->translate( 'admin', 'Delete this entry') ); ?>" |
|
80 | + <div v-if="!checkSite('media.siteid', idx)" class="btn act-delete fa" tabindex="<?= $this->get('tabindex'); ?>" |
|
81 | + title="<?= $enc->attr($this->translate('admin', 'Delete this entry')); ?>" |
|
82 | 82 | v-on:click.stop="removePropertyItem(idx, propidx)"> |
83 | 83 | </div> |
84 | 84 | </td> |
@@ -87,6 +87,6 @@ discard block |
||
87 | 87 | </tbody> |
88 | 88 | </table> |
89 | 89 | |
90 | - <?= $this->get( 'propertyBody' ); ?> |
|
90 | + <?= $this->get('propertyBody'); ?> |
|
91 | 91 | |
92 | 92 | </div> |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | <thead> |
18 | 18 | <tr> |
19 | 19 | <th colspan="3"> |
20 | - <span class="help"><?= $enc->html( $this->translate( 'admin', 'Media properties' ) ); ?></span> |
|
20 | + <span class="help"><?= $enc->html($this->translate('admin', 'Media properties')); ?></span> |
|
21 | 21 | <div class="form-text text-muted help-text"> |
22 | - <?= $enc->html( $this->translate( 'admin', 'Non-shared properties for the media item' ) ); ?> |
|
22 | + <?= $enc->html($this->translate('admin', 'Non-shared properties for the media item')); ?> |
|
23 | 23 | </div> |
24 | 24 | </th> |
25 | 25 | <th class="actions"> |
26 | - <div class="btn act-add fa" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
27 | - title="<?= $enc->attr( $this->translate( 'admin', 'Insert new entry (Ctrl+I)') ); ?>" |
|
26 | + <div class="btn act-add fa" tabindex="<?= $this->get('tabindex'); ?>" |
|
27 | + title="<?= $enc->attr($this->translate('admin', 'Insert new entry (Ctrl+I)')); ?>" |
|
28 | 28 | v-on:click="addPropertyItem(idx)"> |
29 | 29 | </div> |
30 | 30 | </th> |
@@ -37,48 +37,48 @@ discard block |
||
37 | 37 | |
38 | 38 | <td class="property-type"> |
39 | 39 | <input class="item-propertyid" type="hidden" v-bind:value="propdata['media.property.id']" |
40 | - v-bind:name="'<?= $enc->attr( $this->formparam( array( 'image', 'idx', 'property', 'propidx', 'media.property.id' ) ) ); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" /> |
|
41 | - <select class="form-control custom-select item-typeid" required="required" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
42 | - v-bind:name="'<?= $enc->attr( $this->formparam( array( 'image', 'idx', 'property', 'propidx', 'media.property.typeid' ) ) ); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
40 | + v-bind:name="'<?= $enc->attr($this->formparam(array('image', 'idx', 'property', 'propidx', 'media.property.id'))); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" /> |
|
41 | + <select class="form-control custom-select item-typeid" required="required" tabindex="<?= $this->get('tabindex'); ?>" |
|
42 | + v-bind:name="'<?= $enc->attr($this->formparam(array('image', 'idx', 'property', 'propidx', 'media.property.typeid'))); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
43 | 43 | v-bind:readonly="checkSite('media.siteid', idx)" |
44 | 44 | v-model="items[idx]['property'][propidx]['media.property.typeid']" > |
45 | 45 | |
46 | - <?php foreach( $this->get( 'propertyTypes', [] ) as $id => $item ) : ?> |
|
47 | - <option value="<?= $enc->attr( $id ); ?>" v-bind:selected="items[idx]['property'][propidx]['media.property.typeid'] == '<?= $enc->attr( $id ) ?>'" > |
|
48 | - <?= $enc->html( $item->getLabel() ); ?> |
|
46 | + <?php foreach ($this->get('propertyTypes', []) as $id => $item) : ?> |
|
47 | + <option value="<?= $enc->attr($id); ?>" v-bind:selected="items[idx]['property'][propidx]['media.property.typeid'] == '<?= $enc->attr($id) ?>'" > |
|
48 | + <?= $enc->html($item->getLabel()); ?> |
|
49 | 49 | </option> |
50 | 50 | <?php endforeach; ?> |
51 | 51 | |
52 | 52 | </select> |
53 | 53 | </td> |
54 | 54 | <td class="property-language"> |
55 | - <select class="form-control custom-select item-languageid" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
56 | - v-bind:name="'<?= $enc->attr( $this->formparam( array( 'image', 'idx', 'property', 'propidx', 'media.property.languageid' ) ) ); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
55 | + <select class="form-control custom-select item-languageid" tabindex="<?= $this->get('tabindex'); ?>" |
|
56 | + v-bind:name="'<?= $enc->attr($this->formparam(array('image', 'idx', 'property', 'propidx', 'media.property.languageid'))); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
57 | 57 | v-bind:readonly="checkSite('media.siteid', idx)" |
58 | 58 | v-model="items[idx]['property'][propidx]['media.property.languageid']" > |
59 | 59 | |
60 | 60 | <option v-bind:value="null"> |
61 | - <?= $enc->html( $this->translate( 'admin', 'All' ) ); ?> |
|
61 | + <?= $enc->html($this->translate('admin', 'All')); ?> |
|
62 | 62 | </option> |
63 | 63 | |
64 | - <?php foreach( $this->get( 'pageLangItems', [] ) as $langId => $langItem ) : ?> |
|
65 | - <option value="<?= $enc->attr( $langId ); ?>" v-bind:selected="items[idx]['property'][propidx]['media.property.languageid'] == '<?= $enc->attr( $langId ) ?>'" > |
|
66 | - <?= $enc->html( $langItem->getLabel() ); ?> |
|
64 | + <?php foreach ($this->get('pageLangItems', []) as $langId => $langItem) : ?> |
|
65 | + <option value="<?= $enc->attr($langId); ?>" v-bind:selected="items[idx]['property'][propidx]['media.property.languageid'] == '<?= $enc->attr($langId) ?>'" > |
|
66 | + <?= $enc->html($langItem->getLabel()); ?> |
|
67 | 67 | </option> |
68 | 68 | <?php endforeach; ?> |
69 | 69 | </select> |
70 | 70 | </td> |
71 | 71 | <td class="property-value"> |
72 | - <input class="form-control item-value" type="text" required="required" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
73 | - v-bind:name="'<?= $enc->attr( $this->formparam( array( 'image', 'idx', 'property', 'propidx', 'media.property.value' ) ) ); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
74 | - placeholder="<?= $enc->attr( $this->translate( 'admin', 'Property value (required)' ) ); ?>" |
|
72 | + <input class="form-control item-value" type="text" required="required" tabindex="<?= $this->get('tabindex'); ?>" |
|
73 | + v-bind:name="'<?= $enc->attr($this->formparam(array('image', 'idx', 'property', 'propidx', 'media.property.value'))); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
74 | + placeholder="<?= $enc->attr($this->translate('admin', 'Property value (required)')); ?>" |
|
75 | 75 | v-bind:readonly="checkSite('media.siteid', idx)" |
76 | 76 | v-model="items[idx]['property'][propidx]['media.property.value']" > |
77 | 77 | </td> |
78 | 78 | |
79 | 79 | <td class="actions"> |
80 | - <div v-if="!checkSite('media.siteid', idx)" class="btn act-delete fa" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
81 | - title="<?= $enc->attr( $this->translate( 'admin', 'Delete this entry') ); ?>" |
|
80 | + <div v-if="!checkSite('media.siteid', idx)" class="btn act-delete fa" tabindex="<?= $this->get('tabindex'); ?>" |
|
81 | + title="<?= $enc->attr($this->translate('admin', 'Delete this entry')); ?>" |
|
82 | 82 | v-on:click.stop="removePropertyItem(idx, propidx)"> |
83 | 83 | </div> |
84 | 84 | </td> |
@@ -87,6 +87,6 @@ discard block |
||
87 | 87 | </tbody> |
88 | 88 | </table> |
89 | 89 | |
90 | - <?= $this->get( 'propertyBody' ); ?> |
|
90 | + <?= $this->get('propertyBody'); ?> |
|
91 | 91 | |
92 | 92 | </div> |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | <thead> |
18 | 18 | <tr> |
19 | 19 | <th colspan="3"> |
20 | - <span class="help"><?= $enc->html( $this->translate( 'admin', 'Media properties' ) ); ?></span> |
|
20 | + <span class="help"><?= $enc->html($this->translate('admin', 'Media properties')); ?></span> |
|
21 | 21 | <div class="form-text text-muted help-text"> |
22 | - <?= $enc->html( $this->translate( 'admin', 'Non-shared properties for the media item' ) ); ?> |
|
22 | + <?= $enc->html($this->translate('admin', 'Non-shared properties for the media item')); ?> |
|
23 | 23 | </div> |
24 | 24 | </th> |
25 | 25 | <th class="actions"> |
26 | - <div class="btn act-add fa" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
27 | - title="<?= $enc->attr( $this->translate( 'admin', 'Insert new entry (Ctrl+I)') ); ?>" |
|
26 | + <div class="btn act-add fa" tabindex="<?= $this->get('tabindex'); ?>" |
|
27 | + title="<?= $enc->attr($this->translate('admin', 'Insert new entry (Ctrl+I)')); ?>" |
|
28 | 28 | v-on:click="addPropertyItem(idx)"> |
29 | 29 | </div> |
30 | 30 | </th> |
@@ -37,48 +37,48 @@ discard block |
||
37 | 37 | |
38 | 38 | <td class="property-type"> |
39 | 39 | <input class="item-propertyid" type="hidden" v-bind:value="propdata['media.property.id']" |
40 | - v-bind:name="'<?= $enc->attr( $this->formparam( array( 'image', 'idx', 'property', 'propidx', 'media.property.id' ) ) ); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" /> |
|
41 | - <select class="form-control custom-select item-typeid" required="required" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
42 | - v-bind:name="'<?= $enc->attr( $this->formparam( array( 'image', 'idx', 'property', 'propidx', 'media.property.typeid' ) ) ); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
40 | + v-bind:name="'<?= $enc->attr($this->formparam(array('image', 'idx', 'property', 'propidx', 'media.property.id'))); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" /> |
|
41 | + <select class="form-control custom-select item-typeid" required="required" tabindex="<?= $this->get('tabindex'); ?>" |
|
42 | + v-bind:name="'<?= $enc->attr($this->formparam(array('image', 'idx', 'property', 'propidx', 'media.property.typeid'))); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
43 | 43 | v-bind:readonly="checkSite('media.siteid', idx)" |
44 | 44 | v-model="items[idx]['property'][propidx]['media.property.typeid']" > |
45 | 45 | |
46 | - <?php foreach( $this->get( 'propertyTypes', [] ) as $id => $item ) : ?> |
|
47 | - <option value="<?= $enc->attr( $id ); ?>" v-bind:selected="items[idx]['property'][propidx]['media.property.typeid'] == '<?= $enc->attr( $id ) ?>'" > |
|
48 | - <?= $enc->html( $item->getLabel() ); ?> |
|
46 | + <?php foreach ($this->get('propertyTypes', []) as $id => $item) : ?> |
|
47 | + <option value="<?= $enc->attr($id); ?>" v-bind:selected="items[idx]['property'][propidx]['media.property.typeid'] == '<?= $enc->attr($id) ?>'" > |
|
48 | + <?= $enc->html($item->getLabel()); ?> |
|
49 | 49 | </option> |
50 | 50 | <?php endforeach; ?> |
51 | 51 | |
52 | 52 | </select> |
53 | 53 | </td> |
54 | 54 | <td class="property-language"> |
55 | - <select class="form-control custom-select item-languageid" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
56 | - v-bind:name="'<?= $enc->attr( $this->formparam( array( 'image', 'idx', 'property', 'propidx', 'media.property.languageid' ) ) ); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
55 | + <select class="form-control custom-select item-languageid" tabindex="<?= $this->get('tabindex'); ?>" |
|
56 | + v-bind:name="'<?= $enc->attr($this->formparam(array('image', 'idx', 'property', 'propidx', 'media.property.languageid'))); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
57 | 57 | v-bind:readonly="checkSite('media.siteid', idx)" |
58 | 58 | v-model="items[idx]['property'][propidx]['media.property.languageid']" > |
59 | 59 | |
60 | 60 | <option v-bind:value="null"> |
61 | - <?= $enc->html( $this->translate( 'admin', 'All' ) ); ?> |
|
61 | + <?= $enc->html($this->translate('admin', 'All')); ?> |
|
62 | 62 | </option> |
63 | 63 | |
64 | - <?php foreach( $this->get( 'pageLangItems', [] ) as $langId => $langItem ) : ?> |
|
65 | - <option value="<?= $enc->attr( $langId ); ?>" v-bind:selected="items[idx]['property'][propidx]['media.property.languageid'] == '<?= $enc->attr( $langId ) ?>'" > |
|
66 | - <?= $enc->html( $langItem->getLabel() ); ?> |
|
64 | + <?php foreach ($this->get('pageLangItems', []) as $langId => $langItem) : ?> |
|
65 | + <option value="<?= $enc->attr($langId); ?>" v-bind:selected="items[idx]['property'][propidx]['media.property.languageid'] == '<?= $enc->attr($langId) ?>'" > |
|
66 | + <?= $enc->html($langItem->getLabel()); ?> |
|
67 | 67 | </option> |
68 | 68 | <?php endforeach; ?> |
69 | 69 | </select> |
70 | 70 | </td> |
71 | 71 | <td class="property-value"> |
72 | - <input class="form-control item-value" type="text" required="required" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
73 | - v-bind:name="'<?= $enc->attr( $this->formparam( array( 'image', 'idx', 'property', 'propidx', 'media.property.value' ) ) ); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
74 | - placeholder="<?= $enc->attr( $this->translate( 'admin', 'Property value (required)' ) ); ?>" |
|
72 | + <input class="form-control item-value" type="text" required="required" tabindex="<?= $this->get('tabindex'); ?>" |
|
73 | + v-bind:name="'<?= $enc->attr($this->formparam(array('image', 'idx', 'property', 'propidx', 'media.property.value'))); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
74 | + placeholder="<?= $enc->attr($this->translate('admin', 'Property value (required)')); ?>" |
|
75 | 75 | v-bind:readonly="checkSite('media.siteid', idx)" |
76 | 76 | v-model="items[idx]['property'][propidx]['media.property.value']" > |
77 | 77 | </td> |
78 | 78 | |
79 | 79 | <td class="actions"> |
80 | - <div v-if="!checkSite('media.siteid', idx)" class="btn act-delete fa" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
81 | - title="<?= $enc->attr( $this->translate( 'admin', 'Delete this entry') ); ?>" |
|
80 | + <div v-if="!checkSite('media.siteid', idx)" class="btn act-delete fa" tabindex="<?= $this->get('tabindex'); ?>" |
|
81 | + title="<?= $enc->attr($this->translate('admin', 'Delete this entry')); ?>" |
|
82 | 82 | v-on:click.stop="removePropertyItem(idx, propidx)"> |
83 | 83 | </div> |
84 | 84 | </td> |
@@ -87,6 +87,6 @@ discard block |
||
87 | 87 | </tbody> |
88 | 88 | </table> |
89 | 89 | |
90 | - <?= $this->get( 'propertyBody' ); ?> |
|
90 | + <?= $this->get('propertyBody'); ?> |
|
91 | 91 | |
92 | 92 | </div> |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | <thead> |
18 | 18 | <tr> |
19 | 19 | <th colspan="3"> |
20 | - <span class="help"><?= $enc->html( $this->translate( 'admin', 'Media properties' ) ); ?></span> |
|
20 | + <span class="help"><?= $enc->html($this->translate('admin', 'Media properties')); ?></span> |
|
21 | 21 | <div class="form-text text-muted help-text"> |
22 | - <?= $enc->html( $this->translate( 'admin', 'Non-shared properties for the media item' ) ); ?> |
|
22 | + <?= $enc->html($this->translate('admin', 'Non-shared properties for the media item')); ?> |
|
23 | 23 | </div> |
24 | 24 | </th> |
25 | 25 | <th class="actions"> |
26 | - <div class="btn act-add fa" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
27 | - title="<?= $enc->attr( $this->translate( 'admin', 'Insert new entry (Ctrl+I)') ); ?>" |
|
26 | + <div class="btn act-add fa" tabindex="<?= $this->get('tabindex'); ?>" |
|
27 | + title="<?= $enc->attr($this->translate('admin', 'Insert new entry (Ctrl+I)')); ?>" |
|
28 | 28 | v-on:click="addPropertyItem(idx)"> |
29 | 29 | </div> |
30 | 30 | </th> |
@@ -37,48 +37,48 @@ discard block |
||
37 | 37 | |
38 | 38 | <td class="property-type"> |
39 | 39 | <input class="item-propertyid" type="hidden" v-bind:value="propdata['media.property.id']" |
40 | - v-bind:name="'<?= $enc->attr( $this->formparam( array( 'image', 'idx', 'property', 'propidx', 'media.property.id' ) ) ); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" /> |
|
41 | - <select class="form-control custom-select item-typeid" required="required" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
42 | - v-bind:name="'<?= $enc->attr( $this->formparam( array( 'image', 'idx', 'property', 'propidx', 'media.property.typeid' ) ) ); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
40 | + v-bind:name="'<?= $enc->attr($this->formparam(array('image', 'idx', 'property', 'propidx', 'media.property.id'))); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" /> |
|
41 | + <select class="form-control custom-select item-typeid" required="required" tabindex="<?= $this->get('tabindex'); ?>" |
|
42 | + v-bind:name="'<?= $enc->attr($this->formparam(array('image', 'idx', 'property', 'propidx', 'media.property.typeid'))); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
43 | 43 | v-bind:readonly="checkSite('media.siteid', idx)" |
44 | 44 | v-model="items[idx]['property'][propidx]['media.property.typeid']" > |
45 | 45 | |
46 | - <?php foreach( $this->get( 'propertyTypes', [] ) as $id => $item ) : ?> |
|
47 | - <option value="<?= $enc->attr( $id ); ?>" v-bind:selected="items[idx]['property'][propidx]['media.property.typeid'] == '<?= $enc->attr( $id ) ?>'" > |
|
48 | - <?= $enc->html( $item->getLabel() ); ?> |
|
46 | + <?php foreach ($this->get('propertyTypes', []) as $id => $item) : ?> |
|
47 | + <option value="<?= $enc->attr($id); ?>" v-bind:selected="items[idx]['property'][propidx]['media.property.typeid'] == '<?= $enc->attr($id) ?>'" > |
|
48 | + <?= $enc->html($item->getLabel()); ?> |
|
49 | 49 | </option> |
50 | 50 | <?php endforeach; ?> |
51 | 51 | |
52 | 52 | </select> |
53 | 53 | </td> |
54 | 54 | <td class="property-language"> |
55 | - <select class="form-control custom-select item-languageid" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
56 | - v-bind:name="'<?= $enc->attr( $this->formparam( array( 'image', 'idx', 'property', 'propidx', 'media.property.languageid' ) ) ); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
55 | + <select class="form-control custom-select item-languageid" tabindex="<?= $this->get('tabindex'); ?>" |
|
56 | + v-bind:name="'<?= $enc->attr($this->formparam(array('image', 'idx', 'property', 'propidx', 'media.property.languageid'))); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
57 | 57 | v-bind:readonly="checkSite('media.siteid', idx)" |
58 | 58 | v-model="items[idx]['property'][propidx]['media.property.languageid']" > |
59 | 59 | |
60 | 60 | <option v-bind:value="null"> |
61 | - <?= $enc->html( $this->translate( 'admin', 'All' ) ); ?> |
|
61 | + <?= $enc->html($this->translate('admin', 'All')); ?> |
|
62 | 62 | </option> |
63 | 63 | |
64 | - <?php foreach( $this->get( 'pageLangItems', [] ) as $langId => $langItem ) : ?> |
|
65 | - <option value="<?= $enc->attr( $langId ); ?>" v-bind:selected="items[idx]['property'][propidx]['media.property.languageid'] == '<?= $enc->attr( $langId ) ?>'" > |
|
66 | - <?= $enc->html( $langItem->getLabel() ); ?> |
|
64 | + <?php foreach ($this->get('pageLangItems', []) as $langId => $langItem) : ?> |
|
65 | + <option value="<?= $enc->attr($langId); ?>" v-bind:selected="items[idx]['property'][propidx]['media.property.languageid'] == '<?= $enc->attr($langId) ?>'" > |
|
66 | + <?= $enc->html($langItem->getLabel()); ?> |
|
67 | 67 | </option> |
68 | 68 | <?php endforeach; ?> |
69 | 69 | </select> |
70 | 70 | </td> |
71 | 71 | <td class="property-value"> |
72 | - <input class="form-control item-value" type="text" required="required" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
73 | - v-bind:name="'<?= $enc->attr( $this->formparam( array( 'image', 'idx', 'property', 'propidx', 'media.property.value' ) ) ); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
74 | - placeholder="<?= $enc->attr( $this->translate( 'admin', 'Property value (required)' ) ); ?>" |
|
72 | + <input class="form-control item-value" type="text" required="required" tabindex="<?= $this->get('tabindex'); ?>" |
|
73 | + v-bind:name="'<?= $enc->attr($this->formparam(array('image', 'idx', 'property', 'propidx', 'media.property.value'))); ?>'.replace( 'idx', idx ).replace( 'propidx', propidx )" |
|
74 | + placeholder="<?= $enc->attr($this->translate('admin', 'Property value (required)')); ?>" |
|
75 | 75 | v-bind:readonly="checkSite('media.siteid', idx)" |
76 | 76 | v-model="items[idx]['property'][propidx]['media.property.value']" > |
77 | 77 | </td> |
78 | 78 | |
79 | 79 | <td class="actions"> |
80 | - <div v-if="!checkSite('media.siteid', idx)" class="btn act-delete fa" tabindex="<?= $this->get( 'tabindex' ); ?>" |
|
81 | - title="<?= $enc->attr( $this->translate( 'admin', 'Delete this entry') ); ?>" |
|
80 | + <div v-if="!checkSite('media.siteid', idx)" class="btn act-delete fa" tabindex="<?= $this->get('tabindex'); ?>" |
|
81 | + title="<?= $enc->attr($this->translate('admin', 'Delete this entry')); ?>" |
|
82 | 82 | v-on:click.stop="removePropertyItem(idx, propidx)"> |
83 | 83 | </div> |
84 | 84 | </td> |
@@ -87,6 +87,6 @@ discard block |
||
87 | 87 | </tbody> |
88 | 88 | </table> |
89 | 89 | |
90 | - <?= $this->get( 'propertyBody' ); ?> |
|
90 | + <?= $this->get('propertyBody'); ?> |
|
91 | 91 | |
92 | 92 | </div> |
@@ -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 | } |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | * @since 2017.07 |
318 | 318 | * @category Developer |
319 | 319 | */ |
320 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/service/image/standard/subparts', [] ); |
|
320 | + return $this->getContext()->getConfig()->get('admin/jqadm/service/image/standard/subparts', []); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | |
@@ -327,59 +327,59 @@ discard block |
||
327 | 327 | * @param \Aimeos\MShop\Service\Item\Iface $item Service item object without referenced domain items |
328 | 328 | * @param string[] $data Data array |
329 | 329 | */ |
330 | - protected function fromArray( \Aimeos\MShop\Service\Item\Iface $item, array $data ) |
|
330 | + protected function fromArray(\Aimeos\MShop\Service\Item\Iface $item, array $data) |
|
331 | 331 | { |
332 | 332 | $context = $this->getContext(); |
333 | 333 | |
334 | - $mediaManager = \Aimeos\MShop\Factory::createManager( $context, 'media' ); |
|
335 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'service/lists' ); |
|
336 | - $cntl = \Aimeos\Controller\Common\Media\Factory::createController( $context ); |
|
334 | + $mediaManager = \Aimeos\MShop\Factory::createManager($context, 'media'); |
|
335 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'service/lists'); |
|
336 | + $cntl = \Aimeos\Controller\Common\Media\Factory::createController($context); |
|
337 | 337 | |
338 | - $listItems = $item->getListItems( 'media', null, null, false ); |
|
338 | + $listItems = $item->getListItems('media', null, null, false); |
|
339 | 339 | $files = (array) $this->getView()->request()->getUploadedFiles(); |
340 | 340 | |
341 | - foreach( $data as $idx => $entry ) |
|
341 | + foreach ($data as $idx => $entry) |
|
342 | 342 | { |
343 | - if( ( $listItem = $item->getListItem( 'media', $entry['service.lists.type'], $entry['media.id'] ) ) === null ) { |
|
343 | + if (($listItem = $item->getListItem('media', $entry['service.lists.type'], $entry['media.id'])) === null) { |
|
344 | 344 | $listItem = $listManager->createItem(); |
345 | 345 | } |
346 | 346 | |
347 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
347 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
348 | 348 | $refItem = $mediaManager->createItem(); |
349 | 349 | } |
350 | 350 | |
351 | - $refItem->fromArray( $entry ); |
|
351 | + $refItem->fromArray($entry); |
|
352 | 352 | |
353 | - if( ( $file = $this->getValue( $files, 'image/' . $idx . '/file' ) ) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE ) { |
|
354 | - $cntl->add( $refItem, $file ); |
|
353 | + if (($file = $this->getValue($files, 'image/' . $idx . '/file')) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE) { |
|
354 | + $cntl->add($refItem, $file); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | $conf = []; |
358 | 358 | |
359 | - foreach( (array) $this->getValue( $entry, 'config/key' ) as $num => $key ) |
|
359 | + foreach ((array) $this->getValue($entry, 'config/key') as $num => $key) |
|
360 | 360 | { |
361 | - if( trim( $key ) !== '' && ( $val = $this->getValue( $entry, 'config/val/' . $num ) ) !== null ) { |
|
362 | - $conf[$key] = trim( $val ); |
|
361 | + if (trim($key) !== '' && ($val = $this->getValue($entry, 'config/val/' . $num)) !== null) { |
|
362 | + $conf[$key] = trim($val); |
|
363 | 363 | } |
364 | 364 | } |
365 | 365 | |
366 | - $listItem->fromArray( $entry ); |
|
367 | - $listItem->setPosition( $idx ); |
|
368 | - $listItem->setConfig( $conf ); |
|
366 | + $listItem->fromArray($entry); |
|
367 | + $listItem->setPosition($idx); |
|
368 | + $listItem->setConfig($conf); |
|
369 | 369 | |
370 | - $item->addListItem( 'media', $listItem, $refItem ); |
|
370 | + $item->addListItem('media', $listItem, $refItem); |
|
371 | 371 | |
372 | - unset( $listItems[$listItem->getId()] ); |
|
372 | + unset($listItems[$listItem->getId()]); |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | |
376 | - foreach( $listItems as $listItem ) |
|
376 | + foreach ($listItems as $listItem) |
|
377 | 377 | { |
378 | - if( ( $refItem = $listItem->getRefItem() ) !== null ) { |
|
379 | - $cntl->delete( $refItem ); |
|
378 | + if (($refItem = $listItem->getRefItem()) !== null) { |
|
379 | + $cntl->delete($refItem); |
|
380 | 380 | } |
381 | 381 | |
382 | - $item->deleteListItem( 'media', $listItem, $refItem ); |
|
382 | + $item->deleteListItem('media', $listItem, $refItem); |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | return $item; |
@@ -393,20 +393,20 @@ discard block |
||
393 | 393 | * @param boolean $copy True if items should be copied, false if not |
394 | 394 | * @return string[] Multi-dimensional associative list of item data |
395 | 395 | */ |
396 | - protected function toArray( \Aimeos\MShop\Service\Item\Iface $item, $copy = false ) |
|
396 | + protected function toArray(\Aimeos\MShop\Service\Item\Iface $item, $copy = false) |
|
397 | 397 | { |
398 | 398 | $data = []; |
399 | 399 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
400 | 400 | |
401 | - foreach( $item->getListItems( 'media', null, null, false ) as $listItem ) |
|
401 | + foreach ($item->getListItems('media', null, null, false) as $listItem) |
|
402 | 402 | { |
403 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
403 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
404 | 404 | continue; |
405 | 405 | } |
406 | 406 | |
407 | - $list = $listItem->toArray( true ) + $refItem->toArray( true ); |
|
407 | + $list = $listItem->toArray(true) + $refItem->toArray(true); |
|
408 | 408 | |
409 | - if( $copy === true ) |
|
409 | + if ($copy === true) |
|
410 | 410 | { |
411 | 411 | $list['service.lists.siteid'] = $siteId; |
412 | 412 | $list['service.lists.id'] = ''; |
@@ -414,10 +414,10 @@ discard block |
||
414 | 414 | $list['media.id'] = null; |
415 | 415 | } |
416 | 416 | |
417 | - $list['service.lists.datestart'] = str_replace( ' ', 'T', $list['service.lists.datestart'] ); |
|
418 | - $list['service.lists.dateend'] = str_replace( ' ', 'T', $list['service.lists.dateend'] ); |
|
417 | + $list['service.lists.datestart'] = str_replace(' ', 'T', $list['service.lists.datestart']); |
|
418 | + $list['service.lists.dateend'] = str_replace(' ', 'T', $list['service.lists.dateend']); |
|
419 | 419 | |
420 | - foreach( $list['service.lists.config'] as $key => $val ) |
|
420 | + foreach ($list['service.lists.config'] as $key => $val) |
|
421 | 421 | { |
422 | 422 | $list['config']['key'][] = $key; |
423 | 423 | $list['config']['val'][] = $val; |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
437 | 437 | * @return string HTML output |
438 | 438 | */ |
439 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
439 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
440 | 440 | { |
441 | 441 | /** admin/jqadm/service/image/template-item |
442 | 442 | * Relative path to the HTML body template of the image subpart for services. |
@@ -460,6 +460,6 @@ discard block |
||
460 | 460 | $tplconf = 'admin/jqadm/service/image/template-item'; |
461 | 461 | $default = 'service/item-image-standard.php'; |
462 | 462 | |
463 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
463 | + return $view->render($view->config($tplconf, $default)); |
|
464 | 464 | } |
465 | 465 | } |
466 | 466 | \ 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.php'; |
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() ) ) !== null ) |
|
267 | + if (($litem = $mediaItem->getListItem('attribute', 'variant', $listItem->getRefId())) !== null) |
|
268 | 268 | { |
269 | - unset( $listItems[$litem->getId()] ); |
|
269 | + unset($listItems[$litem->getId()]); |
|
270 | 270 | continue; |
271 | 271 | } |
272 | 272 | |
273 | - $litem = $listManager->createItem( 'variant', 'attribute' )->setRefId( $listItem->getRefId() ); |
|
274 | - $mediaItem->addListItem( 'attribute', $litem ); |
|
273 | + $litem = $listManager->createItem('variant', 'attribute')->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 | } |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | * @since 2017.07 |
347 | 347 | * @category Developer |
348 | 348 | */ |
349 | - return $this->getContext()->getConfig()->get( 'admin/jqadm/product/image/standard/subparts', [] ); |
|
349 | + return $this->getContext()->getConfig()->get('admin/jqadm/product/image/standard/subparts', []); |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | |
@@ -356,66 +356,66 @@ discard block |
||
356 | 356 | * @param \Aimeos\MShop\Product\Item\Iface $item Product item object without referenced domain items |
357 | 357 | * @param string[] $data Data array |
358 | 358 | */ |
359 | - protected function fromArray( \Aimeos\MShop\Product\Item\Iface $item, array $data ) |
|
359 | + protected function fromArray(\Aimeos\MShop\Product\Item\Iface $item, array $data) |
|
360 | 360 | { |
361 | 361 | $context = $this->getContext(); |
362 | 362 | |
363 | - $mediaManager = \Aimeos\MShop\Factory::createManager( $context, 'media' ); |
|
364 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
365 | - $mediaTypeManager = \Aimeos\MShop\Factory::createManager( $context, 'media/type' ); |
|
366 | - $listTypeManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists/type' ); |
|
367 | - $cntl = \Aimeos\Controller\Common\Media\Factory::createController( $context ); |
|
363 | + $mediaManager = \Aimeos\MShop\Factory::createManager($context, 'media'); |
|
364 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
365 | + $mediaTypeManager = \Aimeos\MShop\Factory::createManager($context, 'media/type'); |
|
366 | + $listTypeManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists/type'); |
|
367 | + $cntl = \Aimeos\Controller\Common\Media\Factory::createController($context); |
|
368 | 368 | |
369 | - $listItems = $item->getListItems( 'media', null, null, false ); |
|
369 | + $listItems = $item->getListItems('media', null, null, false); |
|
370 | 370 | $files = (array) $this->getView()->request()->getUploadedFiles(); |
371 | 371 | |
372 | - foreach( $data as $idx => $entry ) |
|
372 | + foreach ($data as $idx => $entry) |
|
373 | 373 | { |
374 | - $type = $mediaTypeManager->getItem( $entry['media.typeid'] )->getCode(); |
|
375 | - $listType = $listTypeManager->getItem( $entry['product.lists.typeid'] )->getCode(); |
|
374 | + $type = $mediaTypeManager->getItem($entry['media.typeid'])->getCode(); |
|
375 | + $listType = $listTypeManager->getItem($entry['product.lists.typeid'])->getCode(); |
|
376 | 376 | |
377 | - if( ( $listItem = $item->getListItem( 'media', $listType, $entry['media.id'] ) ) === null ) { |
|
378 | - $listItem = $listManager->createItem( $listType, 'media' ); |
|
377 | + if (($listItem = $item->getListItem('media', $listType, $entry['media.id'])) === null) { |
|
378 | + $listItem = $listManager->createItem($listType, 'media'); |
|
379 | 379 | } |
380 | 380 | |
381 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
382 | - $refItem = $mediaManager->createItem( $type, 'product' ); |
|
381 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
382 | + $refItem = $mediaManager->createItem($type, 'product'); |
|
383 | 383 | } |
384 | 384 | |
385 | - $refItem->fromArray( $entry ); |
|
385 | + $refItem->fromArray($entry); |
|
386 | 386 | |
387 | - if( ( $file = $this->getValue( $files, 'image/' . $idx . '/file' ) ) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE ) { |
|
388 | - $cntl->add( $refItem, $file ); |
|
387 | + if (($file = $this->getValue($files, 'image/' . $idx . '/file')) !== null && $file->getError() !== UPLOAD_ERR_NO_FILE) { |
|
388 | + $cntl->add($refItem, $file); |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | $conf = []; |
392 | 392 | |
393 | - foreach( (array) $this->getValue( $entry, 'config/key' ) as $num => $key ) |
|
393 | + foreach ((array) $this->getValue($entry, 'config/key') as $num => $key) |
|
394 | 394 | { |
395 | - if( trim( $key ) !== '' && ( $val = $this->getValue( $entry, 'config/val/' . $num ) ) !== null ) { |
|
396 | - $conf[$key] = trim( $val ); |
|
395 | + if (trim($key) !== '' && ($val = $this->getValue($entry, 'config/val/' . $num)) !== null) { |
|
396 | + $conf[$key] = trim($val); |
|
397 | 397 | } |
398 | 398 | } |
399 | 399 | |
400 | - $listItem->fromArray( $entry ); |
|
401 | - $listItem->setPosition( $idx ); |
|
402 | - $listItem->setConfig( $conf ); |
|
400 | + $listItem->fromArray($entry); |
|
401 | + $listItem->setPosition($idx); |
|
402 | + $listItem->setConfig($conf); |
|
403 | 403 | |
404 | - $attrListItems = $item->getListItems( 'attribute', 'variant', null, false ); |
|
405 | - $refItem = $this->addMediaAttributes( $refItem, $attrListItems ); |
|
406 | - $item->addListItem( 'media', $listItem, $refItem ); |
|
404 | + $attrListItems = $item->getListItems('attribute', 'variant', null, false); |
|
405 | + $refItem = $this->addMediaAttributes($refItem, $attrListItems); |
|
406 | + $item->addListItem('media', $listItem, $refItem); |
|
407 | 407 | |
408 | - unset( $listItems[$listItem->getId()] ); |
|
408 | + unset($listItems[$listItem->getId()]); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | |
412 | - foreach( $listItems as $listItem ) |
|
412 | + foreach ($listItems as $listItem) |
|
413 | 413 | { |
414 | - if( ( $refItem = $listItem->getRefItem() ) !== null ) { |
|
415 | - $cntl->delete( $refItem ); |
|
414 | + if (($refItem = $listItem->getRefItem()) !== null) { |
|
415 | + $cntl->delete($refItem); |
|
416 | 416 | } |
417 | 417 | |
418 | - $item->deleteListItem( 'media', $listItem, $refItem ); |
|
418 | + $item->deleteListItem('media', $listItem, $refItem); |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | return $item; |
@@ -429,20 +429,20 @@ discard block |
||
429 | 429 | * @param boolean $copy True if items should be copied, false if not |
430 | 430 | * @return string[] Multi-dimensional associative list of item data |
431 | 431 | */ |
432 | - protected function toArray( \Aimeos\MShop\Product\Item\Iface $item, $copy = false ) |
|
432 | + protected function toArray(\Aimeos\MShop\Product\Item\Iface $item, $copy = false) |
|
433 | 433 | { |
434 | 434 | $data = []; |
435 | 435 | $siteId = $this->getContext()->getLocale()->getSiteId(); |
436 | 436 | |
437 | - foreach( $item->getListItems( 'media', null, null, false ) as $listItem ) |
|
437 | + foreach ($item->getListItems('media', null, null, false) as $listItem) |
|
438 | 438 | { |
439 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
439 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
440 | 440 | continue; |
441 | 441 | } |
442 | 442 | |
443 | - $list = $listItem->toArray( true ) + $refItem->toArray( true ); |
|
443 | + $list = $listItem->toArray(true) + $refItem->toArray(true); |
|
444 | 444 | |
445 | - if( $copy === true ) |
|
445 | + if ($copy === true) |
|
446 | 446 | { |
447 | 447 | $list['product.lists.siteid'] = $siteId; |
448 | 448 | $list['product.lists.id'] = ''; |
@@ -450,10 +450,10 @@ discard block |
||
450 | 450 | $list['media.id'] = null; |
451 | 451 | } |
452 | 452 | |
453 | - $list['product.lists.datestart'] = str_replace( ' ', 'T', $list['product.lists.datestart'] ); |
|
454 | - $list['product.lists.dateend'] = str_replace( ' ', 'T', $list['product.lists.dateend'] ); |
|
453 | + $list['product.lists.datestart'] = str_replace(' ', 'T', $list['product.lists.datestart']); |
|
454 | + $list['product.lists.dateend'] = str_replace(' ', 'T', $list['product.lists.dateend']); |
|
455 | 455 | |
456 | - foreach( $list['product.lists.config'] as $key => $val ) |
|
456 | + foreach ($list['product.lists.config'] as $key => $val) |
|
457 | 457 | { |
458 | 458 | $list['config']['key'][] = $key; |
459 | 459 | $list['config']['val'][] = $val; |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | * @param \Aimeos\MW\View\Iface $view View object with data assigned |
473 | 473 | * @return string HTML output |
474 | 474 | */ |
475 | - protected function render( \Aimeos\MW\View\Iface $view ) |
|
475 | + protected function render(\Aimeos\MW\View\Iface $view) |
|
476 | 476 | { |
477 | 477 | /** admin/jqadm/product/image/template-item |
478 | 478 | * Relative path to the HTML body template of the image subpart for products. |
@@ -496,6 +496,6 @@ discard block |
||
496 | 496 | $tplconf = 'admin/jqadm/product/image/template-item'; |
497 | 497 | $default = 'product/item-image-standard.php'; |
498 | 498 | |
499 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
499 | + return $view->render($view->config($tplconf, $default)); |
|
500 | 500 | } |
501 | 501 | } |
502 | 502 | \ No newline at end of file |