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


PHP E::ModuleTalk方法代码示例

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


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

示例1: getList

 /**
  * @param int $iPageNum
  * @param int $iPageSize
  *
  * @return array
  */
 public function getList($iPageNum, $iPageSize)
 {
     $aFilter = array('user_id' => E::UserId());
     $aTalks = E::ModuleTalk()->GetTalksByFilter($aFilter, $iPageNum, $iPageSize);
     $aResult = array('total' => $aTalks['count'], 'list' => array());
     /** @var PluginAltoApi_ModuleApiTalks_EntityTalk $oTalk */
     foreach ($aTalks['collection'] as $oTalk) {
         $aResult['list'][] = $oTalk->getApiData();
     }
     return $aResult;
 }
开发者ID:altocms,项目名称:alto-plugin-api,代码行数:17,代码来源:ApiTalks.class.php

示例2: NewTalk

 /**
  * Вызывается по строке "new_talk"
  * @param bool $sTemplate
  * @return bool
  */
 public function NewTalk($sTemplate = false)
 {
     $sKeyString = 'menu_new_talk_' . E::UserId() . '_' . (string) $sTemplate;
     if (FALSE === ($sData = E::ModuleCache()->GetTmp($sKeyString))) {
         $iValue = (int) E::ModuleTalk()->GetCountTalkNew(E::UserId());
         if ($sTemplate && $iValue) {
             $sData = str_replace('{{new_talk_count}}', $iValue, $sTemplate);
         } else {
             $sData = $iValue ? $iValue : '';
         }
         E::ModuleCache()->SetTmp($sData, $sKeyString);
     }
     return $sData;
 }
开发者ID:ZeoNish,项目名称:altocms,代码行数:19,代码来源:Menu.class.php

示例3: Shutdown

 /**
  * При завершенни модуля загружаем в шалон объект текущего юзера
  *
  */
 public function Shutdown()
 {
     if ($this->oUserCurrent) {
         E::ModuleViewer()->Assign('iUserCurrentCountTrack', E::ModuleUserfeed()->GetCountTrackNew($this->oUserCurrent->getId()));
         E::ModuleViewer()->Assign('iUserCurrentCountTalkNew', E::ModuleTalk()->GetCountTalkNew($this->oUserCurrent->getId()));
         E::ModuleViewer()->Assign('iUserCurrentCountTopicDraft', E::ModuleTopic()->GetCountDraftTopicsByUserId($this->oUserCurrent->getId()));
     }
     E::ModuleViewer()->Assign('oUserCurrent', $this->oUserCurrent);
     E::ModuleViewer()->Assign('aContentTypes', E::ModuleTopic()->GetContentTypes(array('content_active' => 1)));
     if ($this->oUserCurrent) {
         E::ModuleViewer()->Assign('aAllowedContentTypes', E::ModuleTopic()->GetAllowContentTypeByUserId($this->oUserCurrent));
     }
 }
开发者ID:AntiqS,项目名称:altocms,代码行数:17,代码来源:User.class.php

