当前位置: 首页>>代码示例>>PHP>>正文


PHP OW::getUser方法代码示例

本文整理汇总了PHP中OW::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP OW::getUser方法的具体用法?PHP OW::getUser怎么用?PHP OW::getUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OW的用法示例。


在下文中一共展示了OW::getUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onConsolePagesCollect

 public function onConsolePagesCollect(BASE_CLASS_EventCollector $event)
 {
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'underscore-min.js', 'text/javascript', 3000);
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'backbone-min.js', 'text/javascript', 3000);
     //        OW::getDocument()->addScript( OW::getPluginManager()->getPlugin('base')->getStaticJsUrl().'backbone.js', 'text/javascript', 3000 );
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('mailbox')->getStaticJsUrl() . 'mobile_mailbox.js', 'text/javascript', 3000);
     $userListUrl = OW::getRouter()->urlForRoute('mailbox_user_list');
     $convListUrl = OW::getRouter()->urlForRoute('mailbox_conv_list');
     $authorizationResponderUrl = OW::getRouter()->urlFor('MAILBOX_CTRL_Ajax', 'authorization');
     $pingResponderUrl = OW::getRouter()->urlFor('MAILBOX_CTRL_Ajax', 'ping');
     $getHistoryResponderUrl = OW::getRouter()->urlFor('MAILBOX_CTRL_Ajax', 'getHistory');
     $userId = OW::getUser()->getId();
     $displayName = BOL_UserService::getInstance()->getDisplayName($userId);
     $avatarUrl = BOL_AvatarService::getInstance()->getAvatarUrl($userId);
     if (empty($avatarUrl)) {
         $avatarUrl = BOL_AvatarService::getInstance()->getDefaultAvatarUrl();
     }
     $profileUrl = BOL_UserService::getInstance()->getUserUrl($userId);
     $lastSentMessage = MAILBOX_BOL_ConversationService::getInstance()->getLastSentMessage($userId);
     $lastMessageTimestamp = (int) ($lastSentMessage ? $lastSentMessage->timeStamp : 0);
     $params = array('getHistoryResponderUrl' => $getHistoryResponderUrl, 'pingResponderUrl' => $pingResponderUrl, 'authorizationResponderUrl' => $authorizationResponderUrl, 'userListUrl' => $userListUrl, 'convListUrl' => $convListUrl, 'pingInterval' => 5000, 'lastMessageTimestamp' => $lastMessageTimestamp, 'user' => array('userId' => $userId, 'displayName' => $displayName, 'profileUrl' => $profileUrl, 'avatarUrl' => $avatarUrl));
     $js = UTIL_JsGenerator::composeJsString('OWM.Mailbox = new MAILBOX_Mobile({$params});', array('params' => $params));
     OW::getDocument()->addOnloadScript($js, 'text/javascript', 3000);
     $event->add(array('key' => 'convers', 'cmpClass' => 'MAILBOX_MCMP_ConsoleConversationsPage', 'order' => 2));
 }
开发者ID:tammyrocks,项目名称:mailbox,代码行数:25,代码来源:event_handler.php

示例2: staticDocument

 public function staticDocument($params)
 {
     $navService = BOL_NavigationService::getInstance();
     if (empty($params['documentKey'])) {
         throw new Redirect404Exception();
     }
     $language = OW::getLanguage();
     $documentKey = $params['documentKey'];
     $document = $navService->findDocumentByKey($documentKey);
     if ($document === null) {
         throw new Redirect404Exception();
     }
     $menuItem = $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();
         }
     }
     $settings = BOL_MobileNavigationService::getInstance()->getItemSettings($menuItem);
     $title = $settings[BOL_MobileNavigationService::SETTING_TITLE];
     $this->assign('content', $settings[BOL_MobileNavigationService::SETTING_CONTENT]);
     $this->setPageHeading($settings[BOL_MobileNavigationService::SETTING_TITLE]);
     $this->setPageTitle($settings[BOL_MobileNavigationService::SETTING_TITLE]);
     $this->setDocumentKey($document->getKey());
     //OW::getEventManager()->bind(OW_EventManager::ON_BEFORE_DOCUMENT_RENDER, array($this, 'setCustomMetaInfo'));
 }
