예제 #1
0
 /**
  * @param string $topic
  * @param string $location
  * @param string $level
  * @param bool   $limit
  * @return ArrayList|TrainingViewModel
  */
 public function getTrainings($topic = "", $location = "", $level = "", $limit = true)
 {
     $res = new ArrayList();
     $active_training = $this->training_manager->getActives(DateTimeUtils::getCurrentDate());
     foreach ($active_training as $t) {
         $vm = new TrainingViewModel($t->getIdentifier(), $t->getName(), $t->getDescription(), $t->getCompany());
         $courses_dto = $this->course_repository->get($t->getIdentifier(), DateTimeUtils::getCurrentDate(), $topic, $location, $level, $limit);
         if (!count($courses_dto)) {
             continue;
         }
         $courses = new ArrayList();
         foreach ($courses_dto as $dto) {
             $courses->push(new CourseViewModel($dto));
         }
         $vm->setCourses($courses);
         $res->push($vm);
     }
     return $res;
 }