Skip to content

Commit e11eacb

Browse files
author
fuze
committed
добавлен параметр выключения разбивки на страницы
1 parent c68b908 commit e11eacb

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

package/system/controllers/api/api_actions/api_content_get.php

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ class actionContentApiContentGet extends cmsAction {
2929
array('digits')
3030
)
3131
),
32+
'is_not_paginated' => array(
33+
'default' => 0,
34+
'rules' => array(
35+
array('digits')
36+
)
37+
),
3238
'cat_id' => array(
3339
'default' => 1,
3440
'rules' => array(
@@ -146,11 +152,13 @@ public function run($ctype_name){
146152
$page = $this->request->get('page');
147153
$hide_root = !empty($this->ctype['options']['is_empty_root']) && $this->cat['id'] == 1;
148154

149-
// разбивка на страницы
150-
$this->result['paging'] = array(
151-
'page' => $page,
152-
'per_page' => $perpage
153-
);
155+
// разбивка на страницы если нужна
156+
if(!$this->request->get('is_not_paginated')){
157+
$this->result['paging'] = array(
158+
'page' => $page,
159+
'per_page' => $perpage
160+
);
161+
}
154162

155163
// если записи в корне мы не показываем
156164
if($hide_root){ return; }
@@ -252,7 +260,11 @@ public function run($ctype_name){
252260
}
253261

254262
// Постраничный вывод
255-
$this->model->limitPage($page, $perpage);
263+
if($this->request->get('is_not_paginated')){
264+
$this->model->limit(0);
265+
} else {
266+
$this->model->limitPage($page, $perpage);
267+
}
256268

257269
list($this->ctype, $this->model) = cmsEventsManager::hook('content_list_filter', array($this->ctype, $this->model));
258270
list($this->ctype, $this->model) = cmsEventsManager::hook("content_{$this->ctype['name']}_list_filter", array($this->ctype, $this->model));

0 commit comments

Comments
 (0)