Beispiel #1
0
 public function load(ObjectManager $manager)
 {
     $data = $this->container->get('ilioscore.dataloader.offering')->getAll();
     foreach ($data as $arr) {
         $entity = new Offering();
         $entity->setId($arr['id']);
         $entity->setRoom($arr['room']);
         $entity->setSite($arr['site']);
         $entity->setStartDate(new \DateTime($arr['startDate']));
         $entity->setEndDate(new \DateTime($arr['endDate']));
         $entity->setSession($this->getReference('sessions' . $arr['session']));
         foreach ($arr['learnerGroups'] as $id) {
             $entity->addLearnerGroup($this->getReference('learnerGroups' . $id));
         }
         foreach ($arr['instructorGroups'] as $id) {
             $entity->addInstructorGroup($this->getReference('instructorGroups' . $id));
         }
         foreach ($arr['learners'] as $id) {
             $entity->addLearner($this->getReference('users' . $id));
         }
         foreach ($arr['instructors'] as $id) {
             $entity->addInstructor($this->getReference('users' . $id));
         }
         $manager->persist($entity);
         $this->addReference('offerings' . $arr['id'], $entity);
     }
     $manager->flush();
 }
 /**
  * @return array
  */
 public function testExecuteProvider()
 {
     $schoolA = new School();
     $schoolA->setId(1);
     $schoolA->setTitle('Medicine');
     $schoolA->setIliosAdministratorEmail('*****@*****.**');
     $schoolA->setChangeAlertRecipients('recipientA@som.edu,recipientB@som.edu');
     $schoolB = new School();
     $schoolB->setTitle('Dentistry');
     $schoolB->setId(2);
     $schoolA->setIliosAdministratorEmail('*****@*****.**');
     $schoolB->setChangeAlertRecipients('*****@*****.**');
     $course = new Course();
     $course->setId(1);
     $course->setTitle('Course <strong>A</strong>');
     $course->setExternalId('ILIOS123');
     $course->setSchool($schoolA);
     $sessionType = new SessionType();
     $sessionType->setId(1);
     $sessionType->setTitle('Session Type A');
     $session = new Session();
     $session->setId(1);
     $session->setCourse($course);
     $session->setSessionType($sessionType);
     $session->setTitle('<i>Session A</i>');
     $instructor1 = new User();
     $instructor1->setId(1);
     $instructor1->setFirstName("D'jango");
     $instructor1->setLastName("D'avila");
     $instructor1->setEmail('*****@*****.**');
     $instructor2 = new User();
     $instructor2->setId(2);
     $instructor2->setFirstName('Mike');
     $instructor2->setLastName('Smith');
     $instructor2->setEmail('*****@*****.**');
     $instructorGroup = new InstructorGroup();
     $instructorGroup->setId(1);
     $instructorGroup->addUser($instructor2);
     $learnerGroup = new LearnerGroup();
     $learnerGroup->setId(1);
     $learnerGroup->setTitle('Learner <em>Group</em> A');
     $learner = new User();
     $learner->setId(2);
     $learner->setFirstName('Jimmy');
     $learner->setLastName("O'Mulligan");
     $offering = new Offering();
     $offering->setId(1);
     $offering->setSession($session);
     $offering->setStartDate(new \DateTime('2015-10-01 15:15:00', new \DateTimeZone('UTC')));
     $offering->setEndDate(new \DateTime('2015-10-01 18:30:00', new \DateTimeZone('UTC')));
     $offering->setRoom('Library - Room 119');
     $offering->addInstructorGroup($instructorGroup);
     $offering->addInstructor($instructor1);
     $offering->addLearnerGroup($learnerGroup);
     $offering->addLearner($learner);
     $alert = new Alert();
     $alert->setId(1);
     $alert->setDispatched(false);
     $alert->setTableName('offering');
     $alert->setTableRowId(1);
     $alert->addRecipient($schoolA);
     $i = 0;
     foreach (['A', 'B', 'C'] as $letter) {
         $alertChangeType = new AlertChangeType();
         $alertChangeType->setId(++$i);
         $alertChangeType->setTitle("Alert Change Type {$letter}");
         $alert->addChangeType($alertChangeType);
     }
     $userA = new User();
     $userA->setId(1);
     $userA->setFirstName("K'aren");
     $userA->setLastName("D'lunchtime");
     $userB = new User();
     $userB->setId(2);
     $userB->setFirstName('Billy');
     $userB->setLastName('Brown');
     $logA = new AuditLog();
     $logA->setObjectClass('alert');
     $logA->setObjectId(1);
     $logA->setUser($userA);
     $logA->setCreatedAt(new \DateTime('2015-09-20 11:12:22', new \DateTimeZone('UTC')));
     $logB = new AuditLog();
     $logB->setObjectClass('alert');
     $logB->setObjectId(1);
     $logB->setUser($userB);
     $logB->setCreatedAt(new \DateTime('2015-09-20 15:20:15', new \DateTimeZone('UTC')));
     return [[$alert, $offering, [$logA, $logB]]];
 }
 /**
  * @return OfferingInterface
  *
  * @todo This is truly in bad form. Refactor fixture loading out. [ST 2015/09/25]
  */
 protected function createOffering()
 {
     $school = new School();
     $school->setId(1);
     $school->setIliosAdministratorEmail('*****@*****.**');
     $school->setTemplatePrefix('TEST');
     $school->setTitle('Testing');
     $course = new Course();
     $course->setId(1);
     $course->setTitle('Test Course 1');
     $course->setSchool($school);
     $i = 0;
     foreach (['A', 'B', 'C'] as $letter) {
         $courseObjective = new Objective();
         $courseObjective->setId(++$i);
         $courseObjective->setTitle("Course Objective {$letter}");
         $course->addObjective($courseObjective);
     }
     $session = new Session();
     $session->setId(1);
     $session->setTitle('Test Session 1');
     $session->setCourse($course);
     $sessionType = new SessionType();
     $sessionType->setId(1);
     $sessionType->setTitle('Session Type A');
     $session->setSessionType($sessionType);
     $i = 0;
     foreach (['A', 'B', 'C'] as $letter) {
         $sessionObjective = new Objective();
         $sessionObjective->setId(++$i);
         $sessionObjective->setTitle("Session Objective {$letter}");
         $session->addObjective($sessionObjective);
     }
     $instructor1 = new User();
     $instructor1->setId(1);
     $instructor1->setFirstName('Jane');
     $instructor1->setLastName('Doe');
     $instructor1->setEmail('*****@*****.**');
     $instructor2 = new User();
     $instructor2->setId(2);
     $instructor2->setFirstName('Mike');
     $instructor2->setLastName('Smith');
     $instructor2->setEmail('*****@*****.**');
     $instructorGroup = new InstructorGroup();
     $instructorGroup->setId(1);
     $instructorGroup->addUser($instructor2);
     $learnerGroup = new LearnerGroup();
     $learnerGroup->setId(1);
     $learnerGroup->setTitle('Learner Group A');
     $learner = new User();
     $learner->setId(2);
     $learner->setFirstName('Jimmy');
     $learner->setLastName('Dumas');
     $offering = new Offering();
     $offering->setId(1);
     $offering->setStartDate(new \DateTime('2015-09-28 03:45:00', new \DateTimeZone('UTC')));
     $offering->setEndDate(new \DateTime('2015-09-28 05:45:00', new \DateTimeZone('UTC')));
     $offering->setSession($session);
     $offering->addInstructor($instructor1);
     $offering->addInstructorGroup($instructorGroup);
     $offering->addLearner($learner);
     $offering->addLearnerGroup($learnerGroup);
     $offering->setRoom('Library - Room 119');
     return $offering;
 }
 /**
  * Gets a course with a bunch of relationsips attached
  * @return Course
  */
 protected function createTestCourseWithAssociations()
 {
     $course = $this->createTestCourse();
     $course->setClerkshipType(new CourseClerkshipType());
     $course->setSchool(new School());
     $courseObjective1 = new Objective();
     $courseObjective1->setId(808);
     $courseObjective1->setTitle('test course objective1');
     $courseObjective1->addMeshDescriptor(new MeshDescriptor());
     $courseObjective1->addParent(new Objective());
     $course->addObjective($courseObjective1);
     $courseObjective2 = new Objective();
     $courseObjective2->setId(42);
     $courseObjective2->setTitle('test course objective2');
     $course->addObjective($courseObjective2);
     $courseTerm1 = new Term();
     $courseTerm1->setId(808);
     $course->addTerm($courseTerm1);
     $lm = new LearningMaterial();
     $courseLearningMaterial1 = new CourseLearningMaterial();
     $courseLearningMaterial1->setLearningMaterial($lm);
     $courseLearningMaterial1->setId(808);
     $courseLearningMaterial1->addMeshDescriptor(new MeshDescriptor());
     $courseLearningMaterial1->setNotes('notes');
     $courseLearningMaterial1->setPublicNotes(true);
     $courseLearningMaterial1->setRequired(false);
     $course->addLearningMaterial($courseLearningMaterial1);
     $course->addCohort(new Cohort());
     $session1 = new Session();
     $session1->setSessionType(new SessionType());
     $sessionObjective1 = new Objective();
     $sessionObjective1->setId(99);
     $sessionObjective1->setTitle('test session objective 1');
     $sessionObjective1->addMeshDescriptor(new MeshDescriptor());
     $sessionObjective1->addParent($courseObjective1);
     $sessionObjective1->addParent($courseObjective2);
     $session1->addObjective($sessionObjective1);
     $sessionLearningMaterial1 = new SessionLearningMaterial();
     $sessionLearningMaterial1->setLearningMaterial($lm);
     $sessionLearningMaterial1->setId(808);
     $sessionLearningMaterial1->addMeshDescriptor(new MeshDescriptor());
     $sessionLearningMaterial1->setNotes('notes');
     $sessionLearningMaterial1->setPublicNotes(true);
     $sessionLearningMaterial1->setRequired(false);
     $session1->addLearningMaterial($sessionLearningMaterial1);
     $sessionTerm1 = new Term();
     $sessionTerm1->setId(808);
     $session1->addTerm($sessionTerm1);
     $description = new SessionDescription();
     $description->setDescription('test description');
     $session1->setSessionDescription($description);
     $user = new User();
     $offering1 = new Offering();
     $offering1->setRoom('111b');
     $offering1->setSite('Off Campus');
     $offering1->setStartDate(new DateTime('8am'));
     $offering1->setEndDate(new DateTime('9am'));
     $offering1->addInstructor($user);
     $offering1->addLearner($user);
     $instructorGroup = new InstructorGroup();
     $instructorGroup->addUser($user);
     $offering1->addInstructorGroup($instructorGroup);
     $learnerGroup = new LearnerGroup();
     $learnerGroup->addUser($user);
     $offering1->addLearnerGroup($learnerGroup);
     $session1->addOffering($offering1);
     $course->addSession($session1);
     $session2 = new Session();
     $session2->setSessionType(new SessionType());
     $ilm = new IlmSession();
     $ilm->setHours(4.3);
     $ilm->setDueDate(new DateTime());
     $ilm->addInstructorGroup($instructorGroup);
     $ilm->addLearnerGroup($learnerGroup);
     $ilm->addInstructor($user);
     $ilm->addLearner($user);
     $session2->setIlmSession($ilm);
     $course->addSession($session2);
     return $course;
 }