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.2 3.5.0 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.8.0 3.8.1 3.8.2 3.8.3 3.9.0 3.9.1 3.9.10 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9
tutor / templates / single / course / reviews.php
tutor / templates / single / course Last commit date
enrolled 3 days ago add-to-cart-edd.php 3 days ago add-to-cart-tutor.php 11 months ago add-to-cart-woocommerce.php 1 year ago continue-lesson.php 3 years ago course-benefits.php 2 months ago course-content.php 2 months ago course-entry-box.php 3 days ago course-requirements.php 2 months ago course-target-audience.php 2 months ago course-topics.php 3 days ago instructors.php 3 years ago lead-info.php 9 months ago material-includes.php 2 months ago q_and_a_turned_off.php 3 years ago reviews-loop.php 3 days ago reviews.php 3 days ago social_share.php 3 years ago tags.php 3 years ago wc-price-html.php 3 years ago
reviews.php
199 lines
1 <?php
2 /**
3 * Template for displaying course reviews
4 *
5 * @package Tutor\Templates
6 * @subpackage Single\Course
7 * @author Themeum <support@themeum.com>
8 * @link https://themeum.com
9 * @since 1.0.0
10 */
11
12 defined( 'ABSPATH' ) || exit;
13
14 use TUTOR\Input;
15 use Tutor\Models\EnrollmentModel;
16
17 $disable = ! get_tutor_option( 'enable_course_review' );
18 if ( $disable ) {
19 return;
20 }
21
22 global $is_enrolled, $course_rating;
23
24 $per_page = tutor_utils()->get_option( 'pagination_per_page', 10 );
25 $current_page = max( 1, Input::post( 'current_page', 0, Input::TYPE_INT ) );
26 $offset = ( $current_page - 1 ) * $per_page;
27
28 $current_user_id = get_current_user_id();
29 $course_id = Input::post( 'course_id', get_the_ID(), Input::TYPE_INT );
30 $reviews = tutor_utils()->get_course_reviews( $course_id, $offset, $per_page, false, array( 'approved' ), $current_user_id );
31 $reviews_total = tutor_utils()->get_course_reviews( $course_id, null, null, true, array( 'approved' ) );
32 $my_rating = tutor_utils()->get_reviews_by_user( 0, 0, 150, false, $course_id, array( 'approved', 'hold' ) );
33
34 if ( Input::has( 'course_id' ) ) {
35 // It's load more.
36 tutor_load_template( 'single.course.reviews-loop', array( 'reviews' => $reviews ) );
37 return;
38 }
39
40 /**
41 * Global $is_enrolled, $course_rating get null for third party
42 * who only include this file without single-course.php file.
43 *
44 * @since 2.1.9
45 */
46 if ( is_null( $is_enrolled ) ) {
47 $is_enrolled = EnrollmentModel::is_enrolled( $course_id, $current_user_id );
48 }
49
50 if ( is_null( $course_rating ) ) {
51 $course_rating = tutor_utils()->get_course_rating( $course_id );
52 }
53
54 do_action( 'tutor_course/single/enrolled/before/reviews' );
55 ?>
56
57 <div class="tutor-pagination-wrapper-replaceable">
58 <h3 class="tutor-fs-5 tutor-fw-bold tutor-color-black tutor-mb-24">
59 <?php
60 $review_title = apply_filters( 'tutor_course_reviews_section_title', __( 'Student Ratings & Reviews', 'tutor' ) );
61 echo esc_html( $review_title, 'tutor' );
62 ?>
63 </h3>
64
65 <?php if ( ! is_array( $reviews ) || ! count( $reviews ) ) : ?>
66 <?php tutor_utils()->tutor_empty_state( __( 'No Review Yet', 'tutor' ) ); ?>
67 <?php else : ?>
68 <div class="tutor-card tutor-review-card">
69 <div class="tutor-review-summary tutor-p-24 tutor-p-lg-40">
70 <div class="tutor-row tutor-gx-xl-5 tutor-align-center">
71 <div class="tutor-col-lg-auto tutor-text-center tutor-mb-16 tutor-mb-lg-0">
72 <div class="tutor-review-summary-average-rating tutor-mb-20">
73 <?php echo number_format( $course_rating->rating_avg, 1 ); ?>
74 </div>
75
76 <div>
77 <div class="tutor-d-inline-block">
78 <?php tutor_utils()->star_rating_generator_v2( $course_rating->rating_avg, null, false, '', 'lg' ); ?>
79 </div>
80 </div>
81
82 <div class="tutor-fs-6 tutor-color-secondary tutor-mt-12 tutor-total-rating-count">
83 <?php esc_html_e( 'Total ', 'tutor' ); ?>
84 <?php echo esc_html( $reviews_total ); ?>
85 <?php echo esc_html( _n( ' Rating', ' Ratings', count( $reviews ), 'tutor' ) ); ?>
86 </div>
87 </div>
88
89 <div class="tutor-col-lg">
90 <div class="tutor-review-summary-ratings">
91 <?php foreach ( $course_rating->count_by_value as $key => $value ) : ?>
92 <?php $rating_count_percent = ( $value > 0 ) ? ( $value * 100 ) / $course_rating->rating_count : 0; ?>
93 <div class="tutor-row tutor-align-center tutor-review-summary-rating">
94 <div class="tutor-col-auto">
95 <div class="tutor-ratings">
96 <div class="tutor-ratings-stars">
97 <span class="tutor-icon-star-line" aria-hidden="true"></span>
98 </div>
99 <div class="tutor-ratings-average">
100 <?php echo esc_html( $key ); ?>
101 </div>
102 </div>
103 </div>
104
105 <div class="tutor-col">
106 <div class="tutor-progress-bar tutor-ratings-progress-bar" style="--tutor-progress-value: <?php echo esc_attr( $rating_count_percent ); ?>%">
107 <span class="tutor-progress-value" aria-hidden="true"></span>
108 </div>
109 </div>
110
111 <div class="tutor-col-4 tutor-col-lg-3">
112 <span class="tutor-fs-6 tutor-color-secondary tutor-individual-star-rating">
113 <?php
114 /* translators: %s: rating count */
115 printf( esc_html( _n( '%s Rating', '%s Ratings', 0 == $value ? 1 : $value, 'tutor' ) ), number_format_i18n( $value ) );
116 ?>
117 </span>
118 </div>
119 </div>
120 <?php endforeach; ?>
121 </div>
122 </div>
123 </div>
124 </div>
125
126 <div class="tutor-hr" aria-hidden="true"></div>
127
128 <div class="tutor-reviews tutor-card-list tutor-pagination-content-appendable">
129 <?php tutor_load_template( 'single.course.reviews-loop', array( 'reviews' => $reviews ) ); ?>
130 </div>
131 </div>
132 <?php endif; ?>
133
134 <div class="tutor-row tutor-mt-40 tutor-mb-20">
135 <div class="tutor-col">
136 <?php if ( $is_enrolled ) : ?>
137 <button class="tutor-btn tutor-btn-primary write-course-review-link-btn">
138 <i class="tutor-icon-star-line tutor-mr-8"></i>
139 <?php
140 $is_new = ! $my_rating || empty( $my_rating->rating ) || empty( $my_rating->comment_content );
141 $is_new ? esc_html_e( 'Write a review', 'tutor' ) : esc_html_e( 'Edit review', 'tutor' );
142 ?>
143 </button>
144 <?php endif; ?>
145 </div>
146
147 <div class="tutor-col-auto">
148 <?php
149 $pagination_data = array(
150 'total_items' => $reviews_total,
151 'per_page' => $per_page,
152 'paged' => $current_page,
153 'layout' => array(
154 'type' => 'load_more',
155 'load_more_text' => __( 'Load More', 'tutor' ),
156 ),
157 'ajax' => array(
158 'action' => 'tutor_single_course_reviews_load_more',
159 'course_id' => $course_id,
160 ),
161 );
162 $pagination_template_frontend = tutor()->path . 'templates/dashboard/elements/pagination.php';
163 tutor_load_template_from_custom_path( $pagination_template_frontend, $pagination_data );
164 ?>
165 </div>
166 </div>
167 </div>
168
169 <?php if ( $is_enrolled ) : ?>
170 <div class="tutor-course-enrolled-review-wrap tutor-pt-16">
171 <div class="tutor-write-review-form" style="display: none;">
172 <form method="post">
173 <div class="tutor-star-rating-container">
174 <input type="hidden" name="course_id" value="<?php echo esc_attr( $course_id ); ?>"/>
175 <input type="hidden" name="review_id" value="<?php echo esc_attr( $my_rating ? $my_rating->comment_ID : '' ); ?>"/>
176 <input type="hidden" name="action" value="tutor_place_rating"/>
177 <div class="tutor-form-group">
178 <div class="tutor-ratings tutor-ratings-lg tutor-ratings-selectable" tutor-ratings-selectable>
179 <?php
180 tutor_utils()->star_rating_generator( tutor_utils()->get_rating_value( $my_rating ? $my_rating->rating : 0 ) );
181 ?>
182 </div>
183 </div>
184 <div class="tutor-form-group">
185 <textarea name="review" placeholder="<?php esc_html_e( 'write a review', 'tutor' ); ?>"><?php echo stripslashes( $my_rating ? $my_rating->comment_content : '' ); //phpcs:ignore ?></textarea>
186 </div>
187 <div class="tutor-form-group">
188 <button type="submit" class="tutor_submit_review_btn tutor-btn tutor-btn-primary">
189 <?php esc_html_e( 'Submit Review', 'tutor' ); ?>
190 </button>
191 </div>
192 </div>
193 </form>
194 </div>
195 </div>
196 <?php endif; ?>
197
198 <?php do_action( 'tutor_course/single/enrolled/after/reviews' ); ?>
199