/** * Renders the contents of this view helper, when a user has subscribed a * specific subscribeable object. * * @param \Mittwald\Typo3Forum\Domain\Model\SubscribeableInterface $object * The object that needs to be subscribed in order * for the contents to be rendered. * @param \Mittwald\Typo3Forum\Domain\Model\User\FrontendUser $user * @return string * */ public function render(\Mittwald\Typo3Forum\Domain\Model\SubscribeableInterface $object, \Mittwald\Typo3Forum\Domain\Model\User\FrontendUser $user = NULL) { if ($user === NULL) { $user =& \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Mittwald\\Typo3Forum\\Domain\\Repository\\User\\FrontendUserRepository')->findCurrent(); } foreach ($object->getFavSubscribers() as $subscriber) { if ($subscriber->getUid() == $user->getUid()) { return $this->renderThenChild(); } } return $this->renderElseChild(); }
/** * Redirects the user to the display view of a subscribeable object. This may * either be a forum or a topic, so this method redirects either to the * Forum->show or the Topic->show action. * * @param SubscribeableInterface $object A subscribeable object, i.e. either a forum or a topic. */ protected function redirectToSubscriptionObject(SubscribeableInterface $object) { if ($object instanceof Forum) { $this->redirect('show', 'Forum', NULL, array('forum' => $object)); } if ($object instanceof Topic) { $this->redirect('show', 'Topic', NULL, array('topic' => $object, 'forum' => $object->getForum())); } }