@@ -101,8 +101,7 @@ |
||
| 101 | 101 | $decorators = $config->get( 'admin/jsonadm/' . $dpath . 'decorators/local', [] ); |
| 102 | 102 | $client = self::addDecorators( $client, $decorators, $classprefix, $context, $view, $templatePaths, $path ); |
| 103 | 103 | } |
| 104 | - } |
|
| 105 | - else |
|
| 104 | + } else |
|
| 106 | 105 | { |
| 107 | 106 | $classprefix = '\\Aimeos\\Admin\\JsonAdm\\Common\\Decorator\\'; |
| 108 | 107 | $client = self::addDecorators( $client, $decorators, $classprefix, $context, $view, $templatePaths, $path ); |
@@ -39,24 +39,21 @@ discard block |
||
| 39 | 39 | { |
| 40 | 40 | $response = $this->deleteItems( $view, $request, $response ); |
| 41 | 41 | $status = 200; |
| 42 | - } |
|
| 43 | - catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
| 42 | + } catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
| 44 | 43 | { |
| 45 | 44 | $status = $e->getCode(); |
| 46 | 45 | $view->errors = array( array( |
| 47 | 46 | 'title' => $this->getContext()->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ), |
| 48 | 47 | 'detail' => $e->getTraceAsString(), |
| 49 | 48 | ) ); |
| 50 | - } |
|
| 51 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 49 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 52 | 50 | { |
| 53 | 51 | $status = 404; |
| 54 | 52 | $view->errors = array( array( |
| 55 | 53 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
| 56 | 54 | 'detail' => $e->getTraceAsString(), |
| 57 | 55 | ) ); |
| 58 | - } |
|
| 59 | - catch( \Exception $e ) |
|
| 56 | + } catch( \Exception $e ) |
|
| 60 | 57 | { |
| 61 | 58 | $status = 500; |
| 62 | 59 | $view->errors = array( array( |
@@ -116,16 +113,14 @@ discard block |
||
| 116 | 113 | { |
| 117 | 114 | $response = $this->getItems( $view, $request, $response ); |
| 118 | 115 | $status = 200; |
| 119 | - } |
|
| 120 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 116 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 121 | 117 | { |
| 122 | 118 | $status = 404; |
| 123 | 119 | $view->errors = array( array( |
| 124 | 120 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
| 125 | 121 | 'detail' => $e->getTraceAsString(), |
| 126 | 122 | ) ); |
| 127 | - } |
|
| 128 | - catch( \Exception $e ) |
|
| 123 | + } catch( \Exception $e ) |
|
| 129 | 124 | { |
| 130 | 125 | $status = 500; |
| 131 | 126 | $view->errors = array( array( |
@@ -163,8 +158,7 @@ discard block |
||
| 163 | 158 | */ |
| 164 | 159 | $tplconf = 'admin/jsonadm/standard/template-aggregate'; |
| 165 | 160 | $default = 'aggregate-default.php'; |
| 166 | - } |
|
| 167 | - else |
|
| 161 | + } else |
|
| 168 | 162 | { |
| 169 | 163 | /** admin/jsonadm/standard/template-get |
| 170 | 164 | * Relative path to the JSON API template for GET requests |
@@ -218,24 +212,21 @@ discard block |
||
| 218 | 212 | { |
| 219 | 213 | $response = $this->patchItems( $view, $request, $response ); |
| 220 | 214 | $status = 200; |
| 221 | - } |
|
| 222 | - catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
| 215 | + } catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
| 223 | 216 | { |
| 224 | 217 | $status = $e->getCode(); |
| 225 | 218 | $view->errors = array( array( |
| 226 | 219 | 'title' => $this->getContext()->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ), |
| 227 | 220 | 'detail' => $e->getTraceAsString(), |
| 228 | 221 | ) ); |
| 229 | - } |
|
| 230 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 222 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 231 | 223 | { |
| 232 | 224 | $status = 404; |
| 233 | 225 | $view->errors = array( array( |
| 234 | 226 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
| 235 | 227 | 'detail' => $e->getTraceAsString(), |
| 236 | 228 | ) ); |
| 237 | - } |
|
| 238 | - catch( \Exception $e ) |
|
| 229 | + } catch( \Exception $e ) |
|
| 239 | 230 | { |
| 240 | 231 | $status = 500; |
| 241 | 232 | $view->errors = array( array( |
@@ -295,24 +286,21 @@ discard block |
||
| 295 | 286 | { |
| 296 | 287 | $response = $this->postItems( $view, $request, $response ); |
| 297 | 288 | $status = 201; |
| 298 | - } |
|
| 299 | - catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
| 289 | + } catch( \Aimeos\Admin\JsonAdm\Exception $e ) |
|
| 300 | 290 | { |
| 301 | 291 | $status = $e->getCode(); |
| 302 | 292 | $view->errors = array( array( |
| 303 | 293 | 'title' => $this->getContext()->getI18n()->dt( 'admin/jsonadm', $e->getMessage() ), |
| 304 | 294 | 'detail' => $e->getTraceAsString(), |
| 305 | 295 | ) ); |
| 306 | - } |
|
| 307 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 296 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 308 | 297 | { |
| 309 | 298 | $status = 404; |
| 310 | 299 | $view->errors = array( array( |
| 311 | 300 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
| 312 | 301 | 'detail' => $e->getTraceAsString(), |
| 313 | 302 | ) ); |
| 314 | - } |
|
| 315 | - catch( \Exception $e ) |
|
| 303 | + } catch( \Exception $e ) |
|
| 316 | 304 | { |
| 317 | 305 | $status = 500; |
| 318 | 306 | $view->errors = array( array( |
@@ -438,16 +426,14 @@ discard block |
||
| 438 | 426 | $view->attributes = $attributes; |
| 439 | 427 | |
| 440 | 428 | $status = 200; |
| 441 | - } |
|
| 442 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 429 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 443 | 430 | { |
| 444 | 431 | $status = 404; |
| 445 | 432 | $view->errors = array( array( |
| 446 | 433 | 'title' => $context->getI18n()->dt( 'mshop', $e->getMessage() ), |
| 447 | 434 | 'detail' => $e->getTraceAsString(), |
| 448 | 435 | ) ); |
| 449 | - } |
|
| 450 | - catch( \Exception $e ) |
|
| 436 | + } catch( \Exception $e ) |
|
| 451 | 437 | { |
| 452 | 438 | $status = 500; |
| 453 | 439 | $view->errors = array( array( |
@@ -517,8 +503,7 @@ discard block |
||
| 517 | 503 | $ids = $this->getIds( $payload ); |
| 518 | 504 | $manager->deleteItems( $ids ); |
| 519 | 505 | $view->total = count( $ids ); |
| 520 | - } |
|
| 521 | - else |
|
| 506 | + } else |
|
| 522 | 507 | { |
| 523 | 508 | $manager->deleteItem( $id ); |
| 524 | 509 | $view->total = 1; |
@@ -556,8 +541,7 @@ discard block |
||
| 556 | 541 | $view->data = $manager->searchItems( $search, [], $total ); |
| 557 | 542 | $view->childItems = $this->getChildItems( $view->data, $include ); |
| 558 | 543 | $view->listItems = $this->getListItems( $view->data, $include ); |
| 559 | - } |
|
| 560 | - else |
|
| 544 | + } else |
|
| 561 | 545 | { |
| 562 | 546 | $view->data = $manager->getItem( $id, [] ); |
| 563 | 547 | $view->childItems = $this->getChildItems( array( $id => $view->data ), $include ); |
@@ -597,16 +581,14 @@ discard block |
||
| 597 | 581 | $view->data = $data; |
| 598 | 582 | $view->total = count( $data ); |
| 599 | 583 | $response = $response->withHeader( 'Content-Type', 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"' ); |
| 600 | - } |
|
| 601 | - elseif( ( $id = $view->param( 'id' ) ) != null ) |
|
| 584 | + } elseif( ( $id = $view->param( 'id' ) ) != null ) |
|
| 602 | 585 | { |
| 603 | 586 | $payload->data->id = $id; |
| 604 | 587 | $data = $this->saveEntry( $manager, $payload->data ); |
| 605 | 588 | |
| 606 | 589 | $view->data = $data; |
| 607 | 590 | $view->total = 1; |
| 608 | - } |
|
| 609 | - else |
|
| 591 | + } else |
|
| 610 | 592 | { |
| 611 | 593 | throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'No ID given' ), 400 ); |
| 612 | 594 | } |
@@ -645,8 +627,7 @@ discard block |
||
| 645 | 627 | $view->data = $data; |
| 646 | 628 | $view->total = count( $data ); |
| 647 | 629 | $response = $response->withHeader( 'Content-Type', 'application/vnd.api+json; ext="bulk"; supported-ext="bulk"' ); |
| 648 | - } |
|
| 649 | - else |
|
| 630 | + } else |
|
| 650 | 631 | { |
| 651 | 632 | $payload->data->id = null; |
| 652 | 633 | $data = $this->saveEntry( $manager, $payload->data ); |
@@ -89,12 +89,10 @@ |
||
| 89 | 89 | foreach( $data as $item ) { |
| 90 | 90 | $response[] = $build( $item, $childItems, $listItems ); |
| 91 | 91 | } |
| 92 | -} |
|
| 93 | -elseif( $data !== null ) |
|
| 92 | +} elseif( $data !== null ) |
|
| 94 | 93 | { |
| 95 | 94 | $response = $build( $data, $childItems, $listItems ); |
| 96 | -} |
|
| 97 | -else |
|
| 95 | +} else |
|
| 98 | 96 | { |
| 99 | 97 | $response = null; |
| 100 | 98 | } |
@@ -79,12 +79,10 @@ |
||
| 79 | 79 | foreach( $data as $item ) { |
| 80 | 80 | $response[] = $build( $item, $childItems ); |
| 81 | 81 | } |
| 82 | -} |
|
| 83 | -elseif( $data !== null ) |
|
| 82 | +} elseif( $data !== null ) |
|
| 84 | 83 | { |
| 85 | 84 | $response = $build( $data, $childItems ); |
| 86 | -} |
|
| 87 | -else |
|
| 85 | +} else |
|
| 88 | 86 | { |
| 89 | 87 | $response = null; |
| 90 | 88 | } |
@@ -85,12 +85,10 @@ |
||
| 85 | 85 | foreach( $data as $item ) { |
| 86 | 86 | $response[] = $build( $item, $listItems ); |
| 87 | 87 | } |
| 88 | -} |
|
| 89 | -elseif( $data !== null ) |
|
| 88 | +} elseif( $data !== null ) |
|
| 90 | 89 | { |
| 91 | 90 | $response = $build( $data, $listItems ); |
| 92 | -} |
|
| 93 | -else |
|
| 91 | +} else |
|
| 94 | 92 | { |
| 95 | 93 | $response = null; |
| 96 | 94 | } |
@@ -66,12 +66,10 @@ |
||
| 66 | 66 | foreach( $data as $item ) { |
| 67 | 67 | $response[] = $build( $item ); |
| 68 | 68 | } |
| 69 | -} |
|
| 70 | -elseif( $data !== null ) |
|
| 69 | +} elseif( $data !== null ) |
|
| 71 | 70 | { |
| 72 | 71 | $response = $build( $data ); |
| 73 | -} |
|
| 74 | -else |
|
| 72 | +} else |
|
| 75 | 73 | { |
| 76 | 74 | $response = null; |
| 77 | 75 | } |
@@ -79,12 +79,10 @@ |
||
| 79 | 79 | foreach( $data as $item ) { |
| 80 | 80 | $response[] = $build( $item, $childItems ); |
| 81 | 81 | } |
| 82 | -} |
|
| 83 | -elseif( $data !== null ) |
|
| 82 | +} elseif( $data !== null ) |
|
| 84 | 83 | { |
| 85 | 84 | $response = $build( $data, $childItems ); |
| 86 | -} |
|
| 87 | -else |
|
| 85 | +} else |
|
| 88 | 86 | { |
| 89 | 87 | $response = null; |
| 90 | 88 | } |
@@ -118,16 +118,14 @@ |
||
| 118 | 118 | { |
| 119 | 119 | $response = $this->getItems( $view, $request, $response ); |
| 120 | 120 | $status = 200; |
| 121 | - } |
|
| 122 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 121 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 123 | 122 | { |
| 124 | 123 | $status = 404; |
| 125 | 124 | $view->errors = array( array( |
| 126 | 125 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
| 127 | 126 | 'detail' => $e->getTraceAsString(), |
| 128 | 127 | ) ); |
| 129 | - } |
|
| 130 | - catch( \Exception $e ) |
|
| 128 | + } catch( \Exception $e ) |
|
| 131 | 129 | { |
| 132 | 130 | $status = 500; |
| 133 | 131 | $view->errors = array( array( |
@@ -59,9 +59,12 @@ |
||
| 59 | 59 | |
| 60 | 60 | , "errors": <?= $this->partial( $this->config( $this->get( 'partial-errors', 'admin/jsonadm/partials/template-errors' ), 'partials/errors-standard.php' ), array( 'errors' => $this->errors ) ); ?> |
| 61 | 61 | |
| 62 | - <?php else : ?> |
|
| 62 | + <?php else { |
|
| 63 | + : ?> |
|
| 63 | 64 | |
| 64 | - , "data": <?= json_encode( $build( $configItems, $this->param( 'id' ) ), $options ); ?> |
|
| 65 | + , "data": <?= json_encode( $build( $configItems, $this->param( 'id' ) ), $options ); |
|
| 66 | +} |
|
| 67 | +?> |
|
| 65 | 68 | |
| 66 | 69 | <?php endif; ?> |
| 67 | 70 | } |