diff --git a/assets/src/scss/frontend/learning-area/pages/_index.scss b/assets/src/scss/frontend/learning-area/pages/_index.scss index 91d0d3051a..ab78012e0a 100644 --- a/assets/src/scss/frontend/learning-area/pages/_index.scss +++ b/assets/src/scss/frontend/learning-area/pages/_index.scss @@ -5,5 +5,4 @@ @forward './qna'; @forward './quiz-intro'; @forward './resources'; -@forward './webinar'; @forward './quiz-summary'; diff --git a/assets/src/scss/frontend/learning-area/pages/_webinar.scss b/assets/src/scss/frontend/learning-area/pages/_webinar.scss deleted file mode 100644 index 3917d1e833..0000000000 --- a/assets/src/scss/frontend/learning-area/pages/_webinar.scss +++ /dev/null @@ -1,100 +0,0 @@ -// Learning Area Webinar Styles - -@use '@Core/scss/tokens' as *; -@use '@Core/scss/mixins' as *; - -.tutor-webinar { - &-card { - padding: $tutor-spacing-6; - border-radius: $tutor-radius-lg; - } - - &-month { - @include tutor-typography('h3', 'semibold', 'primary', 'heading'); - @include tutor-breakpoint-down(sm) { - @include tutor-typography('h4', 'semibold', 'primary', 'heading'); - } - } - - &-header { - @include tutor-flex(row, center, space-between, wrap); - gap: $tutor-spacing-4; - margin-bottom: $tutor-spacing-6; - @include tutor-breakpoint-down(sm) { - margin-bottom: $tutor-spacing-5; - } - } - - &-year { - @include tutor-typography('h3', 'regular', 'primary', 'heading'); - @include tutor-breakpoint-down(sm) { - @include tutor-typography('h4', 'regular', 'primary', 'heading'); - } - } - - &-group-heading { - @include tutor-typography('small', 'regular', 'secondary'); - margin-bottom: $tutor-spacing-3; - @include tutor-breakpoint-down(sm) { - display: none; - } - } - - &-body { - margin-top: $tutor-spacing-6; - max-height: min(32rem, 70vh); //Can be changed to any value - overflow-y: auto; - overscroll-behavior: contain; - -webkit-overflow-scrolling: touch; - > .tutor-space-y-3 + .tutor-space-y-3 { - margin-top: $tutor-spacing-5; - } - - @include tutor-breakpoint-down(sm) { - border-radius: $tutor-radius-2xl; - overflow-x: hidden; - overflow-y: auto; - background-color: $tutor-surface-l1; - margin-top: $tutor-spacing-4; - width: calc(100% + #{$tutor-spacing-6 * 2}); - margin-left: -$tutor-spacing-6; - margin-right: -$tutor-spacing-6; - - > .tutor-space-y-3 + .tutor-space-y-3 { - margin-top: 0; - } - } - } - - .tutor-upcoming-lesson-card { - @include tutor-breakpoint-down(sm) { - margin: 0; - border-radius: 0; - border: 0; - border-bottom: 1px solid $tutor-border-idle; - padding: $tutor-spacing-5; - } - } - - .tutor-upcoming-lesson-card + .tutor-upcoming-lesson-card { - margin-top: $tutor-spacing-4; - @include tutor-breakpoint-down(sm) { - margin-top: 0; - } - } - - @include tutor-breakpoint-down(sm) { - .tutor-webinar-body > .tutor-space-y-3:last-child .tutor-upcoming-lesson-card:last-child { - border-bottom: 0; - } - } - - &-divider { - height: 1px; - width: calc(100% + #{$tutor-spacing-6 * 2}); - margin-left: -$tutor-spacing-6; - margin-right: -$tutor-spacing-6; - background-color: $tutor-border-idle; - margin-top: $tutor-spacing-6; - } -} diff --git a/classes/Template.php b/classes/Template.php index cd3b877d81..c99c67ffb8 100644 --- a/classes/Template.php +++ b/classes/Template.php @@ -10,6 +10,8 @@ namespace TUTOR; +use Tutor\Helpers\UrlHelper; + if ( ! defined( 'ABSPATH' ) ) { exit; } @@ -178,7 +180,6 @@ public function load_single_course_template( $template ) { } return $template; - } /** @@ -536,32 +537,25 @@ public static function make_learning_area_sub_page_nav_items( $base_url = '' ): $menu_items = array( 'resources' => array( - 'title' => esc_html__( 'Resources', 'tutor' ), - 'icon' => Icon::RESOURCES, - 'url' => esc_url( add_query_arg( 'subpage', 'resources', $base_url ) ), + 'title' => __( 'Resources', 'tutor' ), + 'icon' => Icon::RESOURCES, + 'url' => UrlHelper::add_query_params( $base_url, array( 'subpage' => 'resources' ) ), + 'template' => tutor_get_template( 'learning-area.subpages.resources' ), ), 'qna' => array( - 'title' => esc_html__( 'Q&A', 'tutor' ), + 'title' => __( 'Q&A', 'tutor' ), 'icon' => Icon::QA, - 'url' => esc_url( add_query_arg( 'subpage', 'qna', $base_url ) ), + 'url' => UrlHelper::add_query_params( $base_url, array( 'subpage' => 'qna' ) ), + 'template' => tutor_get_template( 'learning-area.subpages.qna' ), ), 'course-info' => array( - 'title' => esc_html__( 'Course Info', 'tutor' ), + 'title' => __( 'Course Info', 'tutor' ), 'icon' => Icon::INFO_OCTAGON, - 'url' => esc_url( add_query_arg( 'subpage', 'course-info', $base_url ) ), - ), - 'webinar' => array( - 'title' => esc_html__( 'Webinar', 'tutor' ), - 'icon' => Icon::VIDEO_CAMERA_2, - 'url' => esc_url( add_query_arg( 'subpage', 'webinar', $base_url ) ), - ), - 'certificate' => array( - 'title' => esc_html__( 'Certificate', 'tutor' ), - 'icon' => Icon::CERTIFICATE_2, - 'url' => esc_url( add_query_arg( 'subpage', 'certificate', $base_url ) ), + 'url' => UrlHelper::add_query_params( $base_url, array( 'subpage' => 'course-info' ) ), + 'template' => tutor_get_template( 'learning-area.subpages.course-info' ), ), ); - return apply_filters( 'tutor_learning_area_sub_page_nav_item', $menu_items ); + return apply_filters( 'tutor_learning_area_sub_page_nav_item', $menu_items, $base_url ); } } diff --git a/helpers/DateTimeHelper.php b/helpers/DateTimeHelper.php index e198ab6dc5..3311f995c9 100644 --- a/helpers/DateTimeHelper.php +++ b/helpers/DateTimeHelper.php @@ -122,6 +122,17 @@ public function sub( $number, $interval ) { return $this; } + /** + * Get DateTime obj. + * + * @since 4.0.0 + * + * @return DateTime + */ + public function get() { + return $this->datetime; + } + /** * Check date time is past * diff --git a/templates/dashboard/components/quiz-attempt-row.php b/templates/dashboard/components/quiz-attempt-row.php index a7426a5cbf..6a39432407 100644 --- a/templates/dashboard/components/quiz-attempt-row.php +++ b/templates/dashboard/components/quiz-attempt-row.php @@ -27,7 +27,7 @@ $show_course = $show_course ?? false; $attempt_number = $attempt_number ?? null; $attempts_count = $attempts_count ?? 0; -$badge = Badge::make()->label( 'Failed' )->variant( Variant::CANCELLED )->rounded(); +$badge = Badge::make()->label( 'Failed' )->variant( Badge::ERROR )->rounded(); $kebab_button = Button::make() ->icon( Icon::THREE_DOTS_VERTICAL ) ->attr( 'x-ref', 'trigger' ) @@ -131,12 +131,12 @@ if ( QuizModel::RESULT_PASS === $attempt['result'] ) { $badge ->label( __( 'Passed', 'tutor' ) ) - ->variant( Variant::COMPLETED ) + ->variant( Badge::SUCCESS ) ->render(); } elseif ( QuizModel::RESULT_PENDING === $attempt['result'] ) { $badge ->label( __( 'Pending', 'tutor' ) ) - ->variant( Variant::PENDING ) + ->variant( Badge::WARNING ) ->render(); } else { $badge->render(); diff --git a/templates/learning-area/index.php b/templates/learning-area/index.php index 814f791606..e18cfddfd1 100644 --- a/templates/learning-area/index.php +++ b/templates/learning-area/index.php @@ -12,10 +12,12 @@ use TUTOR\Course_List; use TUTOR\Icon; use TUTOR\Input; +use TUTOR\Template; wp_head(); $current_user_id = get_current_user_id(); +$subpages = Template::make_learning_area_sub_page_nav_items(); // Tutor global variable for using inside learning area. $tutor_current_post_type = get_post_type(); @@ -41,11 +43,11 @@ $subpage = Input::get( 'subpage' ); if ( $subpage ) { - $subpage_template = tutor_get_template( 'learning-area.subpages.' . $subpage ); - if ( file_exists( $subpage_template ) ) { - tutor_load_template( 'learning-area.subpages.' . $subpage ); + $template = $subpages[ $subpage ]['template'] ?? ''; + if ( file_exists( $template ) ) { + tutor_load_template_from_custom_path( $template ); } else { - do_action( 'tutor_single_content_' . $tutor_post_type ); + do_action( 'tutor_single_content_' . $tutor_current_post_type ); } } else { do_action( 'tutor_single_content_' . $tutor_current_post_type, $tutor_current_post ); diff --git a/templates/learning-area/subpages/certificate.php b/templates/learning-area/subpages/certificate.php deleted file mode 100644 index 397f74b189..0000000000 --- a/templates/learning-area/subpages/certificate.php +++ /dev/null @@ -1,150 +0,0 @@ - - * @link https://themeum.com - * @since 4.0.0 - */ - -use TUTOR\Icon; - -?> -
-
-