开发者ID:vBulleteen,项目名称:oxwall,代码行数:29,代码来源:base_document.php

示例3: getMenu

 public function getMenu()
 {
     $language = OW::getLanguage();
     $menu = new BASE_CMP_ContentMenu();
     $menuItem = new BASE_MenuItem();
     $menuItem->setKey('all');
     $menuItem->setPrefix('questions');
     $menuItem->setLabel($language->text('equestions', 'list_all_tab'));
     $menuItem->setOrder(1);
     $menuItem->setUrl(OW::getRouter()->urlForRoute('equestions-all'));
     $menuItem->setIconClass('ow_ic_lens');
     $menu->addElement($menuItem);
     if (OW::getUser()->isAuthenticated()) {
         if (OW::getPluginManager()->isPluginActive('friends')) {
             $menuItem = new BASE_MenuItem();
             $menuItem->setKey('friends');
             $menuItem->setPrefix('questions');
             $menuItem->setLabel($language->text('equestions', 'list_friends_tab'));
             $menuItem->setOrder(2);
             $menuItem->setUrl(OW::getRouter()->urlForRoute('equestions-friends'));
             $menuItem->setIconClass('ow_ic_user');
             $menu->addElement($menuItem);
         }
         $menuItem = new BASE_MenuItem();
         $menuItem->setKey('my');
         $menuItem->setPrefix('questions');
         $menuItem->setLabel($language->text('equestions', 'list_my_tab'));
         $menuItem->setOrder(3);
         $menuItem->setUrl(OW::getRouter()->urlForRoute('equestions-my'));
         $menuItem->setIconClass('ow_ic_user');
         $menu->addElement($menuItem);
     }
     return $menu;
 }
开发者ID:vazahat,项目名称:dudex,代码行数:34,代码来源:feed_menu.php

示例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');
 }
开发者ID:tammyrocks,项目名称:photo,代码行数:33,代码来源:index_photo_list.php

示例5: render

 public function render()
 {
     $defaultAvatarUrl = BOL_AvatarService::getInstance()->getDefaultAvatarUrl();
     $this->assign('defaultAvatarUrl', $defaultAvatarUrl);
     $js = "OW.Mailbox.conversationController = new MAILBOX_ConversationView();";
     OW::getDocument()->addOnloadScript($js, 3006);
     //TODO check this config
     $enableAttachments = OW::getConfig()->getValue('mailbox', 'enable_attachments');
     $this->assign('enableAttachments', $enableAttachments);
     $replyToMessageActionPromotedText = '';
     $isAuthorizedReplyToMessage = OW::getUser()->isAuthorized('mailbox', 'reply_to_message');
     $isAuthorizedReplyToMessage = $isAuthorizedReplyToMessage || OW::getUser()->isAuthorized('mailbox', 'send_chat_message');
     if (!$isAuthorizedReplyToMessage) {
         $status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', 'reply_to_message');
         if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) {
             $replyToMessageActionPromotedText = $status['msg'];
         }
     }
     $this->assign('isAuthorizedReplyToMessage', $isAuthorizedReplyToMessage);
     $isAuthorizedReplyToChatMessage = OW::getUser()->isAuthorized('mailbox', 'reply_to_chat_message');
     if (!$isAuthorizedReplyToChatMessage) {
         $status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', 'reply_to_chat_message');
         if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) {
             $replyToMessageActionPromotedText = $status['msg'];
         }
     }
     $this->assign('isAuthorizedReplyToChatMessage', $isAuthorizedReplyToChatMessage);
     $this->assign('replyToMessageActionPromotedText', $replyToMessageActionPromotedText);
     if ($isAuthorizedReplyToMessage) {
         $text = new WysiwygTextarea('mailbox_message');
         $text->setId('conversationTextarea');
         $this->assign('mailbox_message', $text->renderInput());
     }
     return parent::render();
 }
开发者ID:tammyrocks,项目名称:mailbox,代码行数:35,代码来源:conversation.php

示例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');
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:32,代码来源:abstract.php

示例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);
 }
