예제 #1
0
 /**
  * @param string $module
  * @param int $entryId
  *
  * @return array
  */
 public function execute($module, $entryId)
 {
     $this->setCacheResponseCacheable($this->config->getSettings(Schema::MODULE_NAME)['cache_lifetime']);
     $resultsPerPage = $this->resultsPerPage->getResultsPerPage(Comments\Installer\Schema::MODULE_NAME);
     $this->pagination->setResultsPerPage($resultsPerPage)->setTotalResults($this->commentRepository->countAllByModule($this->modules->getModuleId($module), $entryId));
     $comments = $this->commentRepository->getAllByModule($this->modules->getModuleId($module), $entryId, $this->pagination->getResultsStartOffset(), $resultsPerPage);
     $cComments = count($comments);
     for ($i = 0; $i < $cComments; ++$i) {
         if (empty($comments[$i]['name'])) {
             $comments[$i]['name'] = $this->translator->t('users', 'deleted_user');
         }
         if ($this->emoticonsActive === true && $this->emoticonsHelpers) {
             $comments[$i]['message'] = $this->emoticonsHelpers->emoticonsReplace($comments[$i]['message']);
         }
     }
     return ['comments' => $comments, 'dateformat' => $this->commentsSettings['dateformat'], 'pagination' => $this->pagination->render()];
 }
예제 #2
0
 /**
  * Zählt die Anzahl der Kommentare für einen bestimmten Eintrag eines Modules zusammen
  *
  * @param string  $moduleName
  * @param integer $resultId
  *
  * @return integer
  */
 public function commentsCount($moduleName, $resultId)
 {
     return $this->commentRepository->countAllByModule($this->modules->getModuleId($moduleName), $resultId);
 }