コード例 #1
0
 public function onChildModelUpdated(Kwf_Events_Event_Row_Updated $ev)
 {
     if ($ev->isDirty('visible')) {
         foreach (Kwf_Component_Data_Root::getInstance()->getComponentsByDbId($ev->row->component_id) as $c) {
             if ($c->componentClass == $this->_class) {
                 $this->fireEvent(new Kwf_Component_Event_Component_ContentChanged($this->_class, $c));
             }
         }
     }
 }
コード例 #2
0
 public function onRowUpdate(Kwf_Events_Event_Row_Updated $event)
 {
     if ($event->isDirty('visible')) {
         $cmps = Kwf_Component_Data_Root::getInstance()->getComponentsByDbId($event->row->getParentRow('Project')->component_id);
         foreach ($cmps as $c) {
             if ($c->componentClass == $this->_class) {
                 $this->fireEvent(new Kwf_Component_Event_Component_HasContentChanged($this->_class, $c));
             }
         }
     }
 }
コード例 #3
0
 public function onLanguageUpdate(Kwf_Events_Event_Row_Updated $event)
 {
     if ($event->isDirty('visible')) {
         $c = Kwf_Component_Data_Root::getInstance()->getChildComponent(array('id' => '-' . $event->row->id, 'ignoreVisible' => true));
         if ($c) {
             if ($event->row->visible) {
                 $this->fireEvent(new Kwf_Component_Event_Page_Added($this->_class, $c, Kwf_Component_Event_Component_AbstractFlag::FLAG_VISIBILITY_CHANGED));
             } else {
                 $this->fireEvent(new Kwf_Component_Event_Page_Removed($this->_class, $c, Kwf_Component_Event_Component_AbstractFlag::FLAG_VISIBILITY_CHANGED));
             }
         }
     }
 }
コード例 #4
0
 public function onRowUpdate(Kwf_Events_Event_Row_Updated $event)
 {
     if ($event->isDirty('visible')) {
         //component_id is the child component id, not as in master the list component id
         $cmps = Kwf_Component_Data_Root::getInstance()->getComponentsByDbId($event->row->component_id, array('ignoreVisible' => true));
         foreach ($cmps as $c) {
             $c = $c->parent;
             if ($c->componentClass == $this->_class) {
                 $this->fireEvent(new Kwf_Component_Event_Component_HasContentChanged($this->_class, $c));
                 $this->fireEvent(new Kwf_Component_Event_Component_ContentChanged($this->_class, $c));
             }
         }
     }
 }
コード例 #5
0
 public function onRowUpdate(Kwf_Events_Event_Row_Updated $event)
 {
     foreach ($this->_getComponentsByRow($event->row) as $c) {
         if ($c->componentClass == $this->_class) {
             $generator = Kwf_Component_Generator_Abstract::getInstance($this->_class, 'child');
             $child = $c->getChildComponent(array('id' => $generator->getIdSeparator() . $event->row->{$generator->getIdColumn()}, 'ignoreVisible' => true));
             $this->fireEvent(new Kwf_Component_Event_Component_ContentChanged($this->_class, $c));
             if (Kwc_Abstract::getSetting($this->_class, 'hasVisible') && $event->isDirty('visible')) {
                 $this->fireEvent(new Kwf_Component_Event_Component_HasContentChanged($this->_class, $c));
                 if ($event->row->visible) {
                     $this->fireEvent(new Kwc_Abstract_List_EventItemInserted($this->_class, $child));
                 } else {
                     $this->fireEvent(new Kwc_Abstract_List_EventItemDeleted($this->_class, $child));
                 }
             } else {
                 $this->fireEvent(new Kwc_Abstract_List_EventItemUpdated($this->_class, $child));
             }
         }
     }
 }
コード例 #6
0
 public function onPageRowUpdate(Kwf_Events_Event_Row_Updated $event)
 {
     //getComponentsByDbId is not required because those are sure to be numeric and thus exist only once
     $c = Kwf_Component_Data_Root::getInstance()->getComponentById($event->row->id);
     if ($c) {
         if ($event->isDirty('parent_id')) {
             $oldParentId = $event->row->getCleanValue('parent_id');
             if ($oldParentId) {
                 $oldParent = Kwf_Component_Data_Root::getInstance()->getComponentById($oldParentId, array('ignoreVisible' => true));
                 $newParent = Kwf_Component_Data_Root::getInstance()->getComponentById($event->row->parent_id, array('ignoreVisible' => true));
                 $this->fireEvent(new Kwf_Component_Event_Page_ParentChanged($this->_class, $c, $newParent, $oldParent));
             }
             $this->fireEvent(new Kwf_Component_Event_Page_RecursiveUrlChanged($this->_class, $c));
         }
         if ($event->isDirty('hide')) {
             $this->fireEvent(new Kwf_Component_Event_Page_ShowInMenuChanged($this->_class, $c));
         }
         if ($event->isDirty('device_visible')) {
             $this->fireEvent(new Kwf_Component_Event_Page_ShowInMenuChanged($this->_class, $c));
         }
         if ($event->isDirty('is_home')) {
             $this->fireEvent(new Kwf_Component_Event_Page_UrlChanged($this->_class, $c));
         }
     }
     if ($event->isDirty(array('parent_id', 'visible'))) {
         $this->_deletePageDataCacheRecursive($event->row->id);
     }
     if ($event->isDirty('parent_id')) {
         $oldParentId = $event->row->getCleanValue('parent_id');
         $newParentId = $event->row->parent_id;
         Kwf_Cache_Simple::delete('pcIds-' . $oldParentId);
         Kwf_Cache_Simple::delete('pcIds-' . $newParentId);
     }
     if ($event->isDirty('pos')) {
         //cache is ordered by pos
         Kwf_Cache_Simple::delete('pcIds-' . $event->row->parent_id);
     }
 }