announcements
4 years ago
assignments
4 years ago
elements
4 years ago
enrolled-courses
4 years ago
instructor
4 years ago
my-courses
4 years ago
my-quiz-attempts
4 years ago
notifications
4 years ago
question-answer
4 years ago
quiz-attempts
4 years ago
reviews
4 years ago
settings
4 years ago
withdraw-method-fields
4 years ago
announcements.php
4 years ago
assignments.php
4 years ago
create-course.php
4 years ago
dashboard.php
4 years ago
enrolled-courses.php
4 years ago
index.php
4 years ago
logged-in.php
4 years ago
my-courses.php
4 years ago
my-profile.php
4 years ago
my-quiz-attempts.php
4 years ago
purchase_history.php
4 years ago
question-answer.php
4 years ago
quiz-attempts.php
4 years ago
registration.php
4 years ago
reviews.php
4 years ago
settings.php
4 years ago
wishlist.php
4 years ago
withdraw.php
4 years ago
quiz-attempts.php
57 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Students Quiz Attempts Frontend |
| 4 | * |
| 5 | * @since v.1.4.0 |
| 6 | * |
| 7 | * @author Themeum |
| 8 | * @url https://themeum.com |
| 9 | * |
| 10 | * @package TutorLMS/Templates |
| 11 | * @version 1.6.4 |
| 12 | */ |
| 13 | |
| 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, tutor_utils()->array_get( 'current_page', $_GET ) ); |
| 23 | $offset = ( $current_page - 1 ) * $item_per_page; |
| 24 | // Filter params. |
| 25 | $course_filter = isset( $_GET['course-id'] ) ? sanitize_text_field( $_GET['course-id'] ) : ''; |
| 26 | $order_filter = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
| 27 | $date_filter = isset( $_GET['date'] ) ? $_GET['date'] : ''; |
| 28 | ?> |
| 29 | |
| 30 | <div class="tutor-fs-5 tutor-fw-medium tutor-color-black tutor-mb-24 tutor-capitalize-text"><?php esc_html_e( 'Quiz Attempts', 'tutor' ); ?></div> |
| 31 | <?php |
| 32 | // Load filter template. |
| 33 | tutor_load_template_from_custom_path( tutor()->path . 'templates/dashboard/elements/filters.php' ); |
| 34 | |
| 35 | $course_id = tutor_utils()->get_assigned_courses_ids_by_instructors(); |
| 36 | $quiz_attempts = tutor_utils()->get_quiz_attempts($offset, $item_per_page, '', $course_filter, $date_filter, $order_filter, null, false, true ); |
| 37 | $quiz_attempts_count = tutor_utils()->get_quiz_attempts($offset, $item_per_page, '', $course_filter, $date_filter, $order_filter, null, true, true ); |
| 38 | |
| 39 | tutor_load_template_from_custom_path( |
| 40 | tutor()->path . '/views/quiz/attempt-table.php', |
| 41 | array( |
| 42 | 'attempt_list' => $quiz_attempts, |
| 43 | 'context' => 'frontend-dashboard-students-attempts', |
| 44 | ) |
| 45 | ); |
| 46 | |
| 47 | $pagination_data = array( |
| 48 | 'total_items' => $quiz_attempts_count, |
| 49 | 'per_page' => $item_per_page, |
| 50 | 'paged' => $current_page, |
| 51 | ); |
| 52 | if( $quiz_attempts_count > $item_per_page ){ |
| 53 | $pagination_template_frontend = tutor()->path . 'templates/dashboard/elements/pagination.php'; |
| 54 | tutor_load_template_from_custom_path( $pagination_template_frontend, $pagination_data ); |
| 55 | } |
| 56 | ?> |
| 57 |