comment-card.php
3 weeks ago
comment-form.php
3 weeks ago
comment-list.php
3 weeks ago
comment-replies.php
3 weeks ago
comments.php
3 weeks ago
content.php
3 weeks ago
exercise-files.php
3 weeks ago
footer.php
3 weeks ago
nav-item.php
1 week ago
overview.php
3 weeks ago
nav-item.php
48 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Show lesson nav item on the learning area |
| 4 | * |
| 5 | * @package Tutor\Templates |
| 6 | * @subpackage LearningArea |
| 7 | * @author Themeum <support@themeum.com> |
| 8 | * @link https://themeum.com |
| 9 | * @since 4.0.0 |
| 10 | */ |
| 11 | |
| 12 | defined( 'ABSPATH' ) || exit; |
| 13 | |
| 14 | use TUTOR\Icon; |
| 15 | use TUTOR\Lesson; |
| 16 | |
| 17 | global $tutor_current_content_id; |
| 18 | |
| 19 | $lesson = $lesson ?? null; |
| 20 | $can_access = $can_access ?? false; |
| 21 | |
| 22 | if ( ! $lesson && ! is_a( $lesson, 'WP_Post' ) ) { |
| 23 | return; |
| 24 | } |
| 25 | |
| 26 | $is_completed = tutor_utils()->is_completed_lesson( $lesson->ID ); |
| 27 | $lesson_type = Lesson::get_content_type_info( $lesson ); |
| 28 | |
| 29 | $icon_name = Icon::COURSES; |
| 30 | if ( ! $can_access ) { |
| 31 | $icon_name = Icon::LOCK_STROKE_2; |
| 32 | } elseif ( $is_completed ) { |
| 33 | $icon_name = Icon::COMPLETED_COLORIZE; |
| 34 | } |
| 35 | |
| 36 | tutor_load_template( |
| 37 | 'learning-area.components.sidebar-nav-item', |
| 38 | array( |
| 39 | 'item' => $lesson, |
| 40 | 'active' => $tutor_current_content_id === $lesson->ID, |
| 41 | 'can_access' => $can_access, |
| 42 | 'is_completed' => $is_completed, |
| 43 | 'type_label' => $lesson_type, |
| 44 | 'icon' => $icon_name, |
| 45 | 'status_class' => '', |
| 46 | ) |
| 47 | ); |
| 48 |