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
question_form.php
169 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Quiz question form template |
| 4 | * |
| 5 | * @package Tutor\Views |
| 6 | * @subpackage Tutor\Modal |
| 7 | * @author Themeum <support@themeum.com> |
| 8 | * @link https://themeum.com |
| 9 | * @since 1.0.0 |
| 10 | */ |
| 11 | |
| 12 | global $wpdb; |
| 13 | $settings = maybe_unserialize( $question->question_settings ); |
| 14 | ?> |
| 15 | |
| 16 | <div id="tutor-quiz-question-wrapper" |
| 17 | data-question-id="<?php echo esc_attr( $question_id ); ?>" |
| 18 | data-question_type="<?php echo esc_attr( $question->question_type ); ?>"> |
| 19 | |
| 20 | <div class="question-form-header tutor-mb-12"> |
| 21 | <a href="javascript:;" class="back-to-quiz-questions-btn tutor-btn tutor-btn-ghost" |
| 22 | data-quiz-id="<?php echo esc_attr( isset( $quiz_id ) ? $quiz_id : '' ); ?>" |
| 23 | data-topic-id="<?php echo esc_attr( isset( $topic_id ) ? $topic_id : '' ); ?>"> |
| 24 | <span class="tutor-icon-previous" area-hidden="true"></span> |
| 25 | <?php esc_html_e( 'Back', 'tutor' ); ?> |
| 26 | </a> |
| 27 | </div> |
| 28 | |
| 29 | <input type="hidden" name="quiz_id" value="<?php echo esc_attr( $quiz_id ); ?>" /> |
| 30 | |
| 31 | <div class="tutor-mb-32"> |
| 32 | <label class="tutor-form-label"><?php esc_html_e( 'Write your question here', 'tutor' ); ?></label> |
| 33 | <div class="tutor-mb-16"> |
| 34 | <input type="text" name="tutor_quiz_question[<?php echo esc_attr( $question_id ); ?>][question_title]" |
| 35 | class="tutor-form-control" placeholder="<?php esc_attr_e( 'Type your question here', 'tutor' ); ?>" |
| 36 | value="<?php echo htmlspecialchars( stripslashes( $question->question_title ) ); //phpcs:ignore ?>"> |
| 37 | </div> |
| 38 | </div> |
| 39 | |
| 40 | <div class="tutor-mb-32"> |
| 41 | <label class="tutor-form-label"><?php esc_html_e( 'Select your question type', 'tutor' ); ?></label> |
| 42 | <div class="tutor-mb-16"> |
| 43 | <div class="tutor-w-100"> |
| 44 | <div class="tutor-row tutor-align-center"> |
| 45 | <div class="tutor-col-12 tutor-col-md-12"> |
| 46 | <div class="question-type-select"> |
| 47 | <?php |
| 48 | $question_types = tutor_utils()->get_question_types(); |
| 49 | $current_type = $question->question_type ? $question->question_type : 'true_false'; |
| 50 | ?> |
| 51 | |
| 52 | <div class="select-header"> |
| 53 | <span class="lead-option"> |
| 54 | <?php |
| 55 | $allowed_icon_html_tags = array( |
| 56 | 'span' => array( |
| 57 | 'class' => array(), |
| 58 | ), |
| 59 | 'i' => array( |
| 60 | 'class' => array(), |
| 61 | ), |
| 62 | ); |
| 63 | |
| 64 | //phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped |
| 65 | echo tutor_utils()->clean_html_content( |
| 66 | $question_types[ $current_type ]['icon'], |
| 67 | $allowed_icon_html_tags |
| 68 | ); |
| 69 | echo esc_html( $question_types[ $current_type ]['name'] ); |
| 70 | ?> |
| 71 | </span> |
| 72 | <span class="select-dropdown"> |
| 73 | <i class="tutor-icon-down "></i> |
| 74 | </span> |
| 75 | <input type="hidden" class="tutor_select_value_holder" |
| 76 | name="tutor_quiz_question[<?php echo esc_attr( $question_id ); ?>][question_type]" |
| 77 | value="<?php echo esc_attr( $question->question_type ); ?>"> |
| 78 | </div> |
| 79 | |
| 80 | <div class="tutor-select-options" style="display: none;"> |
| 81 | <?php |
| 82 | $has_tutor_pro = tutor()->has_pro; |
| 83 | |
| 84 | foreach ( $question_types as $type => $question_type ) { |
| 85 | ?> |
| 86 | <p class="tutor-select-option" |
| 87 | data-value="<?php echo $type; ?>" <?php echo $question->question_type === $type ? ' data-selected="selected"' : ''; ?> |
| 88 | data-is-pro="<?php echo ( ! $has_tutor_pro && $question_type['is_pro'] ) ? 'true' : 'false'; ?>"> |
| 89 | |
| 90 | <?php |
| 91 | echo tutor_utils()->clean_html_content( $question_type['icon'], $allowed_icon_html_tags ) . ' ' . esc_html( $question_type['name'] ); |
| 92 | ?> |
| 93 | <?php |
| 94 | if ( ! $has_tutor_pro && $question_type['is_pro'] ) { |
| 95 | $svg_lock = '<svg width="12" height="16" xmlns="http://www.w3.org/2000/svg"><path d="M11.667 6h-1V4.667A4.672 4.672 0 0 0 6 0a4.672 4.672 0 0 0-4.667 4.667V6h-1A.333.333 0 0 0 0 6.333v8.334C0 15.402.598 16 1.333 16h9.334c.735 0 1.333-.598 1.333-1.333V6.333A.333.333 0 0 0 11.667 6zm-4.669 6.963a.334.334 0 0 1-.331.37H5.333a.333.333 0 0 1-.331-.37l.21-1.89A1.319 1.319 0 0 1 4.667 10c0-.735.598-1.333 1.333-1.333S7.333 9.265 7.333 10c0 .431-.204.824-.545 1.072l.21 1.891zM8.667 6H3.333V4.667A2.67 2.67 0 0 1 6 2a2.67 2.67 0 0 1 2.667 2.667V6z" fill="#E2E2E2" fill-rule="nonzero"/></svg>'; |
| 96 | printf( "<span class='question-type-pro' title='%s'>%s</span>", __( 'Pro version required', 'tutor' ), $svg_lock ); |
| 97 | } |
| 98 | ?> |
| 99 | </p> |
| 100 | <?php |
| 101 | } |
| 102 | ?> |
| 103 | </div> |
| 104 | </div> |
| 105 | </div> |
| 106 | <div class="tutor-col-12 tutor-col-md-12 tutor-mt-20"> |
| 107 | <div class="tutor-row tutor-align-center"> |
| 108 | <div class="tutor-col-sm-4 tutor-col-md-4 tutor-mt-4 tutor-mb-4"> |
| 109 | <label class="tutor-form-toggle tutor-nowrap-ellipsis"> |
| 110 | <input type="checkbox" class="tutor-form-toggle-input" value="1" name="tutor_quiz_question[<?php echo esc_attr( $question_id ); ?>][answer_required]" <?php checked( '1', tutor_utils()->avalue_dot( 'answer_required', $settings ) ); ?> /> |
| 111 | <span class="tutor-form-toggle-control"></span> <?php esc_html_e( 'Answer Required', 'tutor' ); ?> |
| 112 | </label> |
| 113 | </div> |
| 114 | <div class="tutor-col-sm-4 tutor-col-md-4 tutor-mt-4 tutor-mb-4"> |
| 115 | <label class="tutor-form-toggle tutor-nowrap-ellipsis"> |
| 116 | <input type="checkbox" class="tutor-form-toggle-input" value="1" name="tutor_quiz_question[<?php echo esc_attr( $question_id ); ?>][randomize_question]" <?php checked( '1', tutor_utils()->avalue_dot( 'randomize_question', $settings ) ); ?> /> |
| 117 | <span class="tutor-form-toggle-control"></span> <?php esc_html_e( 'Randomize', 'tutor' ); ?> |
| 118 | </label> |
| 119 | </div> |
| 120 | </div> |
| 121 | </div> |
| 122 | </div> |
| 123 | </div> |
| 124 | </div> |
| 125 | </div> |
| 126 | |
| 127 | <div class="tutor-mb-32"> |
| 128 | <label class="tutor-form-label"><?php esc_html_e( 'Point(s) for this answer', 'tutor' ); ?></label> |
| 129 | <div class="tutor-mb-16"> |
| 130 | <div class="tutor-row tutor-align-center"> |
| 131 | <div class="tutor-col-sm-6 tutor-col-md-4"> |
| 132 | <input type="text" name="tutor_quiz_question[<?php echo esc_attr( $question_id ); ?>][question_mark]" class="tutor-form-control" placeholder="<?php esc_attr_e( 'set the mark ex. 10', 'tutor' ); ?>" value="<?php echo esc_attr( $question->question_mark ); ?>"> |
| 133 | </div> |
| 134 | <div class="tutor-col-sm-6 tutor-col-md-4 tutor-mt-4 tutor-mb-4"> |
| 135 | <label class="tutor-form-toggle tutor-nowrap-ellipsis"> |
| 136 | <input type="checkbox" class="tutor-form-toggle-input" value="1" name="tutor_quiz_question[<?php echo esc_attr( $question_id ); ?>][show_question_mark]" <?php checked( '1', tutor_utils()->avalue_dot( 'show_question_mark', $settings ) ); ?> /> |
| 137 | <span class="tutor-form-toggle-control"></span> <?php esc_html_e( 'Display Points', 'tutor' ); ?> |
| 138 | </label> |
| 139 | </div> |
| 140 | </div> |
| 141 | </div> |
| 142 | </div> |
| 143 | <input type="hidden" name="tutor_quiz_question_id" value="<?php echo esc_attr( $question_id ); ?>"> |
| 144 | <div class="tutor-mb-32"> |
| 145 | <label class="tutor-form-label"><?php esc_html_e( 'Description', 'tutor' ); ?> <span>(<?php esc_html_e( 'Optional', 'tutor' ); ?>)</span></label> |
| 146 | <div class="tutor-mb-16"> |
| 147 | <?php |
| 148 | $field_name = "tutor_quiz_question[{$question_id}][question_description]"; |
| 149 | ?> |
| 150 | <textarea name="<?php echo esc_attr( $field_name ); ?>" id="tutor_quiz_desc_text_editor" class="tutor-form-control"><?php echo wp_kses_post( wp_unslash( $question->question_description ) ); ?></textarea> |
| 151 | </div> |
| 152 | </div> |
| 153 | |
| 154 | <div class="tutor-mb-16"> |
| 155 | <label class="tutor-form-label"> |
| 156 | <?php esc_html_e( 'Input options for the question and select the correct answer.', 'tutor' ); ?> |
| 157 | </label> |
| 158 | </div> |
| 159 | |
| 160 | <div id="tutor_quiz_builder_answer_wrapper"> |
| 161 | <?php |
| 162 | $question_type = $question->question_type; |
| 163 | $question_id = $question_id; |
| 164 | |
| 165 | require __DIR__ . '/question_answer_list.php'; |
| 166 | ?> |
| 167 | </div> |
| 168 | </div> |
| 169 |