示例4: _eventUsersCmdMessageSeparate

 protected function _eventUsersCmdMessageSeparate()
 {
     $bOk = true;
     $sTitle = F::GetRequest('talk_title');
     $sText = E::ModuleText()->Parser(F::GetRequest('talk_text'));
     $sDate = date(F::Now());
     $sIp = F::GetUserIp();
     if ($sUsers = $this->GetPost('users_list')) {
         $aUsers = explode(',', str_replace(' ', '', $sUsers));
     } else {
         $aUsers = array();
     }
     if ($aUsers) {
         // Если указано, то шлем самому себе со списком получателей
         if (F::GetRequest('send_copy_self')) {
             $oSelfTalk = E::GetEntity('Talk_Talk');
             $oSelfTalk->setUserId($this->oUserCurrent->getId());
             $oSelfTalk->setUserIdLast($this->oUserCurrent->getId());
             $oSelfTalk->setTitle($sTitle);
             $oSelfTalk->setText(E::ModuleText()->Parser('To: <i>' . $sUsers . '</i>' . "\n\n" . 'Msg: ' . $this->GetPost('talk_text')));
             $oSelfTalk->setDate($sDate);
             $oSelfTalk->setDateLast($sDate);
             $oSelfTalk->setUserIp($sIp);
             if ($oSelfTalk = E::ModuleTalk()->AddTalk($oSelfTalk)) {
                 $oTalkUser = E::GetEntity('Talk_TalkUser');
                 $oTalkUser->setTalkId($oSelfTalk->getId());
                 $oTalkUser->setUserId($this->oUserCurrent->getId());
                 $oTalkUser->setDateLast($sDate);
                 E::ModuleTalk()->AddTalkUser($oTalkUser);
                 // уведомление по e-mail
                 $oUserToMail = $this->oUserCurrent;
                 E::ModuleNotify()->SendTalkNew($oUserToMail, $this->oUserCurrent, $oSelfTalk);
             } else {
                 $bOk = false;
             }
         }
         if ($bOk) {
             // теперь рассылаем остальным - каждому отдельное сообщение
             foreach ($aUsers as $sUserLogin) {
                 if ($sUserLogin && $sUserLogin != $this->oUserCurrent->getLogin() && ($oUserRecipient = E::ModuleUser()->GetUserByLogin($sUserLogin))) {
                     $oTalk = E::GetEntity('Talk_Talk');
                     $oTalk->setUserId($this->oUserCurrent->getId());
                     $oTalk->setUserIdLast($this->oUserCurrent->getId());
                     $oTalk->setTitle($sTitle);
                     $oTalk->setText($sText);
                     $oTalk->setDate($sDate);
                     $oTalk->setDateLast($sDate);
                     $oTalk->setUserIp($sIp);
                     if ($oTalk = E::ModuleTalk()->AddTalk($oTalk)) {
                         $oTalkUser = E::GetEntity('Talk_TalkUser');
                         $oTalkUser->setTalkId($oTalk->getId());
                         $oTalkUser->setUserId($oUserRecipient->GetId());
                         $oTalkUser->setDateLast(null);
                         E::ModuleTalk()->AddTalkUser($oTalkUser);
                         // Отправка самому себе, чтобы можно было читать ответ
                         $oTalkUser = E::GetEntity('Talk_TalkUser');
                         $oTalkUser->setTalkId($oTalk->getId());
                         $oTalkUser->setUserId($this->oUserCurrent->getId());
                         $oTalkUser->setDateLast($sDate);
                         E::ModuleTalk()->AddTalkUser($oTalkUser);
                         // Отправляем уведомления
                         $oUserToMail = E::ModuleUser()->GetUserById($oUserRecipient->GetId());
                         E::ModuleNotify()->SendTalkNew($oUserToMail, $this->oUserCurrent, $oTalk);
                     } else {
                         $bOk = false;
                         break;
                     }
                 }
             }
         }
     }
     if ($bOk) {
         E::ModuleMessage()->AddNotice(E::ModuleLang()->Get('action.admin.msg_sent_ok'), null, true);
     } else {
         E::ModuleMessage()->AddError(E::ModuleLang()->Get('system_error'), null, true);
     }
 }
开发者ID:ZeoNish,项目名称:altocms,代码行数:77,代码来源:ActionAdmin.class.php

