$tr->_e("Please fill in all fields"); exit; } if (count($vv->sanitized) !== count($checked) || count($vv->sanitized) < 2 || !in_array("true", $checked, true)) { header("HTTP/1.0 400 Bad Request"); $tr->_e("Please select at least one correct answer"); exit; } if ($managerQuiz->getById($vq->sanitized['id_quiz']) && ($question = $managerQuestion->getById($vq->sanitized['id_question']))) { $question->setContent($vq->sanitized['question']); $managerQuestion->update($vq->sanitized['id_question'], $question); foreach ($question->getPropositions() as $prop) { $managerProp->delete($prop->getId()); } foreach ($vv->sanitized as $key => $value) { $managerProp->add(new Proposition(array('content' => $vv->sanitized[$key], 'questionId' => $question->getId(), 'type' => $checked[$key]))); } echo "true"; } } else { header("HTTP/1.0 400 Bad Request"); $tr->_e("Please fill in all fields"); } exit; } if (isset($_POST['type']) && $_POST['type'] === "order-question") { if (isset($_POST['order']) && !empty($_POST['order'])) { $managerQuestion = new QuestionManager(); $v = new validation(); $v->addSource($_POST['order']); foreach ($_POST['order'] as $key => $value) {