Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion assets/src/scss/frontend/learning-area/pages/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
@forward './qna';
@forward './quiz-intro';
@forward './resources';
@forward './webinar';
@forward './quiz-summary';
100 changes: 0 additions & 100 deletions assets/src/scss/frontend/learning-area/pages/_webinar.scss

This file was deleted.

32 changes: 13 additions & 19 deletions classes/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

namespace TUTOR;

use Tutor\Helpers\UrlHelper;

if ( ! defined( 'ABSPATH' ) ) {
exit;
}
Expand Down Expand Up @@ -178,7 +180,6 @@ public function load_single_course_template( $template ) {
}

return $template;

}

/**
Expand Down Expand Up @@ -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 );
}
}
11 changes: 11 additions & 0 deletions helpers/DateTimeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
6 changes: 3 additions & 3 deletions templates/dashboard/components/quiz-attempt-row.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' )
Expand Down Expand Up @@ -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();
Expand Down
10 changes: 6 additions & 4 deletions templates/learning-area/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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 );
Expand Down
150 changes: 0 additions & 150 deletions templates/learning-area/subpages/certificate.php

This file was deleted.

Loading
Loading