if (count($answers) > 0) { foreach ($answers as $answer) { $result .= "<div id='answer_" . $answer['answer_id'] . "' style='margin-bottom: 5px;'>" . "<input type='text' name='answers[]' value=" . $answer['answer'] . " class='text ui-widget-content ui-corner-all' style='margin: 0px; background: #ededed; width: 83%; display: inline;' disabled />" . "<nobr>[ <a href='#' onclick='javascript:delete_answer(" . $answer['answer_id'] . "); return false;' style='text-decoration: none; color: red; font-weight: bold;'>x</a> ]</nobr>" . "<br /></div>"; } } else { $result = 'Нет отгадок'; } } echo $result; die; } else { if ($action == 'delete_answer') { header("Content-Type: application/json"); $answer_id = isset($_POST['answer_id']) ? (int) $_POST['answer_id'] : null; if ($answer_id && $question_model->is_provider_answer($provider_id, $answer_id)) { $question_model->delete_answer($answer_id); $result = array('success' => true, 'answer_id' => $answer_id); } else { $result = array('success' => false, 'error' => 'answer_id is null'); } echo json_encode($result); die; } else { if ($action == 'get_helps') { $question_id = isset($_POST['question_id']) ? (int) $_POST['question_id'] : null; if ($question_id && $question_model->is_provider_question($provider_id, $question_id)) { $result = ''; $helps = $question_model->get_helps($question_id); if (count($helps) > 0) { foreach ($helps as $help) { $help_status = $help['help_status'];