开发者ID:vazahat,项目名称:dudex,代码行数:32,代码来源:brief_info_content.php

示例8: beforeContentAdd

 public function beforeContentAdd(OW_Event $event)
 {
     $params = $event->getParams();
     $data = $event->getData();
     if (!empty($data)) {
         return;
     }
     if (empty($params["status"]) && empty($params["data"])) {
         $event->setData(false);
         return;
     }
     $attachId = null;
     $content = array();
     if (!empty($params["data"])) {
         $content = $params["data"];
         if ($content['type'] == 'photo' && !empty($content['genId'])) {
             $content['url'] = $content['href'] = OW::getEventManager()->call('base.attachment_save_image', array('genId' => $content['genId']));
             $attachId = $content['genId'];
         }
         if ($content['type'] == 'video') {
             $content['html'] = BOL_TextFormatService::getInstance()->validateVideoCode($content['html']);
         }
     }
     $status = UTIL_HtmlTag::autoLink($params["status"]);
     $out = NEWSFEED_BOL_Service::getInstance()->addStatus(OW::getUser()->getId(), $params['feedType'], $params['feedId'], $params['visibility'], $status, array("content" => $content, "attachmentId" => $attachId));
     $event->setData($out);
 }
开发者ID:vazahat,项目名称:dudex,代码行数:27,代码来源:newsfeed_bridge.php

示例9: __construct

 /**
  * @return Constructor.
  */
 public function __construct(BASE_CLASS_WidgetParameter $paramObj)
 {
     parent::__construct($paramObj);
     $userId = $paramObj->additionalParamList['entityId'];
     // privacy check
     $viewerId = OW::getUser()->getId();
     $ownerMode = $userId == $viewerId;
     $modPermissions = OW::getUser()->isAuthorized('newsfeed');
     if (!$ownerMode && !$modPermissions) {
         $privacyParams = array('action' => NEWSFEED_BOL_Service::PRIVACY_ACTION_VIEW_MY_FEED, 'ownerId' => $userId, 'viewerId' => $viewerId);
         $event = new OW_Event('privacy_check_permission', $privacyParams);
         try {
             OW::getEventManager()->trigger($event);
         } catch (RedirectException $e) {
             $this->setVisible(false);
             return;
         }
     }
     $feed = $this->createFeed('user', $userId);
     $isBloacked = BOL_UserService::getInstance()->isBlocked(OW::getUser()->getId(), $userId);
     if (OW::getUser()->isAuthenticated() && OW::getUser()->isAuthorized('base', 'add_comment')) {
         if ($isBloacked) {
             $feed->addStatusMessage(OW::getLanguage()->text("base", "user_block_message"));
         } else {
             $visibility = NEWSFEED_BOL_Service::VISIBILITY_FULL;
             $feed->addStatusForm('user', $userId, $visibility);
         }
     }
     $feed->setDisplayType(NEWSFEED_CMP_Feed::DISPLAY_TYPE_ACTIVITY);
     $this->setFeed($feed);
 }
开发者ID:vazahat,项目名称:dudex,代码行数:34,代码来源:user_feed_widget.php

