Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Public Attributes | List of all members
RAuthItemBehavior Class Reference

Public Member Functions

 __construct ($userId=null, CAuthItem $parent=null)
 getNameText ()
 getNameLink ()
 getGridNameLink ()
 childCount ()
 sortableId ()
 getTypeText ()
 getDeleteOperationLink ()
 getDeleteTaskLink ()
 getDeleteRoleLink ()
 getRemoveParentLink ()
 getRemoveChildLink ()
 getRevokeAssignmentLink ()
 getRevokePermissionLink (CAuthItem $role)
 getAssignPermissionLink (CAuthItem $role)
 getInheritedPermissionText ($parents, $displayType=false)

Public Attributes

 $userId
 $parent
 $childCount

Detailed Description

Rights authorization item behavior class file.

Author
Christoffer Niska cnisk.nosp@m.a@li.nosp@m.ve.co.nosp@m.m
Since
0.9.11

Definition at line 9 of file RAuthItemBehavior.php.

Constructor & Destructor Documentation

RAuthItemBehavior::__construct (   $userId = null,
CAuthItem  $parent = null 
)

Constructs the behavior.

Parameters
integer$userIdthe id of the user to whom this item is assigned
\CAuthItem$parentthe parent item.
Returns

Definition at line 32 of file RAuthItemBehavior.php.

{
$this->userId = $userId;
$this->parent = $parent;
}

Member Function Documentation

RAuthItemBehavior::childCount ( )

Returns the markup for the child count.

Returns
string the markup.

Definition at line 84 of file RAuthItemBehavior.php.

Referenced by getGridNameLink().

{
if ($this->childCount === null) {
$this->childCount = count($this->owner->getChildren());
}
return $this->childCount>0 ? ' [ <span class="child-count">'.$this->childCount.'</span> ]' : '';
}
RAuthItemBehavior::getAssignPermissionLink ( CAuthItem  $role)

Returns the markup for the assign permission link.

Parameters
CAuthItem$rolethe role the permission is for.
Returns
string the markup.

Definition at line 255 of file RAuthItemBehavior.php.

References Rights\getDataCsrf(), and Rights\t().

{
return CHtml::link(
Rights::t('core', 'Assign'), '#',
array(
'onclick'=>"
jQuery.ajax({
type:'POST',
url:'".Yii::app()->controller->createUrl('authItem/assign', array('name' => urlencode($role->name), 'child' => urlencode($this->owner->name)))."',
data:{ ajax:1 $csrf },
success:function() {
$('#permissions').load('".Yii::app()->controller->createUrl('authItem/permissions')."', { ajax:1 $csrf });
}
});
return false;
",
'class'=>'assign-link',
)
);
}
RAuthItemBehavior::getDeleteOperationLink ( )

Returns the markup for the delete operation link.

Returns
string the markup.

Definition at line 118 of file RAuthItemBehavior.php.

References Rights\t().

{
return CHtml::linkButton(
Rights::t('core', 'Delete'),
array(
'submit'=>array('authItem/delete', 'name'=>urlencode($this->owner->name)),
'confirm'=>Rights::t('core', 'Are you sure you want to delete this operation?'),
'class'=>'delete-link',
'csrf'=>Yii::app()->request->enableCsrfValidation,
)
);
}
RAuthItemBehavior::getDeleteRoleLink ( )

Returns the markup for the delete role link.

Returns
string the markup.

Definition at line 150 of file RAuthItemBehavior.php.

References Rights\module(), and Rights\t().

{
// We do not want to show the delete link for the superuser role.
if ( $this->owner->name!==Rights::module()->superuserName ) {
return CHtml::linkButton(
Rights::t('core', 'Delete'),
array(
'submit'=>array('authItem/delete', 'name'=>urlencode($this->owner->name)),
'confirm'=>Rights::t('core', 'Are you sure you want to delete this role?'),
'class'=>'delete-link',
'csrf'=>Yii::app()->request->enableCsrfValidation,
)
);
}
}
RAuthItemBehavior::getDeleteTaskLink ( )

Returns the markup for the delete task link.

Returns
string the markup.

Definition at line 135 of file RAuthItemBehavior.php.

References Rights\t().

{
return CHtml::linkButton(Rights::t('core', 'Delete'), array(
'submit'=>array('authItem/delete', 'name'=>urlencode($this->owner->name)),
'confirm'=>Rights::t('core', 'Are you sure you want to delete this task?'),
'class'=>'delete-link',
'csrf'=>Yii::app()->request->enableCsrfValidation,
));
}
RAuthItemBehavior::getGridNameLink ( )

Returns the markup for the name link to displayed in the grid.

Returns
string the markup.

Definition at line 69 of file RAuthItemBehavior.php.

References childCount(), and sortableId().

