Passed
Push — master ( 05e7db...c14628 )
by vistart
04:22
created

IndexAction::run()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 11
nc 1
nop 0
1
<?php
2
3
/**
4
 *  _   __ __ _____ _____ ___  ____  _____
5
 * | | / // // ___//_  _//   ||  __||_   _|
6
 * | |/ // /(__  )  / / / /| || |     | |
7
 * |___//_//____/  /_/ /_/ |_||_|     |_|
8
 * @link https://vistart.me/
9
 * @copyright Copyright (c) 2016 - 2017 vistart
10
 * @license https://vistart.me/license/
11
 */
12
13
namespace rhosocial\organization\web\user\controllers\organization;
14
15
use Yii;
16
use yii\base\Action;
17
use yii\data\ActiveDataProvider;
18
19
/**
20
 * @version 1.0
21
 * @author vistart <[email protected]>
22
 */
23
class IndexAction extends Action
24
{
25
    /**
26
     * List the organizations the current identity is participating in & set up.
27
     * @return string rendering results.
28
     */
29
    public function run()
30
    {
31
        $user = Yii::$app->user->identity;
32
        $dataProvider = new ActiveDataProvider([
33
            'query' => $user->getAtOrganizationsOnly(),
34
            'pagination' => [
35
                'pageParam' => 'organization-page',
36
                'defaltPageSize' => 20,
37
                'pageSizeParam' => 'organization-per-page',
38
            ],
39
            'sort' => [
40
                'sortParam' => 'organization-sort',
41
            ],
42
        ]);
43
        return $this->controller->render('index', ['dataProvider' => $dataProvider]);
44
    }
45
}
46