示例5: EventShutdown

 /**
  * Обработка завершения работу экшена
  */
 public function EventShutdown()
 {
     if (!$this->oUserCurrent) {
         return;
     }
     $iCountTalkFavourite = E::ModuleTalk()->GetCountTalksFavouriteByUserId($this->oUserCurrent->getId());
     E::ModuleViewer()->Assign('iCountTalkFavourite', $iCountTalkFavourite);
     $iCountTopicFavourite = E::ModuleTopic()->GetCountTopicsFavouriteByUserId($this->oUserCurrent->getId());
     $iCountTopicUser = E::ModuleTopic()->GetCountTopicsPersonalByUser($this->oUserCurrent->getId(), 1);
     $iCountCommentUser = E::ModuleComment()->GetCountCommentsByUserId($this->oUserCurrent->getId(), 'topic');
     $iCountCommentFavourite = E::ModuleComment()->GetCountCommentsFavouriteByUserId($this->oUserCurrent->getId());
     $iCountNoteUser = E::ModuleUser()->GetCountUserNotesByUserId($this->oUserCurrent->getId());
     E::ModuleViewer()->Assign('oUserProfile', $this->oUserCurrent);
     E::ModuleViewer()->Assign('iCountWallUser', E::ModuleWall()->GetCountWall(array('wall_user_id' => $this->oUserCurrent->getId(), 'pid' => null)));
     // * Общее число публикация и избранного
     E::ModuleViewer()->Assign('iCountCreated', $iCountNoteUser + $iCountTopicUser + $iCountCommentUser);
     E::ModuleViewer()->Assign('iCountFavourite', $iCountCommentFavourite + $iCountTopicFavourite);
     E::ModuleViewer()->Assign('iCountFriendsUser', E::ModuleUser()->GetCountUsersFriend($this->oUserCurrent->getId()));
     E::ModuleViewer()->Assign('sMenuSubItemSelect', $this->sMenuSubItemSelect);
     // * Передаем во вьевер константы состояний участников разговора
     E::ModuleViewer()->Assign('TALK_USER_ACTIVE', ModuleTalk::TALK_USER_ACTIVE);
     E::ModuleViewer()->Assign('TALK_USER_DELETE_BY_SELF', ModuleTalk::TALK_USER_DELETE_BY_SELF);
     E::ModuleViewer()->Assign('TALK_USER_DELETE_BY_AUTHOR', ModuleTalk::TALK_USER_DELETE_BY_AUTHOR);
 }
开发者ID:ZeoNish,项目名称:altocms,代码行数:27,代码来源:ActionTalk.class.php

示例6: GetTalksPage

 /**
  * Получает топики пользователя с картинками
  *
  * @param int $iUserId
  * @param int $iPage
  * @param int $iPerPage
  *
  * @return array
  */
 public function GetTalksPage($iUserId, $iPage, $iPerPage)
 {
     $iCount = 0;
     $aResult = array('collection' => array(), 'count' => 0);
     $aTalkInfo = $this->oMapper->GetTalkInfo($iUserId, $iCount, $iPage, $iPerPage);
     if ($aTalkInfo) {
         $aTalks = E::ModuleTalk()->GetTalksAdditionalData(array_keys($aTalkInfo));
         if ($aTalks) {
             foreach ($aTalks as $sTopicId => $oTopic) {
                 $oTopic->setImagesCount($aTalkInfo[$sTopicId]);
                 $aTalks[$sTopicId] = $oTopic;
             }
         }
         $aResult['collection'] = $aTalks;
         $aResult['count'] = $iCount;
     }
     return $aResult;
 }
开发者ID:hard990,项目名称:altocms,代码行数:27,代码来源:Mresource.class.php

示例7: CanSendTalkTime

 /**
  * Проверяет может ли пользователь отправить инбокс по времени
  *
  * @param  ModuleUser_EntityUser $oUser    Пользователь
  *
  * @return bool
  */
 public function CanSendTalkTime(ModuleUser_EntityUser $oUser)
 {
     if (!$oUser) {
         return false;
     }
     // Для администраторов ограничение по времени не действует
     if ($oUser->isAdministrator() || $oUser->isModerator() || Config::Get('acl.create.talk.limit_time') == 0 || $oUser->getRating() >= Config::Get('acl.create.talk.limit_time_rating')) {
         return true;
     }
     // * Проверяем, если топик опубликованный меньше чем acl.create.topic.limit_time секунд назад
     $aTalks = E::ModuleTalk()->GetLastTalksByUserId($oUser->getId(), Config::Get('acl.create.talk.limit_time'));
     if (isset($aTalks['count']) && $aTalks['count'] > 0) {
         return false;
     }
     return true;
 }
开发者ID:AntiqS,项目名称:altocms,代码行数:23,代码来源:ACL.class.php

