public function testSetConducted()
 {
     $interview = new Interview();
     $date = new \DateTime();
     $interview->setConducted($date);
     $this->assertEquals($date, $interview->getConducted());
 }
Example #2
0
 /**
  * @param Interview $interview
  * @return \Symfony\Component\HttpFoundation\RedirectResponse
  */
 public function cancelAction(Interview $interview)
 {
     $interview->setCancelled(true);
     $manager = $this->getDoctrine()->getManager();
     $manager->persist($interview);
     $manager->flush();
     return $this->redirectToRoute('admissionadmin_show', array('status' => 'assigned'));
 }
Example #3
0
 /**
  * Shows and handles the submission of the schedule interview form.
  * This method can also send an email to the applicant with the info from the submitted form.
  *
  * @param Request $request
  * @param Interview $interview
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function scheduleAction(Request $request, Interview $interview)
 {
     // Only admin and above, or the assigned interviewer should be able to book an interview
     if (!$this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN') && !$interview->isInterviewer($this->getUser())) {
         throw $this->createAccessDeniedException();
     }
     // Set the default data for the form
     $defaultData = array('datetime' => $interview->getScheduled(), 'message' => 'Hei, vi har satt opp et intervju for deg angÄende opptak til vektorprogrammet. ' . 'Dersom tidspunktet ikke passer, venligst send svar som retur til denne eposten.', 'from' => $interview->getInterviewer()->getEmail(), 'to' => $interview->getApplication()->getEmail());
     $form = $this->createForm(new ScheduleInterviewType(), $defaultData);
     $form->handleRequest($request);
     if ($form->isValid()) {
         $data = $form->getData();
         // Update the scheduled time for the interview
         $interview->setScheduled($data['datetime']);
         $em = $this->getDoctrine()->getManager();
         $em->persist($interview);
         $em->flush();
         // Send email if the send button was clicked
         if ($form->get('saveAndSend')->isClicked()) {
             $mailer = $this->get('mailer');
             $message = $mailer->createMessage()->setSubject('Intervju for vektorprogrammet')->setFrom($data['from'])->setTo($data['to'])->setBody($this->renderView('interview/email.html.twig', array('message' => $data['message'], 'datetime' => $data['datetime'])), 'text/html');
             $mailer->send($message);
         }
         return $this->redirect($this->generateUrl('admissionadmin_show', array('status' => 'assigned')));
     }
     return $this->render('interview/schedule.html.twig', array('form' => $form->createView(), 'interview' => $interview));
 }
Example #4
0
 /**
  * Set interview
  *
  * @param \AppBundle\Entity\Interview $interview
  * @return Application
  */
 public function setInterview(\AppBundle\Entity\Interview $interview = null)
 {
     // Must also set the owning side as it is the one doctrine watches
     $interview->setApplication($this);
     $this->interview = $interview;
     return $this;
 }
