edit-lesson.php
3 years ago
edit_quiz.php
3 years ago
login.php
3 years ago
question_answer_form.php
3 years ago
question_answer_list.php
3 years ago
question_form.php
3 years ago
review.php
3 years ago
topic-form.php
3 years ago
edit_quiz.php
290 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Quiz Modal Form |
| 4 | * |
| 5 | * @package Tutor\Views |
| 6 | * @author Themeum <support@themeum.com> |
| 7 | * @link https://themeum.com |
| 8 | * @since 1.0.0 |
| 9 | */ |
| 10 | |
| 11 | ?> |
| 12 | <input type="hidden" name="quiz_id" value="<?php echo esc_attr( $quiz_id ); ?>"/> |
| 13 | <div id="quiz-builder-tab-quiz-info"> |
| 14 | <div class="tutor-mb-32"> |
| 15 | <label class="tutor-form-label"><?php esc_html_e( 'Quiz Title', 'tutor' ); ?></label> |
| 16 | <div class="tutor-mb-16"> |
| 17 | <input type="text" name="quiz_title" class="tutor-form-control tutor-mb-12" placeholder="<?php esc_attr_e( 'Type your quiz title here', 'tutor' ); ?>" value="<?php echo esc_html( $quiz ? htmlspecialchars( stripslashes( $quiz->post_title ) ) : '' ); ?>"/> |
| 18 | </div> |
| 19 | </div> |
| 20 | <div> |
| 21 | <label class="tutor-form-label"><?php esc_html_e( 'Summary', 'tutor' ); ?></label> |
| 22 | <div class="tutor-mb-16"> |
| 23 | <textarea name="quiz_description" class="tutor-form-control tutor-mb-12" rows="5"><?php echo esc_textarea( stripslashes( $quiz ? $quiz->post_content : '' ) ); ?></textarea> |
| 24 | </div> |
| 25 | </div> |
| 26 | <?php do_action( 'tutor_quiz_edit_modal_info_tab_after', $quiz ); ?> |
| 27 | </div> |
| 28 | |
| 29 | <div id="quiz-builder-tab-questions" class="quiz-builder-tab-container tutor-mb-32"> |
| 30 | <div class="quiz-builder-questions-wrap"> |
| 31 | <?php |
| 32 | $questions = ( $quiz_id && $quiz_id > 0 ) ? tutor_utils()->get_questions_by_quiz( $quiz_id ) : array(); |
| 33 | |
| 34 | if ( $questions ) { |
| 35 | foreach ( $questions as $question ) { |
| 36 | $id_target = 'quiz-popup-menu-' . $question->question_id; |
| 37 | ?> |
| 38 | <div class="tutor-quiz-item quiz-builder-question-wrap" data-question-id="<?php echo esc_attr( $question->question_id ); ?>"> |
| 39 | <div class="tutor-quiz-item-label"> |
| 40 | <span class="tutor-quiz-item-draggable tutor-icon-drag question-sorting"></span> |
| 41 | <h6 class="tutor-quiz-item-name"> |
| 42 | <?php echo esc_html( $question->question_title ); ?> |
| 43 | </h6> |
| 44 | </div> |
| 45 | <div class="tutor-quiz-item-action tutor-align-center"> |
| 46 | <div class="tutor-quiz-item-type"> |
| 47 | <?php |
| 48 | $type = tutor_utils()->get_question_types( $question->question_type ); |
| 49 | echo wp_kses( stripslashes( $type['icon'] ), tutor_utils()->allowed_icon_tags() ) . ' ' . esc_html( $type['name'] ); |
| 50 | ?> |
| 51 | </div> |
| 52 | <div class="tutor-dropdown-parent"> |
| 53 | <button type="button" class="tutor-iconic-btn" action-tutor-dropdown="toggle"> |
| 54 | <span class="tutor-icon-kebab-menu" area-hidden="true"></span> |
| 55 | </button> |
| 56 | <ul class="tutor-dropdown tutor-dropdown-dark tutor-text-left"> |
| 57 | <li> |
| 58 | <a href="#" class="tutor-dropdown-item tutor-quiz-open-question-form" data-question-id="<?php echo esc_attr( $question->question_id ); ?>"> |
| 59 | <span class="tutor-icon-edit tutor-mr-8" area-hidden="true"></span> |
| 60 | <span><?php esc_html_e( 'Edit', 'tutor' ); ?></span> |
| 61 | </a> |
| 62 | </li> |
| 63 | <li> |
| 64 | <a href="#" class="tutor-dropdown-item tutor-quiz-question-trash" data-question-id="<?php echo esc_attr( $question->question_id ); ?>"> |
| 65 | <span class="tutor-icon-trash-can-bold tutor-mr-8" area-hidden="true"></span> |
| 66 | <span><?php esc_html_e( 'Delete', 'tutor' ); ?></span> |
| 67 | </a> |
| 68 | </li> |
| 69 | </ul> |
| 70 | </div> |
| 71 | </div> |
| 72 | </div> |
| 73 | <?php |
| 74 | } |
| 75 | } |
| 76 | ?> |
| 77 | </div> |
| 78 | |
| 79 | <div> |
| 80 | <a href="javascript:;" class="tutor-quiz-open-question-form tutor-btn tutor-btn-outline-primary tutor-btn-md"> |
| 81 | <i class="tutor-icon-plus-square tutor-mr-8" area-hidden="true"></i> |
| 82 | <?php esc_html_e( 'Add Question', 'tutor' ); ?> |
| 83 | </a> |
| 84 | </div> |
| 85 | </div> |
| 86 | |
| 87 | <div id="quiz-builder-tab-settings" class="quiz-builder-tab-container"> |
| 88 | <div class="tutor-mb-32"> |
| 89 | <label class="tutor-form-label"> |
| 90 | <?php esc_html_e( 'Time Limit', 'tutor' ); ?> |
| 91 | </label> |
| 92 | <div class="tutor-row tutor-align-center"> |
| 93 | <div class="tutor-col-3"> |
| 94 | <input type="number" class="tutor-form-control" min="0" name="quiz_option[time_limit][time_value]" value="<?php echo esc_attr( tutor_utils()->get_quiz_option( $quiz_id, 'time_limit.time_value', 0 ) ); ?>"> |
| 95 | </div> |
| 96 | <div class="tutor-col-3"> |
| 97 | <?php $limit_time_type = tutor_utils()->get_quiz_option( $quiz_id, 'time_limit.time_type', 'minutes' ); ?> |
| 98 | <select name="quiz_option[time_limit][time_type]" class="tutor-form-control"> |
| 99 | <option value="seconds" <?php selected( 'seconds', $limit_time_type ); ?>><?php esc_html_e( 'Seconds', 'tutor' ); ?></option> |
| 100 | <option value="minutes" <?php selected( 'minutes', $limit_time_type ); ?>><?php esc_html_e( 'Minutes', 'tutor' ); ?></option> |
| 101 | <option value="hours" <?php selected( 'hours', $limit_time_type ); ?>><?php esc_html_e( 'Hours', 'tutor' ); ?></option> |
| 102 | <option value="days" <?php selected( 'days', $limit_time_type ); ?>><?php esc_html_e( 'Days', 'tutor' ); ?></option> |
| 103 | <option value="weeks" <?php selected( 'weeks', $limit_time_type ); ?>><?php esc_html_e( 'Weeks', 'tutor' ); ?></option> |
| 104 | </select> |
| 105 | </div> |
| 106 | <div class="tutor-col-6"> |
| 107 | <label class="tutor-form-toggle"> |
| 108 | <input type="checkbox" class="tutor-form-toggle-input" value="1" name="quiz_option[hide_quiz_time_display]" <?php checked( '1', tutor_utils()->get_quiz_option( $quiz_id, 'hide_quiz_time_display' ) ); ?> /> |
| 109 | <span class="tutor-form-toggle-control"></span> <?php esc_html_e( 'Hide quiz time - display', 'tutor' ); ?> |
| 110 | </label> |
| 111 | </div> |
| 112 | </div> |
| 113 | <div class="tutor-form-feedback"> |
| 114 | <?php esc_html_e( 'Time limit for this quiz. 0 means no time limit.', 'tutor' ); ?> |
| 115 | </div> |
| 116 | </div> |
| 117 | |
| 118 | <div class="tutor-mb-32"> |
| 119 | <label class="tutor-form-label"> |
| 120 | <?php esc_html_e( 'Quiz Feedback Mode', 'tutor' ); ?> |
| 121 | </label> |
| 122 | <div> |
| 123 | <div class="tutor-fs-7 tutor-color-muted tutor-mb-12"> |
| 124 | (<?php esc_html_e( 'Pick the quiz system"s behaviour on choice based questions.', 'tutor' ); ?>) |
| 125 | </div> |
| 126 | |
| 127 | <label class="tutor-radio-select tutor-bg-white tutor-mb-8"> |
| 128 | <input class="tutor-form-check-input" type="radio" name="quiz_option[feedback_mode]" value="default" <?php checked( 'default', tutor_utils()->get_quiz_option( $quiz_id, 'feedback_mode', 'default' ) ); ?>> |
| 129 | <div class="tutor-radio-select-content"> |
| 130 | <span class="tutor-radio-select-title"><?php esc_html_e( 'Default', 'tutor' ); ?></span> |
| 131 | <?php esc_html_e( 'Answers shown after quiz is finished', 'tutor' ); ?> |
| 132 | </div> |
| 133 | </label> |
| 134 | |
| 135 | <label class="tutor-radio-select tutor-bg-transparent tutor-my-8"> |
| 136 | <input class="tutor-form-check-input" type="radio" name="quiz_option[feedback_mode]" value="reveal" <?php checked( 'reveal', tutor_utils()->get_quiz_option( $quiz_id, 'feedback_mode' ) ); ?>> |
| 137 | <div class="tutor-radio-select-content"> |
| 138 | <span class="tutor-radio-select-title"><?php esc_html_e( 'Reveal Mode', 'tutor' ); ?></span> |
| 139 | <?php esc_html_e( 'Show result after the attempt.', 'tutor' ); ?> |
| 140 | </div> |
| 141 | </label> |
| 142 | |
| 143 | <label class="tutor-radio-select tutor-bg-transparent tutor-my-8"> |
| 144 | <input class="tutor-form-check-input" type="radio" name="quiz_option[feedback_mode]" value="retry" <?php checked( 'retry', tutor_utils()->get_quiz_option( $quiz_id, 'feedback_mode' ) ); ?>> |
| 145 | <div class="tutor-radio-select-content"> |
| 146 | <span class="tutor-radio-select-title"><?php esc_html_e( 'Retry Mode', 'tutor' ); ?></span> |
| 147 | <?php esc_html_e( 'Reattempt quiz any number of times. Define Attempts Allowed below.', 'tutor' ); ?> |
| 148 | </div> |
| 149 | </label> |
| 150 | </div> |
| 151 | </div> |
| 152 | |
| 153 | <div class="tutor-mb-32 tutor-quiz-slider tutor-attempt-allowed-slider" style="<?php echo esc_attr( tutor_utils()->get_quiz_option( $quiz_id, 'feedback_mode', 'default' ) === 'retry' ? 'display: block' : 'display: none' ); ?>"> |
| 154 | <label class="tutor-form-label"> |
| 155 | <?php esc_html_e( 'Attempts Allowed', 'tutor' ); ?> |
| 156 | </label> |
| 157 | <?php |
| 158 | $default_attempts_allowed = tutor_utils()->get_option( 'quiz_attempts_allowed' ); |
| 159 | $attempts_allowed = (int) tutor_utils()->get_quiz_option( $quiz_id, 'attempts_allowed', $default_attempts_allowed ); |
| 160 | ?> |
| 161 | <div class="tutor-field-type-slider tutor-p-0" data-min="0" data-max="20"> |
| 162 | <p class="tutor-field-type-slider-value"><?php echo esc_html( $attempts_allowed ); ?></p> |
| 163 | <div class="tutor-field-slider"></div> |
| 164 | <input type="hidden" value="<?php echo esc_attr( $attempts_allowed ); ?>" name="quiz_option[attempts_allowed]" /> |
| 165 | </div> |
| 166 | <div class="tutor-form-feedback"> |
| 167 | <?php esc_html_e( 'Restriction on the number of attempts a student is allowed to take for this quiz. 0 for no limit', 'tutor' ); ?> |
| 168 | </div> |
| 169 | </div> |
| 170 | |
| 171 | <?php do_action( 'tutor_quiz_builder_settings_tab_passing_grade_before', $course_id, $quiz_id ); ?> |
| 172 | |
| 173 | <div class="tutor-mb-32"> |
| 174 | <label class="tutor-form-label"> |
| 175 | <?php esc_html_e( 'Passing Grade (%)', 'tutor' ); ?> |
| 176 | </label> |
| 177 | <input type="number" class="tutor-form-control" name="quiz_option[passing_grade]" value="<?php echo esc_attr( tutor_utils()->get_quiz_option( $quiz_id, 'passing_grade', 80 ) ); ?>" size="10" min="0"/> |
| 178 | <div class="tutor-form-feedback"> |
| 179 | <?php esc_html_e( 'Set the passing percentage for this quiz', 'tutor' ); ?> |
| 180 | </div> |
| 181 | </div> |
| 182 | |
| 183 | <div class="tutor-mb-32"> |
| 184 | <label class="tutor-form-label"> |
| 185 | <?php esc_html_e( 'Max Question Allowed to Answer', 'tutor' ); ?> |
| 186 | </label> |
| 187 | <input type="number" class="tutor-form-control" name="quiz_option[max_questions_for_answer]" value="<?php echo esc_attr( tutor_utils()->get_quiz_option( $quiz_id, 'max_questions_for_answer', 10 ) ); ?>" min="1"/> |
| 188 | <div class="tutor-form-feedback"> |
| 189 | <?php esc_html_e( 'This amount of question will be available for students to answer, and question will comes randomly from all available questions belongs with a quiz, if this amount is greater than available question, then all questions will be available for a student to answer.', 'tutor' ); ?> |
| 190 | </div> |
| 191 | </div> |
| 192 | |
| 193 | <?php do_action( 'tutor_quiz_edit_modal_settings_tab_after_max_allowed_questions', $quiz ); ?> |
| 194 | |
| 195 | <div class="tutor-quiz-advance-settings tutor-bg-white tutor-cursor-pointer tutor-mb-32"> |
| 196 | <!-- Header --> |
| 197 | <div class="tutor-row tutor-align-center tutor-quiz-advance-header tutor-g-0"> |
| 198 | <div class="tutor-col"> |
| 199 | <div class="tutor-row tutor-align-center"> |
| 200 | <div class="tutor-col-auto"> |
| 201 | <span><i class="tutor-icon-gear"></i></span> |
| 202 | </div> |
| 203 | <div class="tutor-col tutor-p-0 tutor-fs-6 tutor-fw-medium tutor-color-secondary"> |
| 204 | <?php esc_html_e( 'Advance Settings', 'tutor' ); ?> |
| 205 | </div> |
| 206 | </div> |
| 207 | </div> |
| 208 | <div class="tutor-col-auto"> |
| 209 | <i class="tutor-icon-angle-down"></i> |
| 210 | </div> |
| 211 | </div> |
| 212 | |
| 213 | <!-- Fields --> |
| 214 | <div class="tutor-quiz-advance-content tutor-p-32"> |
| 215 | <div class="tutor-quiz-advance-settings-fields tutor-row"> |
| 216 | <div class="tutor-col-12 tutor-mb-32"> |
| 217 | <label class="tutor-form-toggle"> |
| 218 | <input type="checkbox" class="tutor-form-toggle-input" value="1" name="quiz_option[quiz_auto_start]" <?php checked( '1', tutor_utils()->get_quiz_option( $quiz_id, 'quiz_auto_start' ) ); ?> /> |
| 219 | <span class="tutor-form-toggle-control"></span> <?php esc_html_e( 'Quiz Auto Start', 'tutor' ); ?> |
| 220 | </label> |
| 221 | <div class="tutor-form-feedback"> |
| 222 | <?php esc_html_e( 'If you enable this option, the quiz will start automatically after the page is loaded.', 'tutor' ); ?> |
| 223 | </div> |
| 224 | </div> |
| 225 | |
| 226 | <div class="tutor-col-12 tutor-col-sm-6 tutor-mb-32"> |
| 227 | <label class="tutor-form-label"> |
| 228 | <?php esc_html_e( 'Question Layout', 'tutor' ); ?> |
| 229 | </label> |
| 230 | <select class="tutor-form-control" name="quiz_option[question_layout_view]"> |
| 231 | <option value=""><?php esc_html_e( 'Set question layout view', 'tutor' ); ?></option> |
| 232 | <option value="single_question" <?php selected( 'single_question', tutor_utils()->get_quiz_option( $quiz_id, 'question_layout_view' ) ); ?>> <?php esc_html_e( 'Single Question', 'tutor' ); ?> </option> |
| 233 | <option value="question_pagination" <?php selected( 'question_pagination', tutor_utils()->get_quiz_option( $quiz_id, 'question_layout_view' ) ); ?>> <?php esc_html_e( 'Question Pagination', 'tutor' ); ?> </option> |
| 234 | <option value="question_below_each_other" <?php selected( 'question_below_each_other', tutor_utils()->get_quiz_option( $quiz_id, 'question_layout_view' ) ); ?>> <?php esc_html_e( 'Question below each other', 'tutor' ); ?> </option> |
| 235 | </select> |
| 236 | </div> |
| 237 | |
| 238 | <div class="tutor-col-12 tutor-col-sm-6 tutor-mb-32"> |
| 239 | <label class="tutor-form-label"> |
| 240 | <?php esc_html_e( 'Questions Order', 'tutor' ); ?> |
| 241 | </label> |
| 242 | <select class="tutor-form-control" name="quiz_option[questions_order]"> |
| 243 | <option value="rand" <?php selected( 'rand', tutor_utils()->get_quiz_option( $quiz_id, 'questions_order' ) ); ?>> <?php esc_html_e( 'Random', 'tutor' ); ?> </option> |
| 244 | <option value="sorting" <?php selected( 'sorting', tutor_utils()->get_quiz_option( $quiz_id, 'questions_order' ) ); ?>> <?php esc_html_e( 'Sorting', 'tutor' ); ?> </option> |
| 245 | <option value="asc" <?php selected( 'asc', tutor_utils()->get_quiz_option( $quiz_id, 'questions_order' ) ); ?>> <?php esc_html_e( 'Ascending', 'tutor' ); ?> </option> |
| 246 | <option value="desc" <?php selected( 'desc', tutor_utils()->get_quiz_option( $quiz_id, 'questions_order' ) ); ?>> <?php esc_html_e( 'Descending', 'tutor' ); ?> </option> |
| 247 | </select> |
| 248 | </div> |
| 249 | |
| 250 | <div class="tutor-col-12 tutor-mb-32"> |
| 251 | <label class="tutor-form-toggle"> |
| 252 | <input type="checkbox" class="tutor-form-toggle-input" value="1" name="quiz_option[hide_question_number_overview]" <?php checked( '1', tutor_utils()->get_quiz_option( $quiz_id, 'hide_question_number_overview' ) ); ?> /> |
| 253 | <span class="tutor-form-toggle-control"></span> <?php esc_html_e( 'Hide question number', 'tutor' ); ?></span> |
| 254 | </label> |
| 255 | <div class="tutor-form-feedback"> |
| 256 | <?php esc_html_e( 'Show/hide question number during attempt.', 'tutor' ); ?> |
| 257 | </div> |
| 258 | </div> |
| 259 | |
| 260 | <div class="tutor-col-12 tutor-mb-32"> |
| 261 | <label class="tutor-form-label"> |
| 262 | <?php esc_html_e( 'Short answer characters limit', 'tutor' ); ?> |
| 263 | </label> |
| 264 | <div class="tutor-row"> |
| 265 | <div class="tutor-col-auto"> |
| 266 | <input class="tutor-form-control" type="number" name="quiz_option[short_answer_characters_limit]" value="<?php echo esc_attr( tutor_utils()->get_quiz_option( $quiz_id, 'short_answer_characters_limit', 200 ) ); ?>" min="0"> |
| 267 | </div> |
| 268 | </div> |
| 269 | <div class="tutor-form-feedback"> |
| 270 | <?php esc_html_e( 'Student will place answer in short answer question type within this characters limit.', 'tutor' ); ?> |
| 271 | </div> |
| 272 | </div> |
| 273 | |
| 274 | <div class="tutor-col-12"> |
| 275 | <label class="tutor-form-label"> |
| 276 | <?php esc_html_e( 'Open-Ended/Essay questions answer character limit', 'tutor' ); ?> |
| 277 | </label> |
| 278 | <input style="max-width: 135px;" class="tutor-form-control" type="number" name="quiz_option[open_ended_answer_characters_limit]" value="<?php echo esc_attr( tutor_utils()->get_quiz_option( $quiz_id, 'open_ended_answer_characters_limit', 500 ) ); ?>" min="0"> |
| 279 | <div class="tutor-form-feedback"> |
| 280 | <?php esc_html_e( 'Students will place the answer in the Open-Ended/Essay question type within this character limit.', 'tutor' ); ?> |
| 281 | </div> |
| 282 | </div> |
| 283 | </div> |
| 284 | </div> |
| 285 | </div> |
| 286 | |
| 287 | <?php do_action( 'tutor_quiz_edit_modal_settings_tab_after', $quiz ); ?> |
| 288 | </div> |
| 289 | |
| 290 |