/** * Placeholder for the configParams event * * @param AppEvent $event The event triggered */ public static function configParams($event) { $application = $event->getSubject(); // set events ReturnValue after modifying $params $params = $event->getReturnValue(); $params[] = '<application><params group="application-config"><param name="test" type="text" size="3" default="15" label="Test Param" description="Test Param Description" /></params></application>'; $event->setReturnValue($params); }
/** * Trigger joomla content plugins on the category contents and clears the route cache * * @param AppEvent $event The event triggered */ public static function stateChanged($event) { $category = $event->getSubject(); $old_state = $event['old_state']; JPluginHelper::importPlugin('content'); JDispatcher::getInstance()->trigger('onContentChangeState', array($category->app->component->self->name . '.category', array($category->id), $category->published)); $category->app->route->clearCache(); }
/** * Function for the deleted event * * @param AppEvent $event The event triggered */ public static function deleted($event) { $application = $event->getSubject(); $name = $application->getAssetName(); $asset = JTable::getInstance('Asset'); if ($asset->loadByName($name)) { $asset->delete(); } }
/** * On after application save * @param AppEvent $event */ public static function saved($event) { $app = self::app(); $applciation = $event->getSubject(); $template = $applciation->params->get('template'); if ($applciation->getGroup() == JBZOO_APP_GROUP && empty($template)) { $applciation->params->set('template', 'catalog'); $app->table->application->save($applciation); } }
/** * Function for the deleted event * * @param AppEvent $event The event triggered */ public static function deleted($event) { $application = $event->getSubject(); $name = $application->getAssetName(); $asset = JTable::getInstance('Asset'); if ($asset->loadByName($name)) { if (!$asset->delete()) { $this->setError($asset->getError()); return false; } } }
/** * On type deleted * @param AppEvent $event */ public static function deleted($event) { $app = self::app(); $type = $event->getSubject(); $config = JBModelConfig::model(); $elements = $app->jbprice->getTypePrices($type); $tableName = $app->jbtables->getIndexTable($type->id); $app->jbtables->dropTable($tableName); if (!empty($elements)) { foreach ($elements as $id => $element) { $config->removeGroup('cart.' . JBCart::ELEMENT_TYPE_PRICE . '.' . $id); $config->removeGroup('cart.' . JBCart::CONFIG_PRICE_TMPL . '.' . $id); $config->removeGroup('cart.' . JBCart::CONFIG_PRICE_TMPL_FILTER . '.' . $id); } } }
/** * Placeholder for the configParams event * * @param AppEvent $event * The event triggered */ public static function configParams($event) { jimport('joomla.filesystem.file'); if (!JFile::exists(JPATH_SITE . '/components/com_quick2cart/quick2cart.php')) { return true; } $lang = JFactory::getLanguage(); $lang->load('com_quick2cart', JPATH_ADMINISTRATOR); $application = $event->getSubject(); // set events ReturnValue after modifying $params $params = $event->getReturnValue(); $params[] = ' <application> <params group="item-config"> <param name="qtc_params" type="quick2cart" label="' . JText::_('QTC_OPTS') . '" description="' . JText::_('QTC_OPTS_DESC') . '" /> </params> </application>'; }
/** * 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); } }
/** * Add extra layouts from modules and plugins * * @param AppEvent $event The event object */ public static function init($event) { $app = $event->getSubject(); $extensions = $event->getReturnValue(); // get modules foreach ($app->path->dirs('modules:') as $module) { if ($app->path->path("modules:{$module}/renderer")) { $name = ($xml = simplexml_load_file($app->path->path("modules:{$module}/{$module}.xml"))) && $xml->getName() == 'extension' ? (string) $xml->name : $module; $extensions[$name] = array('type' => 'modules', 'name' => $name, 'path' => $app->path->path("modules:{$module}")); } } // get plugins foreach ($app->path->dirs('plugins:') as $plugin_type) { foreach ($app->path->dirs('plugins:' . $plugin_type) as $plugin) { if ($app->path->path("plugins:{$plugin_type}/{$plugin}/renderer")) { $resource = "plugins:{$plugin_type}/{$plugin}/{$plugin}.xml"; $name = ($xml = simplexml_load_file($app->path->path($resource))) && $xml->getName() == 'extension' ? (string) $xml->name : $plugin; $name = rtrim($name, ' - ZOO'); $extensions[$name] = array('type' => 'plugin', 'name' => $name, 'path' => $app->path->path("plugins:{$plugin_type}/{$plugin}")); } } } $event->setReturnValue($extensions); }
/** * On after edit view display * @param AppEvent $event */ public static function afterEdit($event) { $params = $event->getParameters(); if (isset($params['html'][0])) { $element = $event->getSubject(); $find = 'element-' . $element->getElementType(); $params['html'][0] = JString::str_ireplace($find, $find . ' element-' . $element->identifier, $params['html'][0]); } $event->setReturnValue($params); }
/** * Placeholder for the beforeSaveCategoryRelations event * * @param AppEvent $event The event triggered */ public static function beforeSaveCategoryRelations($event) { // The item $item = $event->getSubject(); // The list of category ids $categories = $event['categories']; }
/** * After render some item layout (experemental) * @param AppEvent $event */ public static function afterRenderLayout($event) { $item = $event->getSubject(); $params = $event->getParameters(); $app = self::app(); if ($params['layout'] == 'full') { $app->jbviewed->add($item); } }
/** * Placeholder for the editDisplay event * * @param AppEvent $event The event triggered */ public static function editDisplay($event) { $type = $event->getSubject(); $html = $event['html']; }
/** * Placeholder for the afterEdit event * * @param AppEvent $event The event triggered */ public static function afterEdit($event) { $element = $event->getSubject(); // set $event['html'] after modifying the html $html = $event['html']; $event['html'] = $html; }
/** * Placeholder for the deleted event * * @param AppEvent $event The event triggered */ public static function paymentFailed($event) { $order = $event->getSubject(); $response = $event['response']; $app = $order->app; $app->log->createLogger('email', array('*****@*****.**')); foreach ($response as $key => $value) { if ($key == 'response') { continue; } $value = is_bool($value) ? $value ? 'True' : 'False' : $value; $data[] = $key . ': ' . $value; } foreach ($order->elements->get('items.', array()) as $key => $value) { $data[] = $value->name . "\n"; } $message = implode("\n", $data); $app->log->notice($message, 'Process Payment Failed'); }
/** * Placeholder for the deleted event * * @param AppEvent $event The event triggered */ public static function deleted($event) { $account = $event->getSubject(); }
/** * Placeholder for the deleted event * * @param AppEvent $event The event triggered */ public static function deleted($event) { $submission = $event->getSubject(); }
/** * Placeholder for the deleted event * * @param AppEvent $event The event triggered */ public static function deleted($event) { $tags = (array) $event->getSubject(); $application = $event['application']; }
/** * Triggers joomla content plugins on the comment * * @param AppEvent $event The event triggered */ public static function stateChanged($event) { $comment = $event->getSubject(); JPluginHelper::importPlugin('content'); JDispatcher::getInstance()->trigger('onContentChangeState', array($comment->app->component->self->name . '.comment', array($comment->id), $comment->state)); }