本文整理汇总了PHP中EventManager类的典型用法代码示例。如果您正苦于以下问题:PHP EventManager类的具体用法?PHP EventManager怎么用?PHP EventManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EventManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: itFallbackToCallHookIfGivenCallbackDoesNotExist
public function itFallbackToCallHookIfGivenCallbackDoesNotExist()
{
$event = 'an_event';
$params = array('some_params');
$listener = new Event2MockEventListener($this);
stub($listener)->CallHook($event, $params)->once();
$em = new EventManager();
$em->addListener($event, $listener, 'doSomething', false);
$em->processEvent($event, $params);
}
示例2: __viewIndexEventNames
public function __viewIndexEventNames($context)
{
$EventManager = new EventManager($this->_Parent);
$events = $EventManager->listAll();
$options = array();
foreach ($events as $event) {
$selected = $this->_driver->isEventNameSelected($event['handle']);
$options[] = array($event['handle'], $selected, $event['name']);
}
$section = Widget::Label('Selected');
$section->appendChild(Widget::Select('settings[event-names][]', $options, array('multiple' => 'multiple')));
$context->appendChild($section);
}
示例3: run
function run()
{
try {
$repository = new SapphireEventRepository();
$tx_manager = SapphireTransactionManager::getInstance();
$event_manager = new EventManager($repository, new EventRegistrationRequestFactory(), null, new SapphireEventPublishingService(), new EventValidatorFactory(), $tx_manager);
$rss_events = $event_manager->rssEvents(10000);
$events_array = $event_manager->rss2events($rss_events);
$event_manager->saveRssEvents($events_array);
return 'OK';
} catch (Exception $ex) {
SS_Log::log($ex, SS_Log::ERR);
echo $ex->getMessage();
}
}
示例4: _content
function _content($params)
{
if (isset($params['version_number'])) {
$version_factory =& $this->_getVersionFactory($params);
$version =& $version_factory->getSpecificVersion($params['item'], $params['version_number']);
} else {
$version =& $params['item']->getCurrentVersion();
}
if ($version) {
if (file_exists($version->getPath())) {
$event_manager =& EventManager::instance();
$event_manager->processEvent('plugin_docman_event_access', array('group_id' => $params['group_id'], 'item' => &$params['item'], 'version' => $version->getNumber(), 'user' => &$params['user']));
$mime = explode('/', $version->getFiletype());
if (in_array($mime[1], array('plain', 'css', 'javascript'))) {
$balise = 'pre';
} else {
$balise = 'div';
}
echo '<' . $balise . ' class="docman_embedded_file_content">';
echo $this->hp->purify(file_get_contents($version->getPath()), CODENDI_PURIFIER_FULL);
echo '</' . $balise . '>';
} else {
$this->_controller->feedback->log('error', $GLOBALS['Language']->getText('plugin_docman', 'error_filenotfound'));
$v =& new Docman_View_DocmanError($this->_controller);
$v->display($params);
}
}
}
示例5: initializeEvents
private function initializeEvents()
{
EventManager::bind("GetGroupForumsMessageEvent");
EventManager::bind("GetGroupForumDataMessageEvent");
EventManager::bind("GetGroupForumThreadRootMessageEvent");
EventManager::bind("UpdateThreadMessageEvent");
EventManager::bind("UpdateForumSettingsMessageEvent");
EventManager::bind("AlterForumThreadStateMessageEvent");
EventManager::bind("PublishForumThreadMessageEvent");
EventManager::bind("ReadForumThreadMessageEvent");
EventManager::bind("RequestLeaveGroupMessageEvent");
EventManager::bind("ConfirmLeaveGroupMessageEvent");
EventManager::bind("AcceptGroupRequestMessageEvent");
EventManager::bind("CreateGuildMessageEvent");
EventManager::bind("GetGroupFurnitureMessageEvent");
EventManager::bind("GetGroupInfoMessageEvent");
EventManager::bind("GetGroupMembersMessageEvent");
EventManager::bind("GetGroupPurchaseBoxMessageEvent");
EventManager::bind("GetGroupPurchasingInfoMessageEvent");
EventManager::bind("GroupDeclineMembershipRequestMessageEvent");
EventManager::bind("GroupMakeAdministratorMessageEvent");
EventManager::bind("GroupManageMessageEvent");
EventManager::bind("GroupUpdateBadgeMessageEvent");
EventManager::bind("GroupUpdateColoursMessageEvent");
EventManager::bind("GroupUpdateNameMessageEvent");
EventManager::bind("GroupUpdateSettingsMessageEvent");
EventManager::bind("GroupUserJoinMessageEvent");
EventManager::bind("SetFavoriteGroupMessageEvent");
EventManager::bind("RemoveFavouriteGroupMessageEvent");
EventManager::bind("RemoveGroupAdminMessageEvent");
EventManager::bind("DeleteGroupMessageEvent");
}
示例6: tearDown
public function tearDown() {
unlink($GLOBALS['alias_file']);
unset($GLOBALS['alias_file']);
//clear the cache between each tests
Backend::clearInstances();
EventManager::clearInstance();
}
示例7: getContent
public function getContent()
{
$request =& HTTPRequest::instance();
$group_id = $request->get('group_id');
$pm = ProjectManager::instance();
$project = $pm->getProject($group_id);
$res_admin = db_query("SELECT user.user_id AS user_id,user.user_name AS user_name, user.realname as realname " . "FROM user,user_group " . "WHERE user_group.user_id=user.user_id AND user_group.group_id=" . db_ei($group_id) . " AND " . "user_group.admin_flags = 'A'");
if (db_numrows($res_admin) > 0) {
$user_helper = UserHelper::instance();
$hp = Codendi_HTMLPurifier::instance();
$em = EventManager::instance();
echo '<span class="develtitle">' . $GLOBALS['Language']->getText('include_project_home', 'proj_admins') . ':</span><br />';
while ($row_admin = db_fetch_array($res_admin)) {
$display_name = '';
$em->processEvent('get_user_display_name', array('user_id' => $row_admin['user_id'], 'user_name' => $row_admin['user_name'], 'realname' => $row_admin['realname'], 'user_display_name' => &$display_name));
if (!$display_name) {
$display_name = $hp->purify($user_helper->getDisplayNameFromUserId($row_admin['user_id']));
}
echo '<a href="/users/' . $row_admin['user_name'] . '/">' . $display_name . '</a><br />';
}
}
echo '<span class="develtitle">' . $GLOBALS['Language']->getText('include_project_home', 'proj_members') . ':</span><br />';
// count of developers on this project
$res_count = db_query("SELECT user_id FROM user_group WHERE group_id=" . db_ei($group_id));
echo db_numrows($res_count);
echo ' <a href="/project/memberlist.php?group_id=' . $group_id . '">[' . $GLOBALS['Language']->getText('include_project_home', 'view_members') . ']</a>';
}
示例8: build
/** @return User_LoginPresenter */
public function build($return_to, $printer_version, $form_loginname)
{
$presenter = new User_LoginPresenter($return_to, $printer_version, $form_loginname, $this->getToggleSSL());
$authoritative = false;
EventManager::instance()->processEvent('login_presenter', array('presenter' => &$presenter, 'authoritative' => &$authoritative));
return $presenter;
}
示例9: __construct
protected function __construct()
{
$this->charts = null;
$this->chart_factories = array();
$em = EventManager::instance();
$em->processEvent('graphontrackersv5_load_chart_factories', array('factories' => &$this->chart_factories));
}
示例10: getProcessForQueue
public function getProcessForQueue($request_queue)
{
$owner = SystemEvent::OWNER_APP;
$custom_queues = array();
$this->event_manager->processEvent(Event::SYSTEM_EVENT_GET_CUSTOM_QUEUES, array('queues' => &$custom_queues));
if (isset($custom_queues[$request_queue])) {
$this->logger = $custom_queues[$request_queue]->getLogger();
$this->logger->debug('Processing ' . $request_queue . ' queue.');
$process = new SystemEventProcessCustomQueue($request_queue);
$owner = $custom_queues[$request_queue]->getOwner();
} else {
switch ($request_queue) {
case SystemEvent::OWNER_APP:
$this->logger->debug('Processing default queue as app user.');
$process = new SystemEventProcessApplicationOwnerDefaultQueue();
break;
case SystemEvent::DEFAULT_QUEUE:
$this->logger->debug('Processing default queue as root user.');
$owner = SystemEvent::OWNER_ROOT;
$process = new SystemEventProcessRootDefaultQueue();
break;
default:
$this->logger->debug('Ignoring ' . $request_queue . ' queue.');
exit(0);
}
}
if ($owner === SystemEvent::OWNER_APP) {
return new SystemEventProcessor_ApplicationOwner($process, $this->system_event_manager, new SystemEventDao(), $this->logger);
}
return new SystemEventProcessor_Root($process, $this->system_event_manager, new SystemEventDao(), $this->logger, Backend::instance('Aliases'), Backend::instance('CVS'), Backend::instance('SVN'), Backend::instance('System'), new SiteCache($this->logger));
}
示例11: getStatistics
public function getStatistics($statistic_name, $date_start, $date_end)
{
$statistics_data = array();
$params = array('statistic_name' => $statistic_name, 'date_start' => $date_start, 'date_end' => $date_end, 'result' => &$statistics_data);
$this->event_manager->processEvent('get_statistics_aggregation', $params);
return $statistics_data;
}
示例12: getModFromPlugins
private function getModFromPlugins(array $project_info, $requested_authentication_method, $project_authorizes_tokens)
{
$svn_apache_auth = null;
$params = array('svn_apache_auth' => &$svn_apache_auth, 'svn_conf_auth' => $requested_authentication_method, 'project_authorizes_tokens' => $project_authorizes_tokens, 'project_info' => $project_info);
$this->event_manager->processEvent(Event::SVN_APACHE_AUTH, $params);
return $svn_apache_auth;
}
示例13: getMilestoneRepresentation
public function getMilestoneRepresentation(Planning_Milestone $milestone, PFUser $user)
{
$milestone_representation = new MilestoneRepresentation();
$milestone_representation->build($milestone, $this->milestone_factory->getMilestoneStatusCount($user, $milestone), $this->getBacklogTrackers($milestone), $this->milestone_factory->userCanChangePrioritiesInMilestone($milestone, $user));
$this->event_manager->processEvent(AGILEDASHBOARD_EVENT_REST_GET_MILESTONE, array('version' => 'v1', 'user' => $user, 'milestone' => $milestone, 'milestone_representation' => &$milestone_representation));
return $milestone_representation;
}
示例14: update
public function update(Codendi_Request $request, Response $response)
{
$emailgateway_mode = $request->get('emailgateway_mode');
if ($emailgateway_mode && $this->config->setEmailgatewayMode($emailgateway_mode)) {
$response->addFeedback(Feedback::INFO, $GLOBALS['Language']->getText('plugin_tracker_config', 'successfully_updated'));
}
$this->event_manager->processEvent(Event::UPDATE_ALIASES, null);
$response->redirect($_SERVER['REQUEST_URI']);
}
示例15: import
/**
* Import cardwall ontop from XML input
*
* @param SimpleXMLElement $xml_input
* @throws CardwallFromXmlImportCannotBeEnabledException
*/
public function import(SimpleXMLElement $xml_input)
{
if (!$xml_input->{CardwallConfigXml::NODE_CARDWALL}) {
return;
}
$rng_path = realpath(CARDWALL_BASE_DIR . '/../www/resources/xml_project_cardwall.rng');
$this->xml_validator->validate($xml_input->{CardwallConfigXml::NODE_CARDWALL}, $rng_path);
$this->importCardwalls($xml_input->{CardwallConfigXml::NODE_CARDWALL});
$this->event_manager->processEvent(Event::IMPORT_XML_PROJECT_CARDWALL_DONE, array('project_id' => $this->group_id, 'xml_content' => $xml_input, 'mapping' => $this->mapping));
}