Code Duplication    Length = 26-26 lines in 5 locations

Apps/Controller/Admin/Profile.php 1 location

@@ 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

Apps/Controller/Admin/User.php 1 location

@@ 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

Apps/Controller/Admin/Feedback.php 1 location

@@ 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

Apps/Controller/Admin/Comments.php 2 locations

@@ 38-63 (lines=26) @@
35
     * @return string
36
     * @throws \Ffcms\Core\Exception\SyntaxException
37
     */
38
    public function actionIndex()
39
    {
40
        // set current page and offset
41
        $page = (int)App::$Request->query->get('page');
42
        $offset = $page * self::ITEM_PER_PAGE;
43
44
        // initialize active record model
45
        $query = new CommentPost();
46
47
        // make pagination
48
        $pagination = new SimplePagination([
49
            'url' => ['comments/index'],
50
            'page' => $page,
51
            'step' => self::ITEM_PER_PAGE,
52
            'total' => $query->count()
53
        ]);
54
55
        // get result as active records object with offset
56
        $records = $query->orderBy('id', 'desc')->skip($offset)->take(self::ITEM_PER_PAGE)->get();
57
58
        // render output view
59
        return App::$View->render('index', [
60
            'records' => $records,
61
            'pagination' => $pagination
62
        ]);
63
    }
64
65
    /**
66
     * List comment - read comment and list answers
@@ 183-208 (lines=26) @@
180
     * List answers 
181
     * @return string
182
     */
183
    public function actionAnswerlist()
184
    {
185
        // set current page and offset
186
        $page = (int)App::$Request->query->get('page');
187
        $offset = $page * self::ITEM_PER_PAGE;
188
        
189
        // initialize ar answers model
190
        $query = new CommentAnswer();
191
        
192
        // build pagination list
193
        $pagination = new SimplePagination([
194
            'url' => ['comments/answerlist'],
195
            'page' => $page,
196
            'step' => self::ITEM_PER_PAGE,
197
            'total' => $query->count()
198
        ]);
199
        
200
        // get result as active records object with offset
201
        $records = $query->orderBy('id', 'desc')->skip($offset)->take(self::ITEM_PER_PAGE)->get();
202
        
203
        // render output view
204
        return App::$View->render('answer_list', [
205
            'records' => $records,
206
            'pagination' => $pagination
207
        ]);
208
    }
209
210
    /**
211
     * Comment widget global settings