Esempio n. 1
0
 protected function _onOwnRowUpdateNotVisible(Kwf_Component_Data $c, Kwf_Events_Event_Row_Abstract $event)
 {
     parent::_onOwnRowUpdateNotVisible($c, $event);
     if ($event->isDirty(array('kwf_upload_id', 'width', 'height', 'dimension', 'crop_x', 'crop_y', 'crop_width', 'crop_height'))) {
         $this->_fireMediaChanged($c);
     }
 }
Esempio n. 2
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     $masterComponentClass = Kwc_Abstract::getSetting($this->_class, 'masterComponentClass');
     $ret[] = array('class' => $masterComponentClass, 'event' => 'Kwf_Component_Event_Component_ContentChanged', 'callback' => 'onMasterContentChanged');
     return $ret;
 }
Esempio n. 3
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     $generators = Kwc_Abstract::getSetting($this->_class, 'generators');
     $ret[] = array('class' => $generators['child']['component'], 'event' => 'Kwf_Component_Event_Component_HasContentChanged', 'callback' => 'onChildHasContentChange');
     return $ret;
 }
Esempio n. 4
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     //find components that can create ourself ($this->_class)
     foreach ($this->_getCreatingClasses($this->_class) as $class) {
         $ret[] = array('class' => $class, 'event' => 'Kwf_Events_Event_Media_Changed', 'callback' => 'onMediaChanged');
         $ret[] = array('class' => $class, 'event' => 'Kwf_Component_Event_Component_ContentChanged', 'callback' => 'onContentChanged');
         $ret[] = array('class' => $class, 'event' => 'Kwf_Component_Event_ComponentClass_ContentChanged', 'callback' => 'onClassContentChanged');
         $imageEnlargeClasses = array();
         foreach ($this->_getCreatingClasses($class) as $c) {
             if (in_array('Kwc_Basic_LinkTag_Component', Kwc_Abstract::getParentClasses($c))) {
                 $imageEnlargeClasses = array_merge($imageEnlargeClasses, $this->_getCreatingClasses($c));
             } else {
                 $imageEnlargeClasses[] = $c;
             }
         }
         foreach ($imageEnlargeClasses as $imageEnlargeClass) {
             // TODO: does not cover "List_Switch with ImageEnlarge as large component (we have to go up one more level)"
             foreach ($this->_getCreatingClasses($imageEnlargeClass, null) as $listClass) {
                 if (!is_instance_of($listClass, 'Kwc_Abstract_List_Component')) {
                     $listClasses = $this->_getCreatingClasses($listClass, 'Kwc_Abstract_List_Component');
                 } else {
                     $listClasses = array($listClass);
                 }
                 foreach ($listClasses as $listClass) {
                     $ret[] = array('class' => $listClass, 'event' => 'Kwc_Abstract_List_EventItemDeleted', 'callback' => 'onListItemChange');
                     $ret[] = array('class' => $listClass, 'event' => 'Kwc_Abstract_List_EventItemInserted', 'callback' => 'onListItemChange');
                     $ret[] = array('class' => $listClass, 'event' => 'Kwc_Abstract_List_EventItemUpdated', 'callback' => 'onListItemChange');
                 }
             }
         }
     }
     return $ret;
 }
Esempio n. 5
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     $ret[] = array('event' => 'Kwf_Component_Event_Page_ParentChanged', 'callback' => 'onPageParentChanged');
     $ret[] = array('class' => Kwc_Abstract::getSetting($this->_class, 'menuComponentClass'), 'event' => 'Kwf_Component_Event_Component_HasContentChanged', 'callback' => 'onMenuHasContentChanged');
     return $ret;
 }