Example #5
0
 public function load(ObjectManager $manager)
 {
     $application1 = new Application();
     $application1->setFirstName('Marius');
     $application1->setLastName('Svendsen');
     $application1->setEmail('*****@*****.**');
     $application1->setPhone('95321485');
     $application1->setUserCreated(false);
     $application1->setSubstituteCreated(false);
     $as1 = new ApplicationStatistic();
     $as1->setGender(0);
     $as1->setPreviousParticipation(true);
     $as1->setAccepted(0);
     $as1->setYearOfStudy(1);
     $as1->setFieldOfStudy($this->getReference('fos-1'));
     $as1->setSemester($this->getReference('semester-1'));
     $application1->setStatistic($as1);
     $manager->persist($application1);
     $application2 = new Application();
     $application2->setFirstName('Siri');
     $application2->setLastName('Kristiansen');
     $application2->setEmail('*****@*****.**');
     $application2->setPhone('95254873');
     $application2->setUserCreated(false);
     $application2->setSubstituteCreated(false);
     $as2 = new ApplicationStatistic();
     $as2->setGender(0);
     $as2->setPreviousParticipation(true);
     $as2->setAccepted(0);
     $as2->setYearOfStudy(1);
     $as2->setFieldOfStudy($this->getReference('fos-2'));
     $as2->setSemester($this->getReference('semester-1'));
     $application2->setStatistic($as2);
     $manager->persist($application2);
     $application3 = new Application();
     $application3->setFirstName('Leonardo');
     $application3->setLastName('DiCaprio');
     $application3->setEmail('*****@*****.**');
     $application3->setPhone('95235816');
     $application3->setUserCreated(false);
     $application3->setSubstituteCreated(false);
     $as3 = new ApplicationStatistic();
     $as3->setGender(0);
     $as3->setPreviousParticipation(true);
     $as3->setAccepted(0);
     $as3->setYearOfStudy(1);
     $as3->setFieldOfStudy($this->getReference('fos-2'));
     $as3->setSemester($this->getReference('semester-1'));
     $application3->setStatistic($as3);
     $manager->persist($application3);
     // This application has a conducted interview which takes some code to set up
     $application4 = new Application();
     $application4->setFirstName('Walter');
     $application4->setLastName('White');
     $application4->setEmail('*****@*****.**');
     $application4->setPhone('95254873');
     $application4->setUserCreated(false);
     $application4->setSubstituteCreated(false);
     $as4 = new ApplicationStatistic();
     $as4->setGender(0);
     $as4->setPreviousParticipation(true);
     $as4->setAccepted(0);
     $as4->setYearOfStudy(1);
     $as4->setFieldOfStudy($this->getReference('fos-1'));
     $as4->setSemester($this->getReference('semester-1'));
     $application4->setStatistic($as4);
     // The interview
     $interview4 = new Interview();
     $interview4->setInterviewed(true);
     $interview4->setInterviewer($this->getReference('user-2'));
     $interview4->setInterviewSchema($this->getReference('ischema-1'));
     $interview4->setApplication($application4);
     $application4->setInterview($interview4);
     // Create answer objects for all the questions in the schema
     foreach ($interview4->getInterviewSchema()->getInterviewQuestions() as $interviewQuestion) {
         $answer = new InterviewAnswer();
         $answer->setAnswer("Test answer");
         $answer->setInterview($interview4);
         $answer->setInterviewQuestion($interviewQuestion);
         $interview4->addInterviewAnswer($answer);
     }
     // The interview score
     $intScore = new InterviewScore();
     $intScore->setDrive(3);
     $intScore->setExplanatoryPower(3);
     $intScore->setRoleModel(3);
     $intScore->setTotalImpression(3);
     $intScore->setApplicationStatistic($as4);
     $interview4->setInterviewScore($intScore);
     // The interview practical
     $intPrac = new InterviewPractical();
     $intPrac->setMonday("Bra");
     $intPrac->setTuesday("Bra");
     $intPrac->setWednesday("Bra");
     $intPrac->setThursday("Bra");
     $intPrac->setFriday("Bra");
     $intPrac->setComment("Test");
     $intPrac->setHeardAboutFrom("Stand");
     $intPrac->setEnglish(true);
     $intPrac->setPosition("2x2");
     $intPrac->setSubstitute(true);
     $intPrac->setApplicationStatistic($as4);
     $interview4->setInterviewPractical($intPrac);
     $manager->persist($application4);
     $application5 = new Application();
     $application5->setFirstName('Mark');
     $application5->setLastName('Zuckerberg');
     $application5->setEmail('*****@*****.**');
     $application5->setPhone('95856472');
     $application5->setUserCreated(false);
     $application5->setSubstituteCreated(false);
     $as5 = new ApplicationStatistic();
     $as5->setGender(0);
     $as5->setPreviousParticipation(true);
     $as5->setAccepted(0);
     $as5->setYearOfStudy(1);
     $as5->setFieldOfStudy($this->getReference('fos-1'));
     $as5->setSemester($this->getReference('semester-1'));
     $application5->setStatistic($as5);
     $interview5 = new Interview();
     $interview5->setInterviewed(false);
     $interview5->setInterviewer($this->getReference('user-2'));
     $interview5->setInterviewSchema($this->getReference('ischema-1'));
     $application5->setInterview($interview5);
     $manager->persist($application5);
     $manager->flush();
 }
