public function renderActivityAction(Request $request, Application $app) { $path = $request->query->get('path'); if (!$path) { throw new NotFoundHttpException('Missing path!'); } $challenge = $this->createChallengeFromPath($path); $fileBuilder = $challenge->getFileBuilder(); $correctAnswer = Activity\CodingChallenge\CorrectAnswer::createFromFileBuilder($fileBuilder); $challenge->configureCorrectAnswer($correctAnswer); $html = $this->getTwig($app)->render('author/renderActivity.twig', array('challenge' => $challenge, 'fileBuilder' => $fileBuilder, 'path' => $path, 'gradingUrl' => $app['url_generator']->generate('grade_activity'), 'correctAnswer' => $correctAnswer, 'activityUrl' => $app['url_generator']->generate('render_activity'), 'otherFiles' => $this->findOtherFiles($path))); return new Response($html); }