示例10: getData

 public function getData(BASE_CLASS_WidgetParameter $params)
 {
     $count = (int) $params->customParamList['count'];
     $userId = OW::getUser()->getId();
     $service = OCSFAVORITES_BOL_Service::getInstance();
     $lang = OW::getLanguage();
     $router = OW::getRouter();
     $multiple = OW::getConfig()->getValue('ocsfavorites', 'can_view') && OW::getUser()->isAuthorized('ocsfavorites', 'view_users');
     $toolbar = array();
     $lists = array();
     $resultList = array();
     $toolbar['my'] = array('label' => $lang->text('base', 'view_all'), 'href' => $router->urlForRoute('ocsfavorites.list'));
     $lists['my'] = $service->findFavoritesForUser($userId, 1, $count);
     if ($multiple) {
         $toolbar['me'] = array('label' => $lang->text('base', 'view_all'), 'href' => $router->urlForRoute('ocsfavorites.added_list'));
         $lists['me'] = $service->findUsersWhoAddedUserAsFavorite($userId, 1, $count);
         $toolbar['mutual'] = array('label' => $lang->text('base', 'view_all'), 'href' => $router->urlForRoute('ocsfavorites.mutual_list'));
         $lists['mutual'] = $service->findMutualFavorites($userId, 1, $count);
     }
     $this->setSettingValue(self::SETTING_TOOLBAR, array($toolbar['my']));
     $resultList['my'] = array('menu-label' => $lang->text('ocsfavorites', 'my'), 'menu_active' => true, 'userIds' => $this->getIds($lists['my'], 'favoriteId'), 'toolbar' => array($toolbar['my']));
     if ($multiple) {
         if ($lists['me']) {
             $resultList['me'] = array('menu-label' => $lang->text('ocsfavorites', 'who_added_me'), 'userIds' => $this->getIds($lists['me'], 'userId'), 'toolbar' => array($toolbar['me']));
         }
         if ($lists['mutual']) {
             $resultList['mutual'] = array('menu-label' => $lang->text('ocsfavorites', 'mutual'), 'userIds' => $this->getIds($lists['mutual'], 'userId'), 'toolbar' => array($toolbar['mutual']));
         }
     }
     return $resultList;
 }
开发者ID:vazahat,项目名称:dudex,代码行数:31,代码来源:my_favorites_widget.php

示例11: 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);
 }
开发者ID:hardikamutech,项目名称:loov,代码行数:34,代码来源:widget_panel.php

示例12: __construct

 /**
  * Class constructor
  */
 public function __construct($typeId)
 {
     parent::__construct();
     if (!OW::getUser()->isAdmin()) {
         $this->setVisible(false);
         return;
     }
     $service = MEMBERSHIP_BOL_MembershipService::getInstance();
     $type = $service->findTypeById($typeId);
     if (!$type) {
         $this->setVisible(false);
         return;
     }
     $types = $service->getTypeList($type->accountTypeId);
     $availableTypes = array();
     if ($types) {
         foreach ($types as $mType) {
             if ($mType->id == $typeId) {
                 continue;
             }
             $availableTypes[$mType->id] = $service->getMembershipTitle($mType->roleId);
         }
     }
     $this->assign('availableTypes', $availableTypes);
     $form = new MEMBERSHIP_CLASS_DeleteMembershipForm();
     $this->addForm($form);
     $form->getElement('typeId')->setValue($typeId);
     if ($availableTypes) {
         $form->getElement('newTypeId')->addOptions($availableTypes);
     }
 }
开发者ID:hardikamutech,项目名称:loov,代码行数:34,代码来源:delete_membership.php

示例13: updateRate

 public function updateRate()
 {
     if (empty($_POST['entityId']) || empty($_POST['entityType']) || empty($_POST['rate']) || empty($_POST['ownerId'])) {
         exit(json_encode(array('errorMessage' => 'Invalid request')));
     }
     $service = BOL_RateService::getInstance();
     $entityId = (int) $_POST['entityId'];
     $entityType = trim($_POST['entityType']);
     $rate = (int) $_POST['rate'];
     $ownerId = (int) $_POST['ownerId'];
     $userId = OW::getUser()->getId();
     if (!OW::getUser()->isAuthenticated()) {
         exit(json_encode(array('errorMessage' => OW::getLanguage()->text('base', 'rate_cmp_auth_error_message'))));
     }
     if ($userId === $ownerId) {
         exit(json_encode(array('errorMessage' => OW::getLanguage()->text('base', 'rate_cmp_owner_cant_rate_error_message'))));
     }
     if (false) {
         //TODO add authorization error
         exit(json_encode(array('errorMessage' => 'Auth error')));
     }
     if (BOL_UserService::getInstance()->isBlocked(OW::getUser()->getId(), $ownerId)) {
         exit(json_encode(array('errorMessage' => OW::getLanguage()->text('base', 'user_block_message'))));
     }
     $rateItem = $service->findRate($entityId, $entityType, $userId);
     if ($rateItem === null) {
         $rateItem = new BOL_Rate();
         $rateItem->setEntityId($entityId)->setEntityType($entityType)->setUserId($userId)->setActive(true);
     }
     $rateItem->setScore($rate)->setTimeStamp(time());
     $service->saveRate($rateItem);
     $totalScoreCmp = new BASE_CMP_TotalScore($entityId, $entityType);
     exit(json_encode(array('totalScoreCmp' => $totalScoreCmp->render(), 'message' => OW::getLanguage()->text('base', 'rate_cmp_success_message'))));
 }
