ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilDidacticTemplateBlockRoleAction Class Reference

Description of ilDidacticTemplateBlockRoleAction. More...

+ Inheritance diagram for ilDidacticTemplateBlockRoleAction:
+ Collaboration diagram for ilDidacticTemplateBlockRoleAction:

Public Member Functions

 __construct ($action_id=0)
 Constructor.
 addFilterPattern (ilDidacticTemplateFilterPattern $pattern)
 Add filter.
 setFilterPatterns (Array $patterns)
 Set filter patterns.
 getFilterPattern ()
 Get filter pattern.
 setFilterType ($a_type)
 Set filter type.
 getFilterType ()
 Get filter type.
 save ()
 Save action.
 delete ()
 delete action filter ilDB $ilDB
 apply ()
 Apply action.
 revert ()
 Revert action.
 getType ()
 Get action type.
 toXml (ilXmlWriter $writer)
 Export to xml.
 __clone ()
 clone method
 read ()
 read action data ilDB $ilDB
- Public Member Functions inherited from ilDidacticTemplateAction
 getActionId ()
 Get action id.
 setActionId ($a_action_id)
 Set action id.
 setType ($a_type_id)
 Set type id.
 setTemplateId ($a_id)
 Set template id.
 getTemplateId ()
 Get template id.
 setRefId ($a_ref_id)
 Set ref id of target object.
 getRefId ()
 Get ref id of target object.

Data Fields

const FILTER_SOURCE_TITLE = 1
const FILTER_SOURCE_OBJ_ID = 2
const PATTERN_PARENT_TYPE = 'action'
- Data Fields inherited from ilDidacticTemplateAction
const TYPE_LOCAL_POLICY = 1
const TYPE_LOCAL_ROLE = 2
const TYPE_BLOCK_ROLE = 3
const FILTER_SOURCE_TITLE = 1
const FILTER_SOURCE_OBJ_ID = 2
const PATTERN_PARENT_TYPE = 'action'

Protected Member Functions

 blockRole ($a_role_id, $source)
 Blo k role.
 deleteLocalPolicy ($a_role_id, $source)
 Delete local policy.
- Protected Member Functions inherited from ilDidacticTemplateAction
 initSourceObject ()
 Init the source object.
 filterRoles (ilObject $source)
 Filter roles.

Private Attributes

 $pattern = array()
 $filter_type = self::FILTER_SOURCE_TITLE

Detailed Description

Constructor & Destructor Documentation

ilDidacticTemplateBlockRoleAction::__construct (   $action_id = 0)

Constructor.

Parameters
int$action_id

Reimplemented from ilDidacticTemplateAction.

Definition at line 27 of file class.ilDidacticTemplateBlockRoleAction.php.

References ilDidacticTemplateAction\$action_id.

Member Function Documentation

ilDidacticTemplateBlockRoleAction::__clone ( )

clone method

Reimplemented from ilDidacticTemplateAction.

Definition at line 273 of file class.ilDidacticTemplateBlockRoleAction.php.

References $pattern, getFilterPattern(), and setFilterPatterns().

{
// Clone patterns
$cloned = array();
foreach($this->getFilterPattern() as $pattern)
{
$clones[] = clone $pattern;
}
$this->setFilterPatterns($clones);
}

+ Here is the call graph for this function:

ilDidacticTemplateBlockRoleAction::addFilterPattern ( ilDidacticTemplateFilterPattern  $pattern)

Add filter.

Parameters
ilDidacticTemplateFilterPatter$pattern

Definition at line 36 of file class.ilDidacticTemplateBlockRoleAction.php.

References $pattern.

Referenced by read().

{
$this->pattern[] = $pattern;
}

+ Here is the caller graph for this function:

ilDidacticTemplateBlockRoleAction::apply ( )

Apply action.

Reimplemented from ilDidacticTemplateAction.

Definition at line 130 of file class.ilDidacticTemplateBlockRoleAction.php.

References blockRole(), ilDidacticTemplateAction\filterRoles(), and ilDidacticTemplateAction\initSourceObject().

{
$source = $this->initSourceObject();
$roles = $this->filterRoles($source);
// Create local policy for filtered roles
foreach($roles as $role_id => $role)
{
$this->blockRole($role_id, $source);
}
return true;
}

+ Here is the call graph for this function:

ilDidacticTemplateBlockRoleAction::blockRole (   $a_role_id,
  $source 
)
protected

