} $BREADCRUMB[] = array("url" => ENTRADA_URL . "/" . $MODULE . "?section=results" . ($QUIZ_TYPE == "community_page" ? "&community=true" : "") . "&id=" . $RECORD_ID, "title" => limit_chars($quiz_record["quiz_title"], 32)); if ($is_administrator) { $BREADCRUMB[] = array("url" => ENTRADA_URL . "/admin/" . $MODULE . "?section=results" . ($QUIZ_TYPE == "community_page" ? "&community=true" : "") . "&id=" . $quiz_record["aquiz_id"], "title" => "Quiz Results"); $BREADCRUMB[] = array("url" => "", "title" => $respondent_name); } /** * Providing there is no expiry date, or the expiry date is in the * future on both the quiz and the event, allow them to continue. */ if ($is_administrator || $quiz_record["quiztype_code"] == "immediate" || $quiz_record["quiztype_code"] == "delayed" && ((int) $quiz_record["release_until"] === 0 || $quiz_record["release_until"] <= time())) { $quiz_score = $quiz_record["quiz_score"]; $quiz_value = $quiz_record["quiz_value"]; $query = "\tSELECT a.*\n\t\t\t\t\t\t\t\tFROM `quiz_questions` AS a\n\t\t\t\t\t\t\t\tWHERE a.`quiz_id` = " . $db->qstr($quiz_record["quiz_id"]) . "\n\t\t\t\t\t\t\t\tAND a.`question_active` = '1'\n\t\t\t\t\t\t\t\tORDER BY a.`question_order` ASC"; $questions = $db->GetAll($query); $questions = Models_Quiz_Question::fetchAllRecords($quiz_record["quiz_id"]); if ($questions) { $PROCESSED = quiz_load_progress($RECORD_ID); /** * Calculates the percentage for display purposes. */ $quiz_percentage = round($quiz_score / $quiz_value, 2) * 100; if ($quiz_percentage >= 70) { $display_class = "success"; } elseif ($quiz_percentage > 50 && $quiz_percentage < 70) { $display_class = "notice"; } else { $display_class = "error"; } echo "<h1>" . html_encode($quiz_record["quiz_title"]) . "</h1>"; ?>
</div> <div class="row-fluid"> <button href="#delete-quiz-confirmation-box" id="quiz-control-delete" class="btn btn-danger">Delete Quiz</button> <button href="#copy-quiz-confirmation-box" id="quiz-control-copy" class="btn">Copy Quiz</button> <div class="pull-right"> <input type="submit" class="btn btn-primary" value="Save Changes" /> </div> </div> </form> </div> <a name="quiz_questions_section"></a> <h2 id="quiz_questions_section" title="Quiz Content Questions">Quiz Questions</h2> <div id="quiz-content-questions"> <?php $questions = Models_Quiz_Question::fetchAllRecords($RECORD_ID); if ($ALLOW_QUESTION_MODIFICATIONS) { $question_types = Models_Quiz_QuestionType::fetchAllRecords(); if ($question_types) { ?> <div class="row-fluid space-below"> <?php if (isset($questions) && $questions) { ?> <a href="#delete-question-confirmation-box" class="btn btn-danger" id="delete-questions" data-toggle="modal">Delete Selected</a> <a href="#" class="btn" id="group-questions">Group Selected</a> <?php } ?> <div class="pull-right"> <div class="btn-group">
<tr> <th width="5%"> </th> <th width="30%">Quiz Title</th> <th width="25%">Author</th> <th width="15%">Questions</th> <th width="25%">Last Updated</th> </tr> </thead> <tbody> <?php foreach ($delete_quizzes as $quiz) { echo "<tr>\n"; echo "\t<td class=\"modified\"><input class=\"delete-control\" type=\"checkbox\" name=\"delete[]\" value=\"" . (int) $quiz->getQuizID() . "\" checked=\"checked\" /></td>\n"; echo "\t<td class=\"title\"><a href=\"" . ENTRADA_RELATIVE . "/admin/" . $MODULE . "?section=edit&id=" . (int) $quiz->getQuizID() . "\">" . html_encode($quiz->getQuizTitle()) . "</a></td>\n"; echo "\t<td class=\"author\"><a href=\"" . ENTRADA_RELATIVE . "/admin/" . $MODULE . "?section=edit&id=" . (int) $quiz->getQuizID() . "\">" . html_encode($quiz->getQuizAuthor()->getFullname()) . "</a></td>\n"; echo "\t<td class=\"questions\"><a href=\"" . ENTRADA_RELATIVE . "/admin/" . $MODULE . "?section=edit&id=" . (int) $quiz->getQuizID() . "\">" . count(Models_Quiz_Question::fetchAllRecords($quiz->getQuizID())) . "</a></td>\n"; echo "\t<td class=\"updated\"><a href=\"" . ENTRADA_RELATIVE . "/admin/" . $MODULE . "?section=edit&id=" . (int) $quiz->getQuizID() . "\">" . date("Y-m-d g:ia", $quiz->getUpdatedDate()) . "</a></td>\n"; echo "</tr>\n"; } ?> </tbody> </table> <div class="row-fluid"> <a href="<?php echo ENTRADA_RELATIVE . "/admin/" . $MODULE; ?> " class="btn">Cancel</a> <input id="delete-quizzes" type="submit" class="btn btn-danger pull-right" value="Confirm Delete" /> </div> </form> <?php
} else { application_log("error", "Unable to insert new quiz_questions record when attempting to copy quiz_id [" . $RECORD_ID . "]. Database said: " . $db->ErrorMsg()); } } if ($ERROR) { if (count($new_qquestion_ids) > 0) { foreach ($new_qquestion_ids as $new_qquestion_id) { $qquestion_responses = Models_Quiz_Question_Response::fetchAllRecords($new_qquestion_id); if ($qquestion_responses) { foreach ($qquestion_responses as $qquestion_response) { $qquestion_response->delete(); } } } } $quiz_questions = Models_Quiz_Question::fetchAllRecords($new_quiz_id); if ($quiz_questions) { foreach ($quiz_questions as $quiz_question) { $quiz_question->delete(); } } $quiz_contacts = Models_Quiz_Contact::fetchAllRecords($new_quiz_id); if ($quiz_contacts) { foreach ($quiz_contacts as $quiz_contact) { $quiz_contact->delete(); } } $quiz = Models_Quiz::fetchRowByID($new_quiz_id); if ($quiz) { $quiz->delete(); }
public function getQuizQuestions() { return Models_Quiz_Question::fetchAllRecords($this->quiz_id); }