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_answer_list.php
106 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Quiz question answer list |
| 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 | use TUTOR\Question_Answers_List; |
| 13 | |
| 14 | if ( 'open_ended' === $question_type || 'short_answer' === $question_type ) { |
| 15 | echo '<p class="tutor-px-32 tutor-py-16">' . |
| 16 | esc_html__( 'No option is necessary for this answer type', 'tutor' ) . |
| 17 | '</p>'; |
| 18 | return ''; |
| 19 | } |
| 20 | ?> |
| 21 | |
| 22 | <div id="tutor_quiz_question_answers" data-question-id="<?php echo esc_attr( $question_id ); ?>"> |
| 23 | <?php |
| 24 | $answers = Question_Answers_List::answer_list_by_question( $question_id, $question_type ); |
| 25 | |
| 26 | if ( is_array( $answers ) && count( $answers ) ) { |
| 27 | foreach ( $answers as $answer ) { |
| 28 | ?> |
| 29 | <div class="tutor-quiz-answer-wrap" data-answer-id="<?php echo esc_attr( $answer->answer_id ); ?>"> |
| 30 | <div class="tutor-quiz-answer"> |
| 31 | <span class="tutor-quiz-answer-title"> |
| 32 | <?php |
| 33 | echo esc_html( stripslashes( $answer->answer_title ) ); |
| 34 | if ( 'fill_in_the_blank' === $answer->belongs_question_type ) { |
| 35 | ?> |
| 36 | <?php esc_html_e( 'Answer', 'tutor' ); ?> |
| 37 | <strong> |
| 38 | <?php echo esc_html( stripslashes( $answer->answer_two_gap_match ) ); ?> |
| 39 | </strong> |
| 40 | <?php |
| 41 | } |
| 42 | |
| 43 | if ( 'matching' === $answer->belongs_question_type ) { |
| 44 | echo ' - ' . esc_html( stripslashes( $answer->answer_two_gap_match ) ); |
| 45 | } |
| 46 | ?> |
| 47 | </span> |
| 48 | |
| 49 | <?php |
| 50 | // Show image for the single answer. |
| 51 | if ( $answer->image_id ) { |
| 52 | echo '<span class="tutor-question-answer-image"> |
| 53 | <img src="' . esc_url( wp_get_attachment_image_url( $answer->image_id ) ) . '" /></span>'; |
| 54 | } |
| 55 | |
| 56 | if ( 'true_false' === $question_type || 'single_choice' === $question_type ) { |
| 57 | ?> |
| 58 | <span class="tutor-quiz-answers-mark-correct-wrap tutor-mr-4"> |
| 59 | <input type="radio" name="mark_as_correct[<?php echo esc_attr( $answer->belongs_question_id ); ?>]" value="<?php echo esc_attr( $answer->answer_id ); ?>" title="<?php esc_html_e( 'Mark as correct', 'tutor' ); ?>" <?php checked( 1, $answer->is_correct ); ?> > |
| 60 | </span> |
| 61 | <?php |
| 62 | } elseif ( 'multiple_choice' === $question_type ) { |
| 63 | ?> |
| 64 | <span class="tutor-quiz-answers-mark-correct-wrap tutor-mr-4"> |
| 65 | <input type="checkbox" name="mark_as_correct[<?php echo esc_attr( $answer->belongs_question_id ); ?>]" value="<?php echo esc_attr( $answer->answer_id ); ?>" title="<?php esc_html_e( 'Mark as correct', 'tutor' ); ?>" <?php checked( 1, $answer->is_correct ); ?> > |
| 66 | </span> |
| 67 | <?php |
| 68 | } |
| 69 | ?> |
| 70 | |
| 71 | <?php if ( 'true_false' !== $question_type ) : ?> |
| 72 | <span class="tutor-quiz-answer-edit tutor-mr-4"> |
| 73 | <a class="tutor-iconic-btn" href="javascript:;"> |
| 74 | <i class="tutor-icon-pencil" area-hidden="true"></i> |
| 75 | </a> |
| 76 | </span> |
| 77 | <?php endif; ?> |
| 78 | |
| 79 | <?php if ( 'fill_in_the_blank' !== $question_type ) : ?> |
| 80 | <span class="tutor-quiz-answer-sort-icon"> |
| 81 | <i class="tutor-d-flex tutor-icon-hamburger-o"></i> |
| 82 | </span> |
| 83 | <?php endif; ?> |
| 84 | </div> |
| 85 | |
| 86 | <?php if ( 'true_false' !== $question_type && 'fill_in_the_blank' !== $question_type ) : ?> |
| 87 | <div class="tutor-quiz-answer-trash-wrap tutor-d-flex"> |
| 88 | <a href="javascript:;" class="answer-trash-btn answer-trash-btn tutor-d-flex tutor-align-center" data-answer-id="<?php echo esc_attr( $answer->answer_id ); ?>"> |
| 89 | <i class="tutor-icon-trash-can"></i> |
| 90 | </a> |
| 91 | </div> |
| 92 | <?php endif; ?> |
| 93 | </div> |
| 94 | <?php |
| 95 | } |
| 96 | } |
| 97 | ?> |
| 98 | </div> |
| 99 | |
| 100 | <?php if ( 'true_false' != $question_type && ( 'fill_in_the_blank' != $question_type || empty( $answers ) ) ) : ?> |
| 101 | <a href="javascript:;" class="add_question_answers_option tutor-btn tutor-d-flex tutor-align-center" data-question-id="<?php echo esc_attr( $question_id ); ?>"> |
| 102 | <i class="tutor-icon-plus-o "></i> |
| 103 | <?php esc_html_e( 'Add An Option', 'tutor' ); ?> |
| 104 | </a> |
| 105 | <?php endif; ?> |
| 106 |