コード例 #1
0
ファイル: Training.php プロジェクト: alerj/parlamentojuvenil
 public function findById($item, $user, $year)
 {
     $training = $this->addTrainingData($user, TrainingModel::byYear($year));
     foreach ($training as $course) {
         foreach ($course['relations'] as $relation) {
             foreach ($relation as $element) {
                 if ($element['id'] == $item) {
                     return $element;
                 }
                 if ($element['type'] == 'quiz' && starts_with($item, $element['id'])) {
                     foreach ($element['questions'] as $key => $question) {
                         if ($element['id'] . '.' . $key == $item) {
                             return $question;
                         }
                     }
                 }
             }
         }
     }
     return null;
 }
コード例 #2
0
ファイル: Training.php プロジェクト: alerj/parlamentojuvenil
 private function renderTraining($user)
 {
     $training = $this->trainingRepository->addTrainingData($user, TrainingModel::byYear($this->year));
     return view($this->year . '.training.content')->with('loggedUser', $user)->with('training', $training);
 }