-
Notifications
You must be signed in to change notification settings - Fork 88
Update bundle courses view in student dashboard #2863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
5961c07
Change active courses icon
sazedul-haque 1f8ca05
Improve progress card style
sazedul-haque bc8357c
Display courses orderby enrollment date
sazedul-haque 8858c6f
Exclude courses enrolled by bundle from completed list
sazedul-haque d39def5
Split course progress card and add hook to override
sazedul-haque 9f82ff6
Format Icon.php
sazedul-haque b3a0421
Merge branch '4.0.0-dev' into update-dashboard-bundle
sazedul-haque a02a767
focus style improved
sazedul-haque 7dcd5b9
Course progress card template override hook updated
sazedul-haque 1f676de
Merge branch '4.0.0-dev' into update-dashboard-bundle
sazedul-haque d4f57e7
Merge branch '4.0.0-dev' into update-dashboard-bundle
sazedul-haque b421d25
Refactor courses.php
sazedul-haque e27cfeb
Use constant for course status
sazedul-haque File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1291,7 +1291,7 @@ function ( $item ) { | |
| */ | ||
| public static function get_completed_courses_by_user( $user_id = 0, $offset = 0, $posts_per_page = -1, $args = array() ) { | ||
| $user_id = tutor_utils()->get_user_id( $user_id ); | ||
| $course_ids = tutor_utils()->get_completed_courses_ids_by_user( $user_id ); | ||
| $course_ids = tutor_utils()->get_completed_courses_ids_by_user( $user_id, false ); | ||
|
|
||
| if ( count( $course_ids ) ) { | ||
| $course_post_type = tutor()->course_post_type; | ||
|
|
@@ -1301,6 +1301,7 @@ public static function get_completed_courses_by_user( $user_id = 0, $offset = 0, | |
| 'post__in' => $course_ids, | ||
| 'posts_per_page' => $posts_per_page, | ||
| 'offset' => $offset, | ||
| 'orderby' => 'post__in', | ||
| ); | ||
|
|
||
| $args = apply_filters( 'tutor_get_completed_courses_by_user', $args, $user_id, $course_post_type ); | ||
|
|
@@ -1326,7 +1327,7 @@ public static function get_completed_courses_by_user( $user_id = 0, $offset = 0, | |
| */ | ||
| public static function get_active_courses_by_user( $user_id = 0, $offset = 0, $posts_per_page = -1, $args = array() ) { | ||
| $user_id = tutor_utils()->get_user_id( $user_id ); | ||
| $course_ids = tutor_utils()->get_completed_courses_ids_by_user( $user_id ); | ||
| $course_ids = tutor_utils()->get_completed_courses_ids_by_user( $user_id, false ); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
| $enrolled_course_ids = tutor_utils()->get_enrolled_courses_ids_by_user( $user_id, false ); | ||
| $active_courses = array_diff( $enrolled_course_ids, $course_ids ); | ||
|
|
||
|
|
@@ -1338,6 +1339,7 @@ public static function get_active_courses_by_user( $user_id = 0, $offset = 0, $p | |
| 'post__in' => $active_courses, | ||
| 'posts_per_page' => $posts_per_page, | ||
| 'offset' => $offset, | ||
| 'orderby' => 'post__in', | ||
| ); | ||
|
|
||
| $args = apply_filters( 'tutor_get_active_courses_by_user', $args, $user_id, $course_post_type ); | ||
|
|
@@ -1377,6 +1379,7 @@ public static function get_enrolled_courses_by_user( $user_id = 0, $post_status | |
| 'post__in' => $course_ids, | ||
| 'offset' => $offset, | ||
| 'posts_per_page' => $posts_per_page, | ||
| 'orderby' => 'post__in', | ||
| ); | ||
|
|
||
| $args = apply_filters( 'tutor_get_enrolled_courses_by_user', $args, $user_id, $course_post_type ); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <?php | ||
| /** | ||
| * Course Card Header Template | ||
| * | ||
| * @package Tutor\Templates | ||
| * @subpackage Dashboard\Enrolled_Courses | ||
| * @author Themeum | ||
| * | ||
| * @since 4.0.0 | ||
| */ | ||
|
|
||
| defined( 'ABSPATH' ) || exit; | ||
|
|
||
| $category = isset( $category ) ? $category : ''; | ||
| ?> | ||
|
|
||
| <div class="tutor-progress-card-header"> | ||
| <?php if ( ! empty( $category ) ) : ?> | ||
| <div class="tutor-progress-card-category"> | ||
| <?php echo esc_html( $category ); ?> | ||
| </div> | ||
| <?php endif; ?> | ||
| <h3 class="tutor-progress-card-title tutor-line-clamp-2"> | ||
| <?php the_title(); ?> | ||
| </h3> | ||
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| <?php | ||
| /** | ||
| * Course Card Progress Template | ||
| * | ||
| * @package Tutor\Templates | ||
| * @subpackage Dashboard\Enrolled_Courses | ||
| * @author Themeum | ||
| * | ||
| * @since 4.0.0 | ||
| */ | ||
|
|
||
| defined( 'ABSPATH' ) || exit; | ||
|
|
||
| use Tutor\Components\Progress; | ||
|
|
||
| if ( $course_progress['completed_count'] <= 0 && $course_progress['total_count'] <= 0 ) { | ||
| return; | ||
| } | ||
|
|
||
| $progress_message_label = isset( $progress_message_label ) ? $progress_message_label : _n( 'lesson', 'lessons', (int) $course_progress['total_count'], 'tutor' ); | ||
| ?> | ||
| <div class="tutor-progress-card-progress"> | ||
| <?php if ( $course_progress['total_count'] > 0 ) : ?> | ||
| <div class="tutor-progress-card-details"> | ||
| <?php | ||
| printf( | ||
| esc_html( | ||
| // translators: %1$s is the completed count, %2$s is the total count, %3$s is the label (lesson/lessons or course/courses). | ||
| _n( | ||
| '%1$s of %2$s %3$s', | ||
| '%1$s of %2$s %3$s', | ||
| (int) $course_progress['total_count'], | ||
| 'tutor' | ||
| ) | ||
| ), | ||
| esc_html( $course_progress['completed_count'] ), | ||
| esc_html( $course_progress['total_count'] ), | ||
| esc_html( $progress_message_label ) | ||
| ); | ||
| ?> | ||
| <span class="tutor-progress-card-separator">•</span> | ||
| <?php | ||
| printf( | ||
| // translators: %1$s is the completed percent. | ||
| esc_html__( '%1$s%% Complete', 'tutor' ), | ||
| esc_html( $course_progress['completed_percent'] ) | ||
| ); | ||
| ?> | ||
| </div> | ||
| <?php endif; ?> | ||
| <?php if ( $course_progress['completed_percent'] >= 0 ) : ?> | ||
| <div class="tutor-progress-card-bar"> | ||
| <?php | ||
| Progress::make() | ||
| ->value( $course_progress['completed_percent'] ) | ||
| ->type( 'bar' ) | ||
| ->render(); | ||
| ?> | ||
| </div> | ||
| <?php endif; ?> | ||
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <?php | ||
| /** | ||
| * Course Card Thumbnail Template | ||
| * | ||
| * @package Tutor\Templates | ||
| * @subpackage Dashboard\Enrolled_Courses | ||
| * @author Themeum | ||
| * | ||
| * @since 4.0.0 | ||
| */ | ||
|
|
||
| defined( 'ABSPATH' ) || exit; | ||
|
|
||
| $thumbnail_img = isset( $thumbnail_img ) ? $thumbnail_img : get_tutor_course_thumbnail_src(); | ||
| $post_id = isset( $post_id ) ? $post_id : get_the_ID(); | ||
| ?> | ||
|
|
||
| <div class="tutor-progress-card-thumbnail"> | ||
| <?php do_action( 'tutor_courses_card_before_thumbnail', $post_id ); ?> | ||
| <?php if ( ! empty( $thumbnail_img ) ) : ?> | ||
| <img src="<?php echo esc_url( $thumbnail_img ); ?>" alt="<?php the_title_attribute( array( 'post' => $post_id ) ); ?>" loading="lazy" /> | ||
| <?php endif; ?> | ||
| </div> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is used in several places, we need to ensure all the called places context before passing 2nd param false.