public function __construct(Course $course)
 {
     $details = [];
     $details['id'] = $course->getId();
     $details['title'] = $course->getTitle();
     $details['code'] = $course->getCode();
     $details['publicRegistration'] = $course->getPublicRegistration();
     $details['publicUnregistration'] = $course->getPublicUnregistration();
     $details['registrationValidation'] = $course->getRegistrationValidation();
     $details['icon'] = $course->getIcon();
     $details['tutorRoleName'] = $course->getTutorRoleName();
     $details['learnerRoleName'] = $course->getLearnerRoleName();
     $details['userValidation'] = $course->getUserValidation();
     $details['organizationValidation'] = $course->getOrganizationValidation();
     $details['maxUsers'] = $course->getMaxUsers();
     $details['defaultSessionDuration'] = $course->getDefaultSessionDuration();
     $details['withSessionEvent'] = $course->getWithSessionEvent();
     $workspace = $course->getWorkspace();
     $workspaceModel = $course->getWorkspaceModel();
     if (!is_null($workspace)) {
         $details['workspaceId'] = $workspace->getId();
         $details['workspaceName'] = $workspace->getName();
         $details['workspaceCode'] = $workspace->getCode();
         $details['workspaceGuid'] = $workspace->getGuid();
     }
     if (!is_null($workspaceModel)) {
         $details['workspaceModelId'] = $workspaceModel->getId();
         $details['workspaceModelName'] = $workspaceModel->getName();
     }
     parent::__construct(self::ACTION, $details);
 }
示例#2
0
 public function generateWorkspace(Course $course, CourseSession $session, User $user)
 {
     $model = $course->getWorkspaceModel();
     $description = $course->getDescription();
     $displayable = false;
     $selfRegistration = false;
     $selfUnregistration = false;
     $registrationValidation = false;
     $name = $course->getTitle() . ' [' . $session->getName() . ']';
     $code = $this->generateWorkspaceCode($course->getCode());
     if (is_null($model)) {
         $ds = DIRECTORY_SEPARATOR;
         $config = Configuration::fromTemplate($this->templateDir . $ds . 'default.zip');
         $config->setWorkspaceName($name);
         $config->setWorkspaceCode($code);
         $config->setDisplayable($displayable);
         $config->setSelfRegistration($selfRegistration);
         $config->setSelfUnregistration($selfUnregistration);
         $config->setRegistrationValidation($registrationValidation);
         $config->setWorkspaceDescription($description);
         $workspace = $this->workspaceManager->create($config, $user);
     } else {
         $workspace = $this->workspaceManager->createWorkspaceFromModel($model, $user, $name, $code, $description, $displayable, $selfRegistration, $selfUnregistration);
     }
     $workspace->setWorkspaceType(0);
     $startDate = $session->getStartDate();
     $endDate = $session->getEndDate();
     if (!is_null($startDate)) {
         $workspace->setStartDate($startDate);
     }
     if (!is_null($endDate)) {
         $workspace->setEndDate($endDate);
     }
     $this->workspaceManager->editWorkspace($workspace);
     return $workspace;
 }
示例#3
0
 public function generateWorkspace(Course $course, CourseSession $session)
 {
     $user = $this->tokenStorage->getToken()->getUser();
     $model = $course->getWorkspaceModel();
     $description = $course->getDescription();
     $displayable = false;
     $selfRegistration = false;
     $selfUnregistration = false;
     $registrationValidation = false;
     $name = $course->getTitle() . ' [' . $session->getName() . ']';
     $code = $this->generateWorkspaceCode($course->getCode());
     if (is_null($model)) {
         $template = new File($this->defaultTemplate);
         $workspace = new Workspace();
         $workspace->setCreator($user);
         $workspace->setName($name);
         $workspace->setCode($code);
         $workspace->setDisplayable($displayable);
         $workspace->setSelfRegistration($selfRegistration);
         $workspace->setSelfUnregistration($selfUnregistration);
         $workspace->setRegistrationValidation($registrationValidation);
         $workspace->setDescription($description);
         $workspace = $this->workspaceManager->create($workspace, $template);
     } else {
         $workspace = $this->workspaceManager->createWorkspaceFromModel($model, $user, $name, $code, $description, $displayable, $selfRegistration, $selfUnregistration);
     }
     $workspace->setWorkspaceType(0);
     $startDate = $session->getStartDate();
     $endDate = $session->getEndDate();
     if (!is_null($startDate)) {
         $workspace->setStartDate($startDate);
     }
     if (!is_null($endDate)) {
         $workspace->setEndDate($endDate);
     }
     $this->workspaceManager->editWorkspace($workspace);
     return $workspace;
 }