comment.php
4 years ago
complete_form.php
4 years ago
content.php
4 years ago
lesson_sidebar.php
4 years ago
required-enroll.php
4 years ago
sidebar_question_and_answer.php
4 years ago
sidebar_question_and_answer.php
64 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Question and answer in left sidebar at course spotlight |
| 4 | * |
| 5 | * @since v.1.0.0 |
| 6 | * @author themeum |
| 7 | * @url https://themeum.com |
| 8 | * |
| 9 | * @package TutorLMS/Templates |
| 10 | * @version 1.5.2 |
| 11 | */ |
| 12 | global $post; |
| 13 | $currentPost = $post; |
| 14 | |
| 15 | $course_id = tutor_utils()->get_course_id_by_content( $post ); |
| 16 | |
| 17 | $disable_qa_for_this_course = get_post_meta( $course_id, '_tutor_enable_qa', true ) != 'yes'; |
| 18 | $enable_q_and_a_on_course = tutor_utils()->get_option( 'enable_q_and_a_on_course' ); |
| 19 | if ( ! $enable_q_and_a_on_course || $disable_qa_for_this_course ) { |
| 20 | tutor_load_template( 'single.course.q_and_a_turned_off' ); |
| 21 | return; |
| 22 | } |
| 23 | |
| 24 | echo '<div class="tutor-qna-spotlight-sidebar">'; |
| 25 | do_action( 'tutor_course/question_and_answer/before' ); |
| 26 | |
| 27 | $questions = tutor_utils()->get_qa_questions( 0, 20, $search_term = '', $question_id = null, $meta_query = null, $asker_id = null, $question_status = null, $count_only = false, $args = array('course_id' => $course_id) ); |
| 28 | foreach ( $questions as $question ) { |
| 29 | tutor_load_template_from_custom_path( |
| 30 | tutor()->path . '/views/qna/qna-single.php', |
| 31 | array( |
| 32 | 'question_id' => $question->comment_ID, |
| 33 | 'context' => 'course-single-qna-sidebar', |
| 34 | ), |
| 35 | false |
| 36 | ); |
| 37 | } |
| 38 | |
| 39 | if(!count($questions)) : ?> |
| 40 | <div class="tutor-empty-state-wrapper"> |
| 41 | <div class="tutor-empty-state td-empty-state tutor-p-32 tutor-text-center"> |
| 42 | <img src="<?php echo esc_url( tutor()->url . 'assets/images/empty-qa.svg' ); ?>" alt="<?php __( "No Data Available in this Section", "tutor" ); ?>" width="85%"> |
| 43 | <div class="tutor-fs-6 tutor-color-secondary tutor-text-center tutor-mt-20"> |
| 44 | <?php _e( "No questions yet", "tutor" ); ?> |
| 45 | </div> |
| 46 | <div class="tutor-fs-7 tutor-color-muted tutor-mt-12"> |
| 47 | <?php _e( "Describe what you're trying to achieve and where you're getting stuck", "tutor" ); ?> |
| 48 | </div> |
| 49 | </div> |
| 50 | </div> |
| 51 | <?php endif; |
| 52 | |
| 53 | tutor_load_template_from_custom_path( |
| 54 | tutor()->path . '/views/qna/qna-new.php', |
| 55 | array( |
| 56 | 'course_id' => $course_id, |
| 57 | 'context' => 'course-single-qna-sidebar', |
| 58 | ), |
| 59 | false |
| 60 | ); |
| 61 | do_action( 'tutor_course/question_and_answer/after' ); |
| 62 | echo '</div>'; |
| 63 | |
| 64 |