/**
  * @EXT\Route(
  *     "cursus/group/{cursusGroup}/delete",
  *     name="claro_cursus_group_delete",
  *     options={"expose"=true}
  * )
  * @EXT\ParamConverter("authenticatedUser", options={"authenticatedUser" = true})
  */
 public function cursusGroupDeleteAction(CursusGroup $cursusGroup)
 {
     $this->checkToolAccess();
     $this->cursusManager->unregisterGroupFromCursus($cursusGroup->getCursus(), $cursusGroup->getGroup());
     return new JsonResponse('success', 200);
 }
Beispiel #2
0
 public function registerGroupToMultipleCursus(array $multipleCursus, Group $group, $withWorkspace = true)
 {
     $registrationDate = new \DateTime();
     $this->om->startFlushSuite();
     foreach ($multipleCursus as $cursus) {
         $cursusGroup = $this->cursusGroupRepo->findOneCursusGroupByCursusAndGroup($cursus, $group);
         if (is_null($cursusGroup)) {
             $cursusGroup = new CursusGroup();
             $cursusGroup->setCursus($cursus);
             $cursusGroup->setGroup($group);
             $cursusGroup->setRegistrationDate($registrationDate);
             $this->persistCursusGroup($cursusGroup);
             if ($withWorkspace) {
                 $this->registerToCursusWorkspace($group, $cursus);
             }
             $users = $group->getUsers();
             $this->registerUsersToCursus($cursus, $users->toArray(), false);
         }
     }
     $this->om->endFlushSuite();
 }
 public function cursusGroup(Group $group, Cursus $cursus, $type = 0)
 {
     $now = new \DateTime();
     $cursusGroup = new CursusGroup();
     $cursusGroup->setGroup($group);
     $cursusGroup->setCursus($cursus);
     $cursusGroup->setGroupType($type);
     $cursusGroup->setRegistrationDate($now);
     $this->om->persist($cursusGroup);
     return $cursusGroup;
 }