@@ -27,13 +27,13 @@ |
||
| 27 | 27 | public function save() |
| 28 | 28 | { |
| 29 | 29 | $result = $this->getClient()->save(); |
| 30 | - $ids = array( 'catalog' ); |
|
| 30 | + $ids = array('catalog'); |
|
| 31 | 31 | |
| 32 | - foreach( $this->getView()->param( 'category/catalog.id', array() ) as $id ) { |
|
| 32 | + foreach ($this->getView()->param('category/catalog.id', array()) as $id) { |
|
| 33 | 33 | $ids[] = 'catalog-' . $id; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - $this->getContext()->getCache()->deleteByTags( $ids ); |
|
| 36 | + $this->getContext()->getCache()->deleteByTags($ids); |
|
| 37 | 37 | |
| 38 | 38 | return $result; |
| 39 | 39 | } |
@@ -67,17 +67,17 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | $view = $this->getView(); |
| 69 | 69 | |
| 70 | - $this->setData( $view ); |
|
| 70 | + $this->setData($view); |
|
| 71 | 71 | $view->categoryBody = ''; |
| 72 | 72 | |
| 73 | - foreach( $this->getSubClients() as $client ) { |
|
| 73 | + foreach ($this->getSubClients() as $client) { |
|
| 74 | 74 | $view->categoryBody .= $client->copy(); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $tplconf = 'admin/jqadm/product/category/template-item'; |
| 78 | 78 | $default = 'product/item-category-default.php'; |
| 79 | 79 | |
| 80 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 80 | + return $view->render($view->config($tplconf, $default)); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | |
@@ -90,17 +90,17 @@ discard block |
||
| 90 | 90 | { |
| 91 | 91 | $view = $this->getView(); |
| 92 | 92 | |
| 93 | - $this->setData( $view ); |
|
| 93 | + $this->setData($view); |
|
| 94 | 94 | $view->categoryBody = ''; |
| 95 | 95 | |
| 96 | - foreach( $this->getSubClients() as $client ) { |
|
| 96 | + foreach ($this->getSubClients() as $client) { |
|
| 97 | 97 | $view->categoryBody .= $client->create(); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | $tplconf = 'admin/jqadm/product/category/template-item'; |
| 101 | 101 | $default = 'product/item-category-default.php'; |
| 102 | 102 | |
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 103 | + return $view->render($view->config($tplconf, $default)); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
@@ -113,17 +113,17 @@ discard block |
||
| 113 | 113 | { |
| 114 | 114 | $view = $this->getView(); |
| 115 | 115 | |
| 116 | - $this->setData( $view ); |
|
| 116 | + $this->setData($view); |
|
| 117 | 117 | $view->categoryBody = ''; |
| 118 | 118 | |
| 119 | - foreach( $this->getSubClients() as $client ) { |
|
| 119 | + foreach ($this->getSubClients() as $client) { |
|
| 120 | 120 | $view->categoryBody .= $client->get(); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | $tplconf = 'admin/jqadm/product/category/template-item'; |
| 124 | 124 | $default = 'product/item-category-default.php'; |
| 125 | 125 | |
| 126 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 126 | + return $view->render($view->config($tplconf, $default)); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | |
@@ -137,32 +137,32 @@ discard block |
||
| 137 | 137 | $view = $this->getView(); |
| 138 | 138 | $context = $this->getContext(); |
| 139 | 139 | |
| 140 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
| 140 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
| 141 | 141 | $manager->begin(); |
| 142 | 142 | |
| 143 | 143 | try |
| 144 | 144 | { |
| 145 | - $this->updateItems( $view ); |
|
| 145 | + $this->updateItems($view); |
|
| 146 | 146 | $view->categoryBody = ''; |
| 147 | 147 | |
| 148 | - foreach( $this->getSubClients() as $client ) { |
|
| 148 | + foreach ($this->getSubClients() as $client) { |
|
| 149 | 149 | $view->categoryBody .= $client->save(); |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | $manager->commit(); |
| 153 | 153 | return; |
| 154 | 154 | } |
| 155 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 155 | + catch (\Aimeos\MShop\Exception $e) |
|
| 156 | 156 | { |
| 157 | - $error = array( 'product-item-category' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 158 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
| 157 | + $error = array('product-item-category' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 158 | + $view->errors = $view->get('errors', array()) + $error; |
|
| 159 | 159 | $manager->rollback(); |
| 160 | 160 | } |
| 161 | - catch( \Exception $e ) |
|
| 161 | + catch (\Exception $e) |
|
| 162 | 162 | { |
| 163 | - $context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() ); |
|
| 164 | - $error = array( 'product-item-category' => $e->getMessage() ); |
|
| 165 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
| 163 | + $context->getLogger()->log($e->getMessage() . ' - ' . $e->getTraceAsString()); |
|
| 164 | + $error = array('product-item-category' => $e->getMessage()); |
|
| 165 | + $view->errors = $view->get('errors', array()) + $error; |
|
| 166 | 166 | $manager->rollback(); |
| 167 | 167 | } |
| 168 | 168 | |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | * @param string|null $name Name of the sub-client (Default if null) |
| 178 | 178 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
| 179 | 179 | */ |
| 180 | - public function getSubClient( $type, $name = null ) |
|
| 180 | + public function getSubClient($type, $name = null) |
|
| 181 | 181 | { |
| 182 | 182 | /** admin/jqadm/product/category/decorators/excludes |
| 183 | 183 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | * @see admin/jqadm/product/category/decorators/excludes |
| 253 | 253 | * @see admin/jqadm/product/category/decorators/global |
| 254 | 254 | */ |
| 255 | - return $this->createSubClient( 'product/category/' . $type, $name ); |
|
| 255 | + return $this->createSubClient('product/category/' . $type, $name); |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | */ |
| 264 | 264 | protected function getSubClientNames() |
| 265 | 265 | { |
| 266 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 266 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | |
@@ -273,20 +273,20 @@ discard block |
||
| 273 | 273 | * @param array $listItems List of items implementing \Aimeos\Common\Item\Lists\Iface |
| 274 | 274 | * @return array Associative list of catalog IDs as keys and items implementing \Aimeos\Catalog\Item\Iface as values |
| 275 | 275 | */ |
| 276 | - protected function getCatalogItems( array $listItems ) |
|
| 276 | + protected function getCatalogItems(array $listItems) |
|
| 277 | 277 | { |
| 278 | 278 | $ids = array(); |
| 279 | 279 | |
| 280 | - foreach( $listItems as $listItem ) { |
|
| 280 | + foreach ($listItems as $listItem) { |
|
| 281 | 281 | $ids[] = $listItem->getParentId(); |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog' ); |
|
| 284 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog'); |
|
| 285 | 285 | |
| 286 | 286 | $search = $manager->createSearch(); |
| 287 | - $search->setConditions( $search->compare( '==', 'catalog.id', $ids ) ); |
|
| 287 | + $search->setConditions($search->compare('==', 'catalog.id', $ids)); |
|
| 288 | 288 | |
| 289 | - return $manager->searchItems( $search ); |
|
| 289 | + return $manager->searchItems($search); |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | |
@@ -296,19 +296,19 @@ discard block |
||
| 296 | 296 | * @param string $prodid Unique product ID |
| 297 | 297 | * @return array Associative list of category list IDs as keys and list items as values |
| 298 | 298 | */ |
| 299 | - protected function getListItems( $prodid ) |
|
| 299 | + protected function getListItems($prodid) |
|
| 300 | 300 | { |
| 301 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog/lists' ); |
|
| 301 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog/lists'); |
|
| 302 | 302 | |
| 303 | 303 | $search = $manager->createSearch(); |
| 304 | 304 | $expr = array( |
| 305 | - $search->compare( '==', 'catalog.lists.refid', $prodid ), |
|
| 306 | - $search->compare( '==', 'catalog.lists.domain', 'product' ), |
|
| 307 | - $search->compare( '==', 'catalog.lists.type.domain', 'product' ), |
|
| 305 | + $search->compare('==', 'catalog.lists.refid', $prodid), |
|
| 306 | + $search->compare('==', 'catalog.lists.domain', 'product'), |
|
| 307 | + $search->compare('==', 'catalog.lists.type.domain', 'product'), |
|
| 308 | 308 | ); |
| 309 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 309 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 310 | 310 | |
| 311 | - return $manager->searchItems( $search ); |
|
| 311 | + return $manager->searchItems($search); |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | |
@@ -320,13 +320,13 @@ discard block |
||
| 320 | 320 | protected function getListTypes() |
| 321 | 321 | { |
| 322 | 322 | $list = array(); |
| 323 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog/lists/type' ); |
|
| 323 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog/lists/type'); |
|
| 324 | 324 | |
| 325 | 325 | $search = $manager->createSearch(); |
| 326 | - $search->setConditions( $search->compare( '==', 'catalog.lists.type.domain', 'product' ) ); |
|
| 327 | - $search->setSlice( 0, 0x7fffffff ); |
|
| 326 | + $search->setConditions($search->compare('==', 'catalog.lists.type.domain', 'product')); |
|
| 327 | + $search->setSlice(0, 0x7fffffff); |
|
| 328 | 328 | |
| 329 | - foreach( $manager->searchItems( $search ) as $item ) { |
|
| 329 | + foreach ($manager->searchItems($search) as $item) { |
|
| 330 | 330 | $list[$item->getCode()] = $item->getId(); |
| 331 | 331 | } |
| 332 | 332 | |
@@ -339,29 +339,29 @@ discard block |
||
| 339 | 339 | * |
| 340 | 340 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
| 341 | 341 | */ |
| 342 | - protected function setData( \Aimeos\MW\View\Iface $view ) |
|
| 342 | + protected function setData(\Aimeos\MW\View\Iface $view) |
|
| 343 | 343 | { |
| 344 | - $view->categoryData = (array) $view->param( 'category', array() ); |
|
| 344 | + $view->categoryData = (array) $view->param('category', array()); |
|
| 345 | 345 | |
| 346 | - if( !empty( $view->categoryData ) ) { |
|
| 346 | + if (!empty($view->categoryData)) { |
|
| 347 | 347 | return; |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | - $listItems = $this->getListItems( $view->item->getId() ); |
|
| 351 | - $catItems = $this->getCatalogItems( $listItems ); |
|
| 350 | + $listItems = $this->getListItems($view->item->getId()); |
|
| 351 | + $catItems = $this->getCatalogItems($listItems); |
|
| 352 | 352 | $data = array(); |
| 353 | 353 | |
| 354 | - foreach( $listItems as $listItem ) |
|
| 354 | + foreach ($listItems as $listItem) |
|
| 355 | 355 | { |
| 356 | 356 | $catId = $listItem->getParentId(); |
| 357 | 357 | |
| 358 | - if( isset( $catItems[$catId] ) ) |
|
| 358 | + if (isset($catItems[$catId])) |
|
| 359 | 359 | { |
| 360 | 360 | $data['catalog.id'][] = $catId; |
| 361 | 361 | $data['catalog.label'][] = $catItems[$catId]->getLabel(); |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | - foreach( $listItem->toArray() as $key => $value ) { |
|
| 364 | + foreach ($listItem->toArray() as $key => $value) { |
|
| 365 | 365 | $data[$key][] = $value; |
| 366 | 366 | } |
| 367 | 367 | } |
@@ -376,36 +376,36 @@ discard block |
||
| 376 | 376 | * |
| 377 | 377 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
| 378 | 378 | */ |
| 379 | - protected function updateItems( \Aimeos\MW\View\Iface $view ) |
|
| 379 | + protected function updateItems(\Aimeos\MW\View\Iface $view) |
|
| 380 | 380 | { |
| 381 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog/lists' ); |
|
| 381 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog/lists'); |
|
| 382 | 382 | |
| 383 | 383 | $id = $view->item->getId(); |
| 384 | - $map = $this->getListItems( $id ); |
|
| 385 | - $listIds = (array) $view->param( 'category/catalog.lists.id', array() ); |
|
| 384 | + $map = $this->getListItems($id); |
|
| 385 | + $listIds = (array) $view->param('category/catalog.lists.id', array()); |
|
| 386 | 386 | |
| 387 | 387 | |
| 388 | - foreach( $listIds as $pos => $listid ) |
|
| 388 | + foreach ($listIds as $pos => $listid) |
|
| 389 | 389 | { |
| 390 | - if( isset( $map[$listid] ) ) { |
|
| 391 | - unset( $map[$listid], $listIds[$pos] ); |
|
| 390 | + if (isset($map[$listid])) { |
|
| 391 | + unset($map[$listid], $listIds[$pos]); |
|
| 392 | 392 | } |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | - $manager->deleteItems( array_keys( $map ) ); |
|
| 395 | + $manager->deleteItems(array_keys($map)); |
|
| 396 | 396 | |
| 397 | 397 | |
| 398 | 398 | $item = $manager->createItem(); |
| 399 | - $item->setDomain( 'product' ); |
|
| 400 | - $item->setRefId( $id ); |
|
| 399 | + $item->setDomain('product'); |
|
| 400 | + $item->setRefId($id); |
|
| 401 | 401 | |
| 402 | - foreach( $listIds as $pos => $listid ) |
|
| 402 | + foreach ($listIds as $pos => $listid) |
|
| 403 | 403 | { |
| 404 | - $item->setId( null ); |
|
| 405 | - $item->setParentId( $view->param( 'category/catalog.id/' . $pos ) ); |
|
| 406 | - $item->setTypeId( $view->param( 'category/catalog.lists.typeid/' . $pos ) ); |
|
| 404 | + $item->setId(null); |
|
| 405 | + $item->setParentId($view->param('category/catalog.id/' . $pos)); |
|
| 406 | + $item->setTypeId($view->param('category/catalog.lists.typeid/' . $pos)); |
|
| 407 | 407 | |
| 408 | - $manager->saveItem( $item, false ); |
|
| 408 | + $manager->saveItem($item, false); |
|
| 409 | 409 | } |
| 410 | 410 | } |
| 411 | 411 | } |
| 412 | 412 | \ No newline at end of file |
@@ -151,14 +151,12 @@ |
||
| 151 | 151 | |
| 152 | 152 | $manager->commit(); |
| 153 | 153 | return; |
| 154 | - } |
|
| 155 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 154 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 156 | 155 | { |
| 157 | 156 | $error = array( 'product-item-category' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 158 | 157 | $view->errors = $view->get( 'errors', array() ) + $error; |
| 159 | 158 | $manager->rollback(); |
| 160 | - } |
|
| 161 | - catch( \Exception $e ) |
|
| 159 | + } catch( \Exception $e ) |
|
| 162 | 160 | { |
| 163 | 161 | $context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() ); |
| 164 | 162 | $error = array( 'product-item-category' => $e->getMessage() ); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * @category Developer |
| 56 | 56 | */ |
| 57 | 57 | private $subPartPath = 'admin/jqadm/product/standard/subparts'; |
| 58 | - private $subPartNames = array( 'selection', 'bundle', 'image', 'text', 'price', 'stock', 'category', 'characteristic', 'physical', 'download' ); |
|
| 58 | + private $subPartNames = array('selection', 'bundle', 'image', 'text', 'price', 'stock', 'category', 'characteristic', 'physical', 'download'); |
|
| 59 | 59 | |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -70,39 +70,39 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | try |
| 72 | 72 | { |
| 73 | - $this->setData( $view ); |
|
| 73 | + $this->setData($view); |
|
| 74 | 74 | |
| 75 | - if( isset( $view->itemData['product.code'] ) ) |
|
| 75 | + if (isset($view->itemData['product.code'])) |
|
| 76 | 76 | { |
| 77 | 77 | $data = $view->itemData; |
| 78 | 78 | $data['product.id'] = ''; |
| 79 | 79 | $data['product.code'] = $data['product.code'] . '_copy'; |
| 80 | 80 | |
| 81 | - $view->item->setCode( $data['product.code'] ); |
|
| 81 | + $view->item->setCode($data['product.code']); |
|
| 82 | 82 | $view->itemData = $data; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $view->itemBody = ''; |
| 86 | 86 | |
| 87 | - foreach( $this->getSubClients() as $client ) { |
|
| 87 | + foreach ($this->getSubClients() as $client) { |
|
| 88 | 88 | $view->itemBody .= $client->copy(); |
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 91 | + catch (\Aimeos\MShop\Exception $e) |
|
| 92 | 92 | { |
| 93 | - $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 94 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
| 93 | + $error = array('product-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 94 | + $view->errors = $view->get('errors', array()) + $error; |
|
| 95 | 95 | } |
| 96 | - catch( \Exception $e ) |
|
| 96 | + catch (\Exception $e) |
|
| 97 | 97 | { |
| 98 | - $error = array( 'product-item' => $e->getMessage() ); |
|
| 99 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
| 98 | + $error = array('product-item' => $e->getMessage()); |
|
| 99 | + $view->errors = $view->get('errors', array()) + $error; |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | $tplconf = 'admin/jqadm/product/template-item'; |
| 103 | 103 | $default = 'product/item-default.php'; |
| 104 | 104 | |
| 105 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 105 | + return $view->render($view->config($tplconf, $default)); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
@@ -118,28 +118,28 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | try |
| 120 | 120 | { |
| 121 | - $this->setData( $view ); |
|
| 121 | + $this->setData($view); |
|
| 122 | 122 | $view->itemBody = ''; |
| 123 | 123 | |
| 124 | - foreach( $this->getSubClients() as $client ) { |
|
| 124 | + foreach ($this->getSubClients() as $client) { |
|
| 125 | 125 | $view->itemBody .= $client->create(); |
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 128 | + catch (\Aimeos\MShop\Exception $e) |
|
| 129 | 129 | { |
| 130 | - $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 131 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
| 130 | + $error = array('product-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 131 | + $view->errors = $view->get('errors', array()) + $error; |
|
| 132 | 132 | } |
| 133 | - catch( \Exception $e ) |
|
| 133 | + catch (\Exception $e) |
|
| 134 | 134 | { |
| 135 | - $error = array( 'product-item' => $e->getMessage() ); |
|
| 136 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
| 135 | + $error = array('product-item' => $e->getMessage()); |
|
| 136 | + $view->errors = $view->get('errors', array()) + $error; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | $tplconf = 'admin/jqadm/product/template-item'; |
| 140 | 140 | $default = 'product/item-default.php'; |
| 141 | 141 | |
| 142 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 142 | + return $view->render($view->config($tplconf, $default)); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | |
@@ -153,30 +153,30 @@ discard block |
||
| 153 | 153 | $view = $this->getView(); |
| 154 | 154 | $context = $this->getContext(); |
| 155 | 155 | |
| 156 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
| 156 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
| 157 | 157 | $manager->begin(); |
| 158 | 158 | |
| 159 | 159 | try |
| 160 | 160 | { |
| 161 | - foreach( $this->getSubClients() as $client ) { |
|
| 161 | + foreach ($this->getSubClients() as $client) { |
|
| 162 | 162 | $client->delete(); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - $manager->deleteItems( (array) $view->param( 'id' ) ); |
|
| 165 | + $manager->deleteItems((array) $view->param('id')); |
|
| 166 | 166 | $manager->commit(); |
| 167 | 167 | |
| 168 | 168 | return; |
| 169 | 169 | } |
| 170 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 170 | + catch (\Aimeos\MShop\Exception $e) |
|
| 171 | 171 | { |
| 172 | - $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 173 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
| 172 | + $error = array('product-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 173 | + $view->errors = $view->get('errors', array()) + $error; |
|
| 174 | 174 | $manager->rollback(); |
| 175 | 175 | } |
| 176 | - catch( \Exception $e ) |
|
| 176 | + catch (\Exception $e) |
|
| 177 | 177 | { |
| 178 | - $error = array( 'product-item' => $e->getMessage() ); |
|
| 179 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
| 178 | + $error = array('product-item' => $e->getMessage()); |
|
| 179 | + $view->errors = $view->get('errors', array()) + $error; |
|
| 180 | 180 | $manager->rollback(); |
| 181 | 181 | } |
| 182 | 182 | } |
@@ -194,28 +194,28 @@ discard block |
||
| 194 | 194 | |
| 195 | 195 | try |
| 196 | 196 | { |
| 197 | - $this->setData( $view ); |
|
| 197 | + $this->setData($view); |
|
| 198 | 198 | $view->itemBody = ''; |
| 199 | 199 | |
| 200 | - foreach( $this->getSubClients() as $client ) { |
|
| 200 | + foreach ($this->getSubClients() as $client) { |
|
| 201 | 201 | $view->itemBody .= $client->get(); |
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 204 | + catch (\Aimeos\MShop\Exception $e) |
|
| 205 | 205 | { |
| 206 | - $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 207 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
| 206 | + $error = array('product-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 207 | + $view->errors = $view->get('errors', array()) + $error; |
|
| 208 | 208 | } |
| 209 | - catch( \Exception $e ) |
|
| 209 | + catch (\Exception $e) |
|
| 210 | 210 | { |
| 211 | - $error = array( 'product-item' => $e->getMessage() ); |
|
| 212 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
| 211 | + $error = array('product-item' => $e->getMessage()); |
|
| 212 | + $view->errors = $view->get('errors', array()) + $error; |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | $tplconf = 'admin/jqadm/product/template-item'; |
| 216 | 216 | $default = 'product/item-default.php'; |
| 217 | 217 | |
| 218 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 218 | + return $view->render($view->config($tplconf, $default)); |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | |
@@ -229,41 +229,41 @@ discard block |
||
| 229 | 229 | $view = $this->getView(); |
| 230 | 230 | $context = $this->getContext(); |
| 231 | 231 | |
| 232 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
| 232 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
| 233 | 233 | $manager->begin(); |
| 234 | 234 | |
| 235 | 235 | $item = $manager->createItem(); |
| 236 | 236 | |
| 237 | 237 | try |
| 238 | 238 | { |
| 239 | - $item->fromArray( $view->param( 'item', array() ) ); |
|
| 240 | - $item->setConfig( $this->getItemConfig( $view ) ); |
|
| 241 | - $manager->saveItem( $item ); |
|
| 239 | + $item->fromArray($view->param('item', array())); |
|
| 240 | + $item->setConfig($this->getItemConfig($view)); |
|
| 241 | + $manager->saveItem($item); |
|
| 242 | 242 | |
| 243 | - $view->item = $manager->getItem( $item->getId() ); // product.type must be available |
|
| 243 | + $view->item = $manager->getItem($item->getId()); // product.type must be available |
|
| 244 | 244 | $view->itemBody = ''; |
| 245 | 245 | |
| 246 | - foreach( $this->getSubClients() as $client ) { |
|
| 246 | + foreach ($this->getSubClients() as $client) { |
|
| 247 | 247 | $view->itemBody .= $client->save(); |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | $manager->commit(); |
| 251 | 251 | return; |
| 252 | 252 | } |
| 253 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
| 253 | + catch (\Aimeos\Admin\JQAdm\Exception $e) |
|
| 254 | 254 | { |
| 255 | 255 | // fall through to create() |
| 256 | 256 | } |
| 257 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 257 | + catch (\Aimeos\MShop\Exception $e) |
|
| 258 | 258 | { |
| 259 | - $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 260 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
| 259 | + $error = array('product-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 260 | + $view->errors = $view->get('errors', array()) + $error; |
|
| 261 | 261 | $manager->rollback(); |
| 262 | 262 | } |
| 263 | - catch( \Exception $e ) |
|
| 263 | + catch (\Exception $e) |
|
| 264 | 264 | { |
| 265 | - $error = array( 'product-item' => $e->getMessage() ); |
|
| 266 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
| 265 | + $error = array('product-item' => $e->getMessage()); |
|
| 266 | + $view->errors = $view->get('errors', array()) + $error; |
|
| 267 | 267 | $manager->rollback(); |
| 268 | 268 | } |
| 269 | 269 | |
@@ -284,34 +284,34 @@ discard block |
||
| 284 | 284 | try |
| 285 | 285 | { |
| 286 | 286 | $total = 0; |
| 287 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
| 288 | - $search = $this->initCriteria( $manager->createSearch(), $view->param() ); |
|
| 287 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
| 288 | + $search = $this->initCriteria($manager->createSearch(), $view->param()); |
|
| 289 | 289 | |
| 290 | 290 | $view->pageParams = $this->getClientParams(); |
| 291 | - $view->items = $manager->searchItems( $search, array(), $total ); |
|
| 291 | + $view->items = $manager->searchItems($search, array(), $total); |
|
| 292 | 292 | $view->filterOperators = $search->getOperators(); |
| 293 | 293 | $view->total = $total; |
| 294 | 294 | $view->itemBody = ''; |
| 295 | 295 | |
| 296 | - foreach( $this->getSubClients() as $client ) { |
|
| 296 | + foreach ($this->getSubClients() as $client) { |
|
| 297 | 297 | $view->itemBody .= $client->search(); |
| 298 | 298 | } |
| 299 | 299 | } |
| 300 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 300 | + catch (\Aimeos\MShop\Exception $e) |
|
| 301 | 301 | { |
| 302 | - $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 303 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
| 302 | + $error = array('product-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 303 | + $view->errors = $view->get('errors', array()) + $error; |
|
| 304 | 304 | } |
| 305 | - catch( \Exception $e ) |
|
| 305 | + catch (\Exception $e) |
|
| 306 | 306 | { |
| 307 | - $error = array( 'product-item' => $e->getMessage() ); |
|
| 308 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
| 307 | + $error = array('product-item' => $e->getMessage()); |
|
| 308 | + $view->errors = $view->get('errors', array()) + $error; |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | $tplconf = 'admin/jqadm/product/template-list'; |
| 312 | 312 | $default = 'product/list-default.php'; |
| 313 | 313 | |
| 314 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 314 | + return $view->render($view->config($tplconf, $default)); |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | * @param string|null $name Name of the sub-client (Default if null) |
| 323 | 323 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
| 324 | 324 | */ |
| 325 | - public function getSubClient( $type, $name = null ) |
|
| 325 | + public function getSubClient($type, $name = null) |
|
| 326 | 326 | { |
| 327 | 327 | /** admin/jqadm/product/decorators/excludes |
| 328 | 328 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | * @see admin/jqadm/product/decorators/excludes |
| 398 | 398 | * @see admin/jqadm/product/decorators/global |
| 399 | 399 | */ |
| 400 | - return $this->createSubClient( 'product/' . $type, $name ); |
|
| 400 | + return $this->createSubClient('product/' . $type, $name); |
|
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | |
@@ -407,17 +407,17 @@ discard block |
||
| 407 | 407 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
| 408 | 408 | * @return array Multi-dimensional associative array |
| 409 | 409 | */ |
| 410 | - protected function setData( \Aimeos\MW\View\Iface $view ) |
|
| 410 | + protected function setData(\Aimeos\MW\View\Iface $view) |
|
| 411 | 411 | { |
| 412 | 412 | $context = $this->getContext(); |
| 413 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
| 413 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
| 414 | 414 | |
| 415 | 415 | $view->pageParams = $this->getClientParams(); |
| 416 | - $view->itemData = (array) $view->param( 'item', array() ); |
|
| 416 | + $view->itemData = (array) $view->param('item', array()); |
|
| 417 | 417 | $view->itemTypes = $this->getTypeItems(); |
| 418 | 418 | $view->item = $manager->createItem(); |
| 419 | 419 | |
| 420 | - if( !empty( $view->itemData ) || ( $id = $view->param( 'id' ) ) === null ) { |
|
| 420 | + if (!empty($view->itemData) || ($id = $view->param('id')) === null) { |
|
| 421 | 421 | return; |
| 422 | 422 | } |
| 423 | 423 | |
@@ -432,14 +432,14 @@ discard block |
||
| 432 | 432 | * @since 2016.01 |
| 433 | 433 | * @category Developer |
| 434 | 434 | */ |
| 435 | - $domains = array( 'attribute', 'media', 'price', 'product', 'text' ); |
|
| 436 | - $domains = $context->getConfig()->get( 'admin/jqadm/product/domains', $domains ); |
|
| 437 | - $item = $manager->getItem( $id, $domains ); |
|
| 435 | + $domains = array('attribute', 'media', 'price', 'product', 'text'); |
|
| 436 | + $domains = $context->getConfig()->get('admin/jqadm/product/domains', $domains); |
|
| 437 | + $item = $manager->getItem($id, $domains); |
|
| 438 | 438 | |
| 439 | 439 | $data = $item->toArray(); |
| 440 | - $data['config'] = array( 'key' => array(), 'val' => array() ); |
|
| 440 | + $data['config'] = array('key' => array(), 'val' => array()); |
|
| 441 | 441 | |
| 442 | - foreach( $item->getConfig() as $key => $value ) |
|
| 442 | + foreach ($item->getConfig() as $key => $value) |
|
| 443 | 443 | { |
| 444 | 444 | $data['config']['key'][] = $key; |
| 445 | 445 | $data['config']['val'][] = $value; |
@@ -456,14 +456,14 @@ discard block |
||
| 456 | 456 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
| 457 | 457 | * @return array Associative list of key/value pairs |
| 458 | 458 | */ |
| 459 | - protected function getItemConfig( \Aimeos\MW\View\Iface $view ) |
|
| 459 | + protected function getItemConfig(\Aimeos\MW\View\Iface $view) |
|
| 460 | 460 | { |
| 461 | 461 | $config = array(); |
| 462 | 462 | |
| 463 | - foreach( (array) $view->param( 'item/config/key' ) as $idx => $key ) |
|
| 463 | + foreach ((array) $view->param('item/config/key') as $idx => $key) |
|
| 464 | 464 | { |
| 465 | - if( trim( $key ) !== '' ) { |
|
| 466 | - $config[$key] = $view->param( 'item/config/val/' . $idx ); |
|
| 465 | + if (trim($key) !== '') { |
|
| 466 | + $config[$key] = $view->param('item/config/val/' . $idx); |
|
| 467 | 467 | } |
| 468 | 468 | } |
| 469 | 469 | |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | */ |
| 479 | 479 | protected function getSubClientNames() |
| 480 | 480 | { |
| 481 | - $result = $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 481 | + $result = $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 482 | 482 | return $result; |
| 483 | 483 | } |
| 484 | 484 | |
@@ -490,11 +490,11 @@ discard block |
||
| 490 | 490 | */ |
| 491 | 491 | protected function getTypeItems() |
| 492 | 492 | { |
| 493 | - $typeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/type' ); |
|
| 493 | + $typeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/type'); |
|
| 494 | 494 | |
| 495 | 495 | $search = $typeManager->createSearch(); |
| 496 | - $search->setSortations( array( $search->sort( '+', 'product.type.label' ) ) ); |
|
| 496 | + $search->setSortations(array($search->sort('+', 'product.type.label'))); |
|
| 497 | 497 | |
| 498 | - return $typeManager->searchItems( $search ); |
|
| 498 | + return $typeManager->searchItems($search); |
|
| 499 | 499 | } |
| 500 | 500 | } |
@@ -87,13 +87,11 @@ discard block |
||
| 87 | 87 | foreach( $this->getSubClients() as $client ) { |
| 88 | 88 | $view->itemBody .= $client->copy(); |
| 89 | 89 | } |
| 90 | - } |
|
| 91 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 90 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 92 | 91 | { |
| 93 | 92 | $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 94 | 93 | $view->errors = $view->get( 'errors', array() ) + $error; |
| 95 | - } |
|
| 96 | - catch( \Exception $e ) |
|
| 94 | + } catch( \Exception $e ) |
|
| 97 | 95 | { |
| 98 | 96 | $error = array( 'product-item' => $e->getMessage() ); |
| 99 | 97 | $view->errors = $view->get( 'errors', array() ) + $error; |
@@ -124,13 +122,11 @@ discard block |
||
| 124 | 122 | foreach( $this->getSubClients() as $client ) { |
| 125 | 123 | $view->itemBody .= $client->create(); |
| 126 | 124 | } |
| 127 | - } |
|
| 128 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 125 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 129 | 126 | { |
| 130 | 127 | $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 131 | 128 | $view->errors = $view->get( 'errors', array() ) + $error; |
| 132 | - } |
|
| 133 | - catch( \Exception $e ) |
|
| 129 | + } catch( \Exception $e ) |
|
| 134 | 130 | { |
| 135 | 131 | $error = array( 'product-item' => $e->getMessage() ); |
| 136 | 132 | $view->errors = $view->get( 'errors', array() ) + $error; |
@@ -166,14 +162,12 @@ discard block |
||
| 166 | 162 | $manager->commit(); |
| 167 | 163 | |
| 168 | 164 | return; |
| 169 | - } |
|
| 170 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 165 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 171 | 166 | { |
| 172 | 167 | $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 173 | 168 | $view->errors = $view->get( 'errors', array() ) + $error; |
| 174 | 169 | $manager->rollback(); |
| 175 | - } |
|
| 176 | - catch( \Exception $e ) |
|
| 170 | + } catch( \Exception $e ) |
|
| 177 | 171 | { |
| 178 | 172 | $error = array( 'product-item' => $e->getMessage() ); |
| 179 | 173 | $view->errors = $view->get( 'errors', array() ) + $error; |
@@ -200,13 +194,11 @@ discard block |
||
| 200 | 194 | foreach( $this->getSubClients() as $client ) { |
| 201 | 195 | $view->itemBody .= $client->get(); |
| 202 | 196 | } |
| 203 | - } |
|
| 204 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 197 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 205 | 198 | { |
| 206 | 199 | $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 207 | 200 | $view->errors = $view->get( 'errors', array() ) + $error; |
| 208 | - } |
|
| 209 | - catch( \Exception $e ) |
|
| 201 | + } catch( \Exception $e ) |
|
| 210 | 202 | { |
| 211 | 203 | $error = array( 'product-item' => $e->getMessage() ); |
| 212 | 204 | $view->errors = $view->get( 'errors', array() ) + $error; |
@@ -249,18 +241,15 @@ discard block |
||
| 249 | 241 | |
| 250 | 242 | $manager->commit(); |
| 251 | 243 | return; |
| 252 | - } |
|
| 253 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
| 244 | + } catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
| 254 | 245 | { |
| 255 | 246 | // fall through to create() |
| 256 | - } |
|
| 257 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 247 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 258 | 248 | { |
| 259 | 249 | $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 260 | 250 | $view->errors = $view->get( 'errors', array() ) + $error; |
| 261 | 251 | $manager->rollback(); |
| 262 | - } |
|
| 263 | - catch( \Exception $e ) |
|
| 252 | + } catch( \Exception $e ) |
|
| 264 | 253 | { |
| 265 | 254 | $error = array( 'product-item' => $e->getMessage() ); |
| 266 | 255 | $view->errors = $view->get( 'errors', array() ) + $error; |
@@ -296,13 +285,11 @@ discard block |
||
| 296 | 285 | foreach( $this->getSubClients() as $client ) { |
| 297 | 286 | $view->itemBody .= $client->search(); |
| 298 | 287 | } |
| 299 | - } |
|
| 300 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 288 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 301 | 289 | { |
| 302 | 290 | $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 303 | 291 | $view->errors = $view->get( 'errors', array() ) + $error; |
| 304 | - } |
|
| 305 | - catch( \Exception $e ) |
|
| 292 | + } catch( \Exception $e ) |
|
| 306 | 293 | { |
| 307 | 294 | $error = array( 'product-item' => $e->getMessage() ); |
| 308 | 295 | $view->errors = $view->get( 'errors', array() ) + $error; |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | /** |
| 64 | 64 | * Copies a resource |
| 65 | 65 | * |
| 66 | - * @return string|null admin output to display or null for redirecting to the list |
|
| 66 | + * @return string admin output to display or null for redirecting to the list |
|
| 67 | 67 | */ |
| 68 | 68 | public function copy() |
| 69 | 69 | { |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | /** |
| 87 | 87 | * Creates a new resource |
| 88 | 88 | * |
| 89 | - * @return string|null admin output to display or null for redirecting to the list |
|
| 89 | + * @return string admin output to display or null for redirecting to the list |
|
| 90 | 90 | */ |
| 91 | 91 | public function create() |
| 92 | 92 | { |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | /** |
| 110 | 110 | * Returns a single resource |
| 111 | 111 | * |
| 112 | - * @return string|null admin output to display or null for redirecting to the list |
|
| 112 | + * @return string admin output to display or null for redirecting to the list |
|
| 113 | 113 | */ |
| 114 | 114 | public function get() |
| 115 | 115 | { |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @return \Aimeos\Admin\JQAdm\Iface Filter part implementing \Aimeos\Admin\JQAdm\Iface |
| 31 | 31 | * @throws \Aimeos\Admin\JQAdm\Exception If requested client implementation couldn't be found or initialisation fails |
| 32 | 32 | */ |
| 33 | - public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null ) |
|
| 33 | + public static function createClient(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null) |
|
| 34 | 34 | { |
| 35 | 35 | /** admin/jqadm/product/name |
| 36 | 36 | * Class name of the used account favorite client implementation |
@@ -65,22 +65,22 @@ discard block |
||
| 65 | 65 | * @since 2016.01 |
| 66 | 66 | * @category Developer |
| 67 | 67 | */ |
| 68 | - if( $name === null ) { |
|
| 69 | - $name = $context->getConfig()->get( 'admin/jqadm/product/name', 'Standard' ); |
|
| 68 | + if ($name === null) { |
|
| 69 | + $name = $context->getConfig()->get('admin/jqadm/product/name', 'Standard'); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - if( ctype_alnum( $name ) === false ) |
|
| 72 | + if (ctype_alnum($name) === false) |
|
| 73 | 73 | { |
| 74 | - $classname = is_string( $name ) ? '\\Aimeos\\Admin\\JQAdm\\Product\\' . $name : '<not a string>'; |
|
| 75 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 74 | + $classname = is_string($name) ? '\\Aimeos\\Admin\\JQAdm\\Product\\' . $name : '<not a string>'; |
|
| 75 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | $iface = '\\Aimeos\\Admin\\JQAdm\\Iface'; |
| 79 | 79 | $classname = '\\Aimeos\\Admin\\JQAdm\\Product\\' . $name; |
| 80 | 80 | |
| 81 | - $client = self::createClientBase( $context, $classname, $iface, $templatePaths ); |
|
| 81 | + $client = self::createClientBase($context, $classname, $iface, $templatePaths); |
|
| 82 | 82 | |
| 83 | - return self::addClientDecorators( $context, $client, $templatePaths, 'product' ); |
|
| 83 | + return self::addClientDecorators($context, $client, $templatePaths, 'product'); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | } |
| 87 | 87 | \ No newline at end of file |
@@ -29,8 +29,8 @@ |
||
| 29 | 29 | * and a list of relative paths inside the core or the extension as values |
| 30 | 30 | * @param \Aimeos\Admin\JQAdm\Iface $client Admin object |
| 31 | 31 | */ |
| 32 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths ) |
|
| 32 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths) |
|
| 33 | 33 | { |
| 34 | - parent::__construct( $context, $templatePaths ); |
|
| 34 | + parent::__construct($context, $templatePaths); |
|
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | \ No newline at end of file |
@@ -28,5 +28,5 @@ |
||
| 28 | 28 | * and a list of relative paths inside the core or the extension as values |
| 29 | 29 | * @return void |
| 30 | 30 | */ |
| 31 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths ); |
|
| 31 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths); |
|
| 32 | 32 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @param string $classname Full name of the class for which the object should be returned |
| 31 | 31 | * @param \Aimeos\Admin\JQAdm\Iface|null $client ExtJS client object |
| 32 | 32 | */ |
| 33 | - public static function injectClient( $classname, \Aimeos\Admin\JQAdm\Iface $client = null ) |
|
| 33 | + public static function injectClient($classname, \Aimeos\Admin\JQAdm\Iface $client = null) |
|
| 34 | 34 | { |
| 35 | 35 | self::$objects[$classname] = $client; |
| 36 | 36 | } |
@@ -46,29 +46,29 @@ discard block |
||
| 46 | 46 | * @param string $classprefix Decorator class prefix, e.g. "\Aimeos\Admin\JQAdm\Catalog\Decorator\" |
| 47 | 47 | * @return \Aimeos\Admin\JQAdm\Iface Admin object |
| 48 | 48 | */ |
| 49 | - protected static function addDecorators( \Aimeos\MShop\Context\Item\Iface $context, |
|
| 50 | - \Aimeos\Admin\JQAdm\Iface $client, array $templatePaths, array $decorators, $classprefix ) |
|
| 49 | + protected static function addDecorators(\Aimeos\MShop\Context\Item\Iface $context, |
|
| 50 | + \Aimeos\Admin\JQAdm\Iface $client, array $templatePaths, array $decorators, $classprefix) |
|
| 51 | 51 | { |
| 52 | 52 | $iface = '\\Aimeos\\Admin\\JQAdm\\Common\\Decorator\\Iface'; |
| 53 | 53 | |
| 54 | - foreach( $decorators as $name ) |
|
| 54 | + foreach ($decorators as $name) |
|
| 55 | 55 | { |
| 56 | - if( ctype_alnum( $name ) === false ) |
|
| 56 | + if (ctype_alnum($name) === false) |
|
| 57 | 57 | { |
| 58 | - $classname = is_string( $name ) ? $classprefix . $name : '<not a string>'; |
|
| 59 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid class name "%1$s"', $classname ) ); |
|
| 58 | + $classname = is_string($name) ? $classprefix . $name : '<not a string>'; |
|
| 59 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid class name "%1$s"', $classname)); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | $classname = $classprefix . $name; |
| 63 | 63 | |
| 64 | - if( class_exists( $classname ) === false ) { |
|
| 65 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); |
|
| 64 | + if (class_exists($classname) === false) { |
|
| 65 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Class "%1$s" not found', $classname)); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - $client = new $classname( $client, $context, $templatePaths ); |
|
| 68 | + $client = new $classname($client, $context, $templatePaths); |
|
| 69 | 69 | |
| 70 | - if( !( $client instanceof $iface ) ) { |
|
| 71 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Class "%1$s" does not implement "%2$s"', $classname, $iface ) ); |
|
| 70 | + if (!($client instanceof $iface)) { |
|
| 71 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Class "%1$s" does not implement "%2$s"', $classname, $iface)); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
@@ -85,14 +85,14 @@ discard block |
||
| 85 | 85 | * @param string $path Path of the client in lower case, e.g. "catalog/detail" |
| 86 | 86 | * @return \Aimeos\Admin\JQAdm\Iface Admin object |
| 87 | 87 | */ |
| 88 | - protected static function addClientDecorators( \Aimeos\MShop\Context\Item\Iface $context, |
|
| 89 | - \Aimeos\Admin\JQAdm\Iface $client, array $templatePaths, $path ) |
|
| 88 | + protected static function addClientDecorators(\Aimeos\MShop\Context\Item\Iface $context, |
|
| 89 | + \Aimeos\Admin\JQAdm\Iface $client, array $templatePaths, $path) |
|
| 90 | 90 | { |
| 91 | - if( !is_string( $path ) || $path === '' ) { |
|
| 92 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid domain "%1$s"', $path ) ); |
|
| 91 | + if (!is_string($path) || $path === '') { |
|
| 92 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid domain "%1$s"', $path)); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - $localClass = str_replace( ' ', '\\', ucwords( str_replace( '/', ' ', $path ) ) ); |
|
| 95 | + $localClass = str_replace(' ', '\\', ucwords(str_replace('/', ' ', $path))); |
|
| 96 | 96 | $config = $context->getConfig(); |
| 97 | 97 | |
| 98 | 98 | /** admin/jqadm/common/decorators/default |
@@ -117,26 +117,26 @@ discard block |
||
| 117 | 117 | * @since 2014.03 |
| 118 | 118 | * @category Developer |
| 119 | 119 | */ |
| 120 | - $decorators = $config->get( 'admin/jqadm/common/decorators/default', array() ); |
|
| 121 | - $excludes = $config->get( 'admin/jqadm/' . $path . '/decorators/excludes', array() ); |
|
| 120 | + $decorators = $config->get('admin/jqadm/common/decorators/default', array()); |
|
| 121 | + $excludes = $config->get('admin/jqadm/' . $path . '/decorators/excludes', array()); |
|
| 122 | 122 | |
| 123 | - foreach( $decorators as $key => $name ) |
|
| 123 | + foreach ($decorators as $key => $name) |
|
| 124 | 124 | { |
| 125 | - if( in_array( $name, $excludes ) ) { |
|
| 126 | - unset( $decorators[$key] ); |
|
| 125 | + if (in_array($name, $excludes)) { |
|
| 126 | + unset($decorators[$key]); |
|
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | $classprefix = '\\Aimeos\\Admin\\JQAdm\\Common\\Decorator\\'; |
| 131 | - $client = self::addDecorators( $context, $client, $templatePaths, $decorators, $classprefix ); |
|
| 131 | + $client = self::addDecorators($context, $client, $templatePaths, $decorators, $classprefix); |
|
| 132 | 132 | |
| 133 | 133 | $classprefix = '\\Aimeos\\Admin\\JQAdm\\Common\\Decorator\\'; |
| 134 | - $decorators = $config->get( 'admin/jqadm/' . $path . '/decorators/global', array() ); |
|
| 135 | - $client = self::addDecorators( $context, $client, $templatePaths, $decorators, $classprefix ); |
|
| 134 | + $decorators = $config->get('admin/jqadm/' . $path . '/decorators/global', array()); |
|
| 135 | + $client = self::addDecorators($context, $client, $templatePaths, $decorators, $classprefix); |
|
| 136 | 136 | |
| 137 | 137 | $classprefix = '\\Aimeos\\Admin\\JQAdm\\' . $localClass . '\\Decorator\\'; |
| 138 | - $decorators = $config->get( 'admin/jqadm/' . $path . '/decorators/local', array() ); |
|
| 139 | - $client = self::addDecorators( $context, $client, $templatePaths, $decorators, $classprefix ); |
|
| 138 | + $decorators = $config->get('admin/jqadm/' . $path . '/decorators/local', array()); |
|
| 139 | + $client = self::addDecorators($context, $client, $templatePaths, $decorators, $classprefix); |
|
| 140 | 140 | |
| 141 | 141 | return $client; |
| 142 | 142 | } |
@@ -152,20 +152,20 @@ discard block |
||
| 152 | 152 | * @return \Aimeos\Admin\JQAdm\\Iface Admin object |
| 153 | 153 | * @throws \Aimeos\Admin\JQAdm\Exception If client couldn't be found or doesn't implement the interface |
| 154 | 154 | */ |
| 155 | - protected static function createClientBase( \Aimeos\MShop\Context\Item\Iface $context, $classname, $interface, $templatePaths ) |
|
| 155 | + protected static function createClientBase(\Aimeos\MShop\Context\Item\Iface $context, $classname, $interface, $templatePaths) |
|
| 156 | 156 | { |
| 157 | - if( isset( self::$objects[$classname] ) ) { |
|
| 157 | + if (isset(self::$objects[$classname])) { |
|
| 158 | 158 | return self::$objects[$classname]; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - if( class_exists( $classname ) === false ) { |
|
| 162 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Class "%1$s" not available', $classname ) ); |
|
| 161 | + if (class_exists($classname) === false) { |
|
| 162 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Class "%1$s" not available', $classname)); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - $client = new $classname( $context, $templatePaths ); |
|
| 165 | + $client = new $classname($context, $templatePaths); |
|
| 166 | 166 | |
| 167 | - if( !( $client instanceof $interface ) ) { |
|
| 168 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Class "%1$s" does not implement interface "%2$s"', $classname, $interface ) ); |
|
| 167 | + if (!($client instanceof $interface)) { |
|
| 168 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Class "%1$s" does not implement interface "%2$s"', $classname, $interface)); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | return $client; |
@@ -27,5 +27,5 @@ |
||
| 27 | 27 | * @param string $name Admin name (from configuration or "Standard" if null) |
| 28 | 28 | * @return \Aimeos\Admin\JQAdm\Iface New client object |
| 29 | 29 | */ |
| 30 | - public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null ); |
|
| 30 | + public static function createClient(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null); |
|
| 31 | 31 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * Creates a new resource |
| 75 | 75 | * |
| 76 | 76 | * @return string|null admin output to display or null for redirecting to the list |
| 77 | - */ |
|
| 77 | + */ |
|
| 78 | 78 | public function create() |
| 79 | 79 | { |
| 80 | 80 | return $this->client->create(); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * Deletes a resource |
| 86 | 86 | * |
| 87 | 87 | * @return string|null admin output to display or null for redirecting to the list |
| 88 | - */ |
|
| 88 | + */ |
|
| 89 | 89 | public function delete() |
| 90 | 90 | { |
| 91 | 91 | return $this->client->delete(); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * Returns a single resource |
| 97 | 97 | * |
| 98 | 98 | * @return string|null admin output to display or null for redirecting to the list |
| 99 | - */ |
|
| 99 | + */ |
|
| 100 | 100 | public function get() |
| 101 | 101 | { |
| 102 | 102 | return $this->client->get(); |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * Saves the data |
| 108 | 108 | * |
| 109 | 109 | * @return string|null admin output to display or null for redirecting to the list |
| 110 | - */ |
|
| 110 | + */ |
|
| 111 | 111 | public function save() |
| 112 | 112 | { |
| 113 | 113 | return $this->client->save(); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * Returns a list of resource according to the conditions |
| 119 | 119 | * |
| 120 | 120 | * @return string admin output to display |
| 121 | - */ |
|
| 121 | + */ |
|
| 122 | 122 | public function search() |
| 123 | 123 | { |
| 124 | 124 | return $this->client->search(); |
@@ -32,10 +32,10 @@ discard block |
||
| 32 | 32 | * @param array $templatePaths Associative list of the file system paths to the core or the extensions as key |
| 33 | 33 | * and a list of relative paths inside the core or the extension as values |
| 34 | 34 | */ |
| 35 | - public function __construct( \Aimeos\Admin\JQAdm\Iface $client, |
|
| 36 | - \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths ) |
|
| 35 | + public function __construct(\Aimeos\Admin\JQAdm\Iface $client, |
|
| 36 | + \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths) |
|
| 37 | 37 | { |
| 38 | - parent::__construct( $context, $templatePaths ); |
|
| 38 | + parent::__construct($context, $templatePaths); |
|
| 39 | 39 | |
| 40 | 40 | $this->client = $client; |
| 41 | 41 | } |
@@ -49,10 +49,10 @@ discard block |
||
| 49 | 49 | * @return mixed Returns the value of the called method |
| 50 | 50 | * @throws \Aimeos\Admin\JQAdm\Exception If method call failed |
| 51 | 51 | */ |
| 52 | - public function __call( $name, array $param ) |
|
| 52 | + public function __call($name, array $param) |
|
| 53 | 53 | { |
| 54 | - if( ( $result = call_user_func_array( array( $this->client, $name ), $param ) ) === false ) { |
|
| 55 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Unable to call method "%1$s"', $name ) ); |
|
| 54 | + if (($result = call_user_func_array(array($this->client, $name), $param)) === false) { |
|
| 55 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Unable to call method "%1$s"', $name)); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | return $result; |
@@ -132,9 +132,9 @@ discard block |
||
| 132 | 132 | * @param string|null $name Name of the sub-client (Default if null) |
| 133 | 133 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
| 134 | 134 | */ |
| 135 | - public function getSubClient( $type, $name = null ) |
|
| 135 | + public function getSubClient($type, $name = null) |
|
| 136 | 136 | { |
| 137 | - return $this->client->getSubClient( $type, $name ); |
|
| 137 | + return $this->client->getSubClient($type, $name); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | |
@@ -155,9 +155,9 @@ discard block |
||
| 155 | 155 | * @param \Aimeos\MW\View\Iface $view The view object which generates the admin output |
| 156 | 156 | * @return \Aimeos\Admin\JQAdm\Iface Reference to this object for fluent calls |
| 157 | 157 | */ |
| 158 | - public function setView( \Aimeos\MW\View\Iface $view ) |
|
| 158 | + public function setView(\Aimeos\MW\View\Iface $view) |
|
| 159 | 159 | { |
| 160 | - $this->client->setView( $view ); |
|
| 160 | + $this->client->setView($view); |
|
| 161 | 161 | return $this; |
| 162 | 162 | } |
| 163 | 163 | |