Describe "visitorTrack" event in Events class

This commit is contained in:
Dmitriy Simushev 2014-10-17 14:01:23 +00:00
parent 1814298f4f
commit e61b91dd5e
2 changed files with 16 additions and 1 deletions

View File

@ -20,6 +20,7 @@
namespace Mibew\Controller;
use Mibew\EventDispatcher\EventDispatcher;
use Mibew\EventDispatcher\Events;
use Mibew\Settings;
use Mibew\Thread;
use Symfony\Component\HttpFoundation\Request;
@ -34,6 +35,8 @@ class WidgetController extends AbstractController
/**
* Provides a gateway for widget requests.
*
* Triggers {@link \Mibew\EventDispatcher\Events::VISITOR_TRACK} event.
*
* @param Request $request
* @return string Rendered page content
*/
@ -89,7 +92,7 @@ class WidgetController extends AbstractController
// Provide an ability for others to make something on visitor
// tracking
$event_arguments = array('visitor' => $visitor);
EventDispatcher::getInstance()->triggerEvent('visitorTrack', $event_arguments);
EventDispatcher::getInstance()->triggerEvent(Events::VISITOR_TRACK, $event_arguments);
// Get invitation state
$invitation_state = invitation_state($visitor_id);

View File

@ -155,4 +155,16 @@ final class Events
* a response object to this field.
*/
const RESOURCE_NOT_FOUND = 'resourceNotFound';
/**
* Visitor is tracked by the system.
*
* This event is triggered every time a visitor is tracked by the widget. An
* associative array with the following items is passed to the event
* handlers:
* - "visitor": array, list of visitor's info. See returned value of
* {@link track_get_visitor_by_id()} function for details of its
* structure.
*/
const VISITOR_TRACK = 'visitorTrack';
}