本文整理汇总了PHP中owa_coreAPI::getEventDispatch方法的典型用法代码示例。如果您正苦于以下问题:PHP owa_coreAPI::getEventDispatch方法的具体用法?PHP owa_coreAPI::getEventDispatch怎么用?PHP owa_coreAPI::getEventDispatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类owa_coreAPI
的用法示例。
在下文中一共展示了owa_coreAPI::getEventDispatch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: notify
/**
* Notify method
*
* @param object $event
* @access public
*/
function notify($event)
{
$ds = owa_coreAPI::entityFactory('base.domstream');
$ds->load($event->get('guid'));
if (!$ds->wasPersisted()) {
$ds->setProperties($event->getProperties());
$ds->set('id', $event->get('guid'));
$ds->set('domstream_guid', $event->get('domstream_guid'));
$ds->set('document_id', $ds->generateId($event->get('page_url')));
$ds->set('page_url', $event->get('page_url'));
$ds->set('events', $event->get('stream_events'));
$ds->set('duration', $event->get('duration'));
$ret = $ds->create();
if ($ret) {
// Tell others that "dom.stream" has been logged
$eq = owa_coreAPI::getEventDispatch();
$nevent = $eq->makeEvent($event->getEventType() . '_logged');
$nevent->setProperties($event->getProperties());
$eq->asyncNotify($nevent);
return OWA_EHS_EVENT_HANDLED;
} else {
return OWA_EHS_EVENT_FAILED;
}
} else {
owa_coreAPI::debug('No persisting. Domsteam already exists.');
return OWA_EHS_EVENT_HANDLED;
}
}
示例2: __construct
function __construct()
{
$this->params = $this->getArgs();
if (isset($this->params['interval'])) {
$this->job_scheduling_interval = $this->params['interval'];
}
if (isset($this->params['max_workers'])) {
$this->max_workers = $this->params['max_workers'];
}
if (isset($this->params['pid_file_location'])) {
$this->pidFileLocation = $this->params['pid_file_location'];
}
if (isset($this->params['uid'])) {
$this->userID = $this->params['uid'];
}
if (isset($this->params['gid'])) {
$this->groupID = $this->params['gid'];
}
if (isset($this->params['pid_file_location'])) {
$this->pidFileLocation = $this->params['pid_file_location'];
}
$s = owa_coreAPI::serviceSingleton();
$this->jobs = $s->getMap('backgound_jobs');
$this->eq = owa_coreAPI::getEventDispatch();
return parent::__construct();
}
示例3: action
function action()
{
$status = $this->installSchema();
if ($status == true) {
$this->set('status_code', 3305);
$password = $this->createAdminUser($this->getParam('email_address'), '', $this->getParam('password'));
$site_id = $this->createDefaultSite($this->getParam('protocol') . $this->getParam('domain'));
// Set install complete flag.
$this->c->persistSetting('base', 'install_complete', true);
$save_status = $this->c->save();
if ($save_status == true) {
$this->e->notice('Install Complete Flag added to configuration');
} else {
$this->e->notice('Could not add Install Complete Flag to configuration.');
}
// fire install complete event.
$ed = owa_coreAPI::getEventDispatch();
$event = $ed->eventFactory();
$event->set('u', 'admin');
$event->set('p', $password);
$event->set('site_id', $site_id);
$event->setEventType('install_complete');
$ed->notify($event);
// set view
$this->set('u', 'admin');
$this->set('p', $password);
$this->set('site_id', $site_id);
$this->setView('base.install');
$this->setSubview('base.installFinish');
//$this->set('status_code', 3304);
} else {
$this->set('error_msg', $this->getMsg(3302));
$this->errorAction();
}
}
示例4: notify
/**
* Notify Handler
*
* @access public
* @param object $event
*/
function notify($event)
{
$c = owa_coreAPI::entityFactory('base.click');
$c->load($event->get('guid'));
if (!$c->wasPersisted()) {
$c->set('id', $event->get('guid'));
$c->setProperties($event->getProperties());
$c->set('visitor_id', $event->get('visitor_id'));
$c->set('session_id', $event->get('session_id'));
$c->set('ua_id', owa_lib::setStringGuid($event->get('HTTP_USER_AGENT')));
// Make document id
$c->set('document_id', owa_lib::setStringGuid($event->get('page_url')));
// Make Target page id
$c->set('target_id', owa_lib::setStringGuid($c->get('target_url')));
// Make position id used for group bys
$c->set('position', $c->get('click_x') . $c->get('click_y'));
$ret = $c->create();
if ($ret) {
// Tell others that "dom.click" has been logged
$eq = owa_coreAPI::getEventDispatch();
$nevent = $eq->makeEvent($event->getEventType() . '_logged');
$nevent->setProperties($event->getProperties());
$eq->asyncNotify($nevent);
return OWA_EHS_EVENT_HANDLED;
} else {
return OWA_EHS_EVENT_FAILED;
}
} else {
return OWA_EHS_EVENT_HANDLED;
}
}
示例5: notify
/**
* Notify Handler
*
* @access public
* @param object $event
*/
function notify($event)
{
$r = owa_coreAPI::entityFactory('base.request');
$r->load($event->get('guid'));
if (!$r->wasPersisted()) {
$r->setProperties($event->getProperties());
// Set Primary Key
$r->set('id', $event->get('guid'));
// Make prior document id
$r->set('prior_document_id', owa_lib::setStringGuid($event->get('prior_page')));
// Generate Host id
$r->set('num_prior_sessions', $event->get('num_prior_sessions'));
$result = $r->create();
if ($result == true) {
$eq = owa_coreAPI::getEventDispatch();
$nevent = $eq->makeEvent($event->getEventType() . '_logged');
$nevent->setProperties($event->getProperties());
$eq->asyncNotify($nevent);
return OWA_EHS_EVENT_HANDLED;
} else {
return OWA_EHS_EVENT_FAILED;
}
} else {
owa_coreAPI::debug('Not persisting. Request already exists.');
return OWA_EHS_EVENT_HANDLED;
}
}
示例6: action
function action()
{
$this->e->notice('About to delete handled events from database event queue.');
$d = owa_coreAPI::getEventDispatch();
$q = $d->getAsyncEventQueue('database');
$this->e->notice('Events removed: ' . $q->flushHandledEvents());
}
示例7: notify
/**
* Notify Event Handler
*
* @param unknown_type $event
* @access public
*/
function notify($event)
{
// Make entity
$f = owa_coreAPI::entityFactory('base.feed_request');
$f->load($event->get('guid'));
if (!$f->wasPersisted()) {
$f->setProperties($event->getProperties());
// Set Primary Key
$f->set('id', $event->get('guid'));
// Make ua id
$f->set('ua_id', owa_lib::setStringGuid($event->get('HTTP_USER_AGENT')));
// Make OS id
$f->set('os_id', owa_lib::setStringGuid($event->get('os')));
// Make document id
$f->set('document_id', owa_lib::setStringGuid($event->get('page_url')));
// Generate Host id
$f->set('host_id', owa_lib::setStringGuid($event->get('host')));
$f->set('subscription_id', $event->get('feed_subscription_id'));
// Persist to database
$ret = $f->create();
if ($ret) {
$eq = owa_coreAPI::getEventDispatch();
$nevent = $eq->makeEvent($event->getEventType() . '_persisted');
$nevent->setProperties($event->getProperties());
$eq->notify($nevent);
return OWA_EHS_EVENT_HANDLED;
} else {
return OWA_EHS_EVENT_FAILED;
}
} else {
owa_coreAPI::debug('Not persisting. Feed request already exists.');
return OWA_EHS_EVENT_HANDLED;
}
}
示例8: action
function action()
{
if ($this->getParam('source')) {
$input_queue_type = $this->getParam('source');
} else {
$input_queue_type = owa_coreAPI::getSetting('base', 'event_queue_type');
}
$processing_queue_type = $this->getParam('destination');
if (!$processing_queue_type) {
$processing_queue_type = owa_coreAPI::getSetting('base', 'event_secondary_queue_type');
}
// switch event queue setting in case a new events should be sent to a different type of queue.
// this is handy for when processing from a file queue to a database queue
if ($processing_queue_type) {
owa_coreAPI::setSetting('base', 'event_queue_type', $processing_queue_type);
owa_coreAPI::debug("Setting event queue type to {$processing_queue_type} for processing.");
}
$d = owa_coreAPI::getEventDispatch();
owa_coreAPI::debug("Loading {$input_queue_type} event queue.");
$q = $d->getAsyncEventQueue($input_queue_type);
$ret = $q->processQueue();
// go ahead and process the secondary event queue
if ($ret && $processing_queue_type) {
$destq = $d->getAsyncEventQueue($processing_queue_type);
$destq->processQueue();
}
}
示例9: __construct
/**
* Class Constructor
*
* @return owa_auth
*/
function __construct()
{
// register auth cookies
owa_coreAPI::registerStateStore('u', time() + 3600 * 24 * 365 * 10, '', '', 'cookie');
owa_coreAPI::registerStateStore('p', time() + 3600 * 2, '', '', 'cookie');
parent::__construct();
$this->eq = owa_coreAPI::getEventDispatch();
}
示例10: action
function action()
{
if ($this->getParam('queues')) {
$queues = $this->getParam('queues');
} else {
$queues = 'incoming_tracking_events,processing';
}
owa_coreAPI::notice("About to process event queues: {$queues}");
// pull list of event queues to process from command line
$queues = $this->getParam('queues');
if ($queues) {
// parse command line
$queues = explode(',', $this->getParam('queues'));
} else {
// get whatever queues are registered by modules
$s = owa_coreAPI::serviceSingleton();
$queues = array_keys($s->getMap('event_queues'));
}
if ($queues) {
foreach ($queues as $queue_name) {
$q = owa_coreAPI::getEventQueue($queue_name);
if ($q->connect()) {
$d = owa_coreAPI::getEventDispatch();
$more = true;
while ($more) {
owa_coreAPI::debug('calling receive message');
// get an item from the queue
$event = $q->receiveMessage();
owa_coreAPI::debug('Event returned: ' . print_r($event, true));
if ($event) {
// process event if needed
// lookup which event processor to use to process this event type
$processor_action = owa_coreAPI::getEventProcessor($event->getEventType());
if ($processor_action) {
// processor handles it's own event dispatching, so just return
return owa_coreAPI::handleRequest(array('event' => $event), $processor_action);
} else {
// dispatch event
$ret = $d->notify($event);
}
if ($ret = OWA_EHS_EVENT_HANDLED) {
// delete event from queue
// second param is for backwards compat. remove soon
$q->deleteMessage($event->getQueueGuid());
}
} else {
// if no event, stop the loop
$more = false;
owa_coreAPI::notice("No more events to process.");
}
}
$q->disconnect();
}
}
} else {
owa_coreAPI::notice("There are no event queues registered.");
}
}
示例11: action
function action()
{
$userManager = owa_coreApi::supportClassFactory('base', 'userManager');
$user_params = array('user_id' => trim($this->params['user_id']), 'real_name' => $this->params['real_name'], 'role' => $this->params['role'], 'email_address' => trim($this->params['email_address']));
$temp_passkey = $userManager->createNewUser($user_params);
// log account creation event to event queue
$ed = owa_coreAPI::getEventDispatch();
$ed->log(array('user_id' => $this->params['user_id'], 'real_name' => $this->params['real_name'], 'role' => $this->params['role'], 'email_address' => $this->params['email_address'], 'temp_passkey' => $temp_passkey), 'base.new_user_account');
$this->setRedirectAction('base.users');
$this->set('status_code', 3000);
}
示例12: __construct
function __construct($params)
{
if (array_key_exists('event', $params) && !empty($params['event'])) {
$this->event = $params['event'];
} else {
owa_coreAPI::debug("No event object was passed to controller.");
$this->event = owa_coreAPI::supportClassFactory('base', 'event');
}
$this->eq = owa_coreAPI::getEventDispatch();
return parent::__construct($params);
}
示例13: action
function action()
{
// Log password reset request to event queue
$ed = owa_coreAPI::getEventDispatch();
$event = $ed->makeEvent('base.reset_password');
$event->set('email_address', $this->getParam('email_address'));
$ed->notify($event);
// return view
$this->setView('base.passwordResetForm');
$email_address = trim($this->getParam('email_address'));
$msg = $this->getMsg(2000, $email_address);
$this->set('status_msg', $msg);
}
示例14: getGeolocationFromIp
function getGeolocationFromIp($ip_address, $refresh = false)
{
if (empty($this->properties) || $refresh === true) {
$geo = array('ip_address' => $ip_address, 'city' => '', 'country' => '', 'state' => '', 'country_code' => '', 'latitude' => '', 'longitude' => '');
if (owa_coreAPI::getSetting('base', 'geolocation_lookup')) {
$eq = owa_coreAPI::getEventDispatch();
$geo = $eq->filter('geolocation', $geo);
}
foreach ($geo as $k => $v) {
if (!$v) {
$geo[$k] = '(not set)';
}
}
$this->properties = $geo;
}
}
示例15: notify
/**
* Notify Event Handler
*
* @param unknown_type $event
* @access public
*/
function notify($event)
{
// Make entity
$f = owa_coreAPI::entityFactory('base.feed_request');
$f->load($event->get('guid'));
if (!$f->wasPersisted()) {
// rekey Feed subscription id tracking code
// @todo check the wordpress plugin to see if this is even needed
if (!$event->get('feed_subscription_id')) {
$event->set('feed_subscription_id', $event->get(owa_coreAPI::getSetting('base', 'feed_subscription_param')));
}
// needed??
$event->set('feed_reader_guid', $event->setEnvGUID());
// set feedreader flag to true, browser flag to false
$event->set('is_feedreader', true);
$event->set('is_browser', false);
// set params on entity
$f->setProperties($event->getProperties());
// Set Primary Key
$f->set('id', $event->get('guid'));
// Make ua id
$f->set('ua_id', owa_lib::setStringGuid($event->get('HTTP_USER_AGENT')));
// Make OS id
$f->set('os_id', owa_lib::setStringGuid($event->get('os')));
// Make document id
$f->set('document_id', owa_lib::setStringGuid($event->get('page_url')));
// Generate Host id
$f->set('host_id', owa_lib::setStringGuid($event->get('host')));
$f->set('subscription_id', $event->get('feed_subscription_id'));
// Persist to database
$ret = $f->create();
if ($ret) {
$eq = owa_coreAPI::getEventDispatch();
$nevent = $eq->makeEvent($event->getEventType() . '_logged');
$nevent->setProperties($event->getProperties());
$eq->notify($nevent);
return OWA_EHS_EVENT_HANDLED;
} else {
return OWA_EHS_EVENT_FAILED;
}
} else {
owa_coreAPI::debug('Not persisting. Feed request already exists.');
return OWA_EHS_EVENT_HANDLED;
}
}