Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
RAuthItemDataProvider Class Reference
Inheritance diagram for RAuthItemDataProvider:
RAuthItemChildDataProvider RAuthItemParentDataProvider

Public Member Functions

 __construct ($id, $config=array())
 fetchData ()
 fetchKeys ()

Public Attributes

 $type
 $userId
 $parent
 $exclude = array()
 $items
 $sortable

Protected Member Functions

 processSortable ()
 calculateTotalItemCount ()

Detailed Description

Authorization item data provider class file.

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

Definition at line 9 of file RAuthItemDataProvider.php.

Constructor & Destructor Documentation

RAuthItemDataProvider::__construct (   $id,
  $config = array() 
)

Constructs the data provider.

Parameters
string$idthe data provider identifier.
array$configconfiguration (name=>value) to be applied as the initial property values of this class.
Returns

Reimplemented in RAuthItemChildDataProvider, and RAuthItemParentDataProvider.

Definition at line 26 of file RAuthItemDataProvider.php.

{
$this->setId($id);
foreach ($config as $key => $value) {
$this->$key = $value;
}
}

Member Function Documentation

RAuthItemDataProvider::calculateTotalItemCount ( )
protected

Calculates the total number of data items.

Returns
integer the total number of data items.

Definition at line 99 of file RAuthItemDataProvider.php.

{
return count($this->getData());
}
RAuthItemDataProvider::fetchData ( )

Fetches the data from the persistent data storage.

Returns
array list of data items

Reimplemented in RAuthItemChildDataProvider, and RAuthItemParentDataProvider.

Definition at line 40 of file RAuthItemDataProvider.php.

References Rights\getAuthorizer(), and processSortable().

{
if ($this->sortable!==null) {
$this->processSortable();
}
if ($this->items===null) {
$this->items = Rights::getAuthorizer()->getAuthItems($this->type, $this->userId, $this->parent, true, $this->exclude);
}
$data = array();
foreach ($this->items as $name => $item) {
$data[] = $item;
}
return $data;
}
RAuthItemDataProvider::fetchKeys ( )

Fetches the data item keys from the persistent data storage.

Returns
array list of data item keys.

Definition at line 63 of file RAuthItemDataProvider.php.

{
$keys = array();
foreach ($this->getData() as $name => $item) {
$keys[] = $name;
}
return $keys;
}
RAuthItemDataProvider::processSortable ( )
protected

Applies jQuery UI sortable on the target element.

Returns
void

Definition at line 78 of file RAuthItemDataProvider.php.

Referenced by fetchData().

{
if ($this->sortable!==null) {
if (isset($this->sortable['id'])===true && isset($this->sortable['element'])===true && isset($this->sortable['url'])===true) {
// Register the script to bind the sortable plugin to the role table
Yii::app()->getClientScript()->registerScript(
$this->sortable['id'],
"jQuery('".$this->sortable['element']."').rightsSortableTable({
url:'".$this->sortable['url']."',
csrfToken:'".Yii::app()->request->csrfToken."'
});"
);
}
}
}

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