/** * Execute all elements for system event (zoo trigger) * @param AppEvent $event * @return void */ public function fireElements(AppEvent $event) { $eventName = $this->app->jbvars->lower($event->getName(), true); // simple check if (!$eventName || !isset($this->_eventList[$eventName])) { return; } // prepare vars $eventData = $this->_eventList[$eventName]; $order = $event->getSubject(); $params = $event->getParameters(); // system events $cartConf = JBModelConfig::model()->getGroup('cart.' . JBCart::CONFIG_NOTIFICATION); $elements = $cartConf->get($eventData['name'], array()); $this->_execElements($event, $elements, $order, $params); // status events if (isset($eventData['status']) && $eventData['status']) { $cartConf = JBModelConfig::model()->getGroup('cart.' . JBCart::CONFIG_STATUS_EVENTS); $elements = $cartConf->get($eventData['status'] . '__' . $params['newStatus'], array()); $this->_execElements($event, $elements, $order, $params); } }
/** * Filters a value by calling all listeners of a given event. * * @param AppEvent $event A AppEvent instance * @param mixed $value The value to be filtered * * @return AppEvent The AppEvent instance * * @since 1.0.0 */ public function filter(AppEvent $event, $value) { foreach ($this->getListeners($event->getName()) as $listener) { $value = call_user_func_array($listener, array($event, $value)); } $event->setReturnValue($value); return $event; }