add_quiz.php
4 years ago
edit-lesson.php
4 years ago
edit_quiz.php
4 years ago
question_answer_edit_form.php
4 years ago
question_answer_form.php
4 years ago
question_form.php
4 years ago
review.php
4 years ago
question_answer_edit_form.php
260 lines
| 1 | <?php |
| 2 | if ( $question_type === 'open_ended' ) { |
| 3 | echo '<p class="open-ended-notice" style="color: #ff0000;">' . __( 'No option is necessary for this answer type', 'tutor' ) . '</p>'; |
| 4 | return ''; |
| 5 | } |
| 6 | |
| 7 | $answer_title = ! empty( $old_answer->answer_title ) ? stripslashes( $old_answer->answer_title ) : ''; |
| 8 | $image_id = ! empty( $old_answer->image_id ) ? $old_answer->image_id : ''; |
| 9 | $answer_view_format = ! empty( $old_answer->answer_view_format ) ? $old_answer->answer_view_format : ''; |
| 10 | $answer_two_gap_match = ! empty( $old_answer->answer_two_gap_match ) ? stripslashes( $old_answer->answer_two_gap_match ) : ''; |
| 11 | ?> |
| 12 | |
| 13 | <div class="tutor-quiz-question-answers-form"> |
| 14 | |
| 15 | <input type="hidden" name="tutor_quiz_answer_id" value="<?php echo esc_attr( $old_answer->answer_id ); ?>" /> |
| 16 | |
| 17 | <?php |
| 18 | if ( $question_type === 'true_false' ) { |
| 19 | // No Need |
| 20 | } elseif ( $question_type === 'multiple_choice' || $question_type === 'single_choice' || $question_type === 'ordering' ) { |
| 21 | |
| 22 | ?> |
| 23 | |
| 24 | <div class="tutor-quiz-builder-group"> |
| 25 | <h4><?php _e( 'Answer title', 'tutor' ); ?></h4> |
| 26 | <div class="tutor-quiz-builder-row"> |
| 27 | <div class="tutor-quiz-builder-col"> |
| 28 | <input type="text" name="quiz_answer[<?php echo esc_attr( $question_id ); ?>][answer_title]" value="<?php echo esc_attr( $answer_title ); ?>"> |
| 29 | </div> |
| 30 | </div> |
| 31 | </div> |
| 32 | |
| 33 | <div class="tutor-quiz-builder-group"> |
| 34 | <h4><?php _e( 'Upload Image', 'tutor' ); ?></h4> |
| 35 | <div class="tutor-quiz-builder-row"> |
| 36 | <div class="tutor-quiz-builder-col"> |
| 37 | <div class="tutor-media-upload-wrap"> |
| 38 | <input type="hidden" name="quiz_answer[<?php echo esc_attr( $question_id ); ?>][image_id]" value="<?php echo esc_attr( $image_id ); ?>"> |
| 39 | <div class="tutor-media-preview"> |
| 40 | <a href="javascript:;" class="tutor-media-upload-btn"> |
| 41 | <?php |
| 42 | if ( $image_id ) { |
| 43 | echo '<img src="' . esc_url( wp_get_attachment_image_url( $image_id ) ) . '" />'; |
| 44 | } else { |
| 45 | echo '<i class="tutor-icon-image1"></i>'; |
| 46 | } |
| 47 | ?> |
| 48 | </a> |
| 49 | </div> |
| 50 | <div class="tutor-media-upload-trash-wrap"> |
| 51 | <a href="javascript:;" class="tutor-media-upload-trash">×</a> |
| 52 | </div> |
| 53 | </div> |
| 54 | </div> |
| 55 | </div> |
| 56 | </div> |
| 57 | <div class="tutor-quiz-builder-group"> |
| 58 | <h4><?php _e( 'Display format for options', 'tutor' ); ?></h4> |
| 59 | <div class="tutor-quiz-builder-row"> |
| 60 | <div class="tutor-quiz-builder-col auto-width"> |
| 61 | <label> |
| 62 | <input type="radio" name="quiz_answer[<?php echo esc_attr( $question_id ); ?>][answer_view_format]" value="text" <?php echo $answer_view_format ? checked( 'text', $answer_view_format ) : 'checked'; ?>> |
| 63 | <?php _e( 'Only text', 'tutor' ); ?> |
| 64 | </label> |
| 65 | </div> |
| 66 | <div class="tutor-quiz-builder-col auto-width"> |
| 67 | <label> |
| 68 | <input type="radio" name="quiz_answer[<?php echo esc_attr( $question_id ); ?>][answer_view_format]" value="image" <?php echo checked( 'image', $answer_view_format ); ?>> |
| 69 | <?php _e( 'Only Image', 'tutor' ); ?> |
| 70 | </label> |
| 71 | </div> |
| 72 | <div class="tutor-quiz-builder-col auto-width"> |
| 73 | <label> |
| 74 | <input type="radio" name="quiz_answer[<?php echo esc_attr( $question_id ); ?>][answer_view_format]" value="text_image" <?php echo checked( 'text_image', $answer_view_format ); ?> > |
| 75 | <?php _e( 'Text & Image both', 'tutor' ); ?> |
| 76 | </label> |
| 77 | </div> |
| 78 | </div> |
| 79 | </div> |
| 80 | <?php |
| 81 | } elseif ( $question_type === 'fill_in_the_blank' ) { |
| 82 | ?> |
| 83 | <div class="tutor-quiz-builder-group"> |
| 84 | <h4><?php _e( 'Question Title', 'tutor' ); ?></h4> |
| 85 | <div class="tutor-quiz-builder-row"> |
| 86 | <div class="tutor-quiz-builder-col"> |
| 87 | <input type="text" name="quiz_answer[<?php echo esc_attr( $question_id ); ?>][answer_title]" value="<?php echo esc_attr( $answer_title ); ?>"> |
| 88 | </div> |
| 89 | </div> |
| 90 | <p class="help"> |
| 91 | <?php _e( 'Please make sure that <b>{dash}</b> variable contains in your question title to show dash, You can use multiple variable', 'tutor' ); ?> |
| 92 | </p> |
| 93 | </div> |
| 94 | |
| 95 | <div class="tutor-quiz-builder-group"> |
| 96 | <h4><?php _e( 'Correct Answer(s)', 'tutor' ); ?></h4> |
| 97 | <div class="tutor-quiz-builder-row"> |
| 98 | <div class="tutor-quiz-builder-col"> |
| 99 | <input type="text" name="quiz_answer[<?php echo esc_attr( $question_id ); ?>][answer_two_gap_match]" value="<?php echo esc_attr( $answer_two_gap_match ); ?>"> |
| 100 | </div> |
| 101 | </div> |
| 102 | <p class="help"><?php _e( 'Separate multiple answer by pipe <b>( | )</b> , 1 answer per variable assigned in question', 'tutor' ); ?></p> |
| 103 | </div> |
| 104 | |
| 105 | |
| 106 | <?php |
| 107 | } elseif ( $question_type === 'matching' ) { |
| 108 | ?> |
| 109 | <div class="tutor-quiz-builder-group"> |
| 110 | <h4><?php _e( 'Answer title', 'tutor' ); ?></h4> |
| 111 | <div class="tutor-quiz-builder-row"> |
| 112 | <div class="tutor-quiz-builder-col"> |
| 113 | <input type="text" name="quiz_answer[<?php echo esc_attr( $question_id ); ?>][answer_title]" value="<?php echo esc_attr( $answer_title ); ?>"> |
| 114 | </div> |
| 115 | </div> |
| 116 | </div> |
| 117 | <div class="tutor-quiz-builder-group"> |
| 118 | <h4><?php _e( 'Matched Answer title', 'tutor' ); ?></h4> |
| 119 | <div class="tutor-quiz-builder-row"> |
| 120 | <div class="tutor-quiz-builder-col"> |
| 121 | <input type="text" name="quiz_answer[<?php echo esc_attr( $question_id ); ?>][matched_answer_title]" value="<?php echo esc_attr( $answer_two_gap_match ); ?>"/> |
| 122 | </div> |
| 123 | </div> |
| 124 | </div> |
| 125 | |
| 126 | <div class="tutor-quiz-builder-group"> |
| 127 | <h4><?php _e( 'Upload Image', 'tutor' ); ?></h4> |
| 128 | <div class="tutor-quiz-builder-row"> |
| 129 | <div class="tutor-quiz-builder-col"> |
| 130 | <div class="tutor-media-upload-wrap"> |
| 131 | <input type="hidden" name="quiz_answer[<?php echo esc_attr( $question_id ); ?>][image_id]" value="<?php echo esc_attr( $image_id ); ?>"/> |
| 132 | <div class="tutor-media-preview"> |
| 133 | <a href="javascript:;" class="tutor-media-upload-btn"> |
| 134 | <?php |
| 135 | if ( $image_id ) { |
| 136 | echo '<img src="' . esc_url( wp_get_attachment_image_url( $image_id ) ) . '" />'; |
| 137 | } else { |
| 138 | echo '<i class="tutor-icon-image1"></i>'; |
| 139 | } |
| 140 | ?> |
| 141 | </a> |
| 142 | </div> |
| 143 | <div class="tutor-media-upload-trash-wrap"> |
| 144 | <a href="javascript:;" class="tutor-media-upload-trash">×</a> |
| 145 | </div> |
| 146 | </div> |
| 147 | </div> |
| 148 | </div> |
| 149 | </div> |
| 150 | |
| 151 | <div class="tutor-quiz-builder-group"> |
| 152 | <h4><?php _e( 'Display format for options', 'tutor' ); ?></h4> |
| 153 | <div class="tutor-quiz-builder-row"> |
| 154 | <div class="tutor-quiz-builder-col auto-width"> |
| 155 | <label> |
| 156 | <input type="radio" name="quiz_answer[<?php echo esc_attr( $question_id ); ?>][answer_view_format]" value="text" <?php echo $answer_view_format ? checked( 'text', $answer_view_format ) : 'checked'; ?>> |
| 157 | <?php _e( 'Only text', 'tutor' ); ?> |
| 158 | </label> |
| 159 | </div> |
| 160 | <div class="tutor-quiz-builder-col auto-width"> |
| 161 | <label> |
| 162 | <input type="radio" name="quiz_answer[<?php echo esc_attr( $question_id ); ?>][answer_view_format]" value="image" <?php echo checked( 'image', $answer_view_format ); ?> > |
| 163 | <?php _e( 'Only Image', 'tutor' ); ?> |
| 164 | </label> |
| 165 | </div> |
| 166 | <div class="tutor-quiz-builder-col auto-width"> |
| 167 | <label> |
| 168 | <input type="radio" name="quiz_answer[<?php echo esc_attr( $question_id ); ?>][answer_view_format]" value="text_image" <?php echo checked( 'text_image', $answer_view_format ); ?> > |
| 169 | <?php _e( 'Text & Image both', 'tutor' ); ?> |
| 170 | </label> |
| 171 | </div> |
| 172 | </div> |
| 173 | </div> |
| 174 | |
| 175 | <?php |
| 176 | } elseif ( $question_type === 'image_matching' ) { |
| 177 | ?> |
| 178 | |
| 179 | <div class="tutor-quiz-builder-group"> |
| 180 | <h4><?php _e( 'Upload Image', 'tutor' ); ?></h4> |
| 181 | <div class="tutor-quiz-builder-row"> |
| 182 | <div class="tutor-quiz-builder-col"> |
| 183 | <div class="tutor-media-upload-wrap"> |
| 184 | <input type="hidden" name="quiz_answer[<?php echo esc_attr( $question_id ); ?>][image_id]" value="<?php echo esc_attr( $image_id ); ?>"> |
| 185 | <div class="tutor-media-preview"> |
| 186 | <a href="javascript:;" class="tutor-media-upload-btn"> |
| 187 | <?php |
| 188 | if ( $image_id ) { |
| 189 | echo '<img src="' . esc_url( wp_get_attachment_image_url( $image_id ) ) . '" />'; |
| 190 | } else { |
| 191 | echo '<i class="tutor-icon-image1"></i>'; |
| 192 | } |
| 193 | ?> |
| 194 | </a> |
| 195 | </div> |
| 196 | <div class="tutor-media-upload-trash-wrap"> |
| 197 | <a href="javascript:;" class="tutor-media-upload-trash">×</a> |
| 198 | </div> |
| 199 | </div> |
| 200 | </div> |
| 201 | </div> |
| 202 | </div> <!-- /.tutor-quiz-builder-group --> |
| 203 | |
| 204 | <div class="tutor-quiz-builder-group"> |
| 205 | <h4><?php _e( 'Image matched text', 'tutor' ); ?></h4> |
| 206 | <div class="tutor-quiz-builder-row"> |
| 207 | <div class="tutor-quiz-builder-col"> |
| 208 | <input type="text" name="quiz_answer[<?php echo esc_attr( $question_id ); ?>][answer_title]" value="<?php echo esc_attr( $answer_title ); ?>"> |
| 209 | </div> |
| 210 | </div> |
| 211 | </div> <!-- /.tutor-quiz-builder-group --> |
| 212 | |
| 213 | <?php |
| 214 | } elseif ( $question_type === 'image_answering' ) { |
| 215 | ?> |
| 216 | <div class="tutor-quiz-builder-group"> |
| 217 | <h4><?php _e( 'Upload Image', 'tutor' ); ?></h4> |
| 218 | <div class="tutor-quiz-builder-row"> |
| 219 | <div class="tutor-quiz-builder-col"> |
| 220 | <div class="tutor-media-upload-wrap"> |
| 221 | <input type="hidden" name="quiz_answer[<?php echo esc_attr( $question_id ); ?>][image_id]" value="<?php echo esc_attr( $image_id ); ?>"> |
| 222 | <div class="tutor-media-preview"> |
| 223 | <a href="javascript:;" class="tutor-media-upload-btn"> |
| 224 | <?php |
| 225 | if ( $image_id ) { |
| 226 | echo '<img src="' . esc_url( wp_get_attachment_image_url( $image_id ) ) . '" />'; |
| 227 | } else { |
| 228 | echo '<i class="tutor-icon-image1"></i>'; |
| 229 | } |
| 230 | ?> |
| 231 | </a> |
| 232 | </div> |
| 233 | <div class="tutor-media-upload-trash-wrap"> |
| 234 | <a href="javascript:;" class="tutor-media-upload-trash">×</a> |
| 235 | </div> |
| 236 | </div> |
| 237 | </div> |
| 238 | </div> |
| 239 | </div> <!-- /.tutor-quiz-builder-group --> |
| 240 | |
| 241 | <div class="tutor-quiz-builder-group"> |
| 242 | <h4><?php _e( 'Answer input value', 'tutor' ); ?></h4> |
| 243 | <div class="tutor-quiz-builder-row"> |
| 244 | <div class="tutor-quiz-builder-col"> |
| 245 | <input type="text" name="quiz_answer[<?php echo esc_attr( $question_id ); ?>][answer_title]" value="<?php echo esc_attr( $answer_title ); ?>"> |
| 246 | </div> |
| 247 | </div> |
| 248 | <p class="help"><?php _e( 'The answers that students enter should match with this text. Write in <strong>small caps</strong>', 'tutor' ); ?></p> |
| 249 | </div> <!-- /.tutor-quiz-builder-group --> |
| 250 | |
| 251 | <?php |
| 252 | } |
| 253 | ?> |
| 254 | |
| 255 | <div class="tutor-quiz-answers-form-footer tutor-quiz-builder-form-row"> |
| 256 | <button type="button" id="quiz-answer-edit-btn" class="tutor-answer-edit-btn"><i class="tutor-icon-pencil"></i> <?php _e( 'Update Answer', 'tutor' ); ?></button> |
| 257 | </div> |
| 258 | |
| 259 | </div> |
| 260 |