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.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 / views / qna / qna-table.php
tutor / views / qna Last commit date
contexts.php 3 years ago qna-new.php 3 years ago qna-single.php 3 years ago qna-table.php 3 years ago
qna-table.php
213 lines
1 <?php
2 /**
3 * Tutor Q&A table
4 *
5 * @package Tutor\Views
6 * @subpackage Tutor\Q&A
7 * @author Themeum <support@themeum.com>
8 * @link https://themeum.com
9 * @since 2.0.0
10 */
11
12 extract( $data ); // $qna_list, $context, $qna_pagination, $view_as
13
14 $page_key = 'qna-table';
15 $table_columns = include __DIR__ . '/contexts.php';
16 $view_as = isset( $view_as ) ? $view_as : ( is_admin() ? 'instructor' : 'student' );
17 ?>
18 <?php if ( is_array( $qna_list ) && count( $qna_list ) ) : ?>
19 <div class="tutor-table-responsive">
20 <table data-qna_context="<?php echo esc_attr( $context ); ?>" class="frontend-dashboard-qna-table-<?php echo esc_attr( $view_as ); ?> tutor-table tutor-table-middle qna-list-table">
21 <thead>
22 <tr>
23 <?php foreach ( $table_columns as $key => $column ) : ?>
24 <th style="<?php echo esc_attr( 'question' == $key ? 'width: 40%;' : '' ); ?>">
25 <?php echo ( 'action' != $key ? $column : '' ); //phpcs:ignore -- contain safe data ?>
26 </th>
27 <?php endforeach; ?>
28 </tr>
29 </thead>
30
31 <tbody>
32 <?php
33 $current_user_id = get_current_user_id();
34 foreach ( $qna_list as $qna ) :
35 $id_string_delete = 'tutor_delete_qna_' . $qna->comment_ID;
36 $row_id = 'tutor_qna_row_' . $qna->comment_ID;
37 $menu_id = 'tutor_qna_menu_id_' . $qna->comment_ID;
38 $is_self = $current_user_id == $qna->user_id;
39 $key_slug = 'frontend-dashboard-qna-table-student' == $context ? '_' . $current_user_id : '';
40
41 $meta = $qna->meta;
42 $is_solved = (int) tutor_utils()->array_get( 'tutor_qna_solved' . $key_slug, $meta, 0 );
43 $is_important = (int) tutor_utils()->array_get( 'tutor_qna_important' . $key_slug, $meta, 0 );
44 $is_archived = (int) tutor_utils()->array_get( 'tutor_qna_archived' . $key_slug, $meta, 0 );
45 $is_read = (int) tutor_utils()->array_get( 'tutor_qna_read' . $key_slug, $meta, 0 );
46 ?>
47 <tr id="<?php echo esc_attr( $row_id ); ?>" data-question_id="<?php echo esc_attr( $qna->comment_ID ); ?>" class="<?php echo $is_read ? 'is-qna-read' : ''; ?>">
48 <?php foreach ( $table_columns as $key => $column ) : ?>
49 <td>
50 <?php if ( 'checkbox' == $key ) : ?>
51 <div class="tutor-d-flex tutor-align-center">
52 <input id="tutor-admin-list-<?php echo esc_attr( $qna->comment_ID ); ?>" type="checkbox" class="tutor-form-check-input tutor-bulk-checkbox" name="tutor-bulk-checkbox-all" value="<?php echo esc_attr( $qna->comment_ID ); ?>" />
53 </div>
54 <?php elseif ( 'student' == $key ) : ?>
55 <div class="tutor-d-flex tutor-align-center tutor-gap-2">
56 <div class="tooltip-wrap tooltip-icon-custom tutor-qna-badges-wrapper tutor-mt-4">
57 <span
58 data-state-class-0="tutor-icon-important-line"
59 data-state-class-1="tutor-icon-important-bold"
60 data-action="important"
61 data-state-class-selector="i"
62 >
63 <i class="<?php echo $is_important ? 'tutor-icon-important-bold' : 'tutor-icon-important-line'; ?> tutor-cursor-pointer" area-hidden="true"></i>
64 </span>
65
66 <span class="tooltip-txt tooltip-bottom">
67 <?php $is_important ? esc_html_e( 'This conversation is important', 'tutor' ) : esc_html_e( 'Mark this conversation as important', 'tutor' ); ?>
68 </span>
69 </div>
70
71 <?php
72 echo wp_kses(
73 tutor_utils()->get_tutor_avatar( $qna->user_id ),
74 tutor_utils()->allowed_avatar_tags()
75 );
76 ?>
77
78 <div>
79 <div>
80 <?php echo esc_html( $qna->display_name ); ?>
81 </div>
82 <div class="tutor-fs-7 tutor-color-muted tutor-mt-4">
83 <?php echo esc_html( human_time_diff( strtotime( $qna->comment_date ) ) ); ?>
84 </div>
85 </div>
86 </div>
87 <?php elseif ( 'question' == $key ) : ?>
88 <?php $content = ( stripslashes( $qna->comment_content ) ); ?>
89 <a href="<?php echo esc_url( add_query_arg( array( 'question_id' => $qna->comment_ID ), tutor()->current_url ) ); ?>">
90 <div class="tutor-form-feedback tutor-qna-question-col <?php echo $is_read ? 'is-read' : ''; ?>">
91 <i class="tutor-icon-bullet-point tutor-form-feedback-icon" area-hidden="true"></i>
92 <div class="tutor-qna-desc">
93 <div class="tutor-qna-content tutor-fs-6 tutor-fw-bold tutor-color-black">
94 <?php
95 $limit = 60;
96 $content = strlen( $content ) > $limit ? substr( $content, 0, $limit ) . '...' : $content;
97
98 echo $content //phpcs:ignore
99 ?>
100 </div>
101 <div class="tutor-fs-7 tutor-color-secondary">
102 <span class="tutor-fw-medium"><?php esc_html_e( 'Course' ); ?>:</span>
103 <span><?php echo esc_html( $qna->post_title ); ?></span>
104 </div>
105 </div>
106 </div>
107 </a>
108 <?php elseif ( 'reply' == $key ) : ?>
109 <?php echo esc_html( $qna->answer_count ); ?>
110 <?php elseif ( 'waiting_since' == $key ) : ?>
111 <?php echo esc_html( human_time_diff( strtotime( $qna->comment_date ) ) ); ?>
112 <?php elseif ( 'status' == $key ) : ?>
113 <div class="tooltip-wrap tooltip-icon-custom" >
114 <i class="tutor-fs-4 <?php echo $is_solved ? 'tutor-icon-circle-mark tutor-color-success' : 'tutor-icon-circle-mark-line tutor-color-muted'; ?>"></i>
115 <span class="tooltip-txt tooltip-bottom">
116 <?php $is_solved ? esc_html_e( 'Solved', 'tutor' ) : esc_html_e( 'Unresolved Yet', 'tutor' ); ?>
117 </span>
118 </div>
119 <?php elseif ( 'action' == $key ) : ?>
120 <div class="tutor-d-flex tutor-align-center tutor-justify-end tutor-gap-1">
121 <a href="<?php echo esc_url( add_query_arg( array( 'question_id' => $qna->comment_ID ), tutor()->current_url ) ); ?>" class="tutor-btn tutor-btn-outline-primary tutor-btn-sm">
122 <?php esc_html_e( 'Reply', 'tutor' ); ?>
123 </a>
124
125 <div class="tutor-dropdown-parent">
126 <button type="button" class="tutor-iconic-btn" action-tutor-dropdown="toggle">
127 <span class="tutor-icon-kebab-menu" area-hidden="true"></span>
128 </button>
129 <ul class="tutor-dropdown tutor-dropdown-dark tutor-text-left">
130 <?php if ( 'frontend-dashboard-qna-table-student' != $context ) : ?>
131 <li class="tutor-qna-badges tutor-qna-badges-wrapper">
132 <a class="tutor-dropdown-item" href="#" data-action="archived" data-state-text-selector="[data-state-text]" data-state-class-selector="[data-state-class]" data-state-text-0="<?php esc_attr_e( 'Archive', 'tutor' ); ?>" data-state-text-1="<?php esc_attr_e( 'Un-archive', 'tutor' ); ?>">
133 <span class="tutor-icon-archive tutor-mr-8" data-state-class></span>
134 <span data-state-text>
135 <?php $is_archived ? esc_html_e( 'Un-archive', 'tutor' ) : esc_html_e( 'Archive', 'tutor' ); ?>
136 </span>
137 </a>
138 </li>
139 <?php endif; ?>
140 <li class="tutor-qna-badges tutor-qna-badges-wrapper">
141 <a class="tutor-dropdown-item" href="#" data-action="read" data-state-text-selector="[data-state-text]" data-state-class-selector="[data-state-class]" data-state-text-0="<?php esc_attr_e( 'Mark as Read', 'tutor' ); ?>" data-state-text-1="<?php esc_attr_e( 'Mark as Unread', 'tutor' ); ?>">
142 <span class="tutor-icon-envelope tutor-mr-8" data-state-class></span>
143 <span data-state-text>
144 <?php $is_read ? esc_html_e( 'Mark as Unread', 'tutor' ) : esc_html_e( 'Mark as read', 'tutor' ); ?>
145 </span>
146 </a>
147 </li>
148 <li>
149 <a class="tutor-dropdown-item" href="#" data-tutor-modal-target="<?php echo esc_attr( $id_string_delete ); ?>">
150 <span class="tutor-icon-trash-can-bold tutor-mr-8"></span>
151 <span><?php esc_html_e( 'Delete', 'tutor' ); ?></span>
152 </a>
153 </li>
154 </ul>
155 </div>
156
157 <!-- Delete confirmation modal -->
158 <div id="<?php echo esc_attr( $id_string_delete ); ?>" class="tutor-modal">
159 <div class="tutor-modal-overlay"></div>
160 <div class="tutor-modal-window">
161 <div class="tutor-modal-content tutor-modal-content-white">
162 <button class="tutor-iconic-btn tutor-modal-close-o" data-tutor-modal-close>
163 <span class="tutor-icon-times" area-hidden="true"></span>
164 </button>
165
166 <div class="tutor-modal-body tutor-text-center">
167 <div class="tutor-mt-48">
168 <img class="tutor-d-inline-block" src="<?php echo esc_url( trailingslashit( tutor()->url ) . 'assets/images/icon-trash.svg' ); ?>" />
169 </div>
170
171 <div class="tutor-fs-3 tutor-fw-medium tutor-color-black tutor-mb-12"><?php esc_html_e( 'Delete This Question?', 'tutor' ); ?></div>
172 <div class="tutor-fs-6 tutor-color-muted"><?php esc_html_e( 'All the replies also will be deleted.', 'tutor' ); ?></div>
173
174 <div class="tutor-d-flex tutor-justify-center tutor-my-48">
175 <button data-tutor-modal-close class="tutor-btn tutor-btn-outline-primary">
176 <?php esc_html_e( 'Cancel', 'tutor' ); ?>
177 </button>
178 <button class="tutor-btn tutor-btn-primary tutor-list-ajax-action tutor-ml-20" data-request_data='{"question_id":<?php echo esc_attr( $qna->comment_ID ); ?>,"action":"tutor_delete_dashboard_question"}' data-delete_element_id="<?php echo esc_attr( $row_id ); ?>">
179 <?php esc_html_e( 'Yes, Delete This', 'tutor' ); ?>
180 </button>
181 </div>
182 </div>
183 </div>
184 </div>
185 </div>
186 </div>
187 <?php endif; ?>
188 </td>
189 <?php endforeach; ?>
190 </tr>
191 <?php endforeach; ?>
192 </tbody>
193 </table>
194 </div>
195 <?php else : ?>
196 <?php tutor_utils()->tutor_empty_state( tutor_utils()->not_found_text() ); ?>
197 <?php endif; ?>
198
199 <?php if ( $qna_pagination['total_items'] > $qna_pagination['per_page'] ) : ?>
200 <div class="tutor-mt-32">
201 <?php
202 $pagination_data = array(
203 'base' => ! empty( $qna_pagination['base'] ) ? $qna_pagination['base'] : null,
204 'total_items' => $qna_pagination['total_items'],
205 'per_page' => $qna_pagination['per_page'],
206 'paged' => $qna_pagination['paged'],
207 );
208 $pagination_template = tutor()->path . 'views/elements/pagination.php';
209 tutor_load_template_from_custom_path( $pagination_template, $pagination_data );
210 ?>
211 </div>
212 <?php endif; ?>
213