1 | <?php |
||
14 | class Assignment extends Model |
||
15 | { |
||
16 | public $user; |
||
17 | public $id; |
||
18 | public $username; |
||
19 | public $role; |
||
20 | public $isNewRecord = false; |
||
21 | |||
22 | /** |
||
23 | * @return array |
||
24 | */ |
||
25 | public function rules() |
||
31 | |||
32 | /** |
||
33 | * @inheritdoc |
||
34 | */ |
||
35 | public function attributeLabels() |
||
41 | |||
42 | /** |
||
43 | * Список всех ролей |
||
44 | * @return array |
||
45 | */ |
||
46 | public function getRolesArray() |
||
50 | |||
51 | /** |
||
52 | * @param $id |
||
53 | * @return string |
||
54 | */ |
||
55 | public function getRoleName($id = null) |
||
66 | |||
67 | /** |
||
68 | * @param $id |
||
69 | * @return mixed|null |
||
70 | */ |
||
71 | public function getUserRoleName($id = null) |
||
83 | |||
84 | /** |
||
85 | * Получаем роль пользователя |
||
86 | * @param null $id |
||
87 | * @return mixed|null |
||
88 | */ |
||
89 | public function getRoleUser($id = null) |
||
101 | |||
102 | /** |
||
103 | * @param null $user_id |
||
104 | * @return mixed|null |
||
105 | */ |
||
106 | /* public function getUserRoleValue($user_id = null) |
||
107 | { |
||
108 | if ($user_id) { |
||
109 | if ($role = Yii::$app->authManager->getRolesByUser($user_id)) |
||
110 | return ArrayHelper::getValue($role, function ($role) { |
||
111 | foreach ($role as $key => $value) { |
||
112 | return $value->name; |
||
113 | } |
||
114 | return null; |
||
115 | }); |
||
116 | } else { |
||
117 | if ($role = Yii::$app->authManager->getRolesByUser($this->id)) |
||
118 | return ArrayHelper::getValue($role, function ($role) { |
||
119 | foreach ($role as $key => $value) { |
||
120 | return $value->name; |
||
121 | } |
||
122 | return null; |
||
123 | }); |
||
124 | } |
||
125 | return null; |
||
126 | }*/ |
||
127 | } |
||
128 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.