示例8: DelUser

 /**
  * @param   int|object $oUserId
  *
  * @return  bool
  */
 public function DelUser($oUserId)
 {
     if (is_object($oUserId)) {
         $nUserId = $oUserId->getId();
     } else {
         $nUserId = intval($oUserId);
     }
     // Удаляем блоги
     $aBlogsId = E::ModuleBlog()->GetBlogsByOwnerId($nUserId, true);
     if ($aBlogsId) {
         E::ModuleBlog()->DeleteBlog($aBlogsId);
     }
     $oBlog = E::ModuleBlog()->GetPersonalBlogByUserId($nUserId);
     if ($oBlog) {
         E::ModuleBlog()->DeleteBlog($oBlog->getId());
     }
     // Удаляем переписку
     $iPerPage = 10000;
     do {
         $aTalks = E::ModuleTalk()->GetTalksByFilter(array('user_id' => $nUserId), 1, $iPerPage);
         if ($aTalks['count']) {
             $aTalksId = array();
             foreach ($aTalks['collection'] as $oTalk) {
                 $aTalksId[] = $oTalk->getId();
             }
             if ($aTalksId) {
                 E::ModuleTalk()->DeleteTalkUserByArray($aTalksId, $nUserId);
             }
         }
     } while ($aTalks['count'] > $iPerPage);
     $bOk = $this->oMapper->DelUser($nUserId);
     // Слишком много взаимосвязей, поэтому просто сбрасываем кеш
     E::ModuleCache()->Clean();
     return $bOk;
 }
开发者ID:AntiqS,项目名称:altocms,代码行数:40,代码来源:Admin.class.php

示例9: EventFavouriteTalk

 /**
  * Обработка избранного - личное сообщение
  *
  */
 protected function EventFavouriteTalk()
 {
     // * Пользователь авторизован?
     if (!$this->oUserCurrent) {
         E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('need_authorization'), E::ModuleLang()->Get('error'));
         return;
     }
     // * Можно только добавить или удалить из избранного
     $iType = F::GetRequestStr('type', null, 'post');
     if (!in_array($iType, array('1', '0'))) {
         E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('system_error'), E::ModuleLang()->Get('error'));
         return;
     }
     // *    Сообщение существует?
     if (!($oTalk = E::ModuleTalk()->GetTalkById(F::GetRequestStr('idTalk', null, 'post')))) {
         E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('system_error'), E::ModuleLang()->Get('error'));
         return;
     }
     // * Сообщение уже в избранном?
     $oFavouriteTalk = E::ModuleTalk()->GetFavouriteTalk($oTalk->getId(), $this->oUserCurrent->getId());
     if (!$oFavouriteTalk && $iType) {
         $oFavouriteTalkNew = E::GetEntity('Favourite', array('target_id' => $oTalk->getId(), 'target_type' => 'talk', 'user_id' => $this->oUserCurrent->getId(), 'target_publish' => '1'));
         if (E::ModuleTalk()->AddFavouriteTalk($oFavouriteTalkNew)) {
             E::ModuleMessage()->AddNoticeSingle(E::ModuleLang()->Get('talk_favourite_add_ok'), E::ModuleLang()->Get('attention'));
             E::ModuleViewer()->AssignAjax('bState', true);
         } else {
             E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('system_error'), E::ModuleLang()->Get('error'));
             return;
         }
     }
     if (!$oFavouriteTalk && !$iType) {
         E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('talk_favourite_add_no'), E::ModuleLang()->Get('error'));
         return;
     }
     if ($oFavouriteTalk && $iType) {
         E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('talk_favourite_add_already'), E::ModuleLang()->Get('error'));
         return;
     }
     if ($oFavouriteTalk && !$iType) {
         if (E::ModuleTalk()->DeleteFavouriteTalk($oFavouriteTalk)) {
             E::ModuleMessage()->AddNoticeSingle(E::ModuleLang()->Get('talk_favourite_del_ok'), E::ModuleLang()->Get('attention'));
             E::ModuleViewer()->AssignAjax('bState', false);
         } else {
             E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('system_error'), E::ModuleLang()->Get('error'));
             return;
         }
     }
 }
开发者ID:anp135,项目名称:altocms,代码行数:52,代码来源:ActionAjax.class.php

示例10: CheckAccessAndGetTarget