{
$markup = CHtml::link($this->owner->name, array('authItem/update', 'name'=>urlencode($this->owner->name)));
$markup .= $this->childCount();
$markup .= $this->sortableId();
return $markup;
}
RAuthItemBehavior::getInheritedPermissionText (   $parents,
  $displayType = false 
)

Returns the markup for a inherited permission.

Parameters
array$parentsthe parents for this item.
boolean$displayTypewhether to display the parent item type.
Returns
string the markup.

Definition at line 287 of file RAuthItemBehavior.php.

References Rights\t().

{
$items = array();
foreach ( $parents as $itemName=>$item ) {
$itemMarkup = $item->getNameText();
if ($displayType===true) {
$itemMarkup .= ' ('.Rights::getAuthItemTypeName($item->type).')';
}
$items[] = $itemMarkup;
}
return '<span class="inherited-item" title="'.implode('<br />', $items).'">'.Rights::t('core', 'Inherited').' *</span>';
}
RAuthItemBehavior::getNameLink ( )

Returns the link to update the item.

Returns
string the markup.

Definition at line 53 of file RAuthItemBehavior.php.

References getNameText().

{
return CHtml::link(
$this->getNameText(),
array(
'authItem/update',
'name'=>urlencode($this->owner->name),
)
);
}
RAuthItemBehavior::getNameText ( )

Returns the item name.

Returns
string the markup.

Definition at line 43 of file RAuthItemBehavior.php.

References Rights\module().

Referenced by getNameLink().

{
return (Rights::module()->displayDescription===true && $this->owner->description!==null) ? $this->owner->description : $this->owner->name;
}
RAuthItemBehavior::getRemoveChildLink ( )

Returns the markup for the remove child link.

Returns
string the markup.

Definition at line 188 of file RAuthItemBehavior.php.

References Rights\t().

{
return CHtml::linkButton(
Rights::t('core', 'Remove'),
array(
'submit'=>array('authItem/removeChild', 'name'=>urlencode($this->parent->name), 'child'=>urlencode($this->owner->name)),
'class'=>'remove-link',
'csrf'=>Yii::app()->request->enableCsrfValidation,
)
);
}
RAuthItemBehavior::getRemoveParentLink ( )

Returns the markup for the remove parent link.

Returns
string the markup.

Definition at line 171 of file RAuthItemBehavior.php.

References Rights\t().

{
return CHtml::linkButton(
Rights::t('core', 'Remove'),
array(
'submit'=>array('authItem/removeChild', 'name'=>urlencode($this->owner->name), 'child'=>urlencode($this->parent->name)),
'class'=>'remove-link',
'csrf'=>Yii::app()->request->enableCsrfValidation,
)
);
}
RAuthItemBehavior::getRevokeAssignmentLink ( )

Returns the markup for the revoke assignment link.

Returns
string the markup.

Definition at line 205 of file RAuthItemBehavior.php.

References Rights\t().

{
return CHtml::linkButton(
Rights::t('core', 'Revoke'),
array(
'submit'=>array('assignment/revoke', 'id'=>$this->userId, 'name'=>urlencode($this->owner->name)),
'class'=>'revoke-link',
'csrf'=>Yii::app()->request->enableCsrfValidation,
)
);
}
RAuthItemBehavior::getRevokePermissionLink ( CAuthItem  $role)

Returns the markup for the revoke permission link.

Parameters
CAuthItem$rolethe role the permission is for.
Returns
string the markup.

Definition at line 224 of file RAuthItemBehavior.php.

References Rights\getDataCsrf(), and Rights\t().

{
return CHtml::link(
Rights::t('core', 'Revoke'), '#',
array(
'onclick'=>"
jQuery.ajax({
type:'POST',
url:'".Yii::app()->controller->createUrl('authItem/revoke', array('name'=>urlencode($role->name), 'child'=>urlencode($this->owner->name)))."',
data:{ ajax:1 $csrf },
success:function() {
$('#permissions').load('".Yii::app()->controller->createUrl('authItem/permissions')."', { ajax:1 $csrf });
}
});
return false;
",
'class'=>'revoke-link',
)
);
}
RAuthItemBehavior::getTypeText ( )

Returns the markup for the item type.

Returns
string the markup.

Definition at line 108 of file RAuthItemBehavior.php.

References Rights\getAuthItemTypeName().

{
return Rights::getAuthItemTypeName($this->owner->type);
}
RAuthItemBehavior::sortableId ( )

Returns the markup for the id required by jui sortable.

Returns
string the markup.

Definition at line 98 of file RAuthItemBehavior.php.

Referenced by getGridNameLink().

{
return ' <span class="auth-item-name" style="display:none;">'.$this->owner->name.'</span>';
}

The documentation for this class was generated from the following file: