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_form.php
227 lines
| 1 | <?php |
| 2 | global $wpdb; |
| 3 | $settings = maybe_unserialize($question->question_settings); |
| 4 | ?> |
| 5 | |
| 6 | <div class="quiz-questions-form"> |
| 7 | |
| 8 | |
| 9 | <div class="question-form-header"> |
| 10 | <a href="javascript:;" class="back-to-quiz-questions-btn open-tutor-quiz-modal" data-quiz-id="<?php echo $quiz_id; ?>" |
| 11 | data-back-to-tab="#quiz-builder-tab-questions"><i class="tutor-icon-next-2"></i> <?php _e('Back', 'tutor'); ?></a> |
| 12 | </div> |
| 13 | |
| 14 | |
| 15 | <div class="quiz-question-form-body"> |
| 16 | |
| 17 | |
| 18 | <div class="quiz_question_form"> |
| 19 | |
| 20 | <div class="tutor-quiz-builder-group"> |
| 21 | <h4><?php _e('Write your question here', 'tutor'); ?></h4> |
| 22 | <div class="tutor-quiz-builder-row"> |
| 23 | <div class="tutor-quiz-builder-col"> |
| 24 | <input type="text" name="tutor_quiz_question[<?php echo $question_id; ?>][question_title]" placeholder="<?php _e('Type your quiz title here', 'tutor'); ?>" value="<?php echo stripslashes($question->question_title); ?>"> |
| 25 | </div> |
| 26 | </div> |
| 27 | </div> |
| 28 | |
| 29 | <div class="tutor-quiz-builder-group"> |
| 30 | <h4><?php _e('Question Type', 'tutor'); ?></h4> |
| 31 | <div class="tutor-quiz-builder-row"> |
| 32 | <div class="tutor-quiz-builder-col"> |
| 33 | <div class="tutor-select"> |
| 34 | <div class="select-header"> |
| 35 | <span class="lead-option"> <i class="tutor-icon-yes-no"></i> True or False </span> |
| 36 | <span class="select-dropdown"><i class="tutor-icon-light-down"></i> </span> |
| 37 | <input type="hidden" class="tutor_select_value_holder" name="tutor_quiz_question[<?php echo $question_id; ?>][question_type]" value="" > |
| 38 | </div> |
| 39 | |
| 40 | <?php $question_types = tutor_utils()->get_question_types(); |
| 41 | |
| 42 | |
| 43 | ?> |
| 44 | |
| 45 | <div class="tutor-select-options" style="display: none;"> |
| 46 | <?php |
| 47 | $has_tutor_pro = tutor()->has_pro; |
| 48 | |
| 49 | foreach ($question_types as $type => $question_type){ |
| 50 | ?> |
| 51 | <p class="tutor-select-option" data-value="<?php echo $type; ?>" <?php echo $question->question_type===$type ? ' data-selected="selected"' : ''; ?> data-is-pro="<?php echo (! $has_tutor_pro && $question_type['is_pro']) ? 'true' : 'false' ?>" > |
| 52 | <?php echo $question_type['icon'].' '.$question_type['name']; ?> |
| 53 | |
| 54 | <?php |
| 55 | if (! $has_tutor_pro && $question_type['is_pro']){ |
| 56 | $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>'; |
| 57 | printf("<span class='question-type-pro' title='%s'>%s</span>",__('Pro version required', 'tutor'), $svg_lock ); |
| 58 | } |
| 59 | ?> |
| 60 | </p> |
| 61 | <?php |
| 62 | } |
| 63 | ?> |
| 64 | |
| 65 | </div> |
| 66 | </div> |
| 67 | </div> |
| 68 | </div> |
| 69 | </div> |
| 70 | |
| 71 | <div class="tutor-quiz-builder-group"> |
| 72 | <div class="tutor-quiz-builder-row"> |
| 73 | <div class="tutor-quiz-builder-col auto-width"> |
| 74 | <label class="btn-switch"> |
| 75 | <input type="checkbox" value="1" name="tutor_quiz_question[<?php echo $question_id; ?>][answer_required]" <?php checked('1', tutor_utils()->avalue_dot('answer_required', $settings)); ?> /> |
| 76 | <div class="btn-slider btn-round"></div> |
| 77 | </label> |
| 78 | <span><?php _e('Answer Required', 'tutor'); ?></span> |
| 79 | </div> |
| 80 | <div class="tutor-quiz-builder-col auto-width"> |
| 81 | <label class="btn-switch"> |
| 82 | <input type="checkbox" value="1" name="tutor_quiz_question[<?php echo $question_id; ?>][randomize_question]" <?php checked('1', tutor_utils()->avalue_dot('randomize_question', $settings)); ?> /> |
| 83 | <div class="btn-slider btn-round"></div> |
| 84 | </label> |
| 85 | <span><?php _e('Randomize', 'tutor'); ?></span> |
| 86 | </div> |
| 87 | </div> |
| 88 | </div> |
| 89 | |
| 90 | <div class="tutor-quiz-builder-group"> |
| 91 | <h4><?php _e('Point(s) for this answer', 'tutor'); ?></h4> |
| 92 | <div class="tutor-quiz-builder-row"> |
| 93 | <div class="tutor-quiz-builder-col"> |
| 94 | <input type="text" name="tutor_quiz_question[<?php echo $question_id; ?>][question_mark]" placeholder="<?php _e('set the mark ex. 10', 'tutor'); ?>" value="<?php |
| 95 | echo $question->question_mark; ?>"> |
| 96 | </div> |
| 97 | </div> |
| 98 | </div> |
| 99 | |
| 100 | <div class="tutor-quiz-builder-group"> |
| 101 | <div class="tutor-quiz-builder-row"> |
| 102 | <div class="tutor-quiz-builder-col auto-width"> |
| 103 | <label class="btn-switch"> |
| 104 | <input type="checkbox" value="1" name="tutor_quiz_question[<?php echo $question_id; ?>][show_question_mark]" <?php checked('1', tutor_utils()->avalue_dot('show_question_mark', $settings)); ?> /> |
| 105 | <div class="btn-slider btn-round"></div> |
| 106 | </label> |
| 107 | <span><?php _e('Display Points', 'tutor'); ?></span> |
| 108 | </div> |
| 109 | </div> |
| 110 | </div> |
| 111 | |
| 112 | <div class="tutor-quiz-builder-group"> |
| 113 | <h4><?php _e('Description', 'tutor'); ?> <span>(<?php _e('Optional', 'tutor'); ?>)</span></h4> |
| 114 | <div class="tutor-quiz-builder-row"> |
| 115 | <div class="tutor-quiz-builder-col"> |
| 116 | <textarea name="tutor_quiz_question[<?php echo $question_id; ?>][question_description]"><?php echo stripslashes($question->question_description);?></textarea> |
| 117 | </div> |
| 118 | </div> |
| 119 | </div> |
| 120 | |
| 121 | <div class="tutor-quiz-builder-group"> |
| 122 | <h4> |
| 123 | <?php |
| 124 | switch ($question->question_type){ |
| 125 | case 'true_false': |
| 126 | echo __('Input options for the question and select the correct answer.', 'tutor'); |
| 127 | break; |
| 128 | case 'ordering': |
| 129 | echo __('Make sure you’re saving the answers in the right order. Students will have to match this order.', 'tutor'); |
| 130 | break; |
| 131 | } |
| 132 | ?> |
| 133 | </h4> |
| 134 | <div class="tutor-quiz-builder-row"> |
| 135 | <div class="tutor-quiz-builder-col"> |
| 136 | <div id="tuotr_question_options_for_quiz" class="quiz-modal-field-wrap"> |
| 137 | <div id="tutor_quiz_question_answers" data-question-id="<?php echo $question_id; ?>"> |
| 138 | <?php |
| 139 | |
| 140 | $answers = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}tutor_quiz_question_answers where belongs_question_id = {$question_id} AND belongs_question_type = '{$question->question_type}' order by answer_order asc ;"); |
| 141 | if (is_array($answers) && count($answers)){ |
| 142 | foreach ($answers as $answer){ |
| 143 | ?> |
| 144 | <div class="tutor-quiz-answer-wrap" data-answer-id="<?php echo $answer->answer_id; ?>"> |
| 145 | <div class="tutor-quiz-answer"> |
| 146 | <span class="tutor-quiz-answer-title"> |
| 147 | <?php |
| 148 | echo stripslashes($answer->answer_title); |
| 149 | if ($answer->belongs_question_type === 'fill_in_the_blank'){ |
| 150 | echo ' ('.__('Answer', 'tutor').' : '; |
| 151 | echo "<strong>{$answer->answer_two_gap_match} </strong>)"; |
| 152 | } |
| 153 | if ($answer->belongs_question_type === 'matching'){ |
| 154 | echo " - {$answer->answer_two_gap_match}"; |
| 155 | } |
| 156 | ?> |
| 157 | </span> |
| 158 | |
| 159 | <?php |
| 160 | if ($answer->image_id){ |
| 161 | echo '<span class="tutor-question-answer-image"><img src="'.wp_get_attachment_image_url($answer->image_id).'" /> </span>'; |
| 162 | } |
| 163 | if ($question->question_type === 'true_false' || $question->question_type === 'single_choice'){ |
| 164 | ?> |
| 165 | <span class="tutor-quiz-answers-mark-correct-wrap"> |
| 166 | <input type="radio" name="mark_as_correct[<?php echo $answer->belongs_question_id; ?>]" |
| 167 | value="<?php echo $answer->answer_id; ?>" title="<?php _e('Mark as correct', 'tutor'); ?>" <?php checked(1, $answer->is_correct); ?> > |
| 168 | </span> |
| 169 | <?php |
| 170 | }elseif ($question->question_type === 'multiple_choice'){ |
| 171 | ?> |
| 172 | <span class="tutor-quiz-answers-mark-correct-wrap"> |
| 173 | <input type="checkbox" name="mark_as_correct[<?php echo $answer->belongs_question_id; ?>]" |
| 174 | value="<?php echo $answer->answer_id; ?>" title="<?php _e('Mark as correct', 'tutor'); ?>" <?php checked(1, $answer->is_correct); ?> > |
| 175 | </span> |
| 176 | <?php |
| 177 | } |
| 178 | ?> |
| 179 | <span class="tutor-quiz-answer-edit"> |
| 180 | <?php if ( $question->question_type !== 'true_false' ){ ?> |
| 181 | <a href="javascript:;"><i class="tutor-icon-pencil"></i> </a> |
| 182 | <?php } ?> |
| 183 | </span> |
| 184 | <span class="tutor-quiz-answer-sort-icon"><i class="tutor-icon-menu-2"></i> </span> |
| 185 | </div> |
| 186 | |
| 187 | <div class="tutor-quiz-answer-trash-wrap"> |
| 188 | <a href="javascript:;" class="answer-trash-btn" data-answer-id="<?php echo $answer->answer_id; ?>"><i class="tutor-icon-garbage"></i> </a> |
| 189 | </div> |
| 190 | </div> |
| 191 | <?php |
| 192 | } |
| 193 | } |
| 194 | ?> |
| 195 | </div> |
| 196 | |
| 197 | |
| 198 | <div id="tutor_quiz_question_answer_form"></div> |
| 199 | |
| 200 | |
| 201 | <a href="javascript:;" class="add_question_answers_option" data-question-id="<?php echo $question_id; ?>"> |
| 202 | <i class="tutor-icon-block tutor-icon-plus"></i> |
| 203 | <?php _e('Add An Option', 'tutor'); ?> |
| 204 | </a> |
| 205 | </div> |
| 206 | |
| 207 | <div id="quiz_validation_msg_wrap"></div> |
| 208 | |
| 209 | </div> |
| 210 | </div> |
| 211 | </div> |
| 212 | |
| 213 | </div> |
| 214 | |
| 215 | </div> |
| 216 | |
| 217 | </div> |
| 218 | |
| 219 | |
| 220 | <div class="tutor-quiz-builder-modal-control-btn-group question_form_inner"> |
| 221 | <div class="quiz-builder-btn-group-left"> |
| 222 | <a href="javascript:;" class="quiz-modal-tab-navigation-btn quiz-modal-question-save-btn"><?php _e('Save & Continue', 'tutor'); ?></a> |
| 223 | </div> |
| 224 | <div class="quiz-builder-btn-group-right"> |
| 225 | <a href="javascript:;" class="quiz-modal-tab-navigation-btn quiz-modal-btn-cancel"><?php _e('Cancel', 'tutor'); ?></a> |
| 226 | </div> |
| 227 | </div> |