<?php
/**
 * The header for our theme
 *
 * This is the template that displays all of the <head> section and everything up until <div id="content">
 *
 * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
 *
 * @package Sparta
 */

?>
<?php
$hclass = array();
$custom_change_page_header = $custom_page_header_trans = '';
if (true == get_theme_mod('sparta_header_fixed_fullwidth', true)) :
    $hclass[] = ' vk-header-fixed';
endif;

if (is_page()) :
    global $post;
    $meta_page_header_fixed = get_post_meta($post->ID, 'univer_page_header_fixed', true);
    $meta_page_header_trans = get_post_meta($post->ID, 'univer_page_header_trans', true);

    if ($meta_page_header_trans !== '' && $meta_page_header_trans === 'yes') :
        $hclass[] = ' vk-header-transparent';
    endif;

    if ($meta_page_header_fixed !== '' && $meta_page_header_fixed === 'yes') :
        $hclass[] = ' vk-header-fixed';
    endif;
endif;

$sparta_header_default_logo = get_theme_mod('sparta_header_default_logo', '');
$sparta_header_trans_logo = get_theme_mod('sparta_header_trans_logo', '');

/*Render page loader*/
echo wp_kses_post(Sparta_Helper::sparta_page_loader());
?>
<header class="vk-header header-left <?php if (!empty($hclass)) : echo esc_attr(implode(' ', $hclass)); endif; ?>">
    <?php if (is_page('homepage') || is_front_page() || is_home()) : ?>
        <h1 class="homepage-title"><?php the_title(); ?></h1>
    <?php endif; ?>
    <div class="menu_controller">
        <div class="menu_button">
            <div id="click_trigger" class="p-left row_flex open">
                <div class="box_sticks">
                    <div id="stick1" class="stick"></div>
                    <div id="stick2" class="stick"></div>
                    <div id="stick3" class="stick"></div>
                </div>
            </div>
        </div>
    </div>
    <nav id="sparta-menu" class="hidden has_transition_1000 overlay_panel">
        <div class="panel_logo">
            <a href="<?php echo esc_url(home_url('/')); ?>" title="<?php echo esc_attr(get_bloginfo('name', 'display')); ?>">
                <?php
                if (!empty($hclass)) :
                    if ($sparta_header_trans_logo != ''):
                        echo '<img src="' . esc_url($sparta_header_trans_logo) . '" alt="' . esc_attr(get_bloginfo('description')) . '">';
                    else:
                        ?>
                        <img src="<?php echo get_template_directory_uri() . '/assets/images/logo.png'; ?>" alt="<?php echo esc_attr(get_bloginfo('description')); ?>" class="logo-df">
                    <?php
                    endif;
                else:
                    if ($sparta_header_default_logo) :
                        echo '<img src="' . esc_url($sparta_header_default_logo) . '" alt="' . esc_attr(get_bloginfo('description')) . '">';
                    else :
                        ?>
                        <img src="<?php echo get_template_directory_uri() . '/assets/images/logo.png'; ?>" alt="<?php echo esc_attr(get_bloginfo('description')); ?>" class="logo-df">
                    <?php endif;
                endif;
                ?>
            </a>
        </div>
        <div class="panel_content">
            <?php
            wp_nav_menu(
                array(
                    'container_class' => 'sparta-vertical-menu',
                    'container_id' => 'myNavbar',
                    'menu_class' => 'vertical-menu',
                    'theme_location' => 'main-menu'
                )
            );
            ?>
        </div>
    </nav>
    <?php if (class_exists('HotelBookingPlugin')): ?>
        <a href="<?php echo esc_url(sparta_get_link_page_booking()); ?>" class="btn book-now">
            <?php echo esc_html__('BOOK NOW', 'sparta'); ?>
        </a>
    <?php endif; ?>
</header>