/** * @param CourseInterface $newCourse * @param CourseInterface $origCourse * @param int $daysOffset * @param array $options * @param array $newCourseObjectives */ protected function rolloverSessions(CourseInterface $newCourse, CourseInterface $origCourse, $daysOffset, $options, array $newCourseObjectives) { /* @var SessionInterface[] $origCourseSessions */ $origCourseSessions = $origCourse->getSessions(); foreach ($origCourseSessions as $origCourseSession) { /* @var SessionInterface $newSession */ $newSession = $this->sessionManager->create(); $newSession->setCourse($newCourse); $newSession->setTitle($origCourseSession->getTitle()); $newSession->setAttireRequired($origCourseSession->isAttireRequired()); $newSession->setEquipmentRequired($origCourseSession->isEquipmentRequired()); $newSession->setSessionType($origCourseSession->getSessionType()); $newSession->setSupplemental($origCourseSession->isSupplemental()); $newSession->setPublishedAsTbd(0); $newSession->setPublished(0); //now check for a session description and, if there is one, set it... $origSessionDescription = $origCourseSession->getSessionDescription(); if (!empty($origSessionDescription)) { /* @var SessionDescriptionInterface $newSessionDescription */ $newSessionDescription = $this->sessionDescriptionManager->create(); $newSessionDescriptionText = $origSessionDescription->getDescription(); $newSessionDescription->setDescription($newSessionDescriptionText); $newSession->setSessionDescription($newSessionDescription); $this->sessionDescriptionManager->update($newSessionDescription, false, false); } //SESSION LEARNING MATERIALS if (empty($options['skip-session-learning-materials'])) { $this->rolloverSessionLearningMaterials($newSession, $origCourseSession); } //SESSION OBJECTIVES if (empty($options['skip-session-objectives'])) { $this->rolloverSessionObjectives($newSession, $origCourseSession, $newCourseObjectives); } //SESSION TERMS if (empty($options['skip-session-terms'])) { $newSession->setTerms($origCourseSession->getTerms()); } //SESSION MESH TERMS if (empty($options['skip-session-mesh'])) { $newSession->setMeshDescriptors($origCourseSession->getMeshDescriptors()); } //Offerings if (empty($options['skip-offerings'])) { $this->rolloverOfferings($newSession, $origCourseSession, $daysOffset, $options); } //ILMSessions $this->rolloverIlmSession($newSession, $origCourseSession, $daysOffset); $this->sessionManager->update($newSession, false, false); } }