announcements
1 year ago
assignments
8 months ago
elements
1 year ago
enrolled-courses
3 years ago
instructor
2 years ago
my-courses
1 year ago
my-quiz-attempts
3 years ago
notifications
3 years ago
question-answer
1 year ago
quiz-attempts
3 years ago
reviews
3 years ago
settings
1 year ago
withdraw-method-fields
3 years ago
announcements.php
1 year ago
assignments.php
11 months ago
create-course.php
1 year ago
dashboard.php
8 months ago
enrolled-courses.php
8 months ago
index.php
3 years ago
logged-in.php
3 years ago
my-courses.php
8 months ago
my-profile.php
9 months ago
my-quiz-attempts.php
3 years ago
purchase_history.php
10 months ago
question-answer.php
11 months ago
quiz-attempts.php
1 year ago
registration.php
2 years ago
reviews.php
3 years ago
settings.php
1 year ago
wishlist.php
1 year ago
withdraw.php
1 year ago
quiz-attempts.php
58 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 | use TUTOR\Input; |
| 13 | use Tutor\Models\QuizModel; |
| 14 | |
| 15 | if ( isset( $_GET['view_quiz_attempt_id'] ) ) { |
| 16 | // Load single attempt details if ID provided. |
| 17 | include __DIR__ . '/quiz-attempts/quiz-reviews.php'; |
| 18 | return; |
| 19 | } |
| 20 | |
| 21 | $item_per_page = tutor_utils()->get_option( 'pagination_per_page' ); |
| 22 | $current_page = max( 1, Input::get( 'current_page', 1, Input::TYPE_INT ) ); |
| 23 | $offset = ( $current_page - 1 ) * $item_per_page; |
| 24 | |
| 25 | // Filter params. |
| 26 | $course_filter = Input::get( 'course-id', '' ); |
| 27 | $order_filter = Input::get( 'order', 'DESC' ); |
| 28 | $date_filter = Input::get( 'date', '' ); |
| 29 | ?> |
| 30 | |
| 31 | <div class="tutor-fs-5 tutor-fw-medium tutor-color-black tutor-mb-24 tutor-text-capitalize"><?php esc_html_e( 'Quiz Attempts', 'tutor' ); ?></div> |
| 32 | <?php |
| 33 | // Load filter template. |
| 34 | tutor_load_template_from_custom_path( tutor()->path . 'templates/dashboard/elements/filters.php' ); |
| 35 | |
| 36 | $course_id = tutor_utils()->get_assigned_courses_ids_by_instructors(); |
| 37 | $quiz_attempts = QuizModel::get_quiz_attempts( $offset, $item_per_page, '', $course_filter, $date_filter, $order_filter, null, false, true ); |
| 38 | $quiz_attempts_count = QuizModel::get_quiz_attempts( $offset, $item_per_page, '', $course_filter, $date_filter, $order_filter, null, true, true ); |
| 39 | |
| 40 | tutor_load_template_from_custom_path( |
| 41 | tutor()->path . '/views/quiz/attempt-table.php', |
| 42 | array( |
| 43 | 'attempt_list' => $quiz_attempts, |
| 44 | 'context' => 'frontend-dashboard-students-attempts', |
| 45 | ) |
| 46 | ); |
| 47 | |
| 48 | $pagination_data = array( |
| 49 | 'total_items' => $quiz_attempts_count, |
| 50 | 'per_page' => $item_per_page, |
| 51 | 'paged' => $current_page, |
| 52 | ); |
| 53 | if ( $quiz_attempts_count > $item_per_page ) { |
| 54 | $pagination_template_frontend = tutor()->path . 'templates/dashboard/elements/pagination.php'; |
| 55 | tutor_load_template_from_custom_path( $pagination_template_frontend, $pagination_data ); |
| 56 | } |
| 57 | ?> |
| 58 |