<?php
use Elementor\Utils;
// Silence is golden.

	$settings = $this->get_settings_for_display();
    $id = $this->get_id();

    if( class_exists('SFWD_LMS') ) :
        $elementor_editor = \Elementor\Plugin::instance()->editor->is_edit_mode();
        if( $elementor_editor ) {
            $course_id = learndash_post_arr()[0];
        } else {
            $course_id = learndash_get_course_id();
        }

        $course = get_post($course_id);
        $user_id = $course->post_author;
        $course_price_type = learndash_get_course_meta_setting($course_id, 'course_price_type');
        $course_price = learndash_get_course_meta_setting($course_id, 'course_price');

        if( !empty( $course_id ) && !empty( get_post_meta($course_id,'_wkfe_ld_template_course_cover_photo',true) ) ) {
            $bannerstyle = 'style="background-image:url('.esc_url(get_post_meta($course_id,'_wkfe_ld_template_course_cover_photo',true)).')"';
        } else {
            $bannerstyle = '';
        }

        ?>
            <div <?php echo wp_kses_post($bannerstyle); ?> class="learndash-course-banner">
                <!-- <div class="row"> -->
                    <div class="course-banner-left">
                        <?php if( !empty($course_id) ):?>
                            <h1><?php echo wp_kses_post( get_the_title($course_id) ); ?></h1>
                        <?php endif; ?>

                        <?php if( !empty(get_post_meta($course_id,'_wkfe_ld_template_course_short_desc',true)) ):?>
                            <p><?php echo wp_kses_post( get_post_meta($course_id,'_wkfe_ld_template_course_short_desc',true) ); ?></p>
                        <?php endif; ?>
                        <div class="course-author">
                            <div class="author-image">
                                <?php echo get_avatar( $user_id,50, '', ''); ?>
                            </div>
                            <div class="author-name"><?php echo esc_html( get_the_author_meta( 'display_name', $user_id ) ); ?></div>
                        </div>
                    </div>
                    <!-- <div class="col-lg-5"> -->
                        <?php if( $settings['button_trigger'] == 'yes' ) : ?>
                            <div class="course-banner-right text-right">
                                <?php
                                    echo do_shortcode('[learndash_payment_buttons course_id="'.$course_id.'"]');
                                ?>
                            </div>
                        <?php endif; ?>
                    <!-- </div> -->
                <!-- </div> -->
            </div>
    <?php
        else :
    ?>
        <div class="plugin-active-massage">
            <h3><?php esc_html_e('Please activate LearnDash LMS plugin first', 'widgetkit-pro');?></h3>
        </div>
    <?php endif;