mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-26 03:30:48 +03:00
fix #639
This commit is contained in:
parent
b178f0dde8
commit
bed6265c47
|
@ -81,13 +81,24 @@ class ModuleTopic extends Module
|
|||
*
|
||||
* @param string $sType
|
||||
*
|
||||
* @return null
|
||||
* @return ModuleTopic_EntityTopicType|null
|
||||
*/
|
||||
public function GetTopicType($sType)
|
||||
{
|
||||
return isset($this->aTopicTypes[$sType]) ? $this->aTopicTypes[$sType] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Возвращает первый доступные тип топика
|
||||
*
|
||||
* @return ModuleTopic_EntityTopicType|null
|
||||
*/
|
||||
public function GetTopicTypeFirst()
|
||||
{
|
||||
$oType = reset($this->aTopicTypes);
|
||||
return $oType ?: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Проверяет разрешен ли данный тип топика
|
||||
*
|
||||
|
|
|
@ -20,10 +20,13 @@
|
|||
|
||||
{* Написать в блог *}
|
||||
{if $oUserCurrent && ( ( $blog->getUserIsJoin() && $oUserCurrent->getRating() >= $blog->getLimitRatingTopic() ) || $blog->isAllowEdit() )}
|
||||
{$actions[] = [
|
||||
'url' => "{$LS->Topic_GetTopicType('topic')->getUrlForAdd()}?blog_id={$blog->getId()}",
|
||||
'text' => {lang 'blog.actions.write'}
|
||||
]}
|
||||
{$topicType=$LS->Topic_GetTopicTypeFirst()}
|
||||
{if $topicType}
|
||||
{$actions[] = [
|
||||
'url' => "{$topicType->getUrlForAdd()}?blog_id={$blog->getId()}",
|
||||
'text' => {lang 'blog.actions.write'}
|
||||
]}
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{* Подписаться через RSS *}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
{if ! $smarty.local.skipBlogs}
|
||||
{$blogsSelect = []}
|
||||
{$blogsSelectId = []}
|
||||
{$blogsSelectedId=[]}
|
||||
|
||||
{foreach $smarty.local.blogs as $blogType => $blogs}
|
||||
{$blogsSelectOptions = []}
|
||||
|
@ -45,6 +46,11 @@
|
|||
|
||||
{if $topic}
|
||||
{json var=array_intersect($topic->getBlogsId(),$blogsSelectId) assign='chosenOrder'}
|
||||
{$blogsSelectedId = $topic->getBlogsId()}
|
||||
{else}
|
||||
{if $_aRequest.blog_id}
|
||||
{$blogsSelectedId[] = $_aRequest.blog_id}
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{component 'field' template='select'
|
||||
|
@ -53,7 +59,7 @@
|
|||
placeholder = 'Выберите блоги для публикации'
|
||||
inputClasses = 'js-topic-add-blogs'
|
||||
isMultiple = true
|
||||
selectedValue = ( ( $topic ) ? $topic->getBlogsId() : [] )
|
||||
selectedValue = $blogsSelectedId
|
||||
inputAttributes = [ 'data-chosen-order' => {$chosenOrder} ]
|
||||
items = $blogsSelect}
|
||||
{/if}
|
||||
|
|
Loading…
Reference in a new issue