* @license PHP License * @package WB * @subpackage base */ WBClass::load('WBAjax'); /** * Simple AJAX stub: Event Trigger * * Trigger event using AJAX Call * * @version 0.1.1 * @package WB * @subpackage base */ class WBAjax_EventTrigger extends WBAjax { /** * Config * @var WBConfig */ protected $config; /** * Second construcotr * * Called by constructer of super class. * @see include/WB/WBAjax#init() */ protected function init() { $this->config = WBClass::create('WBConfig'); $this->config->load('event/trigger'); } /** * Trigger Event * * @return string comment list HTML */ protected function trigger() { $name = $this->req->get('__name', ''); $config = $this->config->get('trigger/' . $name, array()); if (empty($config)) { // no event found return 1; } if (empty($config['event'])) { // empty event return 1; } if (!empty($config['requiredgroup']) && !$this->user->isInGroup($config['requiredgroup'])) { // user not sufficiant return 2; } $data = $this->req->export(); unset($data['__name']); WBEvent::Trigger($config['event'], 'Ajax Event Trigger', $data); return 0; } }