コード例 #1
0
ファイル: CourseHalf.php プロジェクト: ChrisdAutume/EtuUTT
 /**
  * @param Course $course
  */
 public function addCourse(Course $course)
 {
     if ($course->getWeek() == 'A') {
         $this->courses['A'] = $course;
     } elseif ($course->getWeek() == 'B') {
         $this->courses['B'] = $course;
     }
 }
コード例 #2
0
 /**
  * @Route("/schedule/course/{id}", name="schedule_course")
  * @Template()
  */
 public function courseAction(Course $course)
 {
     if (!$this->getUserLayer()->isStudent()) {
         return $this->createAccessDeniedResponse();
     }
     /** @var $em EntityManager */
     $em = $this->getDoctrine()->getManager();
     $students = $em->createQueryBuilder()->select('c, u')->from('EtuUserBundle:Course', 'c')->leftJoin('c.user', 'u')->where('c.uv = :uv')->andWhere('c.start = :start')->andWhere('c.end = :end')->andWhere('c.week = :week')->andWhere('c.room = :room')->setParameter('uv', $course->getUv())->setParameter('start', $course->getStart())->setParameter('end', $course->getEnd())->setParameter('week', $course->getWeek())->setParameter('room', $course->getRoom())->orderBy('u.lastName', 'ASC')->getQuery()->getResult();
     return array('course' => $course, 'students' => $students);
 }
コード例 #3
0
 /**
  * @param Course $course
  * @return $this
  */
 public function addCourse(Course $course)
 {
     if ($this->useHalf) {
         if ($course->getWeek() == 'T') {
             $this->courses[$course->getDay()][$course->getStart()] = array('type' => 'course', 'size' => self::getBlockSize($course), 'course' => $course);
         } else {
             if (!isset($this->courses[$course->getDay()][$course->getStart()]['courses'])) {
                 $this->courses[$course->getDay()][$course->getStart()] = array('type' => 'course_half', 'size' => self::getBlockSize($course), 'courses' => new CourseHalf());
             }
             $this->courses[$course->getDay()][$course->getStart()]['courses']->addCourse($course);
         }
     } else {
         $this->courses[$course->getDay()][$course->getStart()] = array('type' => 'course', 'size' => self::getBlockSize($course), 'course' => $course);
     }
     return $this;
 }
コード例 #4
0
 /**
  * @param Course $course
  * @return array
  */
 private function getData(Course $course)
 {
     $start = explode(':', $course->getStart());
     $end = explode(':', $course->getEnd());
     return ['day' => $course->getDay(), 'start' => ['hour' => (int) $start[0], 'minute' => (int) $start[1]], 'end' => ['hour' => (int) $end[0], 'minute' => (int) $end[1]], 'week' => $course->getWeek(), 'uv' => $course->getUv(), 'type' => $course->getType(), 'room' => $course->getRoom()];
 }