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 rhosocial\organization\Organization; |
16
|
|
|
use Yii; |
17
|
|
|
use yii\base\Action; |
18
|
|
|
use yii\data\ActiveDataProvider; |
19
|
|
|
use yii\web\BadRequestHttpException; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @version 1.0 |
23
|
|
|
* @author vistart <[email protected]> |
24
|
|
|
*/ |
25
|
|
|
class ViewMembersAction extends Action |
26
|
|
|
{ |
27
|
|
|
/** |
28
|
|
|
* |
29
|
|
|
* @param Organization|string|integer $organization |
30
|
|
|
* @return string rendering result. |
31
|
|
|
*/ |
32
|
|
|
public function run($organization) |
33
|
|
|
{ |
34
|
|
|
if (empty($organization) || ($organization = $this->controller->getOrganization($organization)) == null) { |
35
|
|
|
throw new BadRequestHttpException(Yii::t('organization', 'Organization/Department Not Exist.')); |
36
|
|
|
} |
37
|
|
|
$dataProvider = new ActiveDataProvider([ |
38
|
|
|
'query' => $organization->getMembers(), |
39
|
|
|
'pagination' => [ |
40
|
|
|
'pageParam' => 'organization-member-page', |
41
|
|
|
'pageSize' => 20, |
42
|
|
|
], |
43
|
|
|
'sort' => [ |
44
|
|
|
'sortParam' => 'organization-member-sort', |
45
|
|
|
], |
46
|
|
|
]); |
47
|
|
|
$viewBasePath = $this->controller->viewBasePath; |
48
|
|
|
return $this->controller->render($viewBasePath . 'view-members', [ |
49
|
|
|
'user' => Yii::$app->user->identity, |
50
|
|
|
'organization' => $organization, |
51
|
|
|
'dataProvider' => $dataProvider |
52
|
|
|
]); |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|