本文整理汇总了PHP中OW::getEventManager方法的典型用法代码示例。如果您正苦于以下问题:PHP OW::getEventManager方法的具体用法?PHP OW::getEventManager怎么用?PHP OW::getEventManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OW
的用法示例。
在下文中一共展示了OW::getEventManager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: genericInit
public function genericInit()
{
$em = OW::getEventManager();
$em->bind(OW_EventManager::ON_USER_REGISTER, array($this, 'onUserRegister'));
$em->bind(OW_EventManager::ON_USER_UNREGISTER, array($this, 'onUserUnregister'));
$em->bind(OW_EventManager::ON_PLUGINS_INIT, array($this, 'affiliateSystemEntry'));
}
示例2: grantCredits
public function grantCredits()
{
if (!OW::getRequest()->isAjax()) {
throw new Redirect404Exception();
}
if (!OW::getUser()->isAuthenticated()) {
throw new AuthenticateException();
}
$form = new USERCREDITS_CLASS_GrantCreditsForm();
if ($form->isValid($_POST)) {
$lang = OW::getLanguage();
$creditService = USERCREDITS_BOL_CreditsService::getInstance();
$grantorId = OW::getUser()->getId();
$values = $form->getValues();
$userId = (int) $values['userId'];
$amount = abs((int) $values['amount']);
$granted = $creditService->grantCredits($grantorId, $userId, $amount);
$credits = $creditService->getCreditsBalance($grantorId);
if ($granted) {
$data = array('amount' => $amount, 'grantorId' => $grantorId, 'userId' => $userId);
$event = new OW_Event('usercredits.grant', $data);
OW::getEventManager()->trigger($event);
$data = array('message' => $lang->text('usercredits', 'credits_granted', array('amount' => $amount)), 'credits' => $credits);
} else {
$data = array('error' => $lang->text('usercredits', 'credits_grant_error'));
}
exit(json_encode($data));
}
}
示例3: process
public static function process($prefix, $key)
{
$languageService = BOL_LanguageService::getInstance();
$list = $languageService->findActiveList();
$currentLanguageId = OW::getLanguage()->getCurrentId();
$currentLangValue = "";
foreach ($list as $item) {
$keyDto = $languageService->findKey($prefix, $key);
if (empty($keyDto)) {
$prefixDto = $languageService->findPrefix($prefix);
$keyDto = $languageService->addKey($prefixDto->getId(), $key);
}
$value = trim($_POST['lang'][$item->getId()][$prefix][$key]);
if (mb_strlen(trim($value)) == 0 || $value == json_decode('"\\u00a0"')) {
$value = ' ';
}
$dto = $languageService->findValue($item->getId(), $keyDto->getId());
if ($dto !== null) {
$event = new OW_Event('admin.before_save_lang_value', array('dto' => $dto));
OW::getEventManager()->trigger($event);
if ($dto->getValue() !== $value) {
$languageService->saveValue($dto->setValue($value));
}
} else {
$dto = $languageService->addValue($item->getId(), $prefix, $key, $value);
}
if ((int) $currentLanguageId === (int) $item->getId()) {
$currentLangValue = $value;
}
}
exit(json_encode(array('result' => 'success', 'prefix' => $prefix, 'key' => $key, 'value' => $currentLangValue)));
}
示例4: __construct
public function __construct($params)
{
parent::__construct();
$this->visiblePhotoCount = !empty($params['photoCount']) ? (int) $params['photoCount'] : 8;
$checkAuth = isset($params['checkAuth']) ? (bool) $params['checkAuth'] : true;
$wrap = isset($params['wrapBox']) ? (bool) $params['wrapBox'] : true;
$boxType = isset($params['boxType']) ? $params['boxType'] : '';
$showTitle = isset($params['showTitle']) ? (bool) $params['showTitle'] : true;
$uniqId = isset($params['uniqId']) ? $params['uniqId'] : uniqid();
if ($checkAuth && !OW::getUser()->isAuthorized('photo', 'view')) {
$this->setVisible(false);
return;
}
$photoService = PHOTO_BOL_PhotoService::getInstance();
$latest = $photoService->findPhotoList('latest', 1, $this->visiblePhotoCount, NULL, PHOTO_BOL_PhotoService::TYPE_PREVIEW);
$this->assign('latest', $latest);
$featured = $photoService->findPhotoList('featured', 1, $this->visiblePhotoCount, NULL, PHOTO_BOL_PhotoService::TYPE_PREVIEW);
$this->assign('featured', $featured);
$toprated = $photoService->findPhotoList('toprated', 1, $this->visiblePhotoCount, NULL, PHOTO_BOL_PhotoService::TYPE_PREVIEW);
$this->assign('toprated', $toprated);
$items = array('latest', 'toprated');
if ($featured) {
$items[] = 'featured';
}
$menuItems = $this->getMenuItems($items, $uniqId);
$this->assign('items', $menuItems);
$this->assign('wrapBox', $wrap);
$this->assign('boxType', $boxType);
$this->assign('showTitle', $showTitle);
$this->assign('url', OW::getEventManager()->call('photo.getAddPhotoURL', array('')));
$this->assign('uniqId', $uniqId);
$this->setTemplate(OW::getPluginManager()->getPlugin('photo')->getMobileCmpViewDir() . 'index_photo_list.html');
}
示例5: index
public function index($params)
{
if (empty($params['documentKey'])) {
throw new Redirect404Exception();
}
$language = OW::getLanguage();
$documentKey = $params['documentKey'];
$document = $this->navService->findDocumentByKey($documentKey);
if ($document === null) {
throw new Redirect404Exception();
}
$menuItem = $this->navService->findMenuItemByDocumentKey($document->getKey());
if ($menuItem !== null) {
if (!$menuItem->getVisibleFor() || $menuItem->getVisibleFor() == BOL_NavigationService::VISIBLE_FOR_GUEST && OW::getUser()->isAuthenticated()) {
throw new Redirect403Exception();
}
if ($menuItem->getVisibleFor() == BOL_NavigationService::VISIBLE_FOR_MEMBER && !OW::getUser()->isAuthenticated()) {
throw new AuthenticateException();
}
}
$this->assign('content', $language->text('base', "local_page_content_{$document->getKey()}"));
$this->setPageHeading($language->text('base', "local_page_title_{$document->getKey()}"));
$this->setPageTitle($language->text('base', "local_page_title_{$document->getKey()}"));
$this->documentKey = $document->getKey();
$this->setDocumentKey($document->getKey());
OW::getEventManager()->bind(OW_EventManager::ON_BEFORE_DOCUMENT_RENDER, array($this, 'setCustomMetaInfo'));
}
示例6: __construct
/**
* Constructor.
*/
public function __construct()
{
parent::__construct();
if (!OW::getUser()->isAdmin()) {
throw new AuthenticateException();
}
if (!OW::getRequest()->isAjax()) {
$document = OW::getDocument();
$document->setMasterPage(new ADMIN_CLASS_MasterPage());
$this->setPageTitle(OW::getLanguage()->text('admin', 'page_default_title'));
}
BOL_PluginService::getInstance()->checkManualUpdates();
$plugin = BOL_PluginService::getInstance()->findNextManualUpdatePlugin();
$handlerParams = OW::getRequestHandler()->getHandlerAttributes();
// TODO refactor shortcut below
if (!defined('OW_PLUGIN_XP') && $plugin !== null) {
if ($handlerParams['controller'] === 'ADMIN_CTRL_Plugins' && $handlerParams['action'] === 'manualUpdateRequest') {
//action
} else {
throw new RedirectException(OW::getRouter()->urlFor('ADMIN_CTRL_Plugins', 'manualUpdateRequest', array('key' => $plugin->getKey())));
}
}
// TODO temp admin pge inform event
function admin_check_if_admin_page()
{
return true;
}
OW::getEventManager()->bind('admin.check_if_admin_page', 'admin_check_if_admin_page');
}
示例7: __construct
/**
* @return Constructor.
*/
public function __construct($groupId)
{
parent::__construct();
$service = GROUPS_BOL_Service::getInstance();
$groupDto = $service->findGroupById($groupId);
$group = array('title' => htmlspecialchars($groupDto->title), 'description' => $groupDto->description, 'time' => $groupDto->timeStamp, 'imgUrl' => empty($groupDto->imageHash) ? false : $service->getGroupImageUrl($groupDto), 'url' => OW::getRouter()->urlForRoute('groups-view', array('groupId' => $groupDto->id)), "id" => $groupDto->id);
$imageUrl = empty($groupDto->imageHash) ? '' : $service->getGroupImageUrl($groupDto);
OW::getDocument()->addMetaInfo('image', $imageUrl, 'itemprop');
OW::getDocument()->addMetaInfo('og:image', $imageUrl, 'property');
$createDate = UTIL_DateTime::formatDate($groupDto->timeStamp);
$adminName = BOL_UserService::getInstance()->getDisplayName($groupDto->userId);
$adminUrl = BOL_UserService::getInstance()->getUserUrl($groupDto->userId);
$js = UTIL_JsGenerator::newInstance()->jQueryEvent('#groups_toolbar_flag', 'click', UTIL_JsGenerator::composeJsString('OW.flagContent({$entity}, {$id}, {$title}, {$href}, "groups+flags", {$ownerId});', array('entity' => GROUPS_BOL_Service::WIDGET_PANEL_NAME, 'id' => $groupDto->id, 'title' => $group['title'], 'href' => $group['url'], 'ownerId' => $groupDto->userId)));
OW::getDocument()->addOnloadScript($js, 1001);
$toolbar = array(array('label' => OW::getLanguage()->text('groups', 'widget_brief_info_create_date', array('date' => $createDate))), array('label' => OW::getLanguage()->text('groups', 'widget_brief_info_admin', array('name' => $adminName, 'url' => $adminUrl))));
if ($service->isCurrentUserCanEdit($groupDto)) {
$toolbar[] = array('label' => OW::getLanguage()->text('groups', 'edit_btn_label'), 'href' => OW::getRouter()->urlForRoute('groups-edit', array('groupId' => $groupId)));
}
if (OW::getUser()->isAuthenticated() && OW::getUser()->getId() != $groupDto->userId) {
$toolbar[] = array('label' => OW::getLanguage()->text('base', 'flag'), 'href' => 'javascript://', 'id' => 'groups_toolbar_flag');
}
$event = new BASE_CLASS_EventCollector('groups.on_toolbar_collect', array('groupId' => $groupId));
OW::getEventManager()->trigger($event);
foreach ($event->getData() as $item) {
$toolbar[] = $item;
}
$this->assign('toolbar', $toolbar);
$this->assign('group', $group);
}
示例8: init
public function init()
{
parent::init();
$this->genericInit();
OW::getEventManager()->bind(UTAGS_BOL_Service::EVENT_ON_SEARCH, array($this, "onSearch"));
OW::getEventManager()->bind(UTAGS_BOL_Service::EVENT_ON_INPUT_INIT, array($this, "onInputInit"));
}
示例9: profile
public function profile($paramList)
{
$userService = BOL_UserService::getInstance();
/* @var $userDao BOL_User */
$userDto = $userService->findByUsername($paramList['username']);
if ($userDto === null) {
throw new Redirect404Exception();
}
if (!OW::getUser()->isAuthorized('base', 'view_profile')) {
$status = BOL_AuthorizationService::getInstance()->getActionStatus('base', 'view_profile');
$this->assign('permissionMessage', $status['msg']);
return;
}
$eventParams = array('action' => 'base_view_profile', 'ownerId' => $userDto->id, 'viewerId' => OW::getUser()->getId());
$displayName = BOL_UserService::getInstance()->getDisplayName($userDto->id);
try {
OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams);
} catch (RedirectException $ex) {
throw new RedirectException(OW::getRouter()->urlForRoute('base_user_privacy_no_permission', array('username' => $displayName)));
}
$this->setPageTitle(OW::getLanguage()->text('base', 'profile_view_title', array('username' => $displayName)));
$this->setPageHeading(OW::getLanguage()->text('base', 'profile_view_heading', array('username' => $displayName)));
$this->setPageHeadingIconClass('ow_ic_user');
$profileHeader = OW::getClassInstance("BASE_MCMP_ProfileHeader", $userDto->id);
$this->addComponent("header", $profileHeader);
//Profile Info
$displayNameQuestion = OW::getConfig()->getValue('base', 'display_name_question');
$profileInfo = OW::getClassInstance("BASE_MCMP_ProfileInfo", $userDto->id, false, array($displayNameQuestion, "birthdate"));
$this->addComponent("info", $profileInfo);
$this->addComponent('contentMenu', OW::getClassInstance("BASE_MCMP_ProfileContentMenu", $userDto->id));
$this->addComponent('about', OW::getClassInstance("BASE_MCMP_ProfileAbout", $userDto->id, 80));
$place = BOL_MobileWidgetService::PLACE_MOBILE_PROFILE;
$this->initDragAndDrop($place, $userDto->id);
}
示例10: __construct
public function __construct(BASE_CLASS_WidgetParameter $params)
{
parent::__construct();
$service = FRIENDS_BOL_Service::getInstance();
$userId = $params->additionalParamList['entityId'];
$count = (int) $params->customParamList['count'];
$idList = $service->findUserFriendsInList($userId, 0, $count);
$total = $service->countFriends($userId);
$userService = BOL_UserService::getInstance();
$eventParams = array('action' => 'friends_view', 'ownerId' => $userId, 'viewerId' => OW::getUser()->getId());
try {
OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams);
} catch (RedirectException $e) {
$this->setVisible(false);
return;
}
if (empty($idList) && !$params->customizeMode) {
$this->setVisible(false);
return;
}
if (!empty($idList)) {
$this->addComponent('userList', new BASE_CMP_AvatarUserList($idList));
}
$username = BOL_UserService::getInstance()->getUserName($userId);
$toolbar = array();
if ($total > $count) {
$toolbar = array(array('label' => OW::getLanguage()->text('base', 'view_all'), 'href' => OW::getRouter()->urlForRoute('friends_user_friends', array('user' => $username))));
}
$this->assign('toolbar', $toolbar);
}
示例11: init
public function init()
{
OW::getEventManager()->bind(MBOL_ConsoleService::EVENT_COLLECT_CONSOLE_PAGES, array($this, 'onConsolePagesCollect'));
OW::getEventManager()->bind(BASE_MCMP_ProfileActionToolbar::EVENT_NAME, array($this, "onCollectProfileActions"));
OW::getEventManager()->bind('mailbox.renderOembed', array($this, 'onRenderOembed'));
// OW::getEventManager()->bind(MBOL_ConsoleService::EVENT_COUNT_CONSOLE_PAGE_NEW_ITEMS, array($this, 'countNewItems'));
}
示例12: __construct
public function __construct($userId)
{
parent::__construct();
$data = OW::getEventManager()->call("photo.entity_albums_find", array("entityType" => "user", "entityId" => $userId));
$albums = empty($data["albums"]) ? array() : $data["albums"];
$source = BOL_PreferenceService::getInstance()->getPreferenceValue("pcgallery_source", $userId);
$this->assign("source", $source == "album" ? "album" : "all");
$selectedAlbum = BOL_PreferenceService::getInstance()->getPreferenceValue("pcgallery_album", $userId);
$form = new Form("pcGallerySettings");
$form->setEmptyElementsErrorMessage(null);
$form->setAction(OW::getRouter()->urlFor("PCGALLERY_CTRL_Gallery", "saveSettings"));
$element = new HiddenField("userId");
$element->setValue($userId);
$form->addElement($element);
$element = new Selectbox("album");
$element->setHasInvitation(true);
$element->setInvitation(OW::getLanguage()->text("pcgallery", "settings_album_invitation"));
$validator = new PCGALLERY_AlbumValidator();
$element->addValidator($validator);
$albumsPhotoCount = array();
foreach ($albums as $album) {
$element->addOption($album["id"], $album["name"] . " ({$album["photoCount"]})");
$albumsPhotoCount[$album["id"]] = $album["photoCount"];
if ($album["id"] == $selectedAlbum) {
$element->setValue($album["id"]);
}
}
OW::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString('window.pcgallery_settingsAlbumCounts = {$albumsCount};', array("albumsCount" => $albumsPhotoCount)));
$element->setLabel(OW::getLanguage()->text("pcgallery", "source_album_label"));
$form->addElement($element);
$submit = new Submit("save");
$submit->setValue(OW::getLanguage()->text("pcgallery", "save_settings_btn_label"));
$form->addElement($submit);
$this->addForm($form);
}
示例13: __construct
public function __construct(BASE_CLASS_WidgetParameter $paramsObj)
{
parent::__construct();
$params = $paramsObj->customParamList;
$addParams = $paramsObj->additionalParamList;
if (empty($addParams['entityId']) || !OW::getUser()->isAuthenticated() || !OW::getUser()->isAuthorized('eventx', 'view_event')) {
$this->setVisible(false);
return;
} else {
$userId = $addParams['entityId'];
}
$eventParams = array('action' => 'event_view_attend_events', 'ownerId' => $userId, 'viewerId' => OW::getUser()->getId());
try {
OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams);
} catch (RedirectException $e) {
$this->setVisible(false);
return;
}
$language = OW::getLanguage();
$eventService = EVENTX_BOL_EventService::getInstance();
$userEvents = $eventService->findUserParticipatedPublicEvents($userId, null, $params['events_count']);
if (empty($userEvents)) {
$this->setVisible(false);
return;
}
$this->assign('my_events', $eventService->getListingDataWithToolbar($userEvents));
$toolbarArray = array();
if ($eventService->findUserParticipatedPublicEventsCount($userId) > $params['events_count']) {
$url = OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlForRoute('eventx.view_event_list', array('list' => 'user-participated-events')), array('userId' => $userId));
$toolbarArray = array(array('href' => $url, 'label' => $language->text('eventx', 'view_all_label')));
}
$this->assign('toolbars', $toolbarArray);
}
示例14: __construct
public function __construct()
{
$event = new BASE_CLASS_EventCollector('base.dashboard_menu_items');
OW::getEventManager()->trigger($event);
$menuItems = $event->getData();
parent::__construct($menuItems);
}
示例15: onBeforeRender
public function onBeforeRender()
{
parent::onBeforeRender();
$avatarData = BOL_AvatarService::getInstance()->getDataForUserAvatars(array($this->user->id));
$avatarDto = BOL_AvatarService::getInstance()->findByUserId($this->user->id);
$owner = false;
if (OW::getUser()->getId() == $this->user->getId()) {
$owner = true;
}
$isModerator = OW::getUser()->isAuthorized('base') || OW::getUser()->isAdmin();
$avatarData[$this->user->id]['src'] = BOL_AvatarService::getInstance()->getAvatarUrl($this->user->getId(), 1, null, true, !($owner || $isModerator));
$default_avatar['src'] = BOL_AvatarService::getInstance()->getDefaultAvatarUrl(1);
$user = array();
$user["avatar"] = !empty($avatarData[$this->user->id]['src']) ? $avatarData[$this->user->id] : $default_avatar;
$user["displayName"] = $avatarData[$this->user->id]["title"];
$this->assign("user", $user);
$this->addComponent('toolbar', OW::getClassInstance("BASE_MCMP_ProfileActionToolbar", $this->user->id));
$eventParams = array('action' => 'base_view_my_presence_on_site', 'ownerIdList' => array($this->user->id), 'viewerId' => OW::getUser()->getId());
$permissions = OW::getEventManager()->getInstance()->call('privacy_check_permission_for_user_list', $eventParams);
$showPresence = !(isset($permissions[$this->user->id]['blocked']) && $permissions[$this->user->id]['blocked'] == true);
$this->assign("showPresence", $showPresence);
$isOnline = null;
$activityStamp = null;
if ($showPresence) {
$onlineInfo = BOL_UserService::getInstance()->findOnlineStatusForUserList(array($this->user->id));
$isOnline = $onlineInfo[$this->user->id];
$activityStamp = $this->user->activityStamp;
}
$this->assign("isOnline", $isOnline);
$this->assign("avatarDto", $avatarDto);
$this->assign("activityStamp", $activityStamp);
$this->assign('owner', $owner);
$this->assign('isModerator', $isModerator);
}