tools
4 years ago
add_new_instructor.php
4 years ago
addons.php
4 years ago
announcements.php
4 years ago
answer.php
4 years ago
course-list.php
4 years ago
enable_disable_addons.php
4 years ago
get-pro.php
5 years ago
instructors.php
4 years ago
question_answer.php
4 years ago
quiz_attempts.php
4 years ago
students.php
4 years ago
tools.php
4 years ago
tutor-pro-addons.php
4 years ago
uninstall.php
4 years ago
view_attempt.php
4 years ago
welcome.php
4 years ago
withdraw_requests.php
4 years ago
quiz_attempts.php
109 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Quiz Attempts List Template. |
| 4 | * |
| 5 | * @package Quiz Attempts List |
| 6 | */ |
| 7 | |
| 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 9 | exit; |
| 10 | } |
| 11 | |
| 12 | use TUTOR\Input; |
| 13 | |
| 14 | if ( is_numeric( Input::get( 'view_quiz_attempt_id' ) ) ) { |
| 15 | include tutor()->path."views/pages/view_attempt.php"; |
| 16 | return; |
| 17 | } |
| 18 | |
| 19 | $quiz_attempts = new TUTOR\Quiz_Attempts_List(false); |
| 20 | |
| 21 | /** |
| 22 | * Short able params |
| 23 | */ |
| 24 | $user_id = Input::get( 'user_id', '' ); |
| 25 | $course_id = Input::get( 'course-id', '' ); |
| 26 | $order = Input::get( 'order', 'DESC' ); |
| 27 | $date = Input::has('date') ? tutor_get_formated_date( 'Y-m-d', Input::get( 'date' ) ) : ''; |
| 28 | $search = Input::get( 'search', '' ); |
| 29 | |
| 30 | /** |
| 31 | * Determine active tab |
| 32 | */ |
| 33 | $active_tab = Input::get( 'data', 'all' ); |
| 34 | |
| 35 | /** |
| 36 | * Pagination data |
| 37 | */ |
| 38 | $paged = Input::get( 'paged', 1, Input::TYPE_INT ); |
| 39 | $per_page = tutor_utils()->get_option( 'pagination_per_page' ); |
| 40 | $offset = ( $per_page * $paged ) - $per_page; |
| 41 | |
| 42 | $quiz_attempts_list = tutor_utils()->get_quiz_attempts($offset, $per_page, $search, $course_id, $date, $order, $active_tab, false, true ); |
| 43 | $total = tutor_utils()->get_quiz_attempts($offset, $per_page, $search, $course_id, $date, $order, $active_tab, true, true ); |
| 44 | |
| 45 | /** |
| 46 | * Navbar data to make nav menu |
| 47 | */ |
| 48 | $navbar_data = array( |
| 49 | 'page_title' => $quiz_attempts->page_title, |
| 50 | 'tabs' => $quiz_attempts->tabs_key_value( $user_id, $date, $search, $course_id ), |
| 51 | 'active' => $active_tab, |
| 52 | ); |
| 53 | |
| 54 | $filters = array( |
| 55 | 'bulk_action' => $quiz_attempts->bulk_action, |
| 56 | 'bulk_actions' => $quiz_attempts->prpare_bulk_actions(), |
| 57 | 'ajax_action' => 'tutor_quiz_attempts_bulk_action', |
| 58 | 'filters' => true, |
| 59 | 'course_filter' => true, |
| 60 | ); |
| 61 | |
| 62 | ?> |
| 63 | |
| 64 | <?php |
| 65 | /** |
| 66 | * Load Templates with data. |
| 67 | */ |
| 68 | |
| 69 | |
| 70 | ?> |
| 71 | |
| 72 | <div class="tutor-admin-wrap"> |
| 73 | <?php |
| 74 | /** |
| 75 | * Load Templates with data. |
| 76 | */ |
| 77 | $navbar_template = tutor()->path . 'views/elements/navbar.php'; |
| 78 | $filters_template = tutor()->path . 'views/elements/filters.php'; |
| 79 | tutor_load_template_from_custom_path( $navbar_template, $navbar_data ); |
| 80 | tutor_load_template_from_custom_path( $filters_template, $filters ); |
| 81 | ?> |
| 82 | |
| 83 | <div class="tutor-admin-body"> |
| 84 | <?php |
| 85 | tutor_load_template_from_custom_path(tutor()->path . '/views/quiz/attempt-table.php', array( |
| 86 | 'attempt_list' => $quiz_attempts_list, |
| 87 | 'context' => 'backend-dashboard-students-attempts' |
| 88 | )); |
| 89 | ?> |
| 90 | |
| 91 | <div class="tutor-admin-page-pagination-wrapper tutor-mt-32"> |
| 92 | <?php |
| 93 | /** |
| 94 | * Prepare pagination data & load template |
| 95 | */ |
| 96 | if($total > $per_page) { |
| 97 | $pagination_data = array( |
| 98 | 'total_items' => $total, |
| 99 | 'per_page' => $per_page, |
| 100 | 'paged' => $paged, |
| 101 | ); |
| 102 | $pagination_template = tutor()->path . 'views/elements/pagination.php'; |
| 103 | tutor_load_template_from_custom_path( $pagination_template, $pagination_data ); |
| 104 | } |
| 105 | ?> |
| 106 | </div> |
| 107 | </div> |
| 108 | </div> |
| 109 |