//.........这里部分代码省略.........
         // Топик редактируется
         if ($oTopic = E::ModuleTopic()->GetTopicById($iTargetId)) {
             if (!E::ModuleACL()->IsAllowEditTopic($oTopic, E::User())) {
                 return FALSE;
             }
             return $oTopic;
         }
         return TRUE;
     }
     // Загружать аватарки можно только в свой профиль
     if ($sTarget == 'profile_avatar') {
         if ($iTargetId && E::IsUser() && $iTargetId == E::UserId()) {
             return E::User();
         }
         return FALSE;
     }
     // Загружать аватарки можно только в свой профиль
     if ($sTarget == 'profile_photo') {
         if ($iTargetId && E::IsUser() && $iTargetId == E::UserId()) {
             return E::User();
         }
         return FALSE;
     }
     if ($sTarget == 'blog_avatar') {
         /** @var ModuleBlog_EntityBlog $oBlog */
         $oBlog = E::ModuleBlog()->GetBlogById($iTargetId);
         if (!E::IsUser()) {
             return false;
         }
         if (!$oBlog) {
             // Блог еще не создан
             return E::ModuleACL()->CanCreateBlog(E::User()) || E::IsAdminOrModerator();
         }
         if ($oBlog && (E::ModuleACL()->CheckBlogEditBlog($oBlog, E::User()) || E::IsAdminOrModerator())) {
             return $oBlog;
         }
         return '';
     }
     if ($sTarget == 'topic') {
         if (!E::IsUser()) {
             return false;
         }
         /** @var ModuleTopic_EntityTopic $oTopic */
         $oTopic = E::ModuleTopic()->GetTopicById($iTargetId);
         if (!$oTopic) {
             // Топик еще не создан
             return TRUE;
         }
         if ($oTopic && (E::ModuleACL()->IsAllowEditTopic($oTopic, E::User()) || E::IsAdminOrModerator())) {
             return $oTopic;
         }
         return '';
     }
     if ($sTarget == 'topic_comment') {
         if (!E::IsUser()) {
             return false;
         }
         /** @var ModuleComment_EntityComment $oComment */
         $oComment = E::ModuleComment()->GetCommentById($iTargetId);
         if (!$oComment) {
             // Комментарий еще не создан
             return TRUE;
         }
         if ($oComment && (E::ModuleACL()->CanPostComment(E::User(), $oComment->getTarget()) && E::ModuleAcl()->CanPostCommentTime(E::User()) || E::IsAdminOrModerator())) {
             return $oComment;
         }
         return '';
     }
     if ($sTarget == 'talk_comment') {
         if (!E::IsUser()) {
             return false;
         }
         /** @var ModuleComment_EntityComment $oComment */
         $oComment = E::ModuleComment()->GetCommentById($iTargetId);
         if (!$oComment) {
             // Комментарий еще не создан
             return TRUE;
         }
         if ($oComment && (E::ModuleAcl()->CanPostTalkCommentTime(E::User()) || E::IsAdminOrModerator())) {
             return $oComment;
         }
         return '';
     }
     if ($sTarget == 'talk') {
         if (!E::IsUser()) {
             return false;
         }
         /** @var ModuleComment_EntityComment $oTalk */
         $oTalk = E::ModuleTalk()->GetTalkById($iTargetId);
         if (!$oTalk) {
             // Комментарий еще не создан
             return TRUE;
         }
         if ($oTalk && (E::ModuleAcl()->CanSendTalkTime(E::User()) || E::IsAdminOrModerator())) {
             return $oTalk;
         }
         return '';
     }
     return FALSE;
 }
开发者ID:AntiqS,项目名称:altocms,代码行数:101,代码来源:Uploader.class.php

