mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-26 03:30:48 +03:00
Возможность пропускать топики на главной из определенных блогов fix #681
This commit is contained in:
parent
7a8305ed09
commit
e75e7b21fb
|
@ -266,6 +266,11 @@ class ActionBlog extends Action
|
||||||
$oBlog->setDateAdd(date("Y-m-d H:i:s"));
|
$oBlog->setDateAdd(date("Y-m-d H:i:s"));
|
||||||
$oBlog->setLimitRatingTopic(getRequestStr('blog_limit_rating_topic'));
|
$oBlog->setLimitRatingTopic(getRequestStr('blog_limit_rating_topic'));
|
||||||
$oBlog->setUrl(getRequestStr('blog_url'));
|
$oBlog->setUrl(getRequestStr('blog_url'));
|
||||||
|
if ($this->oUserCurrent->isAdministrator()) {
|
||||||
|
$oBlog->setSkipIndex(getRequest('blog_skip_index') ? 1 : 0);
|
||||||
|
} else {
|
||||||
|
$oBlog->setSkipIndex(0);
|
||||||
|
}
|
||||||
$oBlog->setAvatar(null);
|
$oBlog->setAvatar(null);
|
||||||
/**
|
/**
|
||||||
* Создаём блог
|
* Создаём блог
|
||||||
|
@ -380,6 +385,7 @@ class ActionBlog extends Action
|
||||||
$oBlog->setLimitRatingTopic(getRequestStr('blog_limit_rating_topic'));
|
$oBlog->setLimitRatingTopic(getRequestStr('blog_limit_rating_topic'));
|
||||||
if ($this->oUserCurrent->isAdministrator()) {
|
if ($this->oUserCurrent->isAdministrator()) {
|
||||||
$oBlog->setUrl(getRequestStr('blog_url')); // разрешаем смену URL блога только админу
|
$oBlog->setUrl(getRequestStr('blog_url')); // разрешаем смену URL блога только админу
|
||||||
|
$oBlog->setSkipIndex(getRequest('blog_skip_index') ? 1 : 0);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Обновляем блог
|
* Обновляем блог
|
||||||
|
@ -405,6 +411,7 @@ class ActionBlog extends Action
|
||||||
*/
|
*/
|
||||||
$_REQUEST['blog_title'] = $oBlog->getTitle();
|
$_REQUEST['blog_title'] = $oBlog->getTitle();
|
||||||
$_REQUEST['blog_url'] = $oBlog->getUrl();
|
$_REQUEST['blog_url'] = $oBlog->getUrl();
|
||||||
|
$_REQUEST['blog_skip_index'] = $oBlog->getSkipIndex();
|
||||||
$_REQUEST['blog_type'] = $oBlog->getType();
|
$_REQUEST['blog_type'] = $oBlog->getType();
|
||||||
$_REQUEST['blog_description'] = $oBlog->getDescription();
|
$_REQUEST['blog_description'] = $oBlog->getDescription();
|
||||||
$_REQUEST['blog_limit_rating_topic'] = $oBlog->getLimitRatingTopic();
|
$_REQUEST['blog_limit_rating_topic'] = $oBlog->getLimitRatingTopic();
|
||||||
|
@ -1477,7 +1484,7 @@ class ActionBlog extends Action
|
||||||
* Обрабатываем добавление по каждому из переданных логинов
|
* Обрабатываем добавление по каждому из переданных логинов
|
||||||
*/
|
*/
|
||||||
foreach ($aUsers as $iUserId) {
|
foreach ($aUsers as $iUserId) {
|
||||||
$iUserId = (int) $iUserId;
|
$iUserId = (int)$iUserId;
|
||||||
|
|
||||||
if (!$iUserId) {
|
if (!$iUserId) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -176,6 +176,16 @@ class ModuleBlog_EntityBlog extends Entity
|
||||||
return $this->_getDataOne('blog_url');
|
return $this->_getDataOne('blog_url');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Возвращает флаг пропуска топиков на главной
|
||||||
|
*
|
||||||
|
* @return int|null
|
||||||
|
*/
|
||||||
|
public function getSkipIndex()
|
||||||
|
{
|
||||||
|
return $this->_getDataOne('blog_skip_index');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Возвращает полный серверный путь до аватара блога
|
* Возвращает полный серверный путь до аватара блога
|
||||||
*
|
*
|
||||||
|
@ -435,6 +445,16 @@ class ModuleBlog_EntityBlog extends Entity
|
||||||
$this->_aData['blog_url'] = $data;
|
$this->_aData['blog_url'] = $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Устанавливает флаг пропуска топиков на главной
|
||||||
|
*
|
||||||
|
* @param string $data
|
||||||
|
*/
|
||||||
|
public function setSkipIndex($data)
|
||||||
|
{
|
||||||
|
$this->_aData['blog_skip_index'] = $data;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Устанавливает полный серверный путь до аватара блога
|
* Устанавливает полный серверный путь до аватара блога
|
||||||
*
|
*
|
||||||
|
|
|
@ -43,13 +43,14 @@ class ModuleBlog_MapperBlog extends Mapper
|
||||||
blog_date_add,
|
blog_date_add,
|
||||||
blog_limit_rating_topic,
|
blog_limit_rating_topic,
|
||||||
blog_url,
|
blog_url,
|
||||||
|
blog_skip_index,
|
||||||
blog_avatar
|
blog_avatar
|
||||||
)
|
)
|
||||||
VALUES(?d, ?, ?, ?, ?, ?, ?, ?)
|
VALUES(?d, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||||
";
|
";
|
||||||
if ($iId = $this->oDb->query($sql, $oBlog->getOwnerId(), $oBlog->getTitle(), $oBlog->getDescription(),
|
if ($iId = $this->oDb->query($sql, $oBlog->getOwnerId(), $oBlog->getTitle(), $oBlog->getDescription(),
|
||||||
$oBlog->getType(), $oBlog->getDateAdd(), $oBlog->getLimitRatingTopic(), $oBlog->getUrl(),
|
$oBlog->getType(), $oBlog->getDateAdd(), $oBlog->getLimitRatingTopic(), $oBlog->getUrl(),
|
||||||
$oBlog->getAvatar())
|
$oBlog->getSkipIndex(), $oBlog->getAvatar())
|
||||||
) {
|
) {
|
||||||
return $iId;
|
return $iId;
|
||||||
}
|
}
|
||||||
|
@ -75,13 +76,14 @@ class ModuleBlog_MapperBlog extends Mapper
|
||||||
blog_count_topic= ?d,
|
blog_count_topic= ?d,
|
||||||
blog_limit_rating_topic= ?f ,
|
blog_limit_rating_topic= ?f ,
|
||||||
blog_url= ?,
|
blog_url= ?,
|
||||||
|
blog_skip_index= ?d,
|
||||||
blog_avatar= ?
|
blog_avatar= ?
|
||||||
WHERE
|
WHERE
|
||||||
blog_id = ?d
|
blog_id = ?d
|
||||||
";
|
";
|
||||||
$res = $this->oDb->query($sql, $oBlog->getTitle(), $oBlog->getDescription(), $oBlog->getType(),
|
$res = $this->oDb->query($sql, $oBlog->getTitle(), $oBlog->getDescription(), $oBlog->getType(),
|
||||||
$oBlog->getDateEdit(), $oBlog->getCountVote(), $oBlog->getCountUser(),
|
$oBlog->getDateEdit(), $oBlog->getCountVote(), $oBlog->getCountUser(),
|
||||||
$oBlog->getCountTopic(), $oBlog->getLimitRatingTopic(), $oBlog->getUrl(), $oBlog->getAvatar(),
|
$oBlog->getCountTopic(), $oBlog->getLimitRatingTopic(), $oBlog->getUrl(), $oBlog->getSkipIndex(), $oBlog->getAvatar(),
|
||||||
$oBlog->getId());
|
$oBlog->getId());
|
||||||
return $this->IsSuccessful($res);
|
return $this->IsSuccessful($res);
|
||||||
}
|
}
|
||||||
|
@ -137,7 +139,7 @@ class ModuleBlog_MapperBlog extends Mapper
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Добавляет свзяь пользователя с блогом в БД
|
* Добавляет связь пользователя с блогом в БД
|
||||||
*
|
*
|
||||||
* @param ModuleBlog_EntityBlogUser $oBlogUser Объект отношения пользователя с блогом
|
* @param ModuleBlog_EntityBlogUser $oBlogUser Объект отношения пользователя с блогом
|
||||||
* @return bool
|
* @return bool
|
||||||
|
|
|
@ -604,7 +604,7 @@ class ModuleTopic_MapperTopic extends Mapper
|
||||||
if (isset($aFilter['topic_rating']) and is_array($aFilter['topic_rating'])) {
|
if (isset($aFilter['topic_rating']) and is_array($aFilter['topic_rating'])) {
|
||||||
$sPublishIndex = '';
|
$sPublishIndex = '';
|
||||||
if (isset($aFilter['topic_rating']['publish_index']) and $aFilter['topic_rating']['publish_index'] == 1) {
|
if (isset($aFilter['topic_rating']['publish_index']) and $aFilter['topic_rating']['publish_index'] == 1) {
|
||||||
$sPublishIndex = " or topic_publish_index = 1 ) and ( topic_skip_index = 0 ";
|
$sPublishIndex = " or topic_publish_index = 1 ) and ( topic_skip_index = 0 and b.blog_skip_index = 0 ";
|
||||||
}
|
}
|
||||||
if ($aFilter['topic_rating']['type'] == 'top') {
|
if ($aFilter['topic_rating']['type'] == 'top') {
|
||||||
$sWhere .= " AND ( t.topic_rating >= " . (float)$aFilter['topic_rating']['value'] . " {$sPublishIndex} ) ";
|
$sWhere .= " AND ( t.topic_rating >= " . (float)$aFilter['topic_rating']['value'] . " {$sPublishIndex} ) ";
|
||||||
|
|
|
@ -61,6 +61,14 @@
|
||||||
note = $aLang.blog.add.fields.rating.note
|
note = $aLang.blog.add.fields.rating.note
|
||||||
label = $aLang.blog.add.fields.rating.label}
|
label = $aLang.blog.add.fields.rating.label}
|
||||||
|
|
||||||
|
{* Принудительный вывод топиков на главную (доступно только админам) *}
|
||||||
|
{if $oUserCurrent->isAdministrator()}
|
||||||
|
{component 'field' template='checkbox'
|
||||||
|
name = 'blog_skip_index'
|
||||||
|
note = $aLang.blog.add.fields.skip_index.note
|
||||||
|
label = $aLang.blog.add.fields.skip_index.label}
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
{hook run='form_add_blog_end'}
|
{hook run='form_add_blog_end'}
|
||||||
|
|
||||||
|
|
|
@ -211,6 +211,10 @@ return array(
|
||||||
'label' => 'Аватар',
|
'label' => 'Аватар',
|
||||||
'error' => 'Не удалось загрузить аватар',
|
'error' => 'Не удалось загрузить аватар',
|
||||||
),
|
),
|
||||||
|
'skip_index' => array(
|
||||||
|
'label' => 'Не выводить топики на главную',
|
||||||
|
'note' => 'Все топики из этого блога не смогут попадать на главную страницу',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
// Сообщения
|
// Сообщения
|
||||||
'alerts' => array(
|
'alerts' => array(
|
||||||
|
|
|
@ -878,4 +878,7 @@ ALTER TABLE `prefix_topic` ADD `topic_slug` VARCHAR(500) NOT NULL DEFAULT '' AFT
|
||||||
|
|
||||||
-- 27.03.2015
|
-- 27.03.2015
|
||||||
ALTER TABLE `prefix_topic` ADD `topic_date_publish` DATETIME NOT NULL AFTER `topic_date_edit_content`, ADD INDEX (`topic_date_publish`) ;
|
ALTER TABLE `prefix_topic` ADD `topic_date_publish` DATETIME NOT NULL AFTER `topic_date_edit_content`, ADD INDEX (`topic_date_publish`) ;
|
||||||
UPDATE `prefix_topic` SET `topic_date_publish` = `topic_date_add`;
|
UPDATE `prefix_topic` SET `topic_date_publish` = `topic_date_add`;
|
||||||
|
|
||||||
|
-- 09.09.2015
|
||||||
|
ALTER TABLE `prefix_blog` ADD `blog_skip_index` TINYINT(1) NOT NULL DEFAULT '0' , ADD INDEX (`blog_skip_index`) ;
|
Loading…
Reference in a new issue