1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-29 04:55:02 +03:00

Возможность не заполнять теги у топика

This commit is contained in:
Mzhelskiy Maxim 2012-04-14 16:57:07 +04:00
parent 3e3af2df3b
commit 988ca25ff5
7 changed files with 396 additions and 381 deletions

View file

@ -170,7 +170,7 @@ class ModuleTopic extends Module {
public function AddTopic(ModuleTopic_EntityTopic $oTopic) {
if ($sId=$this->oMapperTopic->AddTopic($oTopic)) {
$oTopic->setId($sId);
if ($oTopic->getPublish()) {
if ($oTopic->getPublish() and $oTopic->getTags()) {
$aTags=explode(',',$oTopic->getTags());
foreach ($aTags as $sTag) {
$oTag=Engine::GetEntity('Topic_TopicTag');
@ -293,10 +293,9 @@ class ModuleTopic extends Module {
/**
* Обновляем теги
*/
$aTags=explode(',',$oTopic->getTags());
$this->DeleteTopicTagsByTopicId($oTopic->getId());
if ($oTopic->getPublish()) {
if ($oTopic->getPublish() and $oTopic->getTags()) {
$aTags=explode(',',$oTopic->getTags());
foreach ($aTags as $sTag) {
$oTag=Engine::GetEntity('Topic_TopicTag');
$oTag->setTopicId($oTopic->getId());

View file

@ -27,7 +27,7 @@ class ModuleTopic_EntityTopic extends Entity {
$this->aValidateRules[]=array('topic_text_source','string','max'=>Config::Get('module.topic.max_length'),'min'=>2,'allowEmpty'=>false,'label'=>$this->Lang_Get('topic_create_text'),'on'=>array('topic','photoset'));
$this->aValidateRules[]=array('topic_text_source','string','max'=>500,'min'=>10,'allowEmpty'=>false,'label'=>$this->Lang_Get('topic_create_text'),'on'=>array('link'));
$this->aValidateRules[]=array('topic_text_source','string','max'=>500,'allowEmpty'=>true,'label'=>$this->Lang_Get('topic_create_text'),'on'=>array('question'));
$this->aValidateRules[]=array('topic_tags','tags','count'=>15,'label'=>$this->Lang_Get('topic_create_tags'),'on'=>array('topic','link','question','photoset'));
$this->aValidateRules[]=array('topic_tags','tags','count'=>15,'label'=>$this->Lang_Get('topic_create_tags'),'allowEmpty'=>Config::Get('module.topic.allow_empty_tags'),'on'=>array('topic','link','question','photoset'));
$this->aValidateRules[]=array('blog_id','blog_id','on'=>array('topic','link','question','photoset'));
$this->aValidateRules[]=array('topic_text_source','topic_unique','on'=>array('topic','link','question','photoset'));
$this->aValidateRules[]=array('topic_type','topic_type','on'=>array('topic','link','question','photoset'));
@ -172,8 +172,11 @@ class ModuleTopic_EntityTopic extends Entity {
}
public function getTagsArray() {
if ($this->getTags()) {
return explode(',',$this->getTags());
}
return array();
}
public function getCountCommentNew() {
return $this->_aData['count_comment_new'];
}

View file

@ -176,6 +176,7 @@ $config['module']['blog']['avatar_size'] = array(48,24,0); // Список ра
$config['module']['topic']['new_time'] = 60*60*24*1; // Время в секундах в течении которого топик считается новым
$config['module']['topic']['per_page'] = 10; // Число топиков на одну страницу
$config['module']['topic']['max_length'] = 15000; // Максимальное количество символов в одном топике
$config['module']['topic']['allow_empty_tags'] = false; // Разрешать или нет не заполнять теги
// Модуль User
$config['module']['user']['per_page'] = 15; // Число юзеров на страницу на странице статистики и в профиле пользователя
$config['module']['user']['friend_on_profile'] = 15; // Ограничение на вывод числа друзей пользователя на странице его профиля

View file

@ -179,6 +179,8 @@ return array(
'topic_title' => 'Topics',
'topic_read_more' => 'Read more',
'topic_date' => 'Date',
'topic_tags' => 'Tags',
'topic_tags_empty' => 'empty',
'topic_user' => "Author's text",
'topic_time_limit' => "Can't create topics in such a frequent rate",
'topic_comment_read' => 'Read comments',

View file

@ -179,6 +179,8 @@ return array(
'topic_title' => 'Топики',
'topic_read_more' => 'Читать дальше',
'topic_date' => 'дата',
'topic_tags' => 'Теги',
'topic_tags_empty' => 'нет',
'topic_user' => 'авторский текст',
'topic_time_limit' => 'Вам нельзя создавать топики слишком часто',
'topic_comment_read' => 'читать комментарии',

View file

@ -17,12 +17,16 @@
<ul class="topic-tags js-favourite-insert-after-form js-favourite-tags-topic-{$oTopic->getId()}">
<li>{$aLang.block_tags}:</li>
<li>{$aLang.topic_tags}:</li>
{strip}
{if $oTopic->getTagsArray()}
{foreach from=$oTopic->getTagsArray() item=sTag name=tags_list}
<li>{if !$smarty.foreach.tags_list.first}, {/if}<a rel="tag" href="{router page='tag'}{$sTag|escape:'url'}/">{$sTag|escape:'html'}</a></li>
{/foreach}
{else}
<li>{$aLang.topic_tags_empty}</li>
{/if}
{if $oUserCurrent}
{if $oFavourite}

View file

@ -25,9 +25,13 @@
<ul class="topic-tags">
<li>{$aLang.block_tags}:</li>
{strip}
{if $oTopic->getTagsArray()}
{foreach from=$oTopic->getTagsArray() item=sTag name=tags_list}
<li>{if !$smarty.foreach.tags_list.first}, {/if}<a rel="tag" href="{router page='tag'}{$sTag|escape:'url'}/">{$sTag|escape:'html'}</a></li>
{/foreach}
{else}
<li>{$aLang.topic_tags_empty}</li>
{/if}
{/strip}
</ul>