示例11: SendBlogInvite

 /**
  * Выполняет отправку приглашения в блог
  * (по внутренней почте и на email)
  *
  * @param ModuleBlog_EntityBlog $oBlog
  * @param ModuleUser_EntityUser $oUser
  */
 protected function SendBlogInvite($oBlog, $oUser)
 {
     $sTitle = E::ModuleLang()->Get('blog_user_invite_title', array('blog_title' => $oBlog->getTitle()));
     F::IncludeLib('XXTEA/encrypt.php');
     //  Формируем код подтверждения в URL
     $sCode = $oBlog->getId() . '_' . $oUser->getId();
     $sCode = rawurlencode(base64_encode(xxtea_encrypt($sCode, Config::Get('module.blog.encrypt'))));
     $aPath = array('accept' => R::GetPath('blog') . 'invite/accept/?code=' . $sCode, 'reject' => R::GetPath('blog') . 'invite/reject/?code=' . $sCode);
     // Сформируем название типа блога на языке приложения.
     // Это может быть либо название, либо текстовка.
     $sBlogType = mb_strtolower(preg_match('~^\\{\\{(.*)\\}\\}$~', $sBlogType = $oBlog->getBlogType()->getTypeName(), $aMatches) ? E::ModuleLang()->Get($aMatches[1]) : $sBlogType, 'UTF-8');
     $sText = E::ModuleLang()->Get('blog_user_invite_text', array('login' => $this->oUserCurrent->getLogin(), 'accept_path' => $aPath['accept'], 'reject_path' => $aPath['reject'], 'blog_title' => $oBlog->getTitle(), 'blog_type' => $sBlogType));
     $oTalk = E::ModuleTalk()->SendTalk($sTitle, $sText, $this->oUserCurrent, array($oUser), false, false);
     //  Отправляем пользователю заявку
     E::ModuleNotify()->SendBlogUserInvite($oUser, $this->oUserCurrent, $oBlog, R::GetPath('talk') . 'read/' . $oTalk->getId() . '/');
     //  Удаляем отправляющего юзера из переписки
     E::ModuleTalk()->DeleteTalkUserByArray($oTalk->getId(), $this->oUserCurrent->getId());
 }
开发者ID:anp135,项目名称:altocms,代码行数:25,代码来源:ActionBlog.class.php

示例12: EventShutdown

 /**
  * Обработка завершения работу экшена
  */
 public function EventShutdown()
 {
     if (!E::User()) {
         return;
     }
     $iCountTalkFavourite = E::ModuleTalk()->GetCountTalksFavouriteByUserId($this->oUserCurrent->getId());
     E::ModuleViewer()->Assign('iCountTalkFavourite', $iCountTalkFavourite);
     $iUserId = E::UserId();
     // Get stats of various user publications topics, comments, images, etc. and stats of favourites
     $aProfileStats = E::ModuleUser()->GetUserProfileStats($iUserId);
     // Получим информацию об изображениях пользователя
     /** @var ModuleMresource_EntityMresourceCategory[] $aUserImagesInfo */
     $aUserImagesInfo = E::ModuleMresource()->GetAllImageCategoriesByUserId($iUserId);
     E::ModuleViewer()->Assign('oUserProfile', E::User());
     E::ModuleViewer()->Assign('aProfileStats', $aProfileStats);
     E::ModuleViewer()->Assign('aUserImagesInfo', $aUserImagesInfo);
     // Old style skin compatibility
     E::ModuleViewer()->Assign('iCountTopicUser', $aProfileStats['count_topics']);
     E::ModuleViewer()->Assign('iCountCommentUser', $aProfileStats['count_comments']);
     E::ModuleViewer()->Assign('iCountTopicFavourite', $aProfileStats['favourite_topics']);
     E::ModuleViewer()->Assign('iCountCommentFavourite', $aProfileStats['favourite_comments']);
     E::ModuleViewer()->Assign('iCountNoteUser', $aProfileStats['count_usernotes']);
     E::ModuleViewer()->Assign('iCountWallUser', $aProfileStats['count_wallrecords']);
     E::ModuleViewer()->Assign('iPhotoCount', $aProfileStats['count_images']);
     E::ModuleViewer()->Assign('iCountCreated', $aProfileStats['count_created']);
     E::ModuleViewer()->Assign('iCountFavourite', $aProfileStats['count_favourites']);
     E::ModuleViewer()->Assign('iCountFriendsUser', $aProfileStats['count_friends']);
     E::ModuleViewer()->Assign('sMenuSubItemSelect', $this->sMenuSubItemSelect);
     E::ModuleViewer()->Assign('sMenuSubItemSelect', $this->sMenuSubItemSelect);
     // * Передаем константы состояний участников разговора
     E::ModuleViewer()->Assign('TALK_USER_ACTIVE', ModuleTalk::TALK_USER_ACTIVE);
     E::ModuleViewer()->Assign('TALK_USER_DELETE_BY_SELF', ModuleTalk::TALK_USER_DELETE_BY_SELF);
     E::ModuleViewer()->Assign('TALK_USER_DELETE_BY_AUTHOR', ModuleTalk::TALK_USER_DELETE_BY_AUTHOR);
 }
