1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-05-19 01:08:19 +03:00
This commit is contained in:
Mzhelskiy Maxim 2015-04-16 20:51:36 +07:00
parent fd1946a995
commit 1482a17760
3 changed files with 25 additions and 9 deletions

View file

@ -1048,14 +1048,21 @@ class ActionBlog extends Action
$aBlogAdministratorsResult = $this->Blog_GetBlogUsersByBlogId($oBlog->getId(),
ModuleBlog::BLOG_USER_ROLE_ADMINISTRATOR);
$aBlogAdministrators = $aBlogAdministratorsResult['collection'];
/**
* Для админов проекта получаем список блогов и передаем их во вьювер
*/
if ($this->oUserCurrent and $this->oUserCurrent->isAdministrator()) {
$aBlogs = $this->Blog_GetBlogs();
unset($aBlogs[$oBlog->getId()]);
$this->Viewer_Assign('blogs', $aBlogs);
if ($this->oUserCurrent) {
/**
* Для админов проекта получаем список блогов и передаем их во вьювер
*/
if ($this->oUserCurrent->isAdministrator()) {
$aBlogs = $this->Blog_GetBlogs();
unset($aBlogs[$oBlog->getId()]);
$this->Viewer_Assign('blogs', $aBlogs);
}
/**
* Текущая роль пользователя в блоге
*/
$this->Viewer_Assign('blogUserCurrent', $this->Blog_GetBlogUserByBlogIdAndUserId($oBlog->getId(), $this->oUserCurrent->getId()));
}
/**
* Вызов хуков

View file

@ -67,6 +67,16 @@ class ModuleBlog_EntityBlogUser extends Entity
return ($this->getUserRole() == ModuleBlog::BLOG_USER_ROLE_ADMINISTRATOR);
}
/**
* Возвращает статус бана пользователя
*
* @return bool
*/
public function getIsBanned()
{
return ($this->getUserRole() == ModuleBlog::BLOG_USER_ROLE_BAN);
}
/**
* Возвращает текущую роль пользователя в блоге
*

View file

@ -27,8 +27,7 @@
{$smarty.block.parent}
{* Сообщение для забаненного пользователя *}
{* TODO: Вывод сообщения о бане *}
{if false}
{if $blogUserCurrent and $blogUserCurrent->getIsBanned()}
{component 'alert' text=$aLang.blog.alerts.banned mods='error'}
{/if}