예제 #1
0
 /**
  * Move a subject to an other category.
  *
  * @param \Claroline\ForumBundle\Entity\Subject  $subject
  * @param \Claroline\ForumBundle\Entity\Category $newCategory
  */
 public function moveSubject(Subject $subject, Category $newCategory)
 {
     $this->om->startFlushSuite();
     $oldCategory = $subject->getCategory();
     $subject->setCategory($newCategory);
     $this->om->persist($subject);
     $this->dispatch(new MoveSubjectEvent($subject, $oldCategory, $newCategory));
     $this->om->endFlushSuite();
 }
예제 #2
0
 /**
  * @EXT\Route(
  *     "/open/subject/{subject}",
  *     name="claro_subject_open",
  *     options={"expose"=true}
  * )
  * @EXT\Method("GET")
  *
  * @param Subject $subject
  */
 public function openSubjectAction(Subject $subject)
 {
     $forum = $subject->getCategory()->getForum();
     $this->checkAccess($forum);
     $this->forumManager->openSubject($subject);
     return new RedirectResponse($this->generateUrl('claro_forum_subjects', array('category' => $subject->getCategory()->getId())));
 }
예제 #3
0
 /**
  * @param Subject $subject
  */
 public function __construct(Subject $subject)
 {
     $details = array('subject' => array('id' => $subject->getId(), 'title' => $subject->getTitle()), 'category' => array('id' => $subject->getCategory()->getId()), 'forum' => array('id' => $subject->getCategory()->getForum()->getId()));
     parent::__construct($subject->getCategory()->getForum()->getResourceNode(), $details);
 }
예제 #4
0
 /**
  * @param \Claroline\ForumBundle\Entity\Subject  $subject
  * @param \Claroline\ForumBundle\Entity\Category $oldCategory
  * @param \Claroline\ForumBundle\Entity\Category $newCategory
  */
 public function __construct(Subject $subject, Category $oldCategory, Category $newCategory)
 {
     $details = array('subject' => array('id' => $subject->getId()), 'category' => array('oldCategoryId' => $oldCategory->getId(), 'newCategoryId' => $newCategory->getId()), 'forum' => array('id' => $subject->getCategory()->getForum()->getId()));
     parent::__construct($subject->getCategory()->getForum()->getResourceNode(), $details);
 }