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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 / quiz-attempts.php
tutor / templates / dashboard Last commit date
account 4 days ago components 4 days ago courses 4 days ago discussions 4 days ago elements 4 days ago instructor 4 days ago my-courses 1 year ago my-quiz-attempts 4 days ago quiz-attempts 4 days ago student 4 days ago wishlist 4 days ago announcements.php 4 days ago courses.php 4 days ago create-course.php 4 days ago dashboard.php 4 days ago discussions.php 4 days ago index.php 3 years ago logged-in.php 3 years ago my-courses.php 4 days ago my-quiz-attempts.php 4 days ago quiz-attempts.php 4 days ago registration.php 4 days ago wishlist.php 4 days ago
quiz-attempts.php
196 lines
1 <?php
2 /**
3 * Frontend Students Quiz Attempts
4 *
5 * @package Tutor\Templates
6 * @subpackage Dashboard
7 * @author Themeum <support@themeum.com>
8 * @link https://themeum.com
9 * @since 1.4.0
10 */
11
12 defined( 'ABSPATH' ) || exit;
13
14 use Tutor\Components\Button;
15 use Tutor\Components\ConfirmationModal;
16 use Tutor\Components\Constants\Positions;
17 use Tutor\Components\Constants\Size;
18 use Tutor\Components\Constants\Variant;
19 use Tutor\Components\CourseFilter;
20 use Tutor\Components\DateFilter;
21 use Tutor\Components\DropdownFilter;
22 use Tutor\Components\EmptyState;
23 use Tutor\Components\Pagination;
24 use Tutor\Components\SearchFilter;
25 use Tutor\Components\Sorting;
26 use TUTOR\Input;
27 use Tutor\Models\QuizModel;
28 use TUTOR\Quiz_Attempts_List;
29
30 if ( Input::has( 'attempt_id', Input::GET_REQUEST ) ) {
31 // Load single attempt details if ID provided.
32 include __DIR__ . '/quiz-attempts/quiz-reviews.php';
33 return;
34 }
35
36 $url = get_pagenum_link( 1, false );
37 $item_per_page = tutor_utils()->get_option( 'pagination_per_page' );
38 $current_page = max( 1, Input::get( 'current_page', 1, Input::TYPE_INT ) );
39 $offset = ( $current_page - 1 ) * $item_per_page;
40 $quiz_attempt_obj = new Quiz_Attempts_List( false );
41
42 // Filter params.
43 $course_id = Input::get( 'course-id', 0, Input::TYPE_INT );
44 $order_filter = Input::get( 'order', 'DESC' );
45 $start_date = Input::get( 'start_date', '' );
46 $end_date = Input::get( 'end_date', '' );
47 $result_filter = Input::get( 'result', '' );
48 $search_filter = Input::get( 'search', '' );
49
50 $quiz_attempts = QuizModel::get_quiz_attempts( $offset, $item_per_page, $search_filter, $course_id > 0 ? $course_id : '', $start_date, $end_date, $order_filter, $result_filter, false, true );
51 $quiz_attempts_list = QuizModel::format_quiz_attempts( $quiz_attempts, $result_filter );
52 $quiz_attempts_count = QuizModel::get_quiz_attempts( $offset, $item_per_page, $search_filter, $course_id > 0 ? $course_id : '', $start_date, $end_date, $order_filter, $result_filter, true, true );
53
54
55 $date_params_present = Input::has( 'start_date', Input::GET_REQUEST ) || Input::has( 'end_date', Input::GET_REQUEST );
56 if ( $date_params_present && $quiz_attempts_count <= $offset ) {
57 $offset = 0;
58 }
59
60
61 $nav_links = $quiz_attempt_obj->get_quiz_attempts_nav_data(
62 $quiz_attempts_count,
63 $url,
64 $result_filter,
65 $search_filter,
66 $course_id,
67 $start_date,
68 $end_date,
69 $order_filter,
70 array()
71 );
72
73 $hidden_inputs = array(
74 'order' => $order_filter,
75 'start_date' => $start_date,
76 'end_date' => $end_date,
77 'result' => $result_filter,
78 'course-id' => $course_id,
79 )
80
81 ?>
82
83 <div class="tutor-dashboard-quiz-attempts-wrapper" x-data="tutorQuizAttempts()">
84 <h4 class="tutor-quiz-attempts-mobile-heading tutor-h4 tutor-mb-5">
85 <?php esc_html_e( 'Quiz Attempts', 'tutor' ); ?>
86 </h4>
87 <div class="tutor-quiz-attempts tutor-instructor-quiz-attempts tutor-surface-l1 tutor-border tutor-rounded-2xl tutor-overflow-hidden">
88 <div class="tutor-quiz-attempts-filter">
89 <?php
90 CourseFilter::make()
91 ->size( Size::SMALL )
92 ->variant( Variant::PRIMARY_SOFT )
93 ->render();
94
95 DropdownFilter::make()
96 ->size( Size::SMALL )
97 ->options( $nav_links['options'] )
98 ->query_param( 'result' )
99 ->variant( Variant::OUTLINE )
100 ->position( Positions::BOTTOM_END )
101 ->render();
102 ?>
103 </div>
104 <div class="tutor-px-6 tutor-py-5 tutor-flex tutor-gap-3 tutor-justify-between tutor-border-b">
105 <?php
106 SearchFilter::make()
107 ->form_id( 'tutor-quiz-attempt-search-form' )
108 ->hidden_inputs( $hidden_inputs )
109 ->placeholder( __( 'Search quizzes...', 'tutor' ) )
110 ->size( Size::SMALL )
111 ->render();
112 ?>
113
114 <div class="tutor-flex tutor-gap-3">
115 <?php
116 $query_items = array( 'course-id', 'search', 'start_date', 'end_date', 'result', 'order' );
117 if ( Input::has_any( $query_items, Input::GET_REQUEST ) ) {
118 Button::make()
119 ->tag( 'a' )
120 ->size( Size::SMALL )
121 ->attr( 'href', tutor_utils()->tutor_dashboard_url( 'quiz-attempts' ) )
122 ->attr( 'class', 'tutor-text-brand' )
123 ->label( __( 'Clear all', 'tutor' ) )
124 ->variant( Variant::LINK )
125 ->render();
126 }
127
128 DateFilter::make()
129 ->type( DateFilter::TYPE_RANGE )
130 ->placement( Positions::BOTTOM_END )
131 ->hide_initial_label()
132 ->render();
133
134 Sorting::make()->size( Size::SMALL )->order( $order_filter )->render();
135 ?>
136 </div>
137 </div>
138 <?php if ( $quiz_attempts_count ) : ?>
139 <div class="tutor-quiz-attempts-header">
140 <div class="tutor-quiz-attempts-header-item"><?php esc_html_e( 'Quiz info', 'tutor' ); ?></div>
141 <div class="tutor-quiz-attempts-header-item"><?php esc_html_e( 'Marks', 'tutor' ); ?></div>
142 <div class="tutor-quiz-attempts-header-item"><?php esc_html_e( 'Time', 'tutor' ); ?></div>
143 <div class="tutor-quiz-attempts-header-item"><?php esc_html_e( 'Result', 'tutor' ); ?></div>
144 </div>
145 <div class="tutor-quiz-attempts-list">
146 <?php foreach ( $quiz_attempts_list as $quiz_attempt ) : ?>
147 <div class="tutor-quiz-attempts-item-wrapper">
148 <?php
149 tutor_load_template(
150 'dashboard.components.quiz-attempt-row',
151 array(
152 'attempt' => $quiz_attempt,
153 'quiz_title' => $quiz_attempt['quiz_title'],
154 'course_title' => $quiz_attempt['course_title'],
155 'course_id' => $quiz_attempt['course_id'],
156 'show_quiz_title' => true,
157 'show_course' => true,
158 'quiz_id' => $quiz_attempt['quiz_id'],
159 'attempts_count' => 1,
160 'attempt_id' => $quiz_attempt['attempt_id'] ?? 0,
161 'quiz_attempt_obj' => $quiz_attempt_obj,
162 )
163 );
164
165 ?>
166 </div>
167 <?php endforeach; ?>
168 <?php
169 Pagination::make()
170 ->current( $current_page )
171 ->total( $quiz_attempts_count )
172 ->limit( $item_per_page )
173 ->attr( 'class', 'tutor-p-6' )
174 ->render();
175 ?>
176 </div>
177 <?php else : ?>
178 <?php
179 EmptyState::make()
180 ->title( __( 'No Quiz Attempts Found', 'tutor' ) )
181 ->icon( tutor_utils()->get_themed_svg( 'images/illustrations/quiz-empty.svg' ) )
182 ->render();
183 ?>
184 <?php endif; ?>
185 </div>
186 <?php
187 ConfirmationModal::make()
188 ->id( 'tutor-quiz-attempt-delete-modal' )
189 ->title( __( 'Do You Want to Delete This?', 'tutor' ) )
190 ->message( __( 'Would you like to delete Quiz Attempt permanently? We suggest you proceed with caution.', 'tutor' ) )
191 ->confirm_handler( 'handleDeleteAttempt(payload?.attemptID)' )
192 ->mutation_state( 'deleteMutation' )
193 ->render();
194 ?>
195 </div>
196