<?php
/**
 * Header templates
 *
 * @package DateBook
 * @author Pagick Themes
 * @link https://www.pagickthemes.com
 */

$is_front_page = is_front_page() ? 1 : 0;

$datebook_moderation = isset($_GET['datebook-moderation']) && $_GET['datebook-moderation'] == 'yes' && isset($_GET['moderation-page']) && ($_GET['moderation-page'] == 'profiles' || $_GET['moderation-page'] == 'images') ? 1 : 0;

if (($is_front_page == 1 && $datebook_moderation == 0 && of_get_option( 'logo_position_front' ) == 'top') || ($is_front_page == 0 && of_get_option( 'logo_position_other' ) == 'top')) { ?>
	
	<div class="datebook-logo-container datebook-logo-top">
		<div class="container">

			<?php include DateBook_Template_Loader::locate( 'pages/header-logo' ); ?>

		</div>
	</div>

<?php

}

if (($is_front_page == 1 && of_get_option( 'primary_menu_position_front' ) == 'top') || ($is_front_page == 0 && of_get_option( 'primary_menu_position_other' ) == 'top')) {
	include DateBook_Template_Loader::locate( 'pages/primary-menu' );
}

if ((get_theme_mod( 'datebook_advanced_control') == 2 && get_theme_mod( 'datebook_show_top_menu', 1 ) == '1' || get_theme_mod( 'datebook_advanced_control', 1) == 1) && (has_nav_menu('datebook-top-menu-left-' . DATEBOOK_WPLANG) || has_nav_menu('datebook-top-menu-right-' . DATEBOOK_WPLANG))) {
	if (($is_front_page == 1 && $datebook_moderation == 0 && of_get_option('top_menu_enabled_front') && of_get_option( 'top_menu_position_front' ) == 'top') || ($is_front_page == 0 && of_get_option('top_menu_enabled_other') && of_get_option( 'top_menu_position_other' ) == 'top')) {

		include DateBook_Template_Loader::locate( 'pages/top-menu' );

	}
}

?>

<div id="datebook-header" class="mb-3">

	<?php do_action('datebook_moderator_panel'); ?>

	<div class="datebook-front-view">

		<?php

		if ((get_theme_mod( 'datebook_advanced_control') == 2 && get_theme_mod( 'datebook_show_top_menu', 1 ) == '1' || get_theme_mod( 'datebook_advanced_control', 1) == 1) && (has_nav_menu('datebook-top-menu-left-' . DATEBOOK_WPLANG) || has_nav_menu('datebook-top-menu-right-' . DATEBOOK_WPLANG))) {
			if (($is_front_page == 1 && $datebook_moderation == 0 && of_get_option('top_menu_enabled_front') && of_get_option('top_menu_position_front') == 'inside') || ($is_front_page == 0 && of_get_option('top_menu_enabled_other') && of_get_option( 'top_menu_position_other' ) == 'inside')) {

				include DateBook_Template_Loader::locate( 'pages/top-menu' );

			}
		}

		if (($is_front_page == 1 && $datebook_moderation == 0 && of_get_option( 'user_menu_position_front' ) == 'top') || ($is_front_page == 0 && of_get_option( 'user_menu_position_other' ) == 'top')) {

			DateBook_Menu::echo_user_menu();

		}

		if (of_get_option( 'logo_position_front' ) && (($is_front_page == 1 && of_get_option( 'logo_position_front' ) == 'inheader') || ($is_front_page == 0 && of_get_option( 'logo_position_other' ) == 'inheader'))) { ?>

			<div class="datebook-logo-container datebook-logo-inheader">
				<div class="container">

					<?php include DateBook_Template_Loader::locate( 'pages/header-logo' ); ?>

				</div>
			</div>

		<?php }


		if (($is_front_page == 1 && $datebook_moderation == 0 && of_get_option( 'user_menu_position_front' ) == 'underlogo') || ($is_front_page == 0 && of_get_option( 'user_menu_position_other' ) == 'underlogo')) {

			DateBook_Menu::echo_user_menu();

		}

		if (($is_front_page == 1 && of_get_option( 'primary_menu_position_front' ) == 'inside') || ($is_front_page == 0 && of_get_option( 'primary_menu_position_other' ) == 'inside')) {
			include DateBook_Template_Loader::locate( 'pages/primary-menu' );
		}


		if (($is_front_page == 1 && $datebook_moderation == 0 && of_get_option( 'user_menu_position_front' ) == 'underprimarymenu' && isset($_GET['datebook-moderation']) && $_GET['datebook-moderation'] == 'yes') || ($is_front_page == 0 &&  of_get_option( 'user_menu_position_other' ) == 'underprimarymenu')) {
			
			do_action('datebook_header_menu');
			
		} else if (is_front_page() && !isset($_GET['datebook-moderation'])) {

			?>

		<div class="datebook-welcome-image">

			<?php if (($is_front_page == 1 && $datebook_moderation == 0 && of_get_option( 'user_menu_position_front' ) == 'underprimarymenu') || ($is_front_page == 0 && of_get_option( 'user_menu_position_other' ) == 'underprimarymenu')) {

				DateBook_Menu::echo_user_menu();

			}

			if (of_get_option('welcome_slogan_' . DATEBOOK_WPLANG)) { ?>

			<div class="container">
				<div class="row">
					<div class="col-lg-12 col-md-12 col-sm-12 datebook-padding-less">
						<div class="datebook-welcome-panel">
							<h1 class="datebook-welcome-slogan"><?php echo of_get_option('welcome_slogan_' . DATEBOOK_WPLANG); ?></h1>
						</div>
					</div>
				</div>
			</div>

			<?php } ?>

			<?php if (of_get_option( 'search_allowed' ) == '1' && of_get_option( 'show_searchpanel' ) == '1') { ?>

			<div class="container">
				<div class="row">
					<div class="col-lg-12 col-md-12 col-sm-12 datebook-padding-less">

					<?php do_action('datebook_search_front'); ?>

					</div>
				</div>
			</div>

			<?php } ?>

		</div>

		<?php
	
		}

		if ($is_front_page == 1 && $datebook_moderation == 0 && of_get_option( 'user_menu_position_front' ) == 'underlast') {

			DateBook_Menu::echo_user_menu();

		}

		?>

	</div>
</div>

<?php if ($is_front_page == 0 && of_get_option( 'user_menu_position_other' ) == 'underlast') { ?>

	<div class="container">
		<div class="datebook-custom-card card datebook-userpanel-under">

			<?php DateBook_Menu::echo_user_menu(); ?>

		</div>
	</div>

<?php }

if ($datebook_moderation == 0) {

	do_action('datebook_featured_profiles');
	
}