Blo k role.

Parameters
int$a_role_id
ilObject$source

Definition at line 148 of file class.ilDidacticTemplateBlockRoleAction.php.

Referenced by apply().

{
global $rbacadmin, $rbacreview;
// Create role folder if it does not exist
$rolf = $rbacreview->getRoleFolderIdOfObject($source->getRefId());
if(!$rolf)
{
$rolf_obj = $source->createRoleFolder();
$rolf = $rolf_obj->getRefId();
}
// Set assign to 'y' only if it is a local role
$assign = $rbacreview->isAssignable($a_role_id, $rolf) ? 'y' : 'n';
// Delete permissions
$rbacadmin->revokeSubtreePermissions($source->getRefId(), $a_role_id);
// Delete template permissions
$rbacadmin->deleteSubtreeTemplates($source->getRefId(), $a_role_id);
$rbacadmin->assignRoleToFolder(
$a_role_id,
$rolf,
$assign
);
return true;
}

+ Here is the caller graph for this function:

ilDidacticTemplateBlockRoleAction::delete ( )

delete action filter ilDB $ilDB

Returns
bool

Reimplemented from ilDidacticTemplateAction.

Definition at line 107 of file class.ilDidacticTemplateBlockRoleAction.php.

References $pattern, $query, ilDidacticTemplateAction\getActionId(), and getFilterPattern().

{
global $ilDB;
$query = 'DELETE FROM didactic_tpl_abr '.
'WHERE action_id = '.$ilDB->quote($this->getActionId(),'integer');
$ilDB->manipulate($query);
foreach($this->getFilterPattern() as $pattern)
{
$pattern->delete();
}
return true;
}

+ Here is the call graph for this function:

ilDidacticTemplateBlockRoleAction::deleteLocalPolicy (   $a_role_id,
  $source 
)
protected

Delete local policy.

Parameters
int$a_role_id
ilObject$source

Definition at line 199 of file class.ilDidacticTemplateBlockRoleAction.php.

References $GLOBALS, ilObject\_lookupTitle(), and ilObjRole\MODE_UNPROTECTED_DELETE_LOCAL_POLICIES.

Referenced by revert().

{
global $rbacreview, $rbacadmin;
// Create role folder if it does not exist
$rolf = $rbacreview->getRoleFolderIdOfObject($source->getRefId());
if(!$rolf)
{
return false;
}
if($rbacreview->getRoleFolderOfRole($a_role_id) == $rolf)
{
$GLOBALS['ilLog']->write(__METHOD__.': Ignoring local role: '.ilObject::_lookupTitle($a_role_id));
return false;
}
$rbacadmin->deleteLocalRole($a_role_id, $rolf);
// Change existing object
include_once './Services/AccessControl/classes/class.ilObjRole.php';
$role = new ilObjRole($a_role_id);
$role->changeExistingObjects(
$source->getRefId(),
array('all')
);
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDidacticTemplateBlockRoleAction::getFilterPattern ( )

Get filter pattern.

Returns
array

Definition at line 54 of file class.ilDidacticTemplateBlockRoleAction.php.

References $pattern.

Referenced by __clone(), delete(), save(), and toXml().

{
}

+ Here is the caller graph for this function:

ilDidacticTemplateBlockRoleAction::getFilterType ( )

Get filter type.

Returns
int

Definition at line 72 of file class.ilDidacticTemplateBlockRoleAction.php.

References $filter_type.

Referenced by save(), and toXml().

{
}

+ Here is the caller graph for this function:

ilDidacticTemplateBlockRoleAction::getType ( )

Get action type.

Returns
int

Reimplemented from ilDidacticTemplateAction.

Definition at line 235 of file class.ilDidacticTemplateBlockRoleAction.php.

References ilDidacticTemplateAction\TYPE_BLOCK_ROLE.

{
}
ilDidacticTemplateBlockRoleAction::read ( )

read action data ilDB $ilDB

Returns
bool

Reimplemented from ilDidacticTemplateAction.

Definition at line 291 of file class.ilDidacticTemplateBlockRoleAction.php.

References $pattern, $query, $res, $row, addFilterPattern(), DB_FETCHMODE_OBJECT, ilDidacticTemplateAction\getActionId(), ilDidacticTemplateFilterPatternFactory\lookupPatternsByParentId(), and setFilterType().

{
global $ilDB;
if(!parent::read())
{
return false;
}
$query = 'SELECT * FROM didactic_tpl_abr '.
'WHERE action_id = '.$ilDB->quote($this->getActionId());
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->setFilterType($row->filter_type);
}
// Read filter
include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateFilterPatternFactory.php';
{
$this->addFilterPattern($pattern);
}
}

