<?php include_once 'procedures.php'; $_SESSION['adminPanelState'] = 'APfaq.php'; if (isAdmin()) { $status = -1; if (isset($_GET['status'])) { $status = intval($_GET['status']); } $_SESSION['adminQuestionStatusId'] = $status; $questionId = -1; $currentQuestion = array(); if (isset($_GET['question'])) { $questionId = intval($_GET['question']); $currentQuestion = getQuestionById($questionId); } $_SESSION['adminQuestionId'] = $questionId; ?> <script> changeActiveAdminButton('faqButton'); </script> <script> function loadFaqData(statusId, questionId) { $('#dataContainer').load('APfaq.php?status=' + statusId + '&question=' + questionId); } function getSelectorValue(selector) {
function getQuestion($test_id, $questionId) { $data = []; $question = []; $optionId = []; $query = "SELECT * FROM `test_info` WHERE `test_id` = {$test_id}"; foreach (select($query) as $value) { $data[] = json_decode($value['json']); } foreach ($data as $key => $ids) { foreach ($ids as $key => $id) { if ($key == $questionId) { $optionId[$key] = $id; $question[$key]['question'] = getQuestionById($key); $question[$key]['alternatives'] = getQuestionAlternatives($key); } } } //return $data; return array($optionId, $question); }
<input type="radio" class="question-item" name="radio-<?php $v->id; ?> " /> <?php } else { ?> <input type="checkbox" class="question-item" name="chkbox" /> <?php } ?> <?php echo $item; ?> (<span style="color:red;"><?php $quest = getQuestionById($v->id, $stats); echo $quest["item" . $idx]; ?> </span>) </label><br> <?php } ?> <?php if ($v->otherfields) { ?> <?php if ($v->type < 3) { ?> <input type="checkbox" name="chkbox" class="question-item item-other" value="radio" /><input class="question-item-text" placeholder="其他" /> <?php