ACL Extension  0.3
 All Data Structures Namespaces Files Functions Variables
Util Class Reference

Static Public Member Functions

static getDataBaseType ($obj)
static getNodeNameOfObject (AclObject $obj)
static generateInStatement ($options)
static getIdsOfObjects ($objects)

Detailed Description

Definition at line 9 of file Util.php.


Member Function Documentation

static generateInStatement (   $options)
static

Generates a database-IN-statement out of the given options

Parameters:
array[string]$options
Returns:
string the in-statement

Definition at line 60 of file Util.php.

{
$ret = ' IN ( ';
foreach($options as $key =>$option){
if($key > 0)
$ret.= ' , ';
$ret.= ctype_digit($option) ? $option : ' "'.$option.'" ';
}
$ret.= ' ) ';
return $ret;
}
static getDataBaseType (   $obj)
static

Returns the database-type of the given object

Parameters:
AclObject$obj
Returns:
string
Exceptions:
InvalidArgumentException

Definition at line 17 of file Util.php.

{
$class = get_class($obj);
switch($class){
case Strategy::getClass('Aro'):
case Strategy::getClass('AroNode'):
case 'RGroup':
return 'aro';
case Strategy::getClass('Aco'):
case Strategy::getClass('AcoNode'):
case 'AGroup':
return 'aco';
default:
throw new InvalidArgumentException('Unexpected Object');
}
}
static getIdsOfObjects (   $objects)
static

Extracts the IDs of the given bunch of objects and returns them in an indexed arry

Parameters:
array$objects
Returns:
array[int]

Definition at line 80 of file Util.php.

{
$ret = array();
foreach($objects as $obj){
$ret[] = $obj->id;
}
return $ret;
}
static getNodeNameOfObject ( AclObject  $obj)
static

Returns the class-name of the node belonging to the given Object

Parameters:
PmAclObject$obj
Returns:
string
Exceptions:
InvalidArgumentException

Definition at line 40 of file Util.php.

{
$class = get_class($obj);
switch($class){
case Strategy::getClass('Aro'):
case 'RGroup':
return Strategy::getClass('AroNode');
case Strategy::getClass('Aco'):
case 'CGroup':
return Strategy::getClass('AcoNode');
default:
throw new InvalidArgumentException('Unexpected Object');
}
}

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