1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-05-17 00:08:17 +03:00

добавлена возможность для админа принудительно выводить топик на главную

This commit is contained in:
Mzhelskiy Maxim 2008-10-10 21:02:31 +00:00
parent 4515216df7
commit e9238651bf
11 changed files with 111 additions and 16 deletions

View file

@ -179,6 +179,7 @@ class ActionLink extends Action {
$_REQUEST['topic_tags']=$oTopic->getTags();
$_REQUEST['blog_id']=$oTopic->getBlogId();
$_REQUEST['topic_id']=$oTopic->getId();
$_REQUEST['topic_publish_index']=$oTopic->getPublishIndex();
}
}
/**
@ -304,6 +305,15 @@ class ActionLink extends Action {
} else {
$oTopic->setPublish(0);
}
/**
* Принудительный вывод на главную
*/
$oTopic->setPublishIndex(0);
if ($this->oUserCurrent->isAdministrator()) {
if (getRequest('topic_publish_index')) {
$oTopic->setPublishIndex(1);
}
}
/**
* Добавляем топик
*/
@ -399,7 +409,17 @@ class ActionLink extends Action {
$oTopic->setPublish(1);
} else {
$oTopic->setPublish(0);
}
}
/**
* Принудительный вывод на главную
*/
if ($this->oUserCurrent->isAdministrator()) {
if (getRequest('topic_publish_index')) {
$oTopic->setPublishIndex(1);
} else {
$oTopic->setPublishIndex(0);
}
}
/**
* Сохраняем топик
*/

View file

@ -146,6 +146,7 @@ class ActionQuestion extends Action {
$_REQUEST['topic_tags']=$oTopic->getTags();
$_REQUEST['blog_id']=$oTopic->getBlogId();
$_REQUEST['topic_id']=$oTopic->getId();
$_REQUEST['topic_publish_index']=$oTopic->getPublishIndex();
$_REQUEST['answer']=array();
$aAnswers=$oTopic->getQuestionAnswers();
@ -276,7 +277,16 @@ class ActionQuestion extends Action {
$oTopic->setPublish(1);
} else {
$oTopic->setPublish(0);
}
}
/**
* Принудительный вывод на главную
*/
$oTopic->setPublishIndex(0);
if ($this->oUserCurrent->isAdministrator()) {
if (getRequest('topic_publish_index')) {
$oTopic->setPublishIndex(1);
}
}
/**
* Добавляем топик
*/
@ -381,7 +391,17 @@ class ActionQuestion extends Action {
$oTopic->setPublish(1);
} else {
$oTopic->setPublish(0);
}
}
/**
* Принудительный вывод на главную
*/
if ($this->oUserCurrent->isAdministrator()) {
if (getRequest('topic_publish_index')) {
$oTopic->setPublishIndex(1);
} else {
$oTopic->setPublishIndex(0);
}
}
/**
* Сохраняем топик
*/

View file

@ -149,6 +149,7 @@ class ActionTopic extends Action {
$_REQUEST['topic_tags']=$oTopic->getTags();
$_REQUEST['blog_id']=$oTopic->getBlogId();
$_REQUEST['topic_id']=$oTopic->getId();
$_REQUEST['topic_publish_index']=$oTopic->getPublishIndex();
}
}
/**
@ -345,7 +346,16 @@ class ActionTopic extends Action {
$oTopic->setPublish(1);
} else {
$oTopic->setPublish(0);
}
}
/**
* Принудительный вывод на главную
*/
$oTopic->setPublishIndex(0);
if ($this->oUserCurrent->isAdministrator()) {
if (getRequest('topic_publish_index')) {
$oTopic->setPublishIndex(1);
}
}
/**
* Добавляем топик
*/
@ -453,7 +463,17 @@ class ActionTopic extends Action {
$oTopic->setPublish(1);
} else {
$oTopic->setPublish(0);
}
}
/**
* Принудительный вывод на главную
*/
if ($this->oUserCurrent->isAdministrator()) {
if (getRequest('topic_publish_index')) {
$oTopic->setPublishIndex(1);
} else {
$oTopic->setPublishIndex(0);
}
}
/**
* Сохраняем топик
*/

View file

@ -211,6 +211,7 @@ class Topic extends Module {
'topic_rating' => array(
'value' => BLOG_INDEX_LIMIT_GOOD,
'type' => 'top',
'publish_index' => 1,
),
);
return $this->GetTopicsByFilter($aFilter,$iPage,$iPerPage);

View file

@ -69,6 +69,9 @@ class TopicEntity_Topic extends Entity
public function getPublish() {
return $this->_aData['topic_publish'];
}
public function getPublishIndex() {
return $this->_aData['topic_publish_index'];
}
public function getRating() {
return number_format(round($this->_aData['topic_rating'],2), 0, '.', '');
}
@ -314,6 +317,9 @@ class TopicEntity_Topic extends Entity
public function setPublish($data) {
$this->_aData['topic_publish']=$data;
}
public function setPublishIndex($data) {
$this->_aData['topic_publish_index']=$data;
}
public function setRating($data) {
$this->_aData['topic_rating']=$data;
}

View file

@ -31,12 +31,13 @@ class Mapper_Topic extends Mapper {
topic_tags,
topic_date_add,
topic_user_ip,
topic_publish
topic_publish,
topic_publish_index
)
VALUES(?d, ?d, ?, ?, ?, ?, ?, ?d)
VALUES(?d, ?d, ?, ?, ?, ?, ?, ?d, ?d)
";
if ($iId=$this->oDb->query($sql,$oTopic->getBlogId(),$oTopic->getUserId(),$oTopic->getType(),$oTopic->getTitle(),
$oTopic->getTags(),$oTopic->getDateAdd(),$oTopic->getUserIp(),$oTopic->getPublish()))
$oTopic->getTags(),$oTopic->getDateAdd(),$oTopic->getUserIp(),$oTopic->getPublish(),$oTopic->getPublishIndex()))
{
$oTopic->setId($iId);
$this->AddTopicContent($oTopic);
@ -629,6 +630,7 @@ class Mapper_Topic extends Mapper {
topic_date_edit = ?,
topic_user_ip= ?,
topic_publish= ? ,
topic_publish_index= ?,
topic_rating= ?f,
topic_count_vote= ?d,
topic_count_read= ?d,
@ -636,7 +638,7 @@ class Mapper_Topic extends Mapper {
WHERE
topic_id = ?d
";
if ($this->oDb->query($sql,$oTopic->getBlogId(),$oTopic->getTitle(),$oTopic->getTags(),$oTopic->getDateEdit(),$oTopic->getUserIp(),$oTopic->getPublish(),$oTopic->getRating(),$oTopic->getCountVote(),$oTopic->getCountRead(),$oTopic->getCountComment(),$oTopic->getId())) {
if ($this->oDb->query($sql,$oTopic->getBlogId(),$oTopic->getTitle(),$oTopic->getTags(),$oTopic->getDateEdit(),$oTopic->getUserIp(),$oTopic->getPublish(),$oTopic->getPublishIndex(),$oTopic->getRating(),$oTopic->getCountVote(),$oTopic->getCountRead(),$oTopic->getCountComment(),$oTopic->getId())) {
$this->UpdateTopicContent($oTopic);
return true;
}
@ -666,10 +668,14 @@ class Mapper_Topic extends Mapper {
$sWhere.=" AND t.topic_publish = ".(int)$aFilter['topic_publish'];
}
if (isset($aFilter['topic_rating']) and is_array($aFilter['topic_rating'])) {
$sPublishIndex='';
if (isset($aFilter['topic_rating']['publish_index']) and $aFilter['topic_rating']['publish_index']==1) {
$sPublishIndex=" or topic_publish_index=1 ";
}
if ($aFilter['topic_rating']['type']=='top') {
$sWhere.=" AND t.topic_rating >= ".(float)$aFilter['topic_rating']['value'];
$sWhere.=" AND ( t.topic_rating >= ".(float)$aFilter['topic_rating']['value']." {$sPublishIndex} ) ";
} else {
$sWhere.=" AND t.topic_rating < ".(float)$aFilter['topic_rating']['value'];
$sWhere.=" AND ( t.topic_rating < ".(float)$aFilter['topic_rating']['value']." ) ";
}
}
if (isset($aFilter['topic_new'])) {

View file

@ -99,7 +99,8 @@ ALTER TABLE `prefix_topic_comment_online`
ALTER TABLE `prefix_blog` CHANGE `blog_url` `blog_url` VARCHAR( 200 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ;
-- новое поле для принудительного вывода топика на главную страницу
ALTER TABLE `prefix_topic` ADD `topic_publish_index` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `topic_publish` ;
--

View file

@ -74,7 +74,14 @@ document.addEvent('domready', function() {
</p>
{if $oUserCurrent->isAdministrator()}
<p>
<input type="checkbox" id="topic_publish_index" name="topic_publish_index" value="1" {if $_aRequest.topic_publish_index==1}checked{/if}/>
<label for="topic_publish_index"> &mdash; принудительно вывести на главную</label>
<br />
<span class="form_note">Если отметить эту галку, то топик сразу попадёт на главную страницу(опция доступна только администраторам)</span>
</p>
{/if}
<p class="l-bot">
<input type="submit" name="submit_topic_publish" value="опубликовать">&nbsp;

View file

@ -117,7 +117,14 @@ document.addEvent('domready', function() {
</p>
{if $oUserCurrent->isAdministrator()}
<p>
<input type="checkbox" id="topic_publish_index" name="topic_publish_index" value="1" {if $_aRequest.topic_publish_index==1}checked{/if}/>
<label for="topic_publish_index"> &mdash; принудительно вывести на главную</label>
<br />
<span class="form_note">Если отметить эту галку, то топик сразу попадёт на главную страницу(опция доступна только администраторам)</span>
</p>
{/if}
<p class="l-bot">
<input type="submit" name="submit_topic_publish" value="опубликовать">&nbsp;

View file

@ -135,7 +135,14 @@ document.addEvent('domready', function() {
</p>
{if $oUserCurrent->isAdministrator()}
<p>
<input type="checkbox" id="topic_publish_index" name="topic_publish_index" value="1" {if $_aRequest.topic_publish_index==1}checked{/if}/>
<label for="topic_publish_index"> &mdash; принудительно вывести на главную</label>
<br />
<span class="form_note">Если отметить эту галку, то топик сразу попадёт на главную страницу(опция доступна только администраторам)</span>
</p>
{/if}
<p class="l-bot">
<input type="submit" name="submit_topic_publish" value="опубликовать">&nbsp;

View file

@ -19,7 +19,7 @@ form.form2{
padding-top: 0px;
}
.backoffice form label{
display: block;
font-size: 13px;
font-family: Arial;
color: #000000;