forked from crisu83/yii-auth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAuthAssignmentItemsColumn.php
executable file
·47 lines (43 loc) · 1.41 KB
/
AuthAssignmentItemsColumn.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* AuthAssignmentItemsColumn class file.
* @author Christoffer Niska <[email protected]>
* @copyright Copyright © Christoffer Niska 2012-
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @package auth.widgets
*/
/**
* Grid column for displaying the authorization items for an assignment row.
*/
class AuthAssignmentItemsColumn extends AuthAssignmentColumn
{
/**
* Initializes the column.
*/
public function init()
{
if (isset($this->htmlOptions['class']))
$this->htmlOptions['class'] .= ' assignment-items-column';
else
$this->htmlOptions['class'] = 'assignment-items-column';
}
/**
* Renders the data cell content.
* @param integer $row the row number (zero-based).
* @param mixed $data the data associated with the row.
*/
protected function renderDataCellContent($row, $data)
{
/* @var $am CAuthManager|AuthBehavior */
$am = Yii::app()->getAuthManager();
/* @var $controller AssignmentController */
$controller = $this->grid->getController();
$assignments = $am->getAuthAssignments($data->{$this->idColumn});
$permissions = $am->getItemsPermissions(array_keys($assignments));
foreach ($permissions as $itemPermission)
{
echo $itemPermission['item']->description;
echo ' <small>' . $controller->getItemTypeText($itemPermission['item']->type, false) . '</small><br />';
}
}
}