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.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 2 months ago qna-table.php 2 months ago
qna-table.php
220 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" aria-hidden="true"></i>
64 </span>
65
66 <span class="tooltip-txt tooltip-right arrow-center">
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" aria-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', 'tutor' ); ?>:</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-top">
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 <?php
122 $query_args = array( 'question_id' => $qna->comment_ID );
123 $front_url = add_query_arg( $query_args, tutor()->current_url );
124 $admin_url = add_query_arg( $query_args, admin_url( 'admin.php?page=question_answer' ) );
125 $url = is_admin() ? $admin_url : $front_url;
126 ?>
127 <a href="<?php echo esc_url( $url ); ?>" class="tutor-btn tutor-btn-outline-primary tutor-btn-sm">
128 <?php esc_html_e( 'Reply', 'tutor' ); ?>
129 </a>
130
131 <div class="tutor-dropdown-parent">
132 <button type="button" class="tutor-iconic-btn" action-tutor-dropdown="toggle">
133 <span class="tutor-icon-kebab-menu" aria-hidden="true"></span>
134 </button>
135 <ul class="tutor-dropdown tutor-dropdown-dark tutor-text-left">
136 <?php if ( 'frontend-dashboard-qna-table-student' != $context ) : ?>
137 <li class="tutor-qna-badges tutor-qna-badges-wrapper">
138 <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' ); ?>">
139 <span class="tutor-icon-archive tutor-mr-8" data-state-class></span>
140 <span data-state-text>
141 <?php $is_archived ? esc_html_e( 'Un-archive', 'tutor' ) : esc_html_e( 'Archive', 'tutor' ); ?>
142 </span>
143 </a>
144 </li>
145 <?php endif; ?>
146 <li class="tutor-qna-badges tutor-qna-badges-wrapper">
147 <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' ); ?>">
148 <span class="tutor-icon-envelope tutor-mr-8" data-state-class></span>
149 <span data-state-text>
150 <?php $is_read ? esc_html_e( 'Mark as Unread', 'tutor' ) : esc_html_e( 'Mark as read', 'tutor' ); ?>
151 </span>
152 </a>
153 </li>
154 <li>
155 <a class="tutor-dropdown-item" href="#" data-tutor-modal-target="<?php echo esc_attr( $id_string_delete ); ?>">
156 <span class="tutor-icon-trash-can-bold tutor-mr-8"></span>
157 <span><?php esc_html_e( 'Delete', 'tutor' ); ?></span>
158 </a>
159 </li>
160 </ul>
161 </div>
162
163 <!-- Delete confirmation modal -->
164 <div id="<?php echo esc_attr( $id_string_delete ); ?>" class="tutor-modal" role="dialog" aria-modal="true" aria-labelledby="<?php echo esc_attr( $id_string_delete ); ?>-title" aria-hidden="true">
165 <div class="tutor-modal-overlay"></div>
166 <div class="tutor-modal-window">
167 <div class="tutor-modal-content tutor-modal-content-white">
168 <button type="button" class="tutor-iconic-btn tutor-modal-close-o" data-tutor-modal-close aria-label="<?php esc_attr_e( 'Close', 'tutor' ); ?>">
169 <span class="tutor-icon-times" aria-hidden="true"></span>
170 </button>
171
172 <div class="tutor-modal-body tutor-text-center">
173 <div class="tutor-mt-48">
174 <img class="tutor-d-inline-block" src="<?php echo esc_url( trailingslashit( tutor()->url ) . 'assets/images/icon-trash.svg' ); ?>" alt="" aria-hidden="true" />
175 </div>
176
177 <div id="<?php echo esc_attr( $id_string_delete ); ?>-title" class="tutor-fs-3 tutor-fw-medium tutor-color-black tutor-mb-12"><?php esc_html_e( 'Delete This Question?', 'tutor' ); ?></div>
178 <div class="tutor-fs-6 tutor-color-muted"><?php esc_html_e( 'All the replies also will be deleted.', 'tutor' ); ?></div>
179
180 <div class="tutor-d-flex tutor-justify-center tutor-my-48">
181 <button data-tutor-modal-close class="tutor-btn tutor-btn-outline-primary">
182 <?php esc_html_e( 'Cancel', 'tutor' ); ?>
183 </button>
184 <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 ); ?>">
185 <?php esc_html_e( 'Yes, Delete This', 'tutor' ); ?>
186 </button>
187 </div>
188 </div>
189 </div>
190 </div>
191 </div>
192 </div>
193 <?php endif; ?>
194 </td>
195 <?php endforeach; ?>
196 </tr>
197 <?php endforeach; ?>
198 </tbody>
199 </table>
200
201 <?php if ( $qna_pagination['total_items'] > $qna_pagination['per_page'] ) : ?>
202 <div class="tutor-mt-32">
203 <?php
204 $pagination_data = array(
205 'base' => ! empty( $qna_pagination['base'] ) ? $qna_pagination['base'] : null,
206 'total_items' => $qna_pagination['total_items'],
207 'per_page' => $qna_pagination['per_page'],
208 'paged' => $qna_pagination['paged'],
209 );
210 $pagination_template = tutor()->path . 'views/elements/pagination.php';
211 tutor_load_template_from_custom_path( $pagination_template, $pagination_data );
212 ?>
213 </div>
214 <?php endif; ?>
215 </div>
216 <!-- end table responsive -->
217 <?php else : ?>
218 <?php tutor_utils()->render_list_empty_state(); ?>
219 <?php endif; ?>
220