Example #6
0
 public function load(ObjectManager $manager)
 {
     $application0 = new Application();
     $application0->setUser($this->getReference('user-15'));
     $application0->setPreviousParticipation(false);
     $application0->setYearOfStudy(1);
     $application0->setSemester($this->getReference('semester-1'));
     $manager->persist($application0);
     $application1 = new Application();
     $application1->setUser($this->getReference('user-10'));
     $application1->setPreviousParticipation(true);
     $application1->setYearOfStudy(1);
     $application1->setSemester($this->getReference('semester-1'));
     $manager->persist($application1);
     $application2 = new Application();
     $application2->setUser($this->getReference('user-11'));
     $application2->setPreviousParticipation(false);
     $application2->setYearOfStudy(1);
     $application2->setSemester($this->getReference('semester-1'));
     $manager->persist($application2);
     $application3 = new Application();
     $application3->setUser($this->getReference('user-12'));
     $application3->setPreviousParticipation(false);
     $application3->setYearOfStudy(1);
     $application3->setSemester($this->getReference('semester-1'));
     $manager->persist($application3);
     // The interview
     $interview3 = new Interview();
     $interview3->setInterviewed(true);
     $interview3->setInterviewer($this->getReference('user-2'));
     $interview3->setInterviewSchema($this->getReference('ischema-1'));
     $interview3->setUser($this->getReference('user-12'));
     $application3->setInterview($interview3);
     // Create answer objects for all the questions in the schema
     foreach ($interview3->getInterviewSchema()->getInterviewQuestions() as $interviewQuestion) {
         $answer = new InterviewAnswer();
         $answer->setAnswer("Test answer");
         $answer->setInterview($interview3);
         $answer->setInterviewQuestion($interviewQuestion);
         $interview3->addInterviewAnswer($answer);
     }
     // The interview score
     $intScore = new InterviewScore();
     $intScore->setSuitability(6);
     $intScore->setExplanatoryPower(5);
     $intScore->setRoleModel(4);
     $intScore->setSuitableAssistant('Ja');
     $interview3->setInterviewScore($intScore);
     // The interview practical
     $application3->setMonday("Bra");
     $application3->setTuesday("Bra");
     $application3->setWednesday("Ikke");
     $application3->setThursday("Bra");
     $application3->setFriday("Ikke");
     $application3->setHeardAboutFrom(array("Stand"));
     $application3->setEnglish(true);
     $application3->setPreferredGroup('Bolk 1');
     $application3->setDoublePosition(true);
     $manager->persist($application3);
     // This application has a conducted interview which takes some code to set up
     $application4 = new Application();
     $application4->setUser($this->getReference('user-13'));
     $application4->setPreviousParticipation(false);
     $application4->setYearOfStudy(1);
     $application4->setSemester($this->getReference('semester-1'));
     // The interview
     $interview4 = new Interview();
     $interview4->setInterviewed(true);
     $interview4->setInterviewer($this->getReference('user-2'));
     $interview4->setInterviewSchema($this->getReference('ischema-1'));
     $interview4->setUser($this->getReference('user-13'));
     $application4->setInterview($interview4);
     // Create answer objects for all the questions in the schema
     foreach ($interview4->getInterviewSchema()->getInterviewQuestions() as $interviewQuestion) {
         $answer = new InterviewAnswer();
         $answer->setAnswer("Test answer");
         $answer->setInterview($interview4);
         $answer->setInterviewQuestion($interviewQuestion);
         $interview4->addInterviewAnswer($answer);
     }
     // The interview score
     $intScore = new InterviewScore();
     $intScore->setSuitability(6);
     $intScore->setExplanatoryPower(5);
     $intScore->setRoleModel(4);
     $intScore->setSuitableAssistant('Ja');
     $interview4->setInterviewScore($intScore);
     // The interview practical
     $application4->setMonday("Bra");
     $application4->setTuesday("Bra");
     $application4->setWednesday("Ikke");
     $application4->setThursday("Bra");
     $application4->setFriday("Ikke");
     $application4->setHeardAboutFrom(array("Stand"));
     $application4->setEnglish(false);
     $application4->setPreferredGroup('Bolk 1');
     $application4->setDoublePosition(false);
     $manager->persist($application4);
     $application5 = new Application();
     $application5->setUser($this->getReference('user-14'));
     $application5->setPreviousParticipation(false);
     $application5->setYearOfStudy(1);
     $application5->setSemester($this->getReference('semester-1'));
     $interview5 = new Interview();
     $interview5->setInterviewed(false);
     $interview5->setInterviewer($this->getReference('user-2'));
     $interview5->setInterviewSchema($this->getReference('ischema-1'));
     $interview5->setUser($this->getReference('user-14'));
     $application5->setInterview($interview5);
     $manager->persist($application5);
     $application6 = new Application();
     $application6->setUser($this->getReference('user-8'));
     $application6->setPreviousParticipation(false);
     $application6->setYearOfStudy(1);
     $application6->setSemester($this->getReference('semester-1'));
     $interview6 = new Interview();
     $interview6->setInterviewed(false);
     $interview6->setInterviewer($this->getReference('user-1'));
     $interview6->setInterviewSchema($this->getReference('ischema-1'));
     $interview6->setUser($this->getReference('user-8'));
     $interview6->setCancelled(true);
     $application6->setInterview($interview6);
     $manager->persist($application6);
     $manager->flush();
 }