예제 #1
0
 /**
  * Show all unread topics of the current user
  * @param Forum $forum
  *
  * @throws NotLoggedInException
  * @return void
  */
 public function showUnreadAction(Forum $forum)
 {
     $user = $this->getCurrentUser();
     if ($user->isAnonymous()) {
         throw new NotLoggedInException('You need to be logged in.', 1288084981);
     }
     $topics = array();
     $unreadTopics = array();
     $tmpTopics = $this->topicRepository->getUnreadTopics($forum, $user);
     foreach ($tmpTopics as $tmpTopic) {
         $unreadTopics[] = $tmpTopic['uid'];
     }
     if (!empty($unreadTopics)) {
         $topics = $this->topicRepository->findByUids($unreadTopics);
     }
     $this->view->assign('forum', $forum)->assign('topics', $topics);
 }
예제 #2
0
 /**
  * @param string $topicIcons
  * @return array
  */
 private function _getTopicIcons($topicIcons)
 {
     $data = array();
     $topicIcons = json_decode($topicIcons);
     if (count($topicIcons) < 1) {
         return $data;
     }
     $this->request->setFormat('html');
     $topicIcons = $this->topicRepository->findByUids($topicIcons);
     $counter = 0;
     foreach ($topicIcons as $topic) {
         $this->view->assign('topic', $topic);
         $data[$counter]['html'] = $this->view->render('topicIcon');
         $data[$counter]['uid'] = $topic->getUid();
         $counter++;
     }
     $this->request->setFormat('json');
     return $data;
 }