/**
  *
  * Generates a data array that will be passed to the typoscript object for
  * rendering the icon.
  * @param \Mittwald\Typo3Forum\Domain\Model\Forum\Topic $topic
  *                             The topic for which the icon is to be displayed.
  * @return array               The data array for the typoscript object.
  *
  */
 protected function getDataArray(\Mittwald\Typo3Forum\Domain\Model\Forum\Topic $topic = NULL)
 {
     if ($topic === NULL) {
         return array();
     } elseif ($topic instanceof \Mittwald\Typo3Forum\Domain\Model\Forum\ShadowTopic) {
         return array('moved' => TRUE);
     } else {
         return array('important' => $topic->getPostCount() >= $this->arguments['important'], 'new' => !$topic->hasBeenReadByUser($this->frontendUserRepository->findCurrent()), 'closed' => $topic->isClosed(), 'sticky' => $topic->isSticky(), 'solved' => $topic->getIsSolved());
     }
 }
Пример #2
0
 /**
  * Marks a topic as read by the current user.
  *
  * @param Topic $topic The topic that is to be marked as read.
  *
  */
 protected function markTopicRead(Topic $topic)
 {
     $currentUser = $this->getCurrentUser();
     if ($currentUser === NULL || $currentUser->isAnonymous()) {
         return;
     } else {
         if ($topic->hasBeenReadByUser($currentUser)) {
             $currentUser->addReadObject($topic);
             $this->frontendUserRepository->update($currentUser);
         }
     }
 }