/** * * @access public * @return \Symfony\Component\Form\Form */ public function getForm() { if (null == $this->form) { // Store the old board before proceeding, as we will need it to update its stats // as it will be a topic down in its count at least, posts perhaps even more so. $this->oldBoard = $this->topic->getBoard(); // Boards are pre-filtered for proper rights managements, moderators may move Topics, // but some boards may only be accessible by admins, so moderators should not see them. $filteredBoards = $this->boardModel->findAllBoardsForForumById($this->forum->getId()); $options = array('boards' => $filteredBoards); $this->dispatcher->dispatch(ForumEvents::MODERATOR_TOPIC_CHANGE_BOARD_INITIALISE, new ModeratorTopicEvent($this->request, $this->topic)); $this->form = $this->factory->create($this->formTopicChangeBoardType, $this->topic, $options); } return $this->form; }
public function canShowCategory(Category $category, Forum $forum = null) { if ($forum) { if ($category->getForum()) { if ($category->getForum()->getId() != $forum->getId()) { return false; } } if (!$this->canShowForum($forum)) { return false; } } if (!$category->isAuthorisedToRead($this->securityContext)) { return false; } return true; }
/** * * @access public * @return \Symfony\Component\Form\Form */ public function getForm() { if (null == $this->form) { if (!is_object($this->board) || !$this->board instanceof Board) { throw new \Exception('Board must be specified to be create a Topic in TopicCreateFormHandler'); } $filteredBoards = $this->boardModel->findAllBoardsForForumById($this->forum->getId()); $topicOptions = array('boards' => $filteredBoards, 'auto_initialize' => false); $topic = $this->topicModel->createTopic(); $topic->setBoard($this->board); $post = $this->postModel->createPost(); $post->setTopic($topic); $post->setCreatedBy($this->user); $this->dispatcher->dispatch(ForumEvents::USER_TOPIC_CREATE_INITIALISE, new UserTopicEvent($this->request, $post->getTopic())); $this->form = $this->factory->create($this->formPostType, $post); $this->form->add($this->factory->create($this->formTopicType, $topic, $topicOptions)); } return $this->form; }
/** * * @access public * @param \Map2u\ForumBundle\Entity\Forum $forum * @return \Map2u\ForumBundle\Component\Crumbs\Factory\CrumbTrail */ public function addAdminManageForumsDelete(Forum $forum) { return $this->createCrumbTrail()->add('crumbs.admin.index', 'ccdn_forum_admin_index')->add('crumbs.admin.manage-forums.index', 'ccdn_forum_admin_forum_list')->add(array('label' => 'crumbs.admin.manage-forums.delete', 'params' => array('%forum_name%' => $forum->getName())), array('route' => 'ccdn_forum_admin_forum_delete', 'params' => array('forumId' => $forum->getId()))); }