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.2 3.2.3 3.3.0 3.3.1 3.4.0 3.4.1 3.4.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 / dashboard / discussions / qna-list.php
tutor / templates / dashboard / discussions Last commit date
comment-card.php 1 month ago comment-form.php 1 month ago comment-list.php 1 month ago comment-replies.php 1 month ago comment-single.php 1 month ago qna-card.php 1 month ago qna-form.php 1 month ago qna-list.php 1 week ago qna-replies.php 1 month ago qna-single.php 1 month ago
qna-list.php
132 lines
1 <?php
2 /**
3 * Q&A list template.
4 *
5 * @package Tutor\Templates
6 * @subpackage Dashboard
7 * @author Themeum <support@themeum.com>
8 * @link https://themeum.com
9 * @since 4.0.0
10 *
11 * These variables are inherited from the parent template file.
12 * template: /tutor/templates/dashboard/discussions.php
13 *
14 * @var string $discussion_url
15 * @var int $item_per_page
16 * @var int $offset
17 * @var string $order_filter
18 * @var int $current_page
19 */
20
21 defined( 'ABSPATH' ) || exit;
22
23 use Tutor\Components\ConfirmationModal;
24 use Tutor\Components\DropdownFilter;
25 use Tutor\Components\EmptyState;
26 use Tutor\Components\Pagination;
27 use Tutor\Components\Sorting;
28 use Tutor\Helpers\QueryHelper;
29 use TUTOR\Input;
30 use TUTOR\User;
31
32 if ( ! is_user_logged_in() ) {
33 return;
34 }
35
36 $user_id = get_current_user_id();
37 $is_instructor = tutor_utils()->is_instructor( $user_id, true );
38 $q_status = Input::get( 'data' );
39 $view_as = User::get_current_view_mode();
40 $asker_id = User::is_instructor_view() ? null : $user_id;
41 $item_per_page = isset( $item_per_page ) ? (int) $item_per_page : (int) tutor_utils()->get_option( 'pagination_per_page', 10 );
42 $offset = isset( $offset ) ? (int) $offset : 0;
43 $current_page = isset( $current_page ) ? max( 1, (int) $current_page ) : 1;
44 $order_filter = isset( $order_filter ) ? QueryHelper::get_valid_sort_order( $order_filter ) : 'DESC';
45 $discussion_url = isset( $discussion_url ) ? $discussion_url : tutor_utils()->tutor_dashboard_url( 'discussions' );
46
47 $total_items = (int) tutor_utils()->get_qa_questions( $offset, $item_per_page, '', null, null, $asker_id, $q_status, true );
48 $questions = tutor_utils()->get_qa_questions( $offset, $item_per_page, '', null, null, $asker_id, $q_status, false, array( 'order' => $order_filter ) );
49
50 $nav_items = array(
51 array(
52 'label' => __( 'All', 'tutor' ),
53 'value' => '',
54 'count' => $total_items,
55 ),
56 array(
57 'label' => __( 'Read', 'tutor' ),
58 'value' => 'read',
59 'count' => tutor_utils()->get_qa_questions( $offset, $item_per_page, '', null, null, $asker_id, 'read', true ),
60 ),
61 array(
62 'label' => __( 'Unread', 'tutor' ),
63 'value' => 'unread',
64 'count' => tutor_utils()->get_qa_questions( $offset, $item_per_page, '', null, null, $asker_id, 'unread', true ),
65 ),
66 ...( User::is_instructor_view() ? array(
67 array(
68 'label' => __( 'Important', 'tutor' ),
69 'value' => 'important',
70 'count' => tutor_utils()->get_qa_questions( $offset, $item_per_page, '', null, null, $asker_id, 'important', true ),
71 ),
72 array(
73 'label' => __( 'Archived', 'tutor' ),
74 'value' => 'archived',
75 'count' => tutor_utils()->get_qa_questions( $offset, $item_per_page, '', null, null, $asker_id, 'archived', true ),
76 ),
77 ) : array() ),
78 );
79 ?>
80 <div class="tutor-flex tutor-items-center tutor-justify-between tutor-px-6 tutor-py-5 tutor-sm-p-5 tutor-border-b">
81 <?php DropdownFilter::make()->options( $nav_items )->query_param( 'data' )->render(); ?>
82 <div class="tutor-discussion-filter-right">
83 <?php Sorting::make()->order( $order_filter )->render(); ?>
84 </div>
85 </div>
86
87 <?php if ( empty( $questions ) ) : ?>
88 <?php
89 EmptyState::make()
90 ->title( __( 'No Questions Found!', 'tutor' ) )
91 ->icon( tutor_utils()->get_themed_svg( 'images/illustrations/qna-empty.svg' ) )
92 ->render();
93 ?>
94 <?php else : ?>
95 <div class="tutor-discussion-card-wrapper tutor-flex tutor-flex-column tutor-gap-4 tutor-sm-gap-none tutor-p-6 tutor-sm-p-none">
96 <?php
97 foreach ( $questions as $question ) :
98 tutor_load_template(
99 'dashboard.discussions.qna-card',
100 array(
101 'question' => $question,
102 'view_as' => $view_as,
103 'discussion_url' => $discussion_url,
104 )
105 );
106 endforeach;
107 ?>
108 </div>
109 <?php endif; ?>
110
111 <?php
112 Pagination::make()
113 ->current( $current_page )
114 ->total( $total_items )
115 ->limit( $item_per_page )
116 ->attr( 'class', 'tutor-px-6 tutor-pb-6 tutor-sm-p-5 tutor-sm-border-t' )
117 ->render();
118 ?>
119
120 <?php
121 if ( ! empty( $questions ) ) {
122 ConfirmationModal::make()
123 ->id( 'tutor-qna-delete-modal' )
124 ->title( __( 'Delete This Question?', 'tutor' ) )
125 ->message( __( 'Are you sure you want to delete this question permanently? Please confirm your choice.', 'tutor' ) )
126 ->confirm_text( __( 'Yes, Delete This', 'tutor' ) )
127 ->confirm_handler( 'deleteQnAMutation?.mutate(payload)' )
128 ->mutation_state( 'deleteQnAMutation' )
129 ->render();
130 }
131 ?>
132