Esempio n. 6
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     $ret[] = array('class' => null, 'event' => 'Kwf_Component_Event_Page_ParentChanged', 'callback' => 'onPageParentChanged');
     foreach (Kwc_Abstract::getComponentClasses() as $class) {
         $classWithoutPoint = $class;
         if (($pos = strpos($class, '.')) !== false) {
             $classWithoutPoint = substr($class, 0, $pos);
         }
         if (Kwc_Abstract::getFlag($class, 'hasAlternativeComponent') && in_array($this->_class, call_user_func(array($classWithoutPoint, 'getAlternativeComponents'), $class))) {
             $ret[] = array('class' => $class, 'event' => 'Kwf_Component_Event_Component_HasContentChanged', 'callback' => 'onParentHasContentChanged');
             $ret[] = array('class' => $class, 'event' => 'Kwf_Component_Event_Component_RecursiveHasContentChanged', 'callback' => 'onParentRecursiveHasContentChanged');
         }
         foreach (Kwc_Abstract::getSetting($class, 'generators') as $generator) {
             if ($generator['class'] == 'Kwf_Component_Generator_Box_StaticSelect' && is_array($generator['component']) && in_array($this->_class, $generator['component'])) {
                 foreach ($generator['component'] as $componentClass) {
                     if ($componentClass == $this->_class) {
                         continue;
                     }
                     $ret[] = array('class' => $componentClass, 'event' => 'Kwf_Component_Event_Component_HasContentChanged', 'callback' => 'onParentHasContentChanged');
                     $ret[] = array('class' => $componentClass, 'event' => 'Kwf_Component_Event_Component_RecursiveHasContentChanged', 'callback' => 'onParentRecursiveHasContentChanged');
                 }
             }
         }
     }
     return $ret;
 }
Esempio n. 7
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     foreach (Kwc_Abstract::getChildComponentClasses($this->_class, 'child') as $class) {
         $ret[] = array('class' => $class, 'event' => 'Kwf_Component_Event_Component_HasContentChanged', 'callback' => 'onChildHasContentChange');
     }
     return $ret;
 }
Esempio n. 8
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     $ret[] = array('class' => $this->_menuComponentClass, 'event' => 'Kwf_Component_Event_ComponentClass_ContentChanged', 'callback' => 'onMenuComponentClassContentChanged');
     $ret[] = array('class' => $this->_menuComponentClass, 'event' => 'Kwf_Component_Event_Component_ContentChanged', 'callback' => 'onMenuContentChanged');
     $ret[] = array('class' => $this->_menuComponentClass, 'event' => 'Kwf_Component_Event_Component_HasContentChanged', 'callback' => 'onMenuHasContentChanged');
     return $ret;
 }
Esempio n. 9
0
 protected function _onOwnRowUpdateNotVisible(Kwf_Component_Data $c, Kwf_Events_Event_Row_Abstract $event)
 {
     parent::_onOwnRowUpdateNotVisible($c, $event);
     $reference = $event->row->getModel()->getReference(Kwc_Abstract::getSetting($this->_class, 'uploadModelRule'));
     if ($event->isDirty($reference['column'])) {
         $this->fireEvent(new Kwf_Events_Event_Media_Changed($this->_class, $c));
     }
 }
Esempio n. 10
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     $ret[] = array('class' => 'Kwf_Component_Generator_Plugin_Tags_ComponentsToTagsModel', 'event' => 'Kwf_Events_Event_Row_Inserted', 'callback' => 'onRowOperation');
     $ret[] = array('class' => 'Kwf_Component_Generator_Plugin_Tags_ComponentsToTagsModel', 'event' => 'Kwf_Events_Event_Row_Deleted', 'callback' => 'onRowOperation');
     $ret[] = array('class' => 'Kwf_Component_Generator_Plugin_Tags_ComponentsToTagsModel', 'event' => 'Kwf_Events_Event_Row_Updated', 'callback' => 'onRowOperation');
     return $ret;
 }
Esempio n. 11
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     $ret[] = array('class' => 'Kwc_Tags_ComponentToTag', 'event' => 'Kwf_Events_Event_Row_Inserted', 'callback' => 'onTagRowUpdate');
     $ret[] = array('class' => 'Kwc_Tags_ComponentToTag', 'event' => 'Kwf_Events_Event_Row_Deleted', 'callback' => 'onTagRowUpdate');
     $ret[] = array('class' => 'Kwc_Tags_Suggestions_Model', 'event' => 'Kwf_Component_Event_Row_Updated', 'callback' => 'onTagRowUpdate');
     return $ret;
 }
Esempio n. 12
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     $model = Kwc_Abstract::createChildModel($this->_class);
     $siblingModels = $model->getSiblingModels();
     $ret[] = array('class' => get_class($siblingModels[0]), 'event' => 'Kwf_Events_Event_Row_Updated', 'callback' => 'onLanguageUpdate');
     return $ret;
 }
Esempio n. 13
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     $ret[] = array('event' => 'Kwf_Component_Event_Page_Removed', 'callback' => 'onPageAddedOrRemoved');
     $ret[] = array('event' => 'Kwf_Component_Event_Page_Added', 'callback' => 'onPageAddedOrRemoved');
     $ret[] = array('event' => 'Kwf_Component_Event_Page_PositionChanged', 'callback' => 'onPageAddedOrRemoved');
     return $ret;
 }