开发者ID:ZyXelP,项目名称:oxwall,代码行数:34,代码来源:rate.php

示例14: index

 /**
  * Controller's default action
  *
  * @param array $params
  * @throws Redirect404Exception
  */
 public function index(array $params)
 {
     if (!isset($params['sectionId']) || !($sectionId = (int) $params['sectionId'])) {
         throw new Redirect404Exception();
     }
     $forumSection = $this->forumService->findSectionById($sectionId);
     if (!$forumSection || $forumSection->isHidden) {
         throw new Redirect404Exception();
     }
     $userId = OW::getUser()->getId();
     $bcItems = array(array('href' => OW::getRouter()->urlForRoute('forum-default'), 'label' => OW::getLanguage()->text('forum', 'forum_index')), array('label' => $forumSection->name));
     $breadCrumbCmp = new BASE_CMP_Breadcrumb($bcItems);
     $this->addComponent('breadcrumb', $breadCrumbCmp);
     $sectionGroupList = $this->forumService->getSectionGroupList($userId, $sectionId);
     $authors = array();
     foreach ($sectionGroupList as $section) {
         foreach ($section['groups'] as $group) {
             if (!$group['lastReply']) {
                 continue;
             }
             $id = $group['lastReply']['userId'];
             if (!in_array($id, $authors)) {
                 array_push($authors, $id);
             }
         }
     }
     $this->assign('sectionGroupList', $sectionGroupList);
     $userNames = BOL_UserService::getInstance()->getUserNamesForList($authors);
     $this->assign('userNames', $userNames);
     $displayNames = BOL_UserService::getInstance()->getDisplayNamesForList($authors);
     $this->assign('displayNames', $displayNames);
     $this->addComponent('search', new FORUM_CMP_ForumSearch(array('scope' => 'section', 'sectionId' => $sectionId)));
     OW::getDocument()->setHeading(OW::getLanguage()->text('forum', 'forum'));
     OW::getDocument()->setHeadingIconClass('ow_ic_forum');
 }
开发者ID:jorgemunoz8807,项目名称:havanabook,代码行数:41,代码来源:section.php

示例15: __construct

    public function __construct($data)
    {
        $script = UTIL_JsGenerator::composeJsString('

        OWM.bind("mailbox.ready", function(readyStatus){
            if (readyStatus == 2){
                OWM.conversation = new MAILBOX_Conversation({$params});
                OWM.conversationView = new MAILBOX_MailConversationView({model: OWM.conversation});
            }
        });
        ', array('params' => $data));
        OW::getDocument()->addOnloadScript($script);
        OW::getLanguage()->addKeyForJs('mailbox', 'text_message_invitation');
        $form = new MAILBOX_MCLASS_NewMailMessageForm($data['conversationId'], $data['opponentId']);
        $this->addForm($form);
        $this->assign('data', $data);
        $this->assign('defaultAvatarUrl', BOL_AvatarService::getInstance()->getDefaultAvatarUrl());
        $firstMessage = MAILBOX_BOL_ConversationService::getInstance()->getFirstMessage($data['conversationId']);
        if (empty($firstMessage)) {
            $actionName = 'send_message';
        } else {
            $actionName = 'reply_to_message';
        }
        $isAuthorized = OW::getUser()->isAuthorized('mailbox', $actionName);
        if (!$isAuthorized) {
            $status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', $actionName);
            if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) {
                $this->assign('sendAuthMessage', $status['msg']);
            } elseif ($status['status'] != BOL_AuthorizationService::STATUS_AVAILABLE) {
                $this->assign('sendAuthMessage', OW::getLanguage()->text('mailbox', $actionName . '_permission_denied'));
            }
        }
    }
开发者ID:tammyrocks,项目名称:mailbox,代码行数:33,代码来源:mail_conversation.php


注:本文中的OW::getUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。