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