forked from koala-framework/koala-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Events.php
37 lines (36 loc) · 1.17 KB
/
Events.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
class Kwc_Basic_Table_Events extends Kwc_Abstract_Composite_Events
{
public function getListeners()
{
$ret = parent::getListeners();
$m = Kwc_Abstract::createChildModel($this->_class);
$ret[] = array(
'class' => $m,
'event' => 'Kwf_Events_Event_Row_Updated',
'callback' => 'onChildRowUpdate'
);
$ret[] = array(
'class' => $m,
'event' => 'Kwf_Events_Event_Row_Deleted',
'callback' => 'onChildRowUpdate'
);
$ret[] = array(
'class' => $m,
'event' => 'Kwf_Events_Event_Row_Inserted',
'callback' => 'onChildRowUpdate'
);
return $ret;
}
public function onChildRowUpdate(Kwf_Events_Event_Row_Abstract $event)
{
$c = Kwf_Component_Data_Root::getInstance()->getComponentByDbId(
$event->row->component_id, array('limit'=>1, 'ignoreVisible'=>true)
);
if ($c && $c->componentClass == $this->_class && $c->isVisible()) {
$this->fireEvent(new Kwf_Component_Event_Component_ContentChanged(
$this->_class, $c
));
}
}
}