开发者ID:anp135,项目名称:altocms,代码行数:37,代码来源:ActionTalk.class.php

示例13: EventAjaxFriendDelete

 /**
  * Удаление пользователя из друзей
  */
 public function EventAjaxFriendDelete()
 {
     /**
      * Устанавливаем формат Ajax ответа
      */
     E::ModuleViewer()->SetResponseAjax('json');
     $sUserId = F::GetRequestStr('idUser', null, 'post');
     /**
      * Если пользователь не авторизирован, возвращаем ошибку
      */
     if (!E::ModuleUser()->IsAuthorization()) {
         E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('need_authorization'), E::ModuleLang()->Get('error'));
         return;
     }
     $this->oUserCurrent = E::ModuleUser()->GetUserCurrent();
     /**
      * При попытке добавить в друзья себя, возвращаем ошибку
      */
     if ($this->oUserCurrent->getId() == $sUserId) {
         E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('user_friend_add_self'), E::ModuleLang()->Get('error'));
         return;
     }
     /**
      * Если пользователь не найден, возвращаем ошибку
      */
     if (!($oUser = E::ModuleUser()->GetUserById($sUserId))) {
         E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('user_friend_del_no'), E::ModuleLang()->Get('error'));
         return;
     }
     $this->oUserProfile = $oUser;
     /**
      * Получаем статус дружбы между пользователями.
      * Если статус не определен, или отличается от принятой заявки,
      * возвращаем ошибку
      */
     $oFriend = E::ModuleUser()->GetFriend($oUser->getId(), $this->oUserCurrent->getId());
     $aAllowedFriendStatus = array(ModuleUser::USER_FRIEND_ACCEPT + ModuleUser::USER_FRIEND_OFFER, ModuleUser::USER_FRIEND_ACCEPT + ModuleUser::USER_FRIEND_ACCEPT);
     if (!$oFriend || !in_array($oFriend->getFriendStatus(), $aAllowedFriendStatus)) {
         E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('user_friend_del_no'), E::ModuleLang()->Get('error'));
         return;
     }
     /**
      * Удаляем из друзей
      */
     if (E::ModuleUser()->DeleteFriend($oFriend)) {
         E::ModuleMessage()->AddNoticeSingle(E::ModuleLang()->Get('user_friend_del_ok'), E::ModuleLang()->Get('attention'));
         $oViewerLocal = $this->GetViewerLocal();
         $oViewerLocal->Assign('oUserFriend', $oFriend);
         E::ModuleViewer()->AssignAjax('sToggleText', $oViewerLocal->Fetch('actions/profile/action.profile.friend_item.tpl'));
         /**
          * Отправляем пользователю сообщение об удалении дружеской связи
          */
         if (Config::Get('module.user.friend_notice.delete')) {
             $sText = E::ModuleLang()->Get('user_friend_del_notice_text', array('login' => $this->oUserCurrent->getLogin()));
             $oTalk = E::ModuleTalk()->SendTalk(E::ModuleLang()->Get('user_friend_del_notice_title'), $sText, $this->oUserCurrent, array($oUser), false, false);
             E::ModuleTalk()->DeleteTalkUserByArray($oTalk->getId(), $this->oUserCurrent->getId());
         }
         return;
     } else {
         E::ModuleMessage()->AddErrorSingle(E::ModuleLang()->Get('system_error'), E::ModuleLang()->Get('error'));
         return;
     }
 }
开发者ID:anp135,项目名称:altocms,代码行数:66,代码来源:ActionProfile.class.php


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