コード例 #1
0
 public function onPageDataChanged(Kwf_Events_Event_Row_Abstract $event)
 {
     if ($event instanceof Kwf_Events_Event_Row_Updated && $event->isDirty(array('parent_id', 'filename'))) {
         Kwf_Cache_Simple::delete('pcFnIds-' . $event->row->getCleanValue('parent_id') . '-' . $event->row->getCleanValue('filename'));
         Kwf_Cache_Simple::delete('pcFnIds-' . $event->row->parent_id . '-' . $event->row->filename);
         if (!is_numeric($event->row->getCleanValue('parent_id'))) {
             Kwf_Cache_Simple::delete('pcFnIds-' . $event->row->getCleanValue('parent_subroot_id') . '-' . $event->row->getCleanValue('filename'));
             Kwf_Cache_Simple::delete('pcFnIds-' . $event->row->parent_subroot_id . '-' . $event->row->filename);
         }
     } else {
         if ($event instanceof Kwf_Events_Event_Row_Inserted || $event instanceof Kwf_Events_Event_Row_Deleted) {
             Kwf_Cache_Simple::delete('pcFnIds-' . $event->row->parent_id . '-' . $event->row->filename);
             if (!is_numeric($event->row->parent_id)) {
                 Kwf_Cache_Simple::delete('pcFnIds-' . $event->row->parent_subroot_id . '-' . $event->row->filename);
             }
         }
     }
     Kwf_Cache_Simple::delete('pd-' . $event->row->id);
     if ($event instanceof Kwf_Events_Event_Row_Deleted) {
         $this->_deletePageDataCacheRecursive($event->row->id);
         $this->_deferredDeleteCacheIds[] = 'pcIds-' . $event->row->parent_id;
         //deferred delete, see comment in onRowUpdatesFinished
     } else {
         if ($event instanceof Kwf_Events_Event_Row_Inserted) {
             Kwf_Cache_Simple::delete('pcIds-' . $event->row->parent_id);
         }
     }
     $this->_getGenerator()->pageDataChanged();
 }
コード例 #2
0
 public function onMasterRowUpdate(Kwf_Events_Event_Row_Abstract $event)
 {
     if ($event->isDirty('pos')) {
         $chainedType = 'Trl';
         foreach (Kwf_Component_Data_Root::getInstance()->getComponentsByDbId($event->row->component_id) as $c) {
             $chained = Kwc_Chained_Abstract_Component::getAllChainedByMaster($c, $chainedType);
             foreach ($chained as $c) {
                 $this->fireEvent(new Kwf_Component_Event_Component_ContentChanged($this->_class, $c));
             }
         }
     }
 }
コード例 #3
0
 public function onOwnRowUpdate(Kwf_Events_Event_Row_Abstract $event)
 {
     if ($event->isDirty('component')) {
         $id = $event->row->component_id;
         foreach (Kwf_Component_Data_Root::getInstance()->getComponentsByDbId($id, array('ignoreVisible' => true)) as $c) {
             if ($c->generator === $this->_getGenerator() && $c->isVisible()) {
                 $classes = $this->_getGenerator()->getChildComponentClasses();
                 $this->fireEvent(new Kwf_Component_Event_Component_RecursiveRemoved($this->_getClassFromRow($classes, $event->row, true), $c));
                 $this->fireEvent(new Kwf_Component_Event_Component_RecursiveAdded($this->_getClassFromRow($classes, $event->row, false), $c));
             }
         }
     }
 }
コード例 #4
0
 public final function onOwnRowUpdate(Kwf_Events_Event_Row_Abstract $event)
 {
     $cmps = Kwf_Component_Data_Root::getInstance()->getComponentsByDbId($event->row->component_id, array('ignoreVisible' => true));
     foreach ($cmps as $c) {
         if ($c->componentClass == $this->_class) {
             if ($c->isVisible()) {
                 $this->fireEvent(new Kwf_Component_Event_Component_ContentChanged($this->_class, $c));
                 if (Kwc_Abstract::hasSetting($this->_class, 'throwHasContentChangedOnRowColumnsUpdate')) {
                     if ($event->isDirty(Kwc_Abstract::getSetting($this->_class, 'throwHasContentChangedOnRowColumnsUpdate'))) {
                         $this->fireEvent(new Kwf_Component_Event_Component_HasContentChanged($this->_class, $c));
                     }
                 }
                 $this->_onOwnRowUpdate($c, $event);
                 $this->_onOwnRowUpdateNotVisible($c, $event);
             } else {
                 $this->_onOwnRowUpdateNotVisible($c, $event);
             }
         }
     }
 }
コード例 #5
0
 public function onMasterOwnRowUpdate(Kwf_Events_Event_Row_Abstract $event)
 {
     $cmps = Kwf_Component_Data_Root::getInstance()->getComponentsByDbId($event->row->component_id, array('ignoreVisible' => true));
     foreach ($cmps as $c) {
         $chainedType = 'Trl';
         $select = array('ignoreVisible' => true);
         $chained = Kwc_Chained_Abstract_Component::getAllChainedByMaster($c, $chainedType, $select);
         foreach ($chained as $i) {
             if ($i->componentClass != $this->_class) {
                 continue;
             }
             if (Kwc_Abstract::hasSetting($this->_class, 'throwContentChangedOnOwnMasterModelUpdate')) {
                 $this->fireEvent(new Kwf_Component_Event_Component_ContentChanged($this->_class, $i));
             }
             if (Kwc_Abstract::hasSetting($this->_class, 'throwHasContentChangedOnMasterRowColumnsUpdate')) {
                 $cols = Kwc_Abstract::getSetting($this->_class, 'throwHasContentChangedOnMasterRowColumnsUpdate');
                 if ($event->isDirty($cols)) {
                     $this->fireEvent(new Kwf_Component_Event_Component_HasContentChanged($this->_class, $i));
                 }
             }
         }
     }
 }