+ Here is the call graph for this function:

ilDidacticTemplateBlockRoleAction::revert ( )

Revert action.

Reimplemented from ilDidacticTemplateAction.

Definition at line 180 of file class.ilDidacticTemplateBlockRoleAction.php.

References deleteLocalPolicy(), ilDidacticTemplateAction\filterRoles(), and ilDidacticTemplateAction\initSourceObject().

{
$source = $this->initSourceObject();
$roles = $this->filterRoles($source);
// Create local policy for filtered roles
foreach($roles as $role_id => $role)
{
$this->deleteLocalPolicy($role_id, $source);
}
return true;
}

+ Here is the call graph for this function:

ilDidacticTemplateBlockRoleAction::save ( )

Save action.

Reimplemented from ilDidacticTemplateAction.

Definition at line 80 of file class.ilDidacticTemplateBlockRoleAction.php.

References $pattern, $query, ilDidacticTemplateAction\getActionId(), getFilterPattern(), and getFilterType().

{
global $ilDB;
$query = 'INSERT INTO didactic_tpl_abr (action_id,filter_type) '.
'VALUES( '.
$ilDB->quote($this->getActionId(),'integer').', '.
$ilDB->quote($this->getFilterType(),'integer').' '.
')';
$ilDB->manipulate($query);
foreach($this->getFilterPattern() as $pattern)
{
/* @var ilDidacticTemplateFilterPattern $pattern */
$pattern->setParentId($this->getActionId());
$pattern->setParentType(self::PATTERN_PARENT_TYPE);
$pattern->save();
}
}

+ Here is the call graph for this function:

ilDidacticTemplateBlockRoleAction::setFilterPatterns ( Array  $patterns)

Set filter patterns.

Parameters
array$patterns

Definition at line 45 of file class.ilDidacticTemplateBlockRoleAction.php.

Referenced by __clone().

{
$this->pattern = $patterns;
}

+ Here is the caller graph for this function:

ilDidacticTemplateBlockRoleAction::setFilterType (   $a_type)

Set filter type.

Parameters
int$a_type

Definition at line 63 of file class.ilDidacticTemplateBlockRoleAction.php.

Referenced by read().

{
$this->filter_type = $a_type;
}

+ Here is the caller graph for this function:

ilDidacticTemplateBlockRoleAction::toXml ( ilXmlWriter  $writer)

Export to xml.

Parameters
ilXmlWriter$writer
Returns
void

Reimplemented from ilDidacticTemplateAction.

Definition at line 245 of file class.ilDidacticTemplateBlockRoleAction.php.

References $pattern, getFilterPattern(), getFilterType(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

{
$writer->xmlStartTag('blockRoleAction');
switch($this->getFilterType())
{
case self::FILTER_SOURCE_OBJ_ID:
$writer->xmlStartTag('roleFilter',array('source' => 'objId'));
break;
default:
case self::FILTER_SOURCE_TITLE:
$writer->xmlStartTag('roleFilter',array('source' => 'title'));
break;
}
foreach($this->getFilterPattern() as $pattern)
{
$pattern->toXml($writer);
}
$writer->xmlEndTag('roleFilter');
$writer->xmlEndTag('blockRoleAction');
return;
}

+ Here is the call graph for this function:

Field Documentation

ilDidacticTemplateBlockRoleAction::$filter_type = self::FILTER_SOURCE_TITLE
private

Definition at line 21 of file class.ilDidacticTemplateBlockRoleAction.php.

Referenced by getFilterType().

ilDidacticTemplateBlockRoleAction::$pattern = array()
private
const ilDidacticTemplateBlockRoleAction::FILTER_SOURCE_OBJ_ID = 2

Definition at line 15 of file class.ilDidacticTemplateBlockRoleAction.php.

const ilDidacticTemplateBlockRoleAction::FILTER_SOURCE_TITLE = 1

Definition at line 14 of file class.ilDidacticTemplateBlockRoleAction.php.

const ilDidacticTemplateBlockRoleAction::PATTERN_PARENT_TYPE = 'action'

Definition at line 17 of file class.ilDidacticTemplateBlockRoleAction.php.


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