Esempio n. 14
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     $ret[] = array('class' => Kwc_Abstract::getSetting($this->_class, 'downloadsModel'), 'event' => 'Kwf_Events_Event_Row_Inserted', 'callback' => 'onRowInsertOrDelete');
     $ret[] = array('class' => Kwc_Abstract::getSetting($this->_class, 'downloadsModel'), 'event' => 'Kwf_Events_Event_Row_Deleted', 'callback' => 'onRowInsertOrDelete');
     $ret[] = array('class' => Kwc_Abstract::getSetting($this->_class, 'downloadsModel'), 'event' => 'Kwf_Events_Event_Row_Updated', 'callback' => 'onRowUpdate');
     return $ret;
 }
Esempio n. 15
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     foreach ($this->_getCreatingClasses($this->_class) as $c) {
         if (is_instance_of($c, 'Kwc_Basic_LinkTag_Component')) {
             $ret[] = array('class' => $c, 'event' => 'Kwf_Component_Event_Component_ContentChanged', 'callback' => 'onLinkTagContentChanged');
         }
     }
     return $ret;
 }
Esempio n. 16
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     foreach ($this->_getCreatingClasses($this->_class) as $class) {
         $ret[] = array('class' => $class, 'event' => 'Kwf_Component_Event_Component_ContentChanged', 'callback' => 'onLanguageChanged');
     }
     $ret[] = array('event' => 'Kwf_Component_Event_Page_UrlChanged', 'callback' => 'onUrlChanged');
     $ret[] = array('event' => 'Kwf_Component_Event_Page_RecursiveUrlChanged', 'callback' => 'onRecursiveUrlChanged');
     return $ret;
 }
Esempio n. 17
0
 protected function _onOwnRowUpdateNotVisible(Kwf_Component_Data $c, Kwf_Events_Event_Row_Abstract $event)
 {
     parent::_onOwnRowUpdateNotVisible($c, $event);
     if ($event->isDirty('kwf_upload_id')) {
         $this->fireEvent(new Kwf_Events_Event_Media_Changed($this->_class, $c));
     }
     if ($event->isDirty('filename') || $event->isDirty('kwf_upload_id')) {
         $this->fireEvent(new Kwf_Component_Event_Page_UrlChanged($this->_class, $c));
     }
 }
Esempio n. 18
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     $generator = Kwf_Component_Generator_Abstract::getInstance($this->_class, 'detail');
     $ret[] = array('class' => get_class($generator->getModel()), 'event' => 'Kwf_Events_Event_Row_Updated', 'callback' => 'onChildRowUpdate');
     $ret[] = array('class' => get_class($generator->getModel()), 'event' => 'Kwf_Events_Event_Row_Inserted', 'callback' => 'onChildRowInsert');
     $ret[] = array('class' => get_class($generator->getModel()), 'event' => 'Kwf_Events_Event_Row_Deleted', 'callback' => 'onChildRowDelete');
     $ret[] = array('class' => get_class($generator->getModel()), 'event' => 'Kwf_Events_Event_Model_Updated', 'callback' => 'onChildModelUpdated');
     return $ret;
 }
Esempio n. 19
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     $ret[] = array('class' => null, 'event' => 'Kwf_Component_Event_Page_Added', 'callback' => 'onPageChanged');
     $ret[] = array('class' => null, 'event' => 'Kwf_Component_Event_Page_Removed', 'callback' => 'onPageChanged');
     $ret[] = array('class' => null, 'event' => 'Kwf_Component_Event_Page_PositionChanged', 'callback' => 'onPageChanged');
     $ret[] = array('class' => null, 'event' => 'Kwf_Component_Event_Page_ShowInMenuChanged', 'callback' => 'onPageChanged');
     $ret[] = array('class' => null, 'event' => 'Kwf_Component_Event_Page_ParentChanged', 'callback' => 'onParentChanged');
     $ret[] = array('class' => null, 'event' => 'Kwf_Component_Event_Component_RecursiveRemoved', 'callback' => 'onRecursiveRemoved');
     return $ret;
 }
Esempio n. 20
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     foreach (Kwc_Abstract::getComponentClasses() as $class) {
         if (in_array('Kwc_Advanced_SearchEngineReferer_Component', Kwc_Abstract::getParentClasses($class))) {
             $m = Kwc_Abstract::createChildModel($class);
             $ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Inserted', 'callback' => 'onRowInsert');
         }
     }
     return $ret;
 }
Esempio n. 21
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     $g = Kwc_Abstract::getSetting($this->_class, 'generators');
     $ret[] = array('class' => $g['child']['component'], 'event' => 'Kwf_Component_Event_Component_HasContentChanged', 'callback' => 'onChildHasContentChanged');
     $ret[] = array('event' => 'Kwf_Component_Event_Page_Removed', 'callback' => 'onPageAddedOrRemoved');
     $ret[] = array('event' => 'Kwf_Component_Event_Page_Added', 'callback' => 'onPageAddedOrRemoved');
     $ret[] = array('event' => 'Kwf_Component_Event_Page_PositionChanged', 'callback' => 'onPageAddedOrRemoved');
     $ret[] = array('class' => Kwc_Abstract::getSetting($this->_class, 'childModel'), 'event' => 'Kwf_Events_Event_Row_Updated', 'callback' => 'onChildModelUpdated');
     return $ret;
 }
Esempio n. 22
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     foreach (Kwc_Abstract::getComponentClasses() as $c) {
         if (Kwc_Abstract::getFlag($c, 'assetsPackage')) {
             $ret[] = array('class' => $c, 'event' => 'Kwf_Component_Event_Component_Added', 'callback' => 'onComponentAddedRemoved');
             $ret[] = array('class' => $c, 'event' => 'Kwf_Component_Event_Component_Removed', 'callback' => 'onComponentAddedRemoved');
         }
     }
     return $ret;
 }
Esempio n. 23
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     foreach (Kwc_Abstract::getComponentClasses() as $class) {
         if ($this->_canCreateUsIndirectly($class)) {
             $ret[] = array('class' => $class, 'event' => 'Kwf_Component_Event_ComponentClass_ContentChanged', 'callback' => 'onClassContentChanged');
             $ret[] = array('class' => $class, 'event' => 'Kwc_Abstract_Image_ImageChangedEvent', 'callback' => 'onImageChanged');
         }
     }
     return $ret;
 }
Esempio n. 24
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     $generators = Kwc_Abstract::getSetting($this->_class, 'generators');
     $ret[] = array('class' => $generators['child']['component']['child'], 'event' => 'Kwf_Component_Event_Component_HasContentChanged', 'callback' => 'onChildHasContentChange');
     $masterComponentClass = Kwc_Abstract::getSetting($this->_class, 'masterComponentClass');
     $cls = strpos($masterComponentClass, '.') ? substr($masterComponentClass, 0, strpos($masterComponentClass, '.')) : $masterComponentClass;
     $m = call_user_func(array($cls, 'createChildModel'), $masterComponentClass);
     $ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Updated', 'callback' => 'onMasterRowUpdate');
     $ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Deleted', 'callback' => 'onMasterRowDelete');
     return $ret;
 }
Esempio n. 25
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     //find components that can create ourself ($this->_class)
     foreach ($this->_getCreatingClasses($this->_class) as $class) {
         $ret[] = array('class' => $class, 'event' => 'Kwf_Events_Event_Media_Changed', 'callback' => 'onMediaChanged');
         $ret[] = array('class' => $class, 'event' => 'Kwf_Component_Event_Component_ContentChanged', 'callback' => 'onContentChanged');
         $ret[] = array('class' => $class, 'event' => 'Kwf_Component_Event_ComponentClass_ContentChanged', 'callback' => 'onClassContentChanged');
         $ret[] = array('class' => $class, 'event' => 'Kwc_Abstract_Image_ImageChangedEvent', 'callback' => 'onImageChanged');
     }
     return $ret;
 }
Esempio n. 26
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     $ret[] = array('class' => $this->_menuComponentClass, 'event' => 'Kwf_Component_Event_ComponentClass_ContentChanged', 'callback' => 'onMenuComponentClassContentChanged');
     $ret[] = array('class' => $this->_menuComponentClass, 'event' => 'Kwf_Component_Event_Component_ContentChanged', 'callback' => 'onMenuContentChanged');
     $ret[] = array('class' => $this->_menuComponentClass, 'event' => 'Kwf_Component_Event_Component_HasContentChanged', 'callback' => 'onMenuHasContentChanged');
     $c = $this->_menuComponentClass;
     $alternativeComponents = call_user_func(array(strpos($c, '.') ? substr($c, 0, strpos($c, '.')) : $c, 'getAlternativeComponents'), $this->_menuComponentClass);
     $ret[] = array('class' => $alternativeComponents['otherCategory'], 'event' => 'Kwf_Component_Event_Component_ContentChanged', 'callback' => 'onMenuContentChanged');
     $ret[] = array('class' => $alternativeComponents['otherCategory'], 'event' => 'Kwf_Component_Event_Component_HasContentChanged', 'callback' => 'onMenuHasContentChanged');
     return $ret;
 }
Esempio n. 27
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     $generators = Kwc_Abstract::getSetting($this->_class, 'generators');
     foreach ($generators['paragraphs']['component'] as $component) {
         $ret[] = array('class' => $component, 'event' => 'Kwf_Component_Event_Component_HasContentChanged', 'callback' => 'onChildHasContentChange');
     }
     $m = Kwc_Abstract::createChildModel($this->_class);
     $ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Updated', 'callback' => 'onRowUpdate');
     $ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Inserted', 'callback' => 'onRowInsertOrDelete');
     $ret[] = array('class' => $m, 'event' => 'Kwf_Events_Event_Row_Deleted', 'callback' => 'onRowInsertOrDelete');
     return $ret;
 }
Esempio n. 28
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     foreach (Kwc_Abstract::getComponentClasses() as $class) {
         foreach (Kwc_Abstract::getChildComponentClasses($class) as $childClass) {
             if ($childClass == $this->_class) {
                 $ret[] = array('class' => $class, 'event' => 'Kwf_Component_Event_ComponentClass_ContentChanged', 'callback' => 'onParentContentChanged');
                 $ret[] = array('class' => $class, 'event' => 'Kwf_Component_Event_ComponentClass_AllPartialChanged', 'callback' => 'onParentPartialsChanged');
             }
         }
     }
     return $ret;
 }
Esempio n. 29
0
 protected function _onOwnRowUpdateNotVisible(Kwf_Component_Data $c, Kwf_Events_Event_Row_Abstract $event)
 {
     parent::_onOwnRowUpdateNotVisible($c, $event);
     if ($event->isDirty(array('video_width', 'video_height'))) {
         $this->fireEvent(new Kwf_Component_Event_Component_ContentWidthChanged($this->_class, $c));
     }
     if ($event->isDirty(array('mp4_kwf_upload_id'))) {
         $this->_fireMediaChanged($c, 'mp4');
     }
     if ($event->isDirty(array('ogg_kwf_upload_id'))) {
         $this->_fireMediaChanged($c, 'ogg');
     }
     if ($event->isDirty(array('webm_kwf_upload_id'))) {
         $this->_fireMediaChanged($c, 'webm');
     }
     //content changed
     foreach (Kwf_Component_Data_Root::getInstance()->getComponentsByDbId($event->row->component_id) as $c) {
         $this->fireEvent(new Kwf_Component_Event_Component_ContentChanged($this->_class, $c));
     }
 }
Esempio n. 30
0
 public function getListeners()
 {
     $ret = parent::getListeners();
     foreach (Kwc_Abstract::getComponentClasses() as $componentClass) {
         $generators = Kwf_Component_Generator_Abstract::getInstances($componentClass, array('box' => true));
         foreach ($generators as $g) {
             foreach ($g->getChildComponentClasses() as $c) {
                 //TODO: only listen to boxes that use if (hasContent(..)) in master template
                 //      (once this is implemented (Recursive)MasterContentChanged must be fired on (Recursive)ContentWidthChanged)
                 if ($g->hasSetting('unique') && $g->getSetting('unique')) {
                     $ret[] = array('class' => $c, 'event' => 'Kwf_Component_Event_Component_HasContentChanged', 'callback' => 'onUniqueBoxHasContentChanged');
                 } else {
                     $ret[] = array('class' => $c, 'event' => 'Kwf_Component_Event_Component_HasContentChanged', 'callback' => 'onBoxHasContentChanged');
                 }
                 $ret[] = array('class' => $c, 'event' => 'Kwf_Component_Event_Component_RecursiveHasContentChanged', 'callback' => 'onBoxRecursiveHasContentChanged');
             }
         }
     }
     $ret[] = array('event' => 'Kwf_Component_Event_Component_RecursiveAdded', 'callback' => 'onRecursiveAdded');
     return $ret;
 }