Пример #1
0
 /**
  * Export exercise with steps with questions.
  *
  * @param Exercise $exercise
  * @param bool     $withSolutions
  *
  * @return array
  */
 public function exportSteps(Exercise $exercise, $withSolutions = true)
 {
     $steps = $exercise->getSteps();
     $data = [];
     foreach ($steps as $step) {
         $data[] = $this->stepManager->exportStep($step, $withSolutions);
     }
     return $data;
 }
Пример #2
0
 /**
  * Update the properties of a Step.
  *
  * @EXT\Route(
  *     "/steps/{id}",
  *     name="exercise_step_update_meta",
  *     requirements={"id"="\d+"},
  *     options={"expose"=true}
  * )
  * @EXT\Method("PUT")
  *
  * @param Exercise $exercise
  * @param Step     $step
  * @param Request  $request
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function updateMetadataAction(Exercise $exercise, Step $step, Request $request)
 {
     $this->assertHasPermission('ADMINISTRATE', $exercise);
     // Get Exercise data from the Request
     $dataRaw = $request->getContent();
     if (!empty($dataRaw)) {
         $this->stepManager->updateMetadata($step, json_decode($dataRaw));
     }
     return new JsonResponse($this->stepManager->exportStep($step, false));
 }