@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param integer &$status Variable which contains the HTTP status afterwards |
109 | 109 | * @return string Content for response body |
110 | 110 | */ |
111 | - public function get( $body, array &$header, &$status ) |
|
111 | + public function get($body, array &$header, &$status) |
|
112 | 112 | { |
113 | 113 | /** admin/jsonadm/partials/order/template-data |
114 | 114 | * Relative path to the data partial template file for the order client |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | * @since 2016.01 |
126 | 126 | * @category Developer |
127 | 127 | */ |
128 | - $this->getView()->assign( array( 'partial-data' => 'admin/jsonadm/partials/order/template-data' ) ); |
|
128 | + $this->getView()->assign(array('partial-data' => 'admin/jsonadm/partials/order/template-data')); |
|
129 | 129 | |
130 | - return parent::get( $body, $header, $status ); |
|
130 | + return parent::get($body, $header, $status); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
@@ -138,35 +138,35 @@ discard block |
||
138 | 138 | * @param array $include List of resource types that should be fetched |
139 | 139 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface |
140 | 140 | */ |
141 | - protected function getChildItems( array $items, array $include ) |
|
141 | + protected function getChildItems(array $items, array $include) |
|
142 | 142 | { |
143 | 143 | $list = array(); |
144 | 144 | |
145 | - if( in_array( 'order/base', $include ) ) |
|
145 | + if (in_array('order/base', $include)) |
|
146 | 146 | { |
147 | 147 | $ids = array(); |
148 | 148 | |
149 | - foreach( $items as $item ) { |
|
149 | + foreach ($items as $item) { |
|
150 | 150 | $ids[] = $item->getBaseId(); |
151 | 151 | } |
152 | 152 | |
153 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base' ); |
|
153 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base'); |
|
154 | 154 | |
155 | 155 | $search = $manager->createSearch(); |
156 | - $search->setConditions( $search->compare( '==', 'order.base.id', $ids ) ); |
|
156 | + $search->setConditions($search->compare('==', 'order.base.id', $ids)); |
|
157 | 157 | |
158 | - $list = array_merge( $list, $manager->searchItems( $search ) ); |
|
158 | + $list = array_merge($list, $manager->searchItems($search)); |
|
159 | 159 | } |
160 | 160 | |
161 | - if( in_array( 'order/status', $include ) ) |
|
161 | + if (in_array('order/status', $include)) |
|
162 | 162 | { |
163 | - $ids = array_keys( $items ); |
|
164 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/status' ); |
|
163 | + $ids = array_keys($items); |
|
164 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/status'); |
|
165 | 165 | |
166 | 166 | $search = $manager->createSearch(); |
167 | - $search->setConditions( $search->compare( '==', 'order.status.parentid', $ids ) ); |
|
167 | + $search->setConditions($search->compare('==', 'order.status.parentid', $ids)); |
|
168 | 168 | |
169 | - $list = array_merge( $list, $manager->searchItems( $search ) ); |
|
169 | + $list = array_merge($list, $manager->searchItems($search)); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | return $list; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param integer &$status Variable which contains the HTTP status afterwards |
109 | 109 | * @return string Content for response body |
110 | 110 | */ |
111 | - public function get( $body, array &$header, &$status ) |
|
111 | + public function get($body, array &$header, &$status) |
|
112 | 112 | { |
113 | 113 | /** admin/jsonadm/partials/order/base/template-data |
114 | 114 | * Relative path to the data partial template file for the order base client |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | * @since 2016.01 |
126 | 126 | * @category Developer |
127 | 127 | */ |
128 | - $this->getView()->assign( array( 'partial-data' => 'admin/jsonadm/partials/order/base/template-data' ) ); |
|
128 | + $this->getView()->assign(array('partial-data' => 'admin/jsonadm/partials/order/base/template-data')); |
|
129 | 129 | |
130 | - return parent::get( $body, $header, $status ); |
|
130 | + return parent::get($body, $header, $status); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
@@ -138,21 +138,21 @@ discard block |
||
138 | 138 | * @param array $include List of resource types that should be fetched |
139 | 139 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Iface |
140 | 140 | */ |
141 | - protected function getChildItems( array $items, array $include ) |
|
141 | + protected function getChildItems(array $items, array $include) |
|
142 | 142 | { |
143 | 143 | $list = array(); |
144 | - $ids = array_keys( $items ); |
|
145 | - $keys = array( 'order/base/address', 'order/base/coupon', 'order/base/product', 'order/base/service' ); |
|
146 | - $include = array_intersect( $include, $keys ); |
|
144 | + $ids = array_keys($items); |
|
145 | + $keys = array('order/base/address', 'order/base/coupon', 'order/base/product', 'order/base/service'); |
|
146 | + $include = array_intersect($include, $keys); |
|
147 | 147 | |
148 | - foreach( $include as $type ) |
|
148 | + foreach ($include as $type) |
|
149 | 149 | { |
150 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $type ); |
|
150 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $type); |
|
151 | 151 | |
152 | 152 | $search = $manager->createSearch(); |
153 | - $search->setConditions( $search->compare( '==', str_replace( '/', '.', $type ) . '.baseid', $ids ) ); |
|
153 | + $search->setConditions($search->compare('==', str_replace('/', '.', $type) . '.baseid', $ids)); |
|
154 | 154 | |
155 | - $list = array_merge( $list, $manager->searchItems( $search ) ); |
|
155 | + $list = array_merge($list, $manager->searchItems($search)); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | return $list; |
@@ -107,17 +107,17 @@ |
||
107 | 107 | * @param array $include List of resource types that should be fetched |
108 | 108 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface |
109 | 109 | */ |
110 | - protected function getListItems( array $items, array $include ) |
|
110 | + protected function getListItems(array $items, array $include) |
|
111 | 111 | { |
112 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'text/lists' ); |
|
112 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'text/lists'); |
|
113 | 113 | |
114 | 114 | $search = $manager->createSearch(); |
115 | 115 | $expr = array( |
116 | - $search->compare( '==', 'text.lists.parentid', array_keys( $items ) ), |
|
117 | - $search->compare( '==', 'text.lists.domain', $include ), |
|
116 | + $search->compare('==', 'text.lists.parentid', array_keys($items)), |
|
117 | + $search->compare('==', 'text.lists.domain', $include), |
|
118 | 118 | ); |
119 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
119 | + $search->setConditions($search->combine('&&', $expr)); |
|
120 | 120 | |
121 | - return $manager->searchItems( $search ); |
|
121 | + return $manager->searchItems($search); |
|
122 | 122 | } |
123 | 123 | } |
@@ -107,17 +107,17 @@ |
||
107 | 107 | * @param array $include List of resource types that should be fetched |
108 | 108 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface |
109 | 109 | */ |
110 | - protected function getListItems( array $items, array $include ) |
|
110 | + protected function getListItems(array $items, array $include) |
|
111 | 111 | { |
112 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'price/lists' ); |
|
112 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'price/lists'); |
|
113 | 113 | |
114 | 114 | $search = $manager->createSearch(); |
115 | 115 | $expr = array( |
116 | - $search->compare( '==', 'price.lists.parentid', array_keys( $items ) ), |
|
117 | - $search->compare( '==', 'price.lists.domain', $include ), |
|
116 | + $search->compare('==', 'price.lists.parentid', array_keys($items)), |
|
117 | + $search->compare('==', 'price.lists.domain', $include), |
|
118 | 118 | ); |
119 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
119 | + $search->setConditions($search->combine('&&', $expr)); |
|
120 | 120 | |
121 | - return $manager->searchItems( $search ); |
|
121 | + return $manager->searchItems($search); |
|
122 | 122 | } |
123 | 123 | } |
@@ -33,11 +33,11 @@ discard block |
||
33 | 33 | * @param integer $id Context ID the objects have been created with (string of \Aimeos\MShop\Context\Item\Iface) |
34 | 34 | * @param string $path Path describing the client to clear, e.g. "product/lists/type" |
35 | 35 | */ |
36 | - static public function clear( $id = null, $path = null ) |
|
36 | + static public function clear($id = null, $path = null) |
|
37 | 37 | { |
38 | - if( $id !== null ) |
|
38 | + if ($id !== null) |
|
39 | 39 | { |
40 | - if( $path !== null ) { |
|
40 | + if ($path !== null) { |
|
41 | 41 | self::$clients[$id][$path] = null; |
42 | 42 | } else { |
43 | 43 | self::$clients[$id] = array(); |
@@ -64,47 +64,47 @@ discard block |
||
64 | 64 | * @param string|null $name Name of the client implementation ("Standard" if null) |
65 | 65 | * @throws \Aimeos\Admin\JsonAdm\Exception If the given path is invalid |
66 | 66 | */ |
67 | - static public function createClient( \Aimeos\MShop\Context\Item\Iface $context, |
|
68 | - array $templatePaths, $path, $name = null ) |
|
67 | + static public function createClient(\Aimeos\MShop\Context\Item\Iface $context, |
|
68 | + array $templatePaths, $path, $name = null) |
|
69 | 69 | { |
70 | - $path = strtolower( trim( $path, "/ \n\t\r\0\x0B" ) ); |
|
70 | + $path = strtolower(trim($path, "/ \n\t\r\0\x0B")); |
|
71 | 71 | |
72 | - if( empty( $path ) ) { |
|
73 | - return self::createClientRoot( $context, $context->getView(), $templatePaths, $path, $name ); |
|
72 | + if (empty($path)) { |
|
73 | + return self::createClientRoot($context, $context->getView(), $templatePaths, $path, $name); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | $id = (string) $context; |
77 | 77 | |
78 | - if( self::$cache === false || !isset( self::$clients[$id][$path] ) ) |
|
78 | + if (self::$cache === false || !isset(self::$clients[$id][$path])) |
|
79 | 79 | { |
80 | - $parts = explode( '/', $path ); |
|
80 | + $parts = explode('/', $path); |
|
81 | 81 | |
82 | - foreach( $parts as $key => $part ) |
|
82 | + foreach ($parts as $key => $part) |
|
83 | 83 | { |
84 | - if( ctype_alnum( $part ) === false ) |
|
84 | + if (ctype_alnum($part) === false) |
|
85 | 85 | { |
86 | - $msg = sprintf( 'Invalid client "%1$s" in "%2$s"', $part, $path ); |
|
87 | - throw new \Aimeos\Admin\JsonAdm\Exception( $msg, 400 ); |
|
86 | + $msg = sprintf('Invalid client "%1$s" in "%2$s"', $part, $path); |
|
87 | + throw new \Aimeos\Admin\JsonAdm\Exception($msg, 400); |
|
88 | 88 | } |
89 | 89 | |
90 | - $parts[$key] = ucwords( $part ); |
|
90 | + $parts[$key] = ucwords($part); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
94 | 94 | $view = $context->getView(); |
95 | - $factory = '\\Aimeos\\Admin\\JsonAdm\\' . join( '\\', $parts ) . '\\Factory'; |
|
95 | + $factory = '\\Aimeos\\Admin\\JsonAdm\\' . join('\\', $parts) . '\\Factory'; |
|
96 | 96 | |
97 | - if( class_exists( $factory ) === true ) |
|
97 | + if (class_exists($factory) === true) |
|
98 | 98 | { |
99 | - $args = array( $context, $view, $templatePaths, $path, $name ); |
|
99 | + $args = array($context, $view, $templatePaths, $path, $name); |
|
100 | 100 | |
101 | - if( ( $client = @call_user_func_array( array( $factory, 'createClient' ), $args ) ) === false ) { |
|
102 | - throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid factory "%1$s"', $factory ), 400 ); |
|
101 | + if (($client = @call_user_func_array(array($factory, 'createClient'), $args)) === false) { |
|
102 | + throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Invalid factory "%1$s"', $factory), 400); |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | else |
106 | 106 | { |
107 | - $client = self::createClientRoot( $context, $view, $templatePaths, $path, $name ); |
|
107 | + $client = self::createClientRoot($context, $view, $templatePaths, $path, $name); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * @param boolean $value True to enable caching, false to disable it. |
122 | 122 | * @return boolean Previous cache setting |
123 | 123 | */ |
124 | - static public function setCache( $value ) |
|
124 | + static public function setCache($value) |
|
125 | 125 | { |
126 | 126 | $old = self::$cache; |
127 | 127 | self::$cache = (boolean) $value; |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | * @param string|null $name Name of the JsonAdm client (default: "Standard") |
141 | 141 | * @throws \Aimeos\Admin\JsonAdm\Exception If the client couldn't be created |
142 | 142 | */ |
143 | - protected static function createClientRoot( \Aimeos\MShop\Context\Item\Iface $context, |
|
144 | - \Aimeos\MW\View\Iface $view, array $templatePaths, $path, $name = null ) |
|
143 | + protected static function createClientRoot(\Aimeos\MShop\Context\Item\Iface $context, |
|
144 | + \Aimeos\MW\View\Iface $view, array $templatePaths, $path, $name = null) |
|
145 | 145 | { |
146 | 146 | /** admin/jsonadm/name |
147 | 147 | * Class name of the used JSON API client implementation |
@@ -176,20 +176,20 @@ discard block |
||
176 | 176 | * @since 2015.12 |
177 | 177 | * @category Developer |
178 | 178 | */ |
179 | - if( $name === null ) { |
|
180 | - $name = $context->getConfig()->get( 'admin/jsonadm/name', 'Standard' ); |
|
179 | + if ($name === null) { |
|
180 | + $name = $context->getConfig()->get('admin/jsonadm/name', 'Standard'); |
|
181 | 181 | } |
182 | 182 | |
183 | - if( ctype_alnum( $name ) === false ) |
|
183 | + if (ctype_alnum($name) === false) |
|
184 | 184 | { |
185 | - $classname = is_string( $name ) ? '\\Aimeos\\Admin\\JsonAdm\\' . $name : '<not a string>'; |
|
186 | - throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid class name "%1$s"', $classname ) ); |
|
185 | + $classname = is_string($name) ? '\\Aimeos\\Admin\\JsonAdm\\' . $name : '<not a string>'; |
|
186 | + throw new \Aimeos\Admin\JsonAdm\Exception(sprintf('Invalid class name "%1$s"', $classname)); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | $iface = '\\Aimeos\\Admin\\JsonAdm\\Iface'; |
190 | 190 | $classname = '\\Aimeos\\Admin\\JsonAdm\\' . $name; |
191 | 191 | |
192 | - $client = self::createClientBase( $classname, $iface, $context, $view, $templatePaths, $path ); |
|
192 | + $client = self::createClientBase($classname, $iface, $context, $view, $templatePaths, $path); |
|
193 | 193 | |
194 | 194 | /** admin/jsonadm/decorators/excludes |
195 | 195 | * Excludes decorators added by the "common" option from the JSON API clients |
@@ -269,6 +269,6 @@ discard block |
||
269 | 269 | * @see admin/jsonadm/decorators/global |
270 | 270 | */ |
271 | 271 | |
272 | - return self::addClientDecorators( $client, $context, $view, $templatePaths, $path ); |
|
272 | + return self::addClientDecorators($client, $context, $view, $templatePaths, $path); |
|
273 | 273 | } |
274 | 274 | } |
@@ -101,8 +101,7 @@ |
||
101 | 101 | if( ( $client = @call_user_func_array( array( $factory, 'createClient' ), $args ) ) === false ) { |
102 | 102 | throw new \Aimeos\Admin\JsonAdm\Exception( sprintf( 'Invalid factory "%1$s"', $factory ), 400 ); |
103 | 103 | } |
104 | - } |
|
105 | - else |
|
104 | + } else |
|
106 | 105 | { |
107 | 106 | $client = self::createClientRoot( $context, $view, $templatePaths, $path, $name ); |
108 | 107 | } |
@@ -107,17 +107,17 @@ |
||
107 | 107 | * @param array $include List of resource types that should be fetched |
108 | 108 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface |
109 | 109 | */ |
110 | - protected function getListItems( array $items, array $include ) |
|
110 | + protected function getListItems(array $items, array $include) |
|
111 | 111 | { |
112 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'attribute/lists' ); |
|
112 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'attribute/lists'); |
|
113 | 113 | |
114 | 114 | $search = $manager->createSearch(); |
115 | 115 | $expr = array( |
116 | - $search->compare( '==', 'attribute.lists.parentid', array_keys( $items ) ), |
|
117 | - $search->compare( '==', 'attribute.lists.domain', $include ), |
|
116 | + $search->compare('==', 'attribute.lists.parentid', array_keys($items)), |
|
117 | + $search->compare('==', 'attribute.lists.domain', $include), |
|
118 | 118 | ); |
119 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
119 | + $search->setConditions($search->combine('&&', $expr)); |
|
120 | 120 | |
121 | - return $manager->searchItems( $search ); |
|
121 | + return $manager->searchItems($search); |
|
122 | 122 | } |
123 | 123 | } |
@@ -107,17 +107,17 @@ |
||
107 | 107 | * @param array $include List of resource types that should be fetched |
108 | 108 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface |
109 | 109 | */ |
110 | - protected function getListItems( array $items, array $include ) |
|
110 | + protected function getListItems(array $items, array $include) |
|
111 | 111 | { |
112 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service/lists' ); |
|
112 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service/lists'); |
|
113 | 113 | |
114 | 114 | $search = $manager->createSearch(); |
115 | 115 | $expr = array( |
116 | - $search->compare( '==', 'service.lists.parentid', array_keys( $items ) ), |
|
117 | - $search->compare( '==', 'service.lists.domain', $include ), |
|
116 | + $search->compare('==', 'service.lists.parentid', array_keys($items)), |
|
117 | + $search->compare('==', 'service.lists.domain', $include), |
|
118 | 118 | ); |
119 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
119 | + $search->setConditions($search->combine('&&', $expr)); |
|
120 | 120 | |
121 | - return $manager->searchItems( $search ); |
|
121 | + return $manager->searchItems($search); |
|
122 | 122 | } |
123 | 123 | } |
@@ -107,17 +107,17 @@ |
||
107 | 107 | * @param array $include List of resource types that should be fetched |
108 | 108 | * @return array List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface |
109 | 109 | */ |
110 | - protected function getListItems( array $items, array $include ) |
|
110 | + protected function getListItems(array $items, array $include) |
|
111 | 111 | { |
112 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'media/lists' ); |
|
112 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'media/lists'); |
|
113 | 113 | |
114 | 114 | $search = $manager->createSearch(); |
115 | 115 | $expr = array( |
116 | - $search->compare( '==', 'media.lists.parentid', array_keys( $items ) ), |
|
117 | - $search->compare( '==', 'media.lists.domain', $include ), |
|
116 | + $search->compare('==', 'media.lists.parentid', array_keys($items)), |
|
117 | + $search->compare('==', 'media.lists.domain', $include), |
|
118 | 118 | ); |
119 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
119 | + $search->setConditions($search->combine('&&', $expr)); |
|
120 | 120 | |
121 | - return $manager->searchItems( $search ); |
|
121 | + return $manager->searchItems($search); |
|
122 | 122 | } |
123 | 123 | } |
@@ -33,15 +33,15 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @param \Aimeos\MW\View\Iface $view View instance with registered view helpers |
35 | 35 | */ |
36 | - public function __construct( \Aimeos\MW\View\Iface $view ) |
|
36 | + public function __construct(\Aimeos\MW\View\Iface $view) |
|
37 | 37 | { |
38 | - parent::__construct( $view ); |
|
38 | + parent::__construct($view); |
|
39 | 39 | |
40 | - $this->target = $this->config( 'admin/jsonadm/url/target' ); |
|
41 | - $this->cntl = $this->config( 'admin/jsonadm/url/controller', 'jsonadm' ); |
|
42 | - $this->action = $this->config( 'admin/jsonadm/url/action', 'get' ); |
|
43 | - $this->config = $this->config( 'admin/jsonadm/url/config', array() ); |
|
44 | - $this->maxlimit = $this->config( 'admin/jsonadm/limit', 100 ); |
|
40 | + $this->target = $this->config('admin/jsonadm/url/target'); |
|
41 | + $this->cntl = $this->config('admin/jsonadm/url/controller', 'jsonadm'); |
|
42 | + $this->action = $this->config('admin/jsonadm/url/action', 'get'); |
|
43 | + $this->config = $this->config('admin/jsonadm/url/config', array()); |
|
44 | + $this->maxlimit = $this->config('admin/jsonadm/limit', 100); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | |
@@ -52,46 +52,46 @@ discard block |
||
52 | 52 | * @param integer $total Total number of items |
53 | 53 | * @return array List of pagination links |
54 | 54 | */ |
55 | - public function transform( array $params, $total ) |
|
55 | + public function transform(array $params, $total) |
|
56 | 56 | { |
57 | - $ref = array( 'id', 'resource', 'filter', 'page', 'sort', 'include', 'fields' ); |
|
58 | - $params = array_intersect_key( $params, array_flip( $ref ) ); |
|
57 | + $ref = array('id', 'resource', 'filter', 'page', 'sort', 'include', 'fields'); |
|
58 | + $params = array_intersect_key($params, array_flip($ref)); |
|
59 | 59 | |
60 | 60 | // set explicitly as workaround for the Laravel router bugs |
61 | - if( !isset( $params['id'] ) ) { |
|
61 | + if (!isset($params['id'])) { |
|
62 | 62 | $params['id'] = ''; |
63 | 63 | } |
64 | 64 | |
65 | - $total = $this->get( 'total', 0 ); |
|
66 | - $offset = ( isset( $params['offset'] ) ? max( (int) $params['offset'], 0 ) : 0 ); |
|
67 | - $limit = ( isset( $params['limit'] ) ? max( (int) $params['limit'], 1 ) : $this->maxlimit ); |
|
65 | + $total = $this->get('total', 0); |
|
66 | + $offset = (isset($params['offset']) ? max((int) $params['offset'], 0) : 0); |
|
67 | + $limit = (isset($params['limit']) ? max((int) $params['limit'], 1) : $this->maxlimit); |
|
68 | 68 | |
69 | - if( $offset > 0 ) |
|
69 | + if ($offset > 0) |
|
70 | 70 | { |
71 | 71 | $params['page']['offset'] = 0; |
72 | - $list['first'] = $this->url( $this->target, $this->cntl, $this->action, $params, array(), $this->config ); |
|
72 | + $list['first'] = $this->url($this->target, $this->cntl, $this->action, $params, array(), $this->config); |
|
73 | 73 | } |
74 | 74 | |
75 | - if( ( $num = $offset - $limit ) >= 0 ) |
|
75 | + if (($num = $offset - $limit) >= 0) |
|
76 | 76 | { |
77 | 77 | $params['page']['offset'] = $num; |
78 | - $list['prev'] = $this->url( $this->target, $this->cntl, $this->action, $params, array(), $this->config ); |
|
78 | + $list['prev'] = $this->url($this->target, $this->cntl, $this->action, $params, array(), $this->config); |
|
79 | 79 | } |
80 | 80 | |
81 | - if( ( $num = $offset + $limit ) < $total ) |
|
81 | + if (($num = $offset + $limit) < $total) |
|
82 | 82 | { |
83 | 83 | $params['page']['offset'] = $num; |
84 | - $list['next'] = $this->url( $this->target, $this->cntl, $this->action, $params, array(), $this->config ); |
|
84 | + $list['next'] = $this->url($this->target, $this->cntl, $this->action, $params, array(), $this->config); |
|
85 | 85 | } |
86 | 86 | |
87 | - if( ( $num = ((int) ($total / $limit)) * $limit ) > $offset ) |
|
87 | + if (($num = ((int) ($total / $limit)) * $limit) > $offset) |
|
88 | 88 | { |
89 | 89 | $params['page']['offset'] = $num; |
90 | - $list['last'] = $this->url( $this->target, $this->cntl, $this->action, $params, array(), $this->config ); |
|
90 | + $list['last'] = $this->url($this->target, $this->cntl, $this->action, $params, array(), $this->config); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | $params['page']['offset'] = $offset; |
94 | - $list['self'] = $this->url( $this->target, $this->cntl, $this->action, $params, array(), $this->config ); |
|
94 | + $list['self'] = $this->url($this->target, $this->cntl, $this->action, $params, array(), $this->config); |
|
95 | 95 | |
96 | 96 | return $list; |
97 | 97 | } |