public function __construct(CourseSession $session)
 {
     $course = $session->getCourse();
     $workspace = $session->getWorkspace();
     $learnerRole = $session->getLearnerRole();
     $tutorRole = $session->getTutorRole();
     $details = [];
     $details['id'] = $session->getId();
     $details['name'] = $session->getName();
     $details['defaultSession'] = $session->isDefaultSession();
     $details['creationDate'] = $session->getCreationDate();
     $details['publicRegistration'] = $session->getPublicRegistration();
     $details['publicUnregistration'] = $session->getPublicUnregistration();
     $details['registrationValidation'] = $session->getRegistrationValidation();
     $details['startDate'] = $session->getStartDate();
     $details['endDate'] = $session->getEndDate();
     $details['extra'] = $session->getExtra();
     $details['userValidation'] = $session->getUserValidation();
     $details['organizationValidation'] = $session->getOrganizationValidation();
     $details['maxUsers'] = $session->getMaxUsers();
     $details['type'] = $session->getType();
     $details['courseId'] = $course->getId();
     $details['courseTitle'] = $course->getTitle();
     $details['courseCode'] = $course->getCode();
     if (!is_null($workspace)) {
         $details['workspaceId'] = $workspace->getId();
         $details['workspaceName'] = $workspace->getName();
         $details['workspaceCode'] = $workspace->getCode();
         $details['workspaceGuid'] = $workspace->getGuid();
     }
     if (!is_null($learnerRole)) {
         $details['learnerRoleId'] = $learnerRole->getId();
         $details['learnerRoleName'] = $learnerRole->getName();
         $details['learnerRoleKey'] = $learnerRole->getTranslationKey();
     }
     if (!is_null($tutorRole)) {
         $details['tutorRoleId'] = $tutorRole->getId();
         $details['tutorRoleName'] = $tutorRole->getName();
         $details['tutorRoleKey'] = $tutorRole->getTranslationKey();
     }
     parent::__construct(self::ACTION, $details);
 }
예제 #2
0
 /**
  * @EXT\Route(
  *     "cursus/course/session/{session}/default/switch",
  *     name="claro_cursus_course_session_default_switch",
  *     options={"expose"=true}
  * )
  * @EXT\ParamConverter("authenticatedUser", options={"authenticatedUser" = true})
  */
 public function courseSessionDefaultSwitchAction(CourseSession $session)
 {
     $isDefault = !$session->isDefaultSession();
     $session->setDefaultSession($isDefault);
     $this->cursusManager->persistCourseSession($session);
     return new JsonResponse(['id' => $session->getId(), 'default' => $isDefault], 200);
 }
예제 #3
0
 public function deleteCourseSession(CourseSession $session, $withWorkspace = false)
 {
     $course = $session->getCourse();
     $workspace = $session->getWorkspace();
     $learnerRole = $session->getLearnerRole();
     $tutorRole = $session->getTutorRole();
     $details = [];
     $details['id'] = $session->getId();
     $details['name'] = $session->getName();
     $details['defaultSession'] = $session->isDefaultSession();
     $details['creationDate'] = $session->getCreationDate();
     $details['publicRegistration'] = $session->getPublicRegistration();
     $details['publicUnregistration'] = $session->getPublicUnregistration();
     $details['registrationValidation'] = $session->getRegistrationValidation();
     $details['startDate'] = $session->getStartDate();
     $details['endDate'] = $session->getEndDate();
     $details['extra'] = $session->getExtra();
     $details['userValidation'] = $session->getUserValidation();
     $details['organizationValidation'] = $session->getOrganizationValidation();
     $details['maxUsers'] = $session->getMaxUsers();
     $details['type'] = $session->getType();
     $details['courseId'] = $course->getId();
     $details['courseTitle'] = $course->getTitle();
     $details['courseCode'] = $course->getCode();
     if (!is_null($workspace)) {
         $details['workspaceId'] = $workspace->getId();
         $details['workspaceName'] = $workspace->getName();
         $details['workspaceCode'] = $workspace->getCode();
         $details['workspaceGuid'] = $workspace->getGuid();
     }
     if (!is_null($learnerRole)) {
         $details['learnerRoleId'] = $learnerRole->getId();
         $details['learnerRoleName'] = $learnerRole->getName();
         $details['learnerRoleKey'] = $learnerRole->getTranslationKey();
     }
     if (!is_null($tutorRole)) {
         $details['tutorRoleId'] = $tutorRole->getId();
         $details['tutorRoleName'] = $tutorRole->getName();
         $details['tutorRoleKey'] = $tutorRole->getTranslationKey();
     }
     $this->om->startFlushSuite();
     $workspace = $session->getWorkspace();
     $this->om->remove($session);
     if ($withWorkspace && !is_null($workspace)) {
         $this->om->remove($tutorRole);
         $this->om->remove($learnerRole);
         $this->workspaceManager->deleteWorkspace($workspace);
     }
     $event = new LogCourseSessionDeleteEvent($details);
     $this->eventDispatcher->dispatch('log', $event);
     $this->om->endFlushSuite();
 }