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-menu.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
my-courses.php
178 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package TutorLMS/Templates |
| 5 | * @version 1.4.3 |
| 6 | */ |
| 7 | |
| 8 | $user = wp_get_current_user(); |
| 9 | $shortcode_arg = isset($GLOBALS['tutor_shortcode_arg']) ? $GLOBALS['tutor_shortcode_arg']['column_per_row'] : null; |
| 10 | $courseCols = $shortcode_arg === null ? tutor_utils()->get_option('courses_col_per_row', 4) : $shortcode_arg; |
| 11 | !isset($active_tab) ? $active_tab = 'my-courses' : 0; |
| 12 | $per_page = tutor_utils()->get_option( 'pagination_per_page', 10 ); |
| 13 | $paged = (isset($_GET['current_page']) && is_numeric($_GET['current_page']) && $_GET['current_page'] >= 1) ? $_GET['current_page'] : 1; |
| 14 | $offset = $per_page * ($paged-1); |
| 15 | $status = $active_tab == 'my-courses' ? array('publish') : array('pending'); |
| 16 | $courses_per_page = tutor_utils()->get_courses_by_instructor($user->ID, $status, $offset, $per_page); |
| 17 | $my_courses = tutor_utils()->get_courses_by_instructor(null, $status); |
| 18 | ?> |
| 19 | |
| 20 | <div class="tutor-fs-5 tutor-fw-medium tutor-color-black tutor-mb-16"><?php esc_html_e('My Courses', 'tutor'); ?></div> |
| 21 | |
| 22 | <div class="tutor-dashboard-content-inner my-courses"> |
| 23 | <?php |
| 24 | $user = wp_get_current_user(); |
| 25 | $publish_courses_count = count(tutor_utils()->get_courses_by_instructor($user->ID)); |
| 26 | $pending_courses_count = count(tutor_utils()->get_pending_courses_by_instructor($user->ID)); |
| 27 | ?> |
| 28 | |
| 29 | <!-- Navigation Tab --> |
| 30 | <div class="tutor-dashboard-inline-links"> |
| 31 | <ul> |
| 32 | <li class="<?php echo $active_tab == 'my-courses' ? 'active' : ''; ?>"> |
| 33 | <a href="<?php echo esc_url(tutor_utils()->get_tutor_dashboard_page_permalink('my-courses')); ?>"> |
| 34 | <?php esc_html_e('Publish', 'tutor'); ?> <?php echo "(" . $publish_courses_count . ")"; ?> |
| 35 | </a> |
| 36 | </li> |
| 37 | <li class="<?php echo $active_tab == 'my-courses/pending-courses' ? 'active' : ''; ?>"> |
| 38 | <a href="<?php echo esc_url(tutor_utils()->get_tutor_dashboard_page_permalink('my-courses/pending-courses')); ?>"> |
| 39 | <?php esc_html_e('Pending', 'tutor'); ?> <?php echo "(" . $pending_courses_count . ")"; ?> |
| 40 | </a> |
| 41 | </li> |
| 42 | </ul> |
| 43 | </div> |
| 44 | |
| 45 | <!-- Course list --> |
| 46 | <?php |
| 47 | $placeholder_img = tutor()->url . 'assets/images/placeholder.png'; |
| 48 | |
| 49 | if (is_array($courses_per_page) && count($courses_per_page)) { |
| 50 | global $post; |
| 51 | ?> |
| 52 | <div class="tutor-course-listing-grid tutor-course-listing-grid-3"> |
| 53 | <?php |
| 54 | foreach ($courses_per_page as $post) : |
| 55 | setup_postdata($post); |
| 56 | |
| 57 | $avg_rating = tutor_utils()->get_course_rating()->rating_avg; |
| 58 | $tutor_course_img = get_tutor_course_thumbnail_src(); |
| 59 | $id_string_delete = 'tutor_my_courses_delete_' . $post->ID; |
| 60 | $row_id = 'tutor-dashboard-my-course-' . $post->ID; |
| 61 | ?> |
| 62 | |
| 63 | <div id="<?php echo $row_id; ?>" class="tutor-course-listing-item tutor-course-listing-item-sm tutor-mycourses-card tutor-mycourse-<?php the_ID(); ?>"> |
| 64 | <div class="tutor-course-listing-item-head tutor-d-flex"> |
| 65 | <!-- <img src="<?php //echo esc_url($tutor_course_img); ?>" alt="Course Thumbnail"> --> |
| 66 | <div class="tutor-course-listing-thumbnail" style="background-image:url(<?php echo empty(esc_url($tutor_course_img)) ? $placeholder_img : esc_url($tutor_course_img) ?>)"></div> |
| 67 | </div> |
| 68 | <div class="tutor-course-listing-item-body tutor-px-20 tutor-py-20"> |
| 69 | <div class="tutor-d-flex tutor-mb-7"> |
| 70 | <span class="tutor-fs-6 tutor-fw-normal tutor-color-black-60"> |
| 71 | <?php echo esc_html(get_the_date()); ?> <?php echo esc_html(get_the_time()); ?> |
| 72 | </span> |
| 73 | </div> |
| 74 | <div class="list-item-title tutor-fs-6 tutor-fw-bold tutor-color-black tutor-mb-16"> |
| 75 | <a href="<?php echo get_the_permalink(); ?>"><?php the_title(); ?></a> |
| 76 | </div> |
| 77 | <div class="list-item-meta tutor-fs-7 tutor-fw-medium tutor-color-black tutor-d-flex tutor-mt-12"> |
| 78 | <?php |
| 79 | $course_duration = get_tutor_course_duration_context($post->ID, true); |
| 80 | $course_students = tutor_utils()->count_enrolled_users_by_course(); |
| 81 | ?> |
| 82 | <?php |
| 83 | if (!empty($course_duration)) { ?> |
| 84 | <div class="tutor-d-flex tutor-align-items-center"> |
| 85 | <span class="meta-icon tutor-icon-clock-filled tutor-color-muted tutor-icon-20 tutor-mr-3"></span> |
| 86 | <span class="tutor-fs-7 tutor-fw-medium tutor-color-black"><?php echo $course_duration; ?></span> |
| 87 | </div> |
| 88 | <?php } ?> |
| 89 | <?php if (!empty($course_students)) : ?> |
| 90 | <div class="tutor-d-flex tutor-align-items-center"> |
| 91 | <span class="meta-icon tutor-icon-user-filled tutor-color-muted"></span> |
| 92 | <span><?php echo $course_students; ?></span> |
| 93 | </div> |
| 94 | <?php endif; ?> |
| 95 | </div> |
| 96 | </div> |
| 97 | |
| 98 | <!-- Card footer --> |
| 99 | <div class="tutor-course-listing-item-footer has-border tutor-py-8 tutor-pl-20 tutor-pr-8"> |
| 100 | <div class="tutor-d-flex tutor-align-items-center tutor-justify-content-between"> |
| 101 | <div class="tutor-d-flex tutor-align-items-center"> |
| 102 | <span class="tutor-fs-7 tutor-fw-medium tutor-color-muted tutor-mr-3"> |
| 103 | <?php esc_html_e('Price:', 'tutor') ?> |
| 104 | </span> |
| 105 | <span class="tutor-fs-7 tutor-fw-medium tutor-color-black"> |
| 106 | <?php echo tutor_utils()->tutor_price(tutor_utils()->get_course_price()); ?> |
| 107 | </span> |
| 108 | </div> |
| 109 | <div class="tutor-course-listing-item-btns"> |
| 110 | <a href="<?php echo tutor_utils()->course_edit_link($post->ID); ?>" class="tutor-btn tutor-btn-icon tutor-btn-disable-outline tutor-btn-ghost tutor-no-hover tutor-btn-sm"> |
| 111 | <i class="tutor-icon-edit-filled tutor-icon-26 tutor-color-muted"></i> |
| 112 | </a> |
| 113 | <a href="#" data-tutor-modal-target="<?php echo $id_string_delete; ?>" class="tutor-dashboard-element-delete-btn tutor-btn tutor-btn-icon tutor-btn-disable-outline tutor-btn-ghost tutor-no-hover tutor-btn-sm"> |
| 114 | <i class="tutor-icon-delete-stroke-filled tutor-icon-24 tutor-color-muted"></i> |
| 115 | </a> |
| 116 | </div> |
| 117 | </div> |
| 118 | </div> |
| 119 | |
| 120 | <!-- Delete prompt modal --> |
| 121 | <div id="<?php echo $id_string_delete; ?>" class="tutor-modal"> |
| 122 | <span class="tutor-modal-overlay"></span> |
| 123 | <button data-tutor-modal-close class="tutor-modal-close"> |
| 124 | <span class="tutor-icon-line-cross-line"></span> |
| 125 | </button> |
| 126 | <div class="tutor-modal-root"> |
| 127 | <div class="tutor-modal-inner"> |
| 128 | <div class="tutor-modal-body tutor-text-center"> |
| 129 | <div class="tutor-modal-icon"> |
| 130 | <img src="<?php echo tutor()->url; ?>assets/images/icon-trash.svg" /> |
| 131 | </div> |
| 132 | <div class="tutor-modal-text-wrap"> |
| 133 | <h3 class="tutor-modal-title"> |
| 134 | <?php esc_html_e('Delete This Course?', 'tutor'); ?> |
| 135 | </h3> |
| 136 | <p> |
| 137 | <?php esc_html_e('Are you sure you want to delete this course permanently from the site? Please confirm your choice.', 'tutor'); ?> |
| 138 | </p> |
| 139 | </div> |
| 140 | <div class="tutor-modal-btns tutor-btn-group"> |
| 141 | <button data-tutor-modal-close class="tutor-btn tutor-is-outline tutor-is-default"> |
| 142 | <?php esc_html_e('Cancel', 'tutor'); ?> |
| 143 | </button> |
| 144 | <button class="tutor-btn tutor-list-ajax-action" data-request_data='{"course_id":<?php echo $post->ID; ?>,"action":"tutor_delete_dashboard_course"}' data-delete_element_id="<?php echo $row_id; ?>"> |
| 145 | <?php esc_html_e('Yes, Delete This', 'tutor'); ?> |
| 146 | </button> |
| 147 | </div> |
| 148 | </div> |
| 149 | </div> |
| 150 | </div> |
| 151 | </div> |
| 152 | </div> |
| 153 | <?php endforeach; |
| 154 | wp_reset_postdata(); ?> |
| 155 | </div> |
| 156 | <div class="tutor-mt-20"> |
| 157 | <?php |
| 158 | if (($status[0] === 'publish' && $publish_courses_count > $per_page) || ($status[0] === 'pending' && $pending_courses_count > $per_page)) { |
| 159 | $pagination_data = array( |
| 160 | 'total_items' => $status[0] === 'publish' ? $publish_courses_count : $pending_courses_count, |
| 161 | 'per_page' => $per_page, |
| 162 | 'paged' => $paged, |
| 163 | ); |
| 164 | tutor_load_template_from_custom_path( |
| 165 | tutor()->path . 'templates/dashboard/elements/pagination.php', |
| 166 | $pagination_data |
| 167 | ); |
| 168 | } |
| 169 | ?> |
| 170 | |
| 171 | </div> |
| 172 | <?php |
| 173 | } else { |
| 174 | tutor_utils()->tutor_empty_state(tutor_utils()->not_found_text()); |
| 175 | } |
| 176 | ?> |
| 177 | </div> |
| 178 |