Example #1
0
 /**
  * Show comments.
  */
 protected function showComments()
 {
     if ($this->getParam('bind_state') == 'main') {
         $targetIds = $this->document->getID();
     } else {
         $priFieldName = $this->bindComponent->getPK();
         $targetIds = $this->bindComponent->getData()->getFieldByName($priFieldName)->getData();
     }
     $commentsParams = ['active' => true, 'table_name' => $this->targetTable, 'is_tree' => $this->getParam('is_tree'), 'bind' => $this->getParam('bind'), 'recordsPerPage' => $this->getParam('recordsPerPage'), 'target_ids' => $targetIds];
     $this->setProperty('bind', $this->getParam('bind'));
     $commentsList = $this->document->componentManager->createComponent('commentsList', 'Energine\\comments\\components\\CommentsList', $commentsParams);
     $this->document->componentManager->add($commentsList);
     if ($this->getParam('bind') && ($forumTheme = $this->document->componentManager->getBlockByName($this->getParam('bind')))) {
         $ap = $forumTheme->getStateParams(true);
         if (isset($ap['pageNumber'])) {
             $commentsList->addActionParam('pageNumber', $ap['pageNumber']);
         }
     }
     $commentsList->run();
 }
Example #2
0
 /**
  * Просмотр поста с комментариями
  *
  * @access protected
  * @return void
  */
 protected function view()
 {
     parent::view();
     if ($this->getData()->isEmpty()) {
         throw new SystemException('ERR_404', SystemException::ERR_404);
     }
     //показываем комментарии
     if ($comments = CommentsHelper::createInsatceFor($this->getTableName(), true)) {
         $comments->createAndAddField($this->getDataDescription(), $this->getData(), $this->getData()->getFieldByName('post_id')->getData());
     }
 }