add_quiz.php
6 years ago
edit-lesson.php
6 years ago
edit_quiz.php
6 years ago
question_answer_edit_form.php
6 years ago
question_answer_form.php
6 years ago
question_form.php
6 years ago
question_answer_edit_form.php
265 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</p>'; |
| 4 | return ''; |
| 5 | } |
| 6 | |
| 7 | $answer_title = ! empty($old_answer->answer_title) ? $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) ? $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 $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 $question_id; ?>][answer_title]" value="<?php echo $answer_title; ?>"> |
| 29 | </div> |
| 30 | </div> |
| 31 | <?php |
| 32 | if ($question_type === 'ordering'){ |
| 33 | printf( |
| 34 | '<p class="help">%s <b>%s</b></p>', |
| 35 | __('Make sure you are saving answer in right sorting in answers lists, student should ordering should match with this answer order.', 'tutor'), |
| 36 | __('You can re-order it from above answer list.', 'tutor') |
| 37 | ); |
| 38 | } |
| 39 | ?> |
| 40 | </div> |
| 41 | |
| 42 | <div class="tutor-quiz-builder-group"> |
| 43 | <h4><?php _e('Upload Image', 'tutor'); ?></h4> |
| 44 | <div class="tutor-quiz-builder-row"> |
| 45 | <div class="tutor-quiz-builder-col"> |
| 46 | <div class="tutor-media-upload-wrap"> |
| 47 | <input type="hidden" name="quiz_answer[<?php echo $question_id; ?>][image_id]" value="<?php echo $image_id; ?>"> |
| 48 | <div class="tutor-media-preview"> |
| 49 | <a href="javascript:;" class="tutor-media-upload-btn"> |
| 50 | <?php |
| 51 | if ($image_id){ |
| 52 | echo '<img src="'.wp_get_attachment_image_url($image_id).'" />'; |
| 53 | }else{ |
| 54 | echo '<i class="tutor-icon-image1"></i>'; |
| 55 | } |
| 56 | ?> |
| 57 | </a> |
| 58 | </div> |
| 59 | <div class="tutor-media-upload-trash-wrap"> |
| 60 | <a href="javascript:;" class="tutor-media-upload-trash">×</a> |
| 61 | </div> |
| 62 | </div> |
| 63 | </div> |
| 64 | </div> |
| 65 | </div> |
| 66 | <div class="tutor-quiz-builder-group"> |
| 67 | <h4><?php _e('Answer option view format', 'tutor'); ?></h4> |
| 68 | <div class="tutor-quiz-builder-row"> |
| 69 | <div class="tutor-quiz-builder-col auto-width"> |
| 70 | <label> |
| 71 | <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="text" <?php |
| 72 | echo $answer_view_format ? checked('text', $answer_view_format) : 'checked="checked"' ?>> <?php _e('Only text', 'tutor'); ?> |
| 73 | </label> |
| 74 | </div> |
| 75 | <div class="tutor-quiz-builder-col auto-width"> |
| 76 | <label> |
| 77 | <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="image" <?php echo |
| 78 | checked('image', $answer_view_format) ?> > <?php _e('Only Image', 'tutor'); ?> |
| 79 | </label> |
| 80 | </div> |
| 81 | <div class="tutor-quiz-builder-col auto-width"> |
| 82 | <label> |
| 83 | <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="text_image" <?php echo checked('text_image', $answer_view_format) ?> > <?php _e('Text & Image both', 'tutor'); ?> |
| 84 | </label> |
| 85 | </div> |
| 86 | </div> |
| 87 | </div> |
| 88 | <?php |
| 89 | }elseif($question_type === 'fill_in_the_blank'){ |
| 90 | ?> |
| 91 | <div class="tutor-quiz-builder-group"> |
| 92 | <h4><?php _e('Question Title', 'tutor'); ?></h4> |
| 93 | <div class="tutor-quiz-builder-row"> |
| 94 | <div class="tutor-quiz-builder-col"> |
| 95 | <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_title]" value="<?php echo $answer_title; ?>"> |
| 96 | </div> |
| 97 | </div> |
| 98 | <p class="help"><?php _e( 'Please make sure that <b>{dash}</b> variable contains in your question title to show dash, You can use multiple variable', 'tutor' ); ?></p> |
| 99 | </div> |
| 100 | |
| 101 | <div class="tutor-quiz-builder-group"> |
| 102 | <h4><?php _e('Gap Answer', 'tutor'); ?></h4> |
| 103 | <div class="tutor-quiz-builder-row"> |
| 104 | <div class="tutor-quiz-builder-col"> |
| 105 | <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_two_gap_match]" value="<?php echo $answer_two_gap_match; ?>"> |
| 106 | </div> |
| 107 | </div> |
| 108 | <p class="help"><?php _e( 'Separate multiple answer by pipe <b>( | )</b> , 1 answer per variable assigned in question', 'tutor' ); ?></p> |
| 109 | </div> |
| 110 | |
| 111 | |
| 112 | <?php |
| 113 | }elseif($question_type === 'matching'){ |
| 114 | ?> |
| 115 | <div class="tutor-quiz-builder-group"> |
| 116 | <h4><?php _e('Answer title', 'tutor'); ?></h4> |
| 117 | <div class="tutor-quiz-builder-row"> |
| 118 | <div class="tutor-quiz-builder-col"> |
| 119 | <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_title]" value="<?php echo $answer_title; ?>"> |
| 120 | </div> |
| 121 | </div> |
| 122 | </div> |
| 123 | <div class="tutor-quiz-builder-group"> |
| 124 | <h4><?php _e('Matched Answer title', 'tutor'); ?></h4> |
| 125 | <div class="tutor-quiz-builder-row"> |
| 126 | <div class="tutor-quiz-builder-col"> |
| 127 | <input type="text" name="quiz_answer[<?php echo $question_id; ?>][matched_answer_title]" value="<?php echo $answer_two_gap_match; ?>"> |
| 128 | </div> |
| 129 | </div> |
| 130 | </div> |
| 131 | |
| 132 | <div class="tutor-quiz-builder-group"> |
| 133 | <h4><?php _e('Upload Image', 'tutor'); ?></h4> |
| 134 | <div class="tutor-quiz-builder-row"> |
| 135 | <div class="tutor-quiz-builder-col"> |
| 136 | <div class="tutor-media-upload-wrap"> |
| 137 | <input type="hidden" name="quiz_answer[<?php echo $question_id; ?>][image_id]" value="<?php echo $image_id; ?>"> |
| 138 | <div class="tutor-media-preview"> |
| 139 | <a href="javascript:;" class="tutor-media-upload-btn"> |
| 140 | <?php |
| 141 | if ($image_id){ |
| 142 | echo '<img src="'.wp_get_attachment_image_url($image_id).'" />'; |
| 143 | }else{ |
| 144 | echo '<i class="tutor-icon-image1"></i>'; |
| 145 | } |
| 146 | ?> |
| 147 | </a> |
| 148 | </div> |
| 149 | <div class="tutor-media-upload-trash-wrap"> |
| 150 | <a href="javascript:;" class="tutor-media-upload-trash">×</a> |
| 151 | </div> |
| 152 | </div> |
| 153 | </div> |
| 154 | </div> |
| 155 | </div> |
| 156 | |
| 157 | <div class="tutor-quiz-builder-group"> |
| 158 | <h4><?php _e('Answer option view format', 'tutor'); ?></h4> |
| 159 | <div class="tutor-quiz-builder-row"> |
| 160 | <div class="tutor-quiz-builder-col auto-width"> |
| 161 | <label> |
| 162 | <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="text" <?php echo $answer_view_format ? checked('text', $answer_view_format) : 'checked="checked"' ?>> |
| 163 | <?php _e('Only text', '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 $question_id; ?>][answer_view_format]" value="image" <?php echo checked('image', $answer_view_format) ?> > |
| 169 | <?php _e('Only Image', 'tutor'); ?> |
| 170 | </label> |
| 171 | </div> |
| 172 | <div class="tutor-quiz-builder-col auto-width"> |
| 173 | <label> |
| 174 | <input type="radio" name="quiz_answer[<?php echo $question_id; ?>][answer_view_format]" value="text_image" <?php echo checked('text_image', $answer_view_format) ?> > |
| 175 | <?php _e('Text & Image both', 'tutor'); ?> |
| 176 | </label> |
| 177 | </div> |
| 178 | </div> |
| 179 | </div> |
| 180 | |
| 181 | <?php |
| 182 | }elseif ($question_type === 'image_matching'){ |
| 183 | ?> |
| 184 | |
| 185 | <div class="tutor-quiz-builder-group"> |
| 186 | <h4><?php _e('Upload Image', 'tutor'); ?></h4> |
| 187 | <div class="tutor-quiz-builder-row"> |
| 188 | <div class="tutor-quiz-builder-col"> |
| 189 | <div class="tutor-media-upload-wrap"> |
| 190 | <input type="hidden" name="quiz_answer[<?php echo $question_id; ?>][image_id]" value="<?php echo $image_id; ?>"> |
| 191 | <div class="tutor-media-preview"> |
| 192 | <a href="javascript:;" class="tutor-media-upload-btn"> |
| 193 | <?php |
| 194 | if ($image_id){ |
| 195 | echo '<img src="'.wp_get_attachment_image_url($image_id).'" />'; |
| 196 | }else{ |
| 197 | echo '<i class="tutor-icon-image1"></i>'; |
| 198 | } |
| 199 | ?> |
| 200 | </a> |
| 201 | </div> |
| 202 | <div class="tutor-media-upload-trash-wrap"> |
| 203 | <a href="javascript:;" class="tutor-media-upload-trash">×</a> |
| 204 | </div> |
| 205 | </div> |
| 206 | </div> |
| 207 | </div> |
| 208 | </div> <!-- /.tutor-quiz-builder-group --> |
| 209 | |
| 210 | <div class="tutor-quiz-builder-group"> |
| 211 | <h4><?php _e('Image matched text', 'tutor'); ?></h4> |
| 212 | <div class="tutor-quiz-builder-row"> |
| 213 | <div class="tutor-quiz-builder-col"> |
| 214 | <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_title]" value="<?php echo $answer_title; ?>"> |
| 215 | </div> |
| 216 | </div> |
| 217 | </div> <!-- /.tutor-quiz-builder-group --> |
| 218 | |
| 219 | <?php |
| 220 | }elseif($question_type === 'image_answering'){ |
| 221 | ?> |
| 222 | <div class="tutor-quiz-builder-group"> |
| 223 | <h4><?php _e('Upload Image', 'tutor'); ?></h4> |
| 224 | <div class="tutor-quiz-builder-row"> |
| 225 | <div class="tutor-quiz-builder-col"> |
| 226 | <div class="tutor-media-upload-wrap"> |
| 227 | <input type="hidden" name="quiz_answer[<?php echo $question_id; ?>][image_id]" value="<?php echo $image_id; ?>"> |
| 228 | <div class="tutor-media-preview"> |
| 229 | <a href="javascript:;" class="tutor-media-upload-btn"> |
| 230 | <?php |
| 231 | if ($image_id){ |
| 232 | echo '<img src="'.wp_get_attachment_image_url($image_id).'" />'; |
| 233 | }else{ |
| 234 | echo '<i class="tutor-icon-image1"></i>'; |
| 235 | } |
| 236 | ?> |
| 237 | </a> |
| 238 | </div> |
| 239 | <div class="tutor-media-upload-trash-wrap"> |
| 240 | <a href="javascript:;" class="tutor-media-upload-trash">×</a> |
| 241 | </div> |
| 242 | </div> |
| 243 | </div> |
| 244 | </div> |
| 245 | </div> <!-- /.tutor-quiz-builder-group --> |
| 246 | |
| 247 | <div class="tutor-quiz-builder-group"> |
| 248 | <h4><?php _e('Answer input value', 'tutor'); ?></h4> |
| 249 | <div class="tutor-quiz-builder-row"> |
| 250 | <div class="tutor-quiz-builder-col"> |
| 251 | <input type="text" name="quiz_answer[<?php echo $question_id; ?>][answer_title]" value="<?php echo $answer_title; ?>"> |
| 252 | </div> |
| 253 | </div> |
| 254 | <p class="help"><?php _e('Student input text should be matched with this answer, write in <b>Small Caps</b>','tutor'); ?></p> |
| 255 | </div> <!-- /.tutor-quiz-builder-group --> |
| 256 | |
| 257 | <?php |
| 258 | } |
| 259 | ?> |
| 260 | |
| 261 | <div class="tutor-quiz-answers-form-footer tutor-quiz-builder-form-row"> |
| 262 | <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> |
| 263 | </div> |
| 264 | |
| 265 | </div> |