foreach ($_POST['result_id'] as $index => $result_id) { $result_id = (int) $result_id; $title = isset($_POST['title'][$index]) ? trim($_POST['title'][$index]) : false; $desciption = isset($_POST['description'][$index]) ? trim($_POST['description'][$index]) : false; $photo = isset($_POST['photo'][$index]) ? trim($_POST['photo'][$index]) : false; $photo_key = 'photo_' . ($index + 1); $quiz_result = array('id' => $result_id, 'title' => $title, 'description' => $desciption, 'photo' => $photo, 'filename' => $photo_key); $result_ids[] = $result_id; $result_arr[] = $quiz_result; if (strlen($title) == 0) { continue; } $quiz_results[] = $quiz_result; } if (count($quiz_results) >= $min_result_count) { he_quiz::save_results($quiz_id, $quiz_results); $redirect_url = "quiz_questions.php?quiz_id={$quiz_id}"; header("Location: {$redirect_url}"); exit; } $message = array('type' => 'error', 'title' => SE_Language::get(690691108, array($min_result_count)), 'text' => SE_Language::get(690691109)); } $result_arr = $result_arr ? $result_arr : he_quiz::get_results($quiz_id, true); $photo_url = he_quiz::photo_url(); $smarty->assign('quiz_id', $quiz_id); $smarty->assign('result_arr', $result_arr); $smarty->assign('steps', $steps); $smarty->assign('message', $message); $smarty->assign('min_result_count', $min_result_count); $smarty->assign('photo_url', $photo_url); include "footer.php";
$quiz_error = true; } else { $questions[] = $question; } } if ($min_question_count > count($questions)) { $message = array('type' => 'error', 'title' => SE_Language::get(690691116, array($min_question_count)), 'text' => SE_Language::get(690691117)); } elseif ($quiz_error) { $message = array('type' => 'error', 'title' => SE_Language::get(690691118), 'text' => SE_Language::get(690691119)); } elseif ($quiz_notice) { $message = array('type' => 'error', 'title' => SE_Language::get(690691120), 'text' => SE_Language::get(690691121)); } else { he_quiz::save_questions($quiz_id, $questions); header("Location: quiz_publish.php?quiz_id={$quiz_id}"); exit; } } if (!isset($question_arr)) { $question_arr = he_quiz::get_questions($quiz_id, true); $question_arr = he_quiz::get_answers($quiz_id, $question_arr); } $results = he_quiz::get_results($quiz_id, false, true); $photo_url = he_quiz::photo_url(); $smarty->assign('quiz_id', $quiz_id); $smarty->assign('min_question_count', $min_question_count); $smarty->assign('question_arr', $question_arr); $smarty->assign('results', $results); $smarty->assign('steps', $steps); $smarty->assign('message', $message); $smarty->assign('photo_url', $photo_url); include "footer.php";
<?php $page = "browse_quiz_results"; include "header.php"; $quiz_id = isset($_GET['quiz_id']) && $_GET['quiz_id'] ? (int) $_GET['quiz_id'] : 0; $quiz_info = he_quiz::get_quiz_info($quiz_id); // DISPLAY ERROR PAGE IF USER IS NOT LOGGED IN AND ADMIN SETTING REQUIRES REGISTRATION if (!$user->user_exists || !$quiz_info) { $page = "error"; $smarty->assign('error_header', 639); $smarty->assign('error_message', 656); $smarty->assign('error_submit', 641); include "footer.php"; } $quiz_results = he_quiz::get_results($quiz_id); $quiz_takes = he_quiz::get_quiz_takes($quiz_id); $comment = new se_comment('he_quiz', 'quiz_id', $quiz_id); $total_comments = $comment->comment_total(); $allowed_to_comment = true; //TODO $photo_url = he_quiz::photo_url(); $smarty->assign('message', $message); $smarty->assign('quiz_info', $quiz_info); $smarty->assign('quiz_results', $quiz_results); $smarty->assign('quiz_takes', $quiz_takes); $smarty->assign('total_comments', $total_comments); $smarty->assign('allowed_to_comment', $allowed_to_comment); $smarty->assign('photo_url', $photo_url); include "footer.php";