<?php

/**
 * Getting Option values for Header
 * @package Edumodo
 */

$post_id = edumodo_get_id();
// Header variation
$enable_scroll_top     = get_theme_mod('edumodo_enable_scrolltop', 'on');
$enable_preloader      = get_theme_mod('edumodo_preloader', 'off');
$main_header_sticky    = get_theme_mod('edumodo_header_sticky_option', 'off');
$enable_page_header    = get_theme_mod('edumodo_section_enable_page_title', 'on');
$enable_breadcrumb     = get_theme_mod('edumodo_enable_breadcrumb', 'on');
$notice_title          = get_theme_mod('edumodo_notice_archive_title', 'All Notices');
$event_title           = get_theme_mod('edumodo_event_archive_custom_title', 'Events');
$blog_title            = get_theme_mod('edumodo_blog_archive_custom_title', 'Blog');
$learnpress_title      = get_theme_mod('edumodo_learnpress_archive_custom_title', 'Courses');
$teacher_title         = get_theme_mod('edumodo_teacher_archive_custom_title', 'Teachers');
$woo_title             = get_theme_mod('edumodo_woocommerce_archive_custom_title', 'Products');
$single_page_title_img = get_post_meta(get_the_ID(), '_edumodo_header_img', true);
$page_custom_title     = get_post_meta(get_the_ID(), '_edumodo_page_title', true);
$enable_custom_page_header = get_post_meta(get_the_ID(), '_edumodo_title_enable', true);
$enable_header_top_bar = get_theme_mod('edumodo_header_enable_top_bar', 'no');
$enable_login          = get_theme_mod('edumodo_header_enable_login', 'yes');
$enable_social         = get_theme_mod('edumodo_header_social_enable', 'yes');
$phone_number          = get_theme_mod('edumodo_top_bar_phone', '0123456789');
$email                 = get_theme_mod('edumodo_top_bar_email', 'hello@admin.com');
$login_text            = get_theme_mod('edumodo_top_bar_login_text', 'Login');
$login_url             = get_theme_mod('edumodo_top_bar_login_url', '#');
$registration_text     = get_theme_mod('edumodo_top_bar_register_text', 'Register');
$registration_url      = get_theme_mod('edumodo_top_bar_register_url', '#');
$profile_text          = get_theme_mod('edumodo_top_bar_register_text', 'Profile');
$profile_url           = get_theme_mod('edumodo_top_bar_register_url', '#');
$facebook              = get_theme_mod('edumodo_social_facebook_url', '#');
$twitter               = get_theme_mod('edumodo_social_twitter_url', '#');
$instagram             = get_theme_mod('edumodo_social_instagram_url', '#');
$linkedin              = get_theme_mod('edumodo_social_linkedin_url', '#');
$whatsapp              = get_theme_mod('edumodo_social_whatsapp_url', '#');
$youtube               = get_theme_mod('edumodo_social_youtube_url', '#');
$skype                 = get_theme_mod('edumodo_social_skype_url', '#');
$snapchat              = get_theme_mod('edumodo_social_snapchat_url', '#');
$enable_cart           = get_theme_mod('edumodo_header_cart', 'off');
$enable_search         = get_theme_mod('edumodo_header_search', 'off');
$breadcrumb_wrap_class = '';

if (is_home()) {
$breadcrumb_wrap_class = 'blog';
} elseif (is_search()) {
$breadcrumb_wrap_class = 'search';
} elseif (is_404()) {
$breadcrumb_wrap_class = 'not-found';
} elseif (is_post_type_archive('notice')) {
$breadcrumb_wrap_class = 'notice';
} elseif (is_post_type_archive('courses')) {
$breadcrumb_wrap_class = 'course';
} elseif (class_exists('WooCommerce')) {
if (is_woocommerce()) {
$breadcrumb_wrap_class = 'woocommerce';
}
} else {
$breadcrumb_wrap_class = '';
}
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?> class="no-js no-svg">

<head>
    <meta charset="<?php bloginfo('charset'); ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="profile" href="http://gmpg.org/xfn/11">

    <?php wp_head(); ?>
</head>


<body <?php body_class(); ?>>

    <!-- Preloader -->
    <?php if ($enable_preloader == 'on') :
        if (edumodo_check_if_this_plugin_is_active('elementor/elementor.php')) :
            if (\Elementor\Plugin::$instance->preview->is_preview_mode()) {
                return;
            }
        endif;
    ?>
    <div class="edumodo-preloader">
        <span class="edumodoloader">
            <span class="edumodoloader-inner"></span>
        </span>
    </div>
    <?php endif; ?>

    <!-- Back to top button -->
    <?php if ($enable_scroll_top == 'on') : ?>
    <a id="scrollTop" class="glyph-icon flaticon-up-arrow"></a>
    <?php endif; ?>

    <div id="tx-site-container" class="tx-site-container <?php if (!is_home() && !is_front_page()) : echo "inner-page-class";
                                                            else : endif; ?>">
        <div class="tx-site-pusher">
            <div class="tx-site-content">
                <!-- this is the wrapper for the content -->
                <div class="tx-site-content-inner">
                    <div id="page" class="site">
                        <div class="responsive-offcanvas-wrap">
                            <div class="sidebar-inner">
                                <div class="sidebar-close">
                                    <div class="sidebar-close-btn">
                                        <i class="fa fa-times"></i>
                                    </div>
                                </div>
                                <div class="sidebar-content">
                                    <div class="sidebar-logo">
                                        <?php
                                        if (has_custom_logo()) {
                                            the_custom_logo();
                                        }
                                        ?>
                                    </div>
                                    <div class="mobile-menu"></div>

                                    <!-- Search Form -->
                                    <?php if ('on' == $enable_search) : ?>
                                    <div class="offcanvas-search-form">
                                        <?php get_search_form(); ?>
                                    </div>
                                    <?php endif; ?>

                                    <!-- Contact Info -->
                                    <?php if ('yes' == $enable_header_top_bar && (!empty($phone_number) || !empty($email))) : ?>
                                    <div class="offcanvas-contact-info">
                                        <ul>
                                            <?php if (!empty($phone_number)) : ?>
                                            <li>
                                                <i class="glyph-icon flaticon-telephone-handle-silhouette"></i>
                                                <a class="top-phone"
                                                    href="tel:<?php echo esc_attr__($phone_number, 'edumodo'); ?>"><?php echo esc_html__($phone_number, 'edumodo'); ?></a>
                                            </li>
                                            <?php endif; ?>
                                            <?php if (!empty($email)) : ?>
                                            <li>
                                                <i class="glyph-icon flaticon-message-closed-envelope"></i>
                                                <a class="top-email"
                                                    href="mailto:<?php echo esc_attr__($email, 'edumodo') ?>"><?php echo esc_html__($email, 'edumodo') ?></a>
                                            </li>
                                            <?php endif; ?>
                                        </ul>
                                    </div>
                                    <?php endif; ?>

                                    <!-- Social Icons -->
                                    <?php if ('yes' == $enable_header_top_bar && 'yes' == $enable_social) : ?>
                                    <div class="offcanvas-social-icons">
                                        <ul>
                                            <?php if (!empty($facebook)) : ?>
                                            <li><a href="<?php echo esc_url($facebook); ?>"><i
                                                        class="fa fa-facebook"></i></a></li>
                                            <?php endif; ?>
                                            <?php if (!empty($twitter)) : ?>
                                            <li><a href="<?php echo esc_url($twitter); ?>"><i
                                                        class="fa fa-twitter"></i></a></li>
                                            <?php endif; ?>
                                            <?php if (!empty($instagram)) : ?>
                                            <li><a href="<?php echo esc_url($instagram); ?>"><i
                                                        class="fa fa-instagram"></i></a></li>
                                            <?php endif; ?>
                                            <?php if (!empty($linkedin)) : ?>
                                            <li><a href="<?php echo esc_url($linkedin); ?>"><i
                                                        class="fa fa-linkedin"></i></a></li>
                                            <?php endif; ?>
                                            <?php if (!empty($whatsapp)) : ?>
                                            <li><a href="<?php echo esc_url($whatsapp); ?>"><i
                                                        class="fa fa-whatsapp"></i></a></li>
                                            <?php endif; ?>
                                            <?php if (!empty($youtube)) : ?>
                                            <li><a href="<?php echo esc_url($youtube); ?>"><i
                                                        class="fa fa-youtube"></i></a></li>
                                            <?php endif; ?>
                                            <?php if (!empty($skype)) : ?>
                                            <li><a href="<?php echo esc_url($skype); ?>"><i class="fa fa-skype"></i></a>
                                            </li>
                                            <?php endif; ?>
                                            <?php if (!empty($snapchat)) : ?>
                                            <li><a href="<?php echo esc_url($snapchat); ?>"><i
                                                        class="fa fa-snapchat"></i></a></li>
                                            <?php endif; ?>
                                        </ul>
                                    </div>
                                    <?php endif; ?>

                                    <!-- Login/Registration -->
                                    <?php if ('yes' == $enable_header_top_bar && 'yes' == $enable_login) : ?>
                                    <div class="offcanvas-login-reg-btn">
                                        <ul>
                                            <?php if (is_user_logged_in()) : ?>
                                            <li>
                                                <a href="<?php echo wp_logout_url(); ?>"><i class="fa fa-unlock"></i>
                                                    <?php _e('Logout', 'edumodo') ?></a>
                                            </li>
                                            <?php if (!empty($profile_text)) : ?>
                                            <li>
                                                <a href="#"><i class="fa fa-user"></i>
                                                    <?php echo esc_html__($profile_text, 'edumodo') ?></a>
                                            </li>
                                            <?php endif; ?>

                                            <?php else : ?>
                                            <?php if (!empty($login_url)) : ?>
                                            <li>
                                                <a href="<?php echo esc_url($login_url) ?>"><i class="fa fa-lock"></i>
                                                    <?php echo esc_html__($login_text, 'edumodo') ?></a>
                                            </li>
                                            <?php endif; ?>

                                            <?php if (!empty($registration_url)) : ?>
                                            <li>
                                                <a href="<?php echo esc_url($registration_url) ?>"><i
                                                        class="fa fa-user"></i>
                                                    <?php echo esc_html__($registration_text, 'edumodo') ?></a>
                                            </li>
                                            <?php endif; ?>
                                            <?php endif; ?>
                                        </ul>
                                    </div>
                                    <?php endif; ?>
                                </div>
                            </div>
                        </div>
                        <header
                            class="edumodo-header <?php echo 'on' === $main_header_sticky ? 'sticky-active' : ''; ?>">
                            <?php get_template_part('template-parts/header/header', 'v1'); ?>
                        </header>

                        <?php if ( !is_front_page() && 'on' == $enable_page_header && !is_singular( 'lp_course' )) : ?>
                            <?php if ( !is_page() ) : ?>
                            <div class="page-details <?php echo esc_attr($breadcrumb_wrap_class); ?>"
                                style="<?php if ($single_page_title_img) : ?>background-image: url(<?php echo esc_url($single_page_title_img); ?>); <?php else : ?><?php endif; ?>">
                                <div class="container">
                                    <div class="page-wrapper">
                                        <?php if (is_post_type_archive('notice') && !empty($notice_title)) : ?>
                                        <h2 class="page-title edumodo-archive-tite">
                                            <?php echo esc_html__($notice_title, 'edumodo') ?></h2>
                                        <?php elseif (is_post_type_archive('tribe_events') && !empty($event_title)) : ?>
                                        <h2 class="page-title edumodo-archive-tite">
                                            <?php echo esc_html__($event_title, 'edumodo') ?></h2>
                                        <?php elseif (is_post_type_archive('teacher') && !empty($teacher_title)) : ?>
                                        <h2 class="page-title edumodo-archive-tite">
                                            <?php echo esc_html__($teacher_title, 'edumodo') ?></h2>
                                        <?php elseif (is_post_type_archive('lp_course') && !empty($learnpress_title)) : ?>
                                        <h2 class="page-title edumodo-archive-tite">
                                            <?php echo esc_html__($learnpress_title, 'edumodo') ?></h2>
                                        <?php elseif (is_home() && !empty($blog_title)) : ?>
                                        <h2 class="page-title edumodo-archive-tite">
                                            <?php echo esc_html__($blog_title, 'edumodo') ?></h2>
                                        <?php elseif (is_post_type_archive('product') && !empty($woo_title)) : ?>
                                        <h2 class="page-title edumodo-archive-tite">
                                            <?php echo esc_html__($woo_title, 'edumodo') ?></h2>
                                        <?php elseif (class_exists('woocommerce')) : ?>
                                        <?php if(is_product_category()):?>
                                        <h2 class="page-title edumodo-archive-tite">
                                            <?php echo esc_html__($woo_title, 'edumodo') ?></h2>
                                        <?php else:?>
                                        <h2 class="page-title edumodo-archive-tite">
                                            <?php echo esc_html__(the_title(), 'edumodo') ?></h2>
                                        <?php endif;?>
                                        <?php else : ?>
                                        <h2 class="page-title edumodo-archive-tite">
                                            <?php echo esc_html__(the_title(), 'edumodo') ?></h2>
                                        <?php endif; ?>
                                        <?php if ('on' == $enable_breadcrumb) : ?>
                                        <div class="breadcrumbs">
                                            <?php if (function_exists('bcn_display')) bcn_display(); ?>
                                        </div>
                                        <?php endif; ?>
                                    </div>
                                </div>
                            </div>
                            
                            <?php elseif ( 'enable' == $enable_custom_page_header ) :?>
                                <div class="page-details <?php echo esc_attr($breadcrumb_wrap_class); ?>"
                                style="<?php if ($single_page_title_img) : ?>background-image: url(<?php echo esc_url($single_page_title_img); ?>); <?php else : ?><?php endif; ?>">
                                <div class="container">
                                    <div class="page-wrapper">
                                        <?php if (is_page() && !empty($page_custom_title )) : ?>
                                        <h2 class="page-title edumodo-archive-tite">
                                            <?php echo esc_html__($page_custom_title , 'edumodo') ?></h2>
                                        <?php elseif (is_post_type_archive('notice') && !empty($notice_title)) : ?>
                                        <h2 class="page-title edumodo-archive-tite">
                                            <?php echo esc_html__($notice_title, 'edumodo') ?></h2>
                                        <?php elseif (is_post_type_archive('tribe_events') && !empty($event_title)) : ?>
                                        <h2 class="page-title edumodo-archive-tite">
                                            <?php echo esc_html__($event_title, 'edumodo') ?></h2>
                                        <?php elseif (is_post_type_archive('teacher') && !empty($teacher_title)) : ?>
                                        <h2 class="page-title edumodo-archive-tite">
                                            <?php echo esc_html__($teacher_title, 'edumodo') ?></h2>
                                        <?php elseif (is_post_type_archive('lp_course') && !empty($learnpress_title)) : ?>
                                        <h2 class="page-title edumodo-archive-tite">
                                            <?php echo esc_html__($learnpress_title, 'edumodo') ?></h2>
                                        <?php elseif (is_home() && !empty($blog_title)) : ?>
                                        <h2 class="page-title edumodo-archive-tite">
                                            <?php echo esc_html__($blog_title, 'edumodo') ?></h2>
                                        <?php elseif (is_post_type_archive('product') && !empty($woo_title)) : ?>
                                        <h2 class="page-title edumodo-archive-tite">
                                            <?php echo esc_html__($woo_title, 'edumodo') ?></h2>
                                        <?php elseif (class_exists('woocommerce')) : ?>
                                        <?php if(is_product_category()):?>
                                        <h2 class="page-title edumodo-archive-tite">
                                            <?php echo esc_html__($woo_title, 'edumodo') ?></h2>
                                        <?php else:?>
                                        <h2 class="page-title edumodo-archive-tite">
                                            <?php echo esc_html__(the_title(), 'edumodo') ?></h2>
                                        <?php endif;?>
                                        <?php else : ?>
                                        <h2 class="page-title edumodo-archive-tite">
                                            <?php echo esc_html__(the_title(), 'edumodo') ?></h2>
                                        <?php endif; ?>
                                        <?php if ('on' == $enable_breadcrumb) : ?>
                                        <div class="breadcrumbs">
                                            <?php if (function_exists('bcn_display')) bcn_display(); ?>
                                        </div>
                                        <?php endif; ?>
                                    </div>
                                </div>
                            </div>
                            <?php endif;?>                                
                            <?php endif;?>                                
                        <div id="content" class="site-content fixed-header-margin">