ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilContainerReferenceAppEventListener Class Reference

Handles delete events from courses and categories. More...

+ Inheritance diagram for ilContainerReferenceAppEventListener:
+ Collaboration diagram for ilContainerReferenceAppEventListener:

Static Public Member Functions

static handleEvent ($a_component, $a_event, $a_parameter)
 Handle events like create, update, delete.
static deleteReferences ($a_target_id)
 Delete references.

Detailed Description

Handles delete events from courses and categories.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 35 of file class.ilContainerReferenceAppEventListener.php.

Member Function Documentation

static ilContainerReferenceAppEventListener::deleteReferences (   $a_target_id)
static

Delete references.

Definition at line 71 of file class.ilContainerReferenceAppEventListener.php.

References $ilLog, $ref_id, ilObject\_getAllReferences(), ilContainerReference\_lookupSourceId(), and ilObjectFactory\getInstanceByRefId().

Referenced by handleEvent().

{
global $ilLog;
include_once('./Services/ContainerReference/classes/class.ilContainerReference.php');
if(!$source_id = ilContainerReference::_lookupSourceId($a_target_id))
{
return true;
}
foreach(ilObject::_getAllReferences($source_id) as $ref_id)
{
if(!$instance = ilObjectFactory::getInstanceByRefId($ref_id,false))
{
continue;
}
switch($instance->getType())
{
case 'crsr':
case 'catr':
$instance->delete();
$ilLog->write(__METHOD__.': Deleted reference object of type '.$instance->getType().' with Id '.$instance->getId());
break;
default:
$ilLog->write(__METHOD__.': Unexpected object type '.$instance->getType().' with Id '.$instance->getId());
break;
}
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilContainerReferenceAppEventListener::handleEvent (   $a_component,
  $a_event,
  $a_parameter 
)
static

Handle events like create, update, delete.

public

Parameters
string$a_componentcomponent, e.g. "Modules/Forum" or "Services/User"
string$a_eventevent e.g. "createUser", "updateUser", "deleteUser", ...
array$a_parameterparameter array (assoc), array("name" => ..., "phone_office" => ...) *

Implements ilAppEventListener.

Definition at line 46 of file class.ilContainerReferenceAppEventListener.php.

References $ilLog, and deleteReferences().

{
global $ilLog;
switch($a_component)
{
case 'Modules/Course':
case 'Modules/Category':
switch($a_event)
{
case 'delete':
$ilLog->write(__METHOD__.': Handling delete event.');
self::deleteReferences($a_parameter['obj_id']);
break;
}
break;
}
}

+ Here is the call graph for this function:


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