@@ 29-54 (lines=26) @@ | ||
26 | * @return string |
|
27 | * @throws \Ffcms\Core\Exception\SyntaxException |
|
28 | */ |
|
29 | public function actionIndex() |
|
30 | { |
|
31 | // init Active Record |
|
32 | $query = new ProfileRecords(); |
|
33 | ||
34 | // set current page and offset |
|
35 | $page = (int)App::$Request->query->get('page'); |
|
36 | $offset = $page * self::ITEM_PER_PAGE; |
|
37 | ||
38 | // build pagination |
|
39 | $pagination = new SimplePagination([ |
|
40 | 'url' => ['profile/index'], |
|
41 | 'page' => $page, |
|
42 | 'step' => self::ITEM_PER_PAGE, |
|
43 | 'total' => $query->count() |
|
44 | ]); |
|
45 | ||
46 | // build listing objects |
|
47 | $records = $query->orderBy('id', 'desc')->skip($offset)->take(self::ITEM_PER_PAGE)->get(); |
|
48 | ||
49 | // display viewer |
|
50 | return App::$View->render('index', [ |
|
51 | 'records' => $records, |
|
52 | 'pagination' => $pagination |
|
53 | ]); |
|
54 | } |
|
55 | ||
56 | /** |
|
57 | * Redirect to user controller |
@@ 30-55 (lines=26) @@ | ||
27 | * @return string |
|
28 | * @throws \Ffcms\Core\Exception\SyntaxException |
|
29 | */ |
|
30 | public function actionIndex() |
|
31 | { |
|
32 | // init Active Record |
|
33 | $query = new UserRecords(); |
|
34 | ||
35 | // set current page and offset |
|
36 | $page = (int)App::$Request->query->get('page'); |
|
37 | $offset = $page * self::ITEM_PER_PAGE; |
|
38 | ||
39 | // build pagination |
|
40 | $pagination = new SimplePagination([ |
|
41 | 'url' => ['user/index'], |
|
42 | 'page' => $page, |
|
43 | 'step' => self::ITEM_PER_PAGE, |
|
44 | 'total' => $query->count() |
|
45 | ]); |
|
46 | ||
47 | // build listing objects |
|
48 | $records = $query->orderBy('id', 'desc')->skip($offset)->take(self::ITEM_PER_PAGE)->get(); |
|
49 | ||
50 | // display viewer |
|
51 | return App::$View->render('index', [ |
|
52 | 'records' => $records, |
|
53 | 'pagination' => $pagination |
|
54 | ]); |
|
55 | } |
|
56 | ||
57 | /** |
|
58 | * Edit user profile by id |
@@ 32-57 (lines=26) @@ | ||
29 | * @return string |
|
30 | * @throws \Ffcms\Core\Exception\SyntaxException |
|
31 | */ |
|
32 | public function actionIndex() |
|
33 | { |
|
34 | // set current page and offset |
|
35 | $page = (int)App::$Request->query->get('page'); |
|
36 | $offset = $page * self::ITEM_PER_PAGE; |
|
37 | ||
38 | // get feedback posts AR table |
|
39 | $query = new FeedbackPost(); |
|
40 | ||
41 | // build pagination |
|
42 | $pagination = new SimplePagination([ |
|
43 | 'url' => ['feedback/index'], |
|
44 | 'page' => $page, |
|
45 | 'step' => self::ITEM_PER_PAGE, |
|
46 | 'total' => $query->count() |
|
47 | ]); |
|
48 | ||
49 | // build listing objects |
|
50 | $records = $query->orderBy('id', 'desc')->skip($offset)->take(self::ITEM_PER_PAGE)->get(); |
|
51 | ||
52 | // render output |
|
53 | return App::$View->render('index', [ |
|
54 | 'records' => $records, |
|
55 | 'pagination' => $pagination |
|
56 | ]); |
|
57 | } |
|
58 | ||
59 | /** |
|
60 | * Read feedback post and answer and add answer to thread post |
@@ 39-64 (lines=26) @@ | ||
36 | * @return string |
|
37 | * @throws \Ffcms\Core\Exception\SyntaxException |
|
38 | */ |
|
39 | public function actionIndex() |
|
40 | { |
|
41 | // set current page and offset |
|
42 | $page = (int)App::$Request->query->get('page'); |
|
43 | $offset = $page * self::ITEM_PER_PAGE; |
|
44 | ||
45 | // initialize active record model |
|
46 | $query = new CommentPost(); |
|
47 | ||
48 | // make pagination |
|
49 | $pagination = new SimplePagination([ |
|
50 | 'url' => ['comments/index'], |
|
51 | 'page' => $page, |
|
52 | 'step' => self::ITEM_PER_PAGE, |
|
53 | 'total' => $query->count() |
|
54 | ]); |
|
55 | ||
56 | // get result as active records object with offset |
|
57 | $records = $query->orderBy('id', 'desc')->skip($offset)->take(self::ITEM_PER_PAGE)->get(); |
|
58 | ||
59 | // render output view |
|
60 | return App::$View->render('index', [ |
|
61 | 'records' => $records, |
|
62 | 'pagination' => $pagination |
|
63 | ]); |
|
64 | } |
|
65 | ||
66 | /** |
|
67 | * List comment - read comment and list answers |
|
@@ 236-261 (lines=26) @@ | ||
233 | * List answers |
|
234 | * @return string |
|
235 | */ |
|
236 | public function actionAnswerlist() |
|
237 | { |
|
238 | // set current page and offset |
|
239 | $page = (int)App::$Request->query->get('page'); |
|
240 | $offset = $page * self::ITEM_PER_PAGE; |
|
241 | ||
242 | // initialize ar answers model |
|
243 | $query = new CommentAnswer(); |
|
244 | ||
245 | // build pagination list |
|
246 | $pagination = new SimplePagination([ |
|
247 | 'url' => ['comments/answerlist'], |
|
248 | 'page' => $page, |
|
249 | 'step' => self::ITEM_PER_PAGE, |
|
250 | 'total' => $query->count() |
|
251 | ]); |
|
252 | ||
253 | // get result as active records object with offset |
|
254 | $records = $query->orderBy('id', 'desc')->skip($offset)->take(self::ITEM_PER_PAGE)->get(); |
|
255 | ||
256 | // render output view |
|
257 | return App::$View->render('answer_list', [ |
|
258 | 'records' => $records, |
|
259 | 'pagination' => $pagination |
|
260 | ]); |
|
261 | } |
|
262 | ||
263 | /** |
|
264 | * Comment widget global settings |