AtkTriggerListener
Appearance
|
Classname: atkTriggerListener
|
atkTriggerListener can be used to add listeners to node that get executed when an event happens on a record from that node (typically updates, deletes etc.). They are different from atkActionListeners: atkActionListeners are typically tied to a screen based action (e.g. updating a record by posting a form), while atkTriggerListeners are lower level, i.e. they not only get called when someone posts a form, but even when somebody calls updateDb() programmatically.
So in general, if you want to do things when a record is updated, atkTriggerListener would be the better choice.
Example use
atkimport("atk.utils.atktriggerlistener");
class MyListener extends atkTriggerListener
{
public function preUpdate( &$record )
{
do some code....
return true;
}
}
Then, add the listener to the node using:
$node->addListener(new MyListener());