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