Beispiel #1
0
    /**
     * @desc render RBAC Item in context "Move"
     * @param array $item
     * @return string rendered RBAC Item
     */
    public function renderItemAssign($child)
    {
        $colUsername = $this->colUsername;
        $colUserid = $this->colUserid;
        if (!$this->_user) {
            throw new CHttpException("RBACDisplayHelper::_user is not set. Use setUser(object \$user)");
        }
        $urlPrefix = 'index.php?r=';
        $item = $child['this'];
        $out = "\n";
        $types = $this->types;
        // Manage Tree Header
        $out .= '
		<table id="rbacItem" ><tr>
				<th width="10%" id="rbacItem' . $item->type . '" >' . $this->_displayName($child['this-name'], $item->type) . '</th>' . '<th width="5%" id="rbacItem" ><b>Type</b></th>' . '<th width="20%" id="rbacItem" ><b>Description</b></th>' . '<th width="20%" id="rbacItem" ><b>Buisness Rule</b></th>' . '<th width="5%" id="rbacItem" ><b>Data</b></th>
			</tr>
			';
        $isAssigned = AuthAssignment::userIsAssigned($this->_user->{$colUserid}, $child['this-name']);
        $checkBoxName = $isAssigned ? 'removeAssignments[]' : 'addAssignments[]';
        $out .= '
			<tr>
				<td id="rbacItem" >' . CHtml::checkbox($checkBoxName, false, array('value' => $child['this-name'])) . ' ' . ($isAssigned ? '<span style="color:#ff0000">Eject</span>' : 'Assign') . '</td>' . '<td id="rbacItem" >' . $types[$item->type] . '</td>' . '<td id="rbacItem" >' . nl2br(CHtml::encode($item->description)) . '</td>' . '<td id="rbacItem" >' . nl2br(CHtml::encode($item->bizrule)) . '</td>' . '<td id="rbacItem" >' . nl2br(CHtml::encode($item->data)) . '</td></tr></table>';
        return $out;
    }