Ejemplo n.º 1
0
 /**
  * Добавляет топик
  *
  * @param ModuleTopic_EntityTopic $oTopic Объект топика
  * @return ModuleTopic_EntityTopic|bool
  */
 public function AddTopic(ModuleTopic_EntityTopic $oTopic)
 {
     if (!$oTopic->getDatePublish()) {
         $oTopic->setDatePublish($oTopic->getDateAdd());
     }
     if ($sId = $this->oMapperTopic->AddTopic($oTopic)) {
         $oTopic->setId($sId);
         if ($oTopic->getPublish() and $oTopic->getTags()) {
             $aTags = explode(',', $oTopic->getTags());
             foreach ($aTags as $sTag) {
                 $oTag = Engine::GetEntity('Topic_TopicTag');
                 $oTag->setTopicId($oTopic->getId());
                 $oTag->setUserId($oTopic->getUserId());
                 $oTag->setBlogId($oTopic->getBlogId());
                 $oTag->setText($sTag);
                 $this->AddTopicTag($oTag);
             }
         }
         /**
          * Обновляем дополнительные поля
          * Здесь важный момент - перед сохранением топика всегда нужно вызывать валидацию полей $this->Property_ValidateEntityPropertiesCheck($oTopic);
          * т.к. она подготавливает данные полей для сохранений
          * Валидация вызывается автоматически при вызове $oTopic->_Validate();
          */
         $this->Property_UpdatePropertiesValue($oTopic->getPropertiesObject(), $oTopic);
         //чистим зависимые кеши
         $this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array('topic_new', "topic_update_user_{$oTopic->getUserId()}", "topic_new_blog_{$oTopic->getBlogId()}"));
         return $oTopic;
     }
     return false;
 }
Ejemplo n.º 2
0
 public function UpdateTopic(ModuleTopic_EntityTopic $oTopic)
 {
     $sql = "UPDATE " . Config::Get('db.table.topic') . " \n\t\t\tSET \n\t\t\t\tblog_id= ?d,\n\t\t\t\ttopic_title= ?,\t\t\t\t\n\t\t\t\ttopic_tags= ?,\n\t\t\t\ttopic_date_add = ?,\n\t\t\t\ttopic_date_edit = ?,\n\t\t\t\ttopic_user_ip= ?,\n\t\t\t\ttopic_publish= ?d ,\n\t\t\t\ttopic_publish_draft= ?d ,\n\t\t\t\ttopic_publish_index= ?d,\n\t\t\t\ttopic_rating= ?f,\n\t\t\t\ttopic_count_vote= ?d,\n\t\t\t\ttopic_count_read= ?d,\n\t\t\t\ttopic_count_comment= ?d, \n\t\t\t\ttopic_cut_text = ? ,\n\t\t\t\ttopic_forbid_comment = ? ,\n\t\t\t\ttopic_text_hash = ? \n\t\t\tWHERE\n\t\t\t\ttopic_id = ?d\n\t\t";
     if ($this->oDb->query($sql, $oTopic->getBlogId(), $oTopic->getTitle(), $oTopic->getTags(), $oTopic->getDateAdd(), $oTopic->getDateEdit(), $oTopic->getUserIp(), $oTopic->getPublish(), $oTopic->getPublishDraft(), $oTopic->getPublishIndex(), $oTopic->getRating(), $oTopic->getCountVote(), $oTopic->getCountRead(), $oTopic->getCountComment(), $oTopic->getCutText(), $oTopic->getForbidComment(), $oTopic->getTextHash(), $oTopic->getId())) {
         $this->UpdateTopicContent($oTopic);
         return true;
     }
     return false;
 }
Ejemplo n.º 3
0
 /**
  * Обновляет топик
  *
  * @param ModuleTopic_EntityTopic $oTopic Объект топика
  * @return bool
  */
 public function UpdateTopic(ModuleTopic_EntityTopic $oTopic)
 {
     $sql = "UPDATE " . Config::Get('db.table.topic') . "\n\t\t\tSET \n\t\t\t\tblog_id= ?d,\n\t\t\t\tblog_id2= ?d,\n\t\t\t\tblog_id3= ?d,\n\t\t\t\tblog_id4= ?d,\n\t\t\t\tblog_id5= ?d,\n\t\t\t\ttopic_title= ?,\n\t\t\t\ttopic_slug= ?,\n\t\t\t\ttopic_tags= ?,\n\t\t\t\ttopic_date_add = ?,\n\t\t\t\ttopic_date_edit = ?,\n\t\t\t\ttopic_date_edit_content = ?,\n\t\t\t\ttopic_date_publish = ?,\n\t\t\t\ttopic_user_ip= ?,\n\t\t\t\ttopic_publish= ?d ,\n\t\t\t\ttopic_publish_draft= ?d ,\n\t\t\t\ttopic_publish_index= ?d,\n\t\t\t\ttopic_skip_index= ?d,\n\t\t\t\ttopic_rating= ?f,\n\t\t\t\ttopic_count_vote= ?d,\n\t\t\t\ttopic_count_vote_up= ?d,\n\t\t\t\ttopic_count_vote_down= ?d,\n\t\t\t\ttopic_count_vote_abstain= ?d,\n\t\t\t\ttopic_count_read= ?d,\n\t\t\t\ttopic_count_comment= ?d, \n\t\t\t\ttopic_count_favourite= ?d,\n\t\t\t\ttopic_cut_text = ? ,\n\t\t\t\ttopic_forbid_comment = ? ,\n\t\t\t\ttopic_text_hash = ? \n\t\t\tWHERE\n\t\t\t\ttopic_id = ?d\n\t\t";
     $res = $this->oDb->query($sql, $oTopic->getBlogId(), $oTopic->getBlogId2(), $oTopic->getBlogId3(), $oTopic->getBlogId4(), $oTopic->getBlogId5(), $oTopic->getTitle(), $oTopic->getSlug(), $oTopic->getTags(), $oTopic->getDateAdd(), $oTopic->getDateEdit(), $oTopic->getDateEditContent(), $oTopic->getDatePublish(), $oTopic->getUserIp(), $oTopic->getPublish(), $oTopic->getPublishDraft(), $oTopic->getPublishIndex(), $oTopic->getSkipIndex(), $oTopic->getRating(), $oTopic->getCountVote(), $oTopic->getCountVoteUp(), $oTopic->getCountVoteDown(), $oTopic->getCountVoteAbstain(), $oTopic->getCountRead(), $oTopic->getCountComment(), $oTopic->getCountFavourite(), $oTopic->getCutText(), $oTopic->getForbidComment(), $oTopic->getTextHash(), $oTopic->getId());
     if ($res !== false and !is_null($res)) {
         $this->UpdateTopicContent($oTopic);
         return true;
     }
     return false;
 }
Ejemplo n.º 4
0
 /**
  * Обновляет топик
  *
  * @param ModuleTopic_EntityTopic $oTopic    Объект топика
  *
  * @return bool
  */
 public function UpdateTopic(ModuleTopic_EntityTopic $oTopic)
 {
     $sql = "UPDATE ?_topic\n\t\t\tSET \n\t\t\t\tblog_id = ?d,\n\t\t\t\ttopic_title = ?,\n\t\t\t\ttopic_tags = ?,\n\t\t\t\ttopic_date_add = ?,\n\t\t\t\ttopic_date_edit = ?,\n\t\t\t\ttopic_date_show = ?,\n\t\t\t\ttopic_user_ip = ?,\n\t\t\t\ttopic_publish = ?d ,\n\t\t\t\ttopic_publish_draft = ?d ,\n\t\t\t\ttopic_publish_index = ?d,\n\t\t\t\ttopic_rating = ?f,\n\t\t\t\ttopic_count_vote = ?d,\n\t\t\t\ttopic_count_vote_up = ?d,\n\t\t\t\ttopic_count_vote_down = ?d,\n\t\t\t\ttopic_count_vote_abstain = ?d,\n\t\t\t\ttopic_count_read = ?d,\n\t\t\t\ttopic_count_comment = ?d,\n\t\t\t\ttopic_count_favourite = ?d,\n\t\t\t\ttopic_cut_text = ? ,\n\t\t\t\ttopic_forbid_comment = ? ,\n\t\t\t\ttopic_text_hash = ?,\n\t\t\t\ttopic_url = ?,\n\t\t\t\ttopic_index_ignore = ?d\n\t\t\tWHERE\n\t\t\t\ttopic_id = ?d\n\t\t";
     $bResult = $this->oDb->query($sql, $oTopic->getBlogId(), $oTopic->getTitle(), $oTopic->getTags(), $oTopic->getDateAdd(), $oTopic->getDateEdit(), $oTopic->getDateShow(), $oTopic->getUserIp(), $oTopic->getPublish() ? 1 : 0, $oTopic->getPublishDraft() ? 1 : 0, $oTopic->getPublishIndex() ? 1 : 0, $oTopic->getRating(), $oTopic->getCountVote(), $oTopic->getCountVoteUp(), $oTopic->getCountVoteDown(), $oTopic->getCountVoteAbstain(), $oTopic->getCountRead(), $oTopic->getCountComment(), $oTopic->getCountFavourite(), $oTopic->getCutText(), $oTopic->getForbidComment(), $oTopic->getTextHash(), $oTopic->getTopicUrl(), $oTopic->getTopicIndexIgnore(), $oTopic->getId());
     if ($bResult !== false) {
         $this->UpdateTopicContent($oTopic);
         return true;
     }
     return false;
 }