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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 / dashboard / discussions / qna-list.php
tutor / templates / dashboard / discussions Last commit date
comment-card.php 4 days ago comment-form.php 4 days ago comment-list.php 4 days ago comment-replies.php 4 days ago comment-single.php 4 days ago qna-card.php 4 days ago qna-form.php 4 days ago qna-list.php 4 days ago qna-replies.php 4 days ago qna-single.php 4 days ago
qna-list.php
122 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\Input;
29 use TUTOR\User;
30
31 $user_id = get_current_user_id();
32 $is_instructor = tutor_utils()->is_instructor( $user_id, true );
33 $q_status = Input::get( 'data' );
34 $view_as = User::get_current_view_mode();
35 $asker_id = User::is_instructor_view() ? null : $user_id;
36
37 $total_items = (int) tutor_utils()->get_qa_questions( $offset, $item_per_page, '', null, null, $asker_id, $q_status, true );
38 $questions = tutor_utils()->get_qa_questions( $offset, $item_per_page, '', null, null, $asker_id, $q_status, false, array( 'order' => $order_filter ) );
39
40 $nav_items = array(
41 array(
42 'label' => __( 'All', 'tutor' ),
43 'value' => '',
44 'count' => $total_items,
45 ),
46 array(
47 'label' => __( 'Read', 'tutor' ),
48 'value' => 'read',
49 'count' => tutor_utils()->get_qa_questions( $offset, $item_per_page, '', null, null, $asker_id, 'read', true ),
50 ),
51 array(
52 'label' => __( 'Unread', 'tutor' ),
53 'value' => 'unread',
54 'count' => tutor_utils()->get_qa_questions( $offset, $item_per_page, '', null, null, $asker_id, 'unread', true ),
55 ),
56 ...( User::is_instructor_view() ? array(
57 array(
58 'label' => __( 'Important', 'tutor' ),
59 'value' => 'important',
60 'count' => tutor_utils()->get_qa_questions( $offset, $item_per_page, '', null, null, $asker_id, 'important', true ),
61 ),
62 array(
63 'label' => __( 'Archived', 'tutor' ),
64 'value' => 'archived',
65 'count' => tutor_utils()->get_qa_questions( $offset, $item_per_page, '', null, null, $asker_id, 'archived', true ),
66 ),
67 ) : array() ),
68 );
69 ?>
70 <div class="tutor-flex tutor-items-center tutor-justify-between tutor-px-6 tutor-py-5 tutor-sm-p-5 tutor-border-b">
71 <?php DropdownFilter::make()->options( $nav_items )->query_param( 'data' )->render(); ?>
72 <div class="tutor-discussion-filter-right">
73 <?php Sorting::make()->order( $order_filter )->render(); ?>
74 </div>
75 </div>
76
77 <?php if ( empty( $questions ) ) : ?>
78 <?php
79 EmptyState::make()
80 ->title( 'No Questions Found!' )
81 ->icon( tutor_utils()->get_themed_svg( 'images/illustrations/qna-empty.svg' ) )
82 ->render();
83 ?>
84 <?php else : ?>
85 <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">
86 <?php
87 foreach ( $questions as $question ) :
88 tutor_load_template(
89 'dashboard.discussions.qna-card',
90 array(
91 'question' => $question,
92 'view_as' => $view_as,
93 'discussion_url' => $discussion_url,
94 )
95 );
96 endforeach;
97 ?>
98 </div>
99 <?php endif; ?>
100
101 <?php
102 Pagination::make()
103 ->current( $current_page )
104 ->total( $total_items )
105 ->limit( $item_per_page )
106 ->attr( 'class', 'tutor-px-6 tutor-pb-6 tutor-sm-p-5 tutor-sm-border-t' )
107 ->render();
108 ?>
109
110 <?php
111 if ( ! empty( $questions ) ) {
112 ConfirmationModal::make()
113 ->id( 'tutor-qna-delete-modal' )
114 ->title( __( 'Delete This Question?', 'tutor' ) )
115 ->message( __( 'Are you sure you want to delete this question permanently? Please confirm your choice.', 'tutor' ) )
116 ->confirm_text( __( 'Yes, Delete This', 'tutor' ) )
117 ->confirm_handler( 'deleteQnAMutation?.mutate(payload)' )
118 ->mutation_state( 'deleteQnAMutation' )
119 ->render();
120 }
121 ?>
122