<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/
?>
<header class="inspira_header inspira_header_horizontal lp_header">
   <div class="inspira_header_container">
      <div class="header-top">
         <?php if(in_array('mainMenu',$this->options)){ ?>
         <?php } ?>
         <div class="header_logo">
            <?php if(engine_in_array('logo',$this->options)){ ?>
            <?php echo $this->content()->renderWidget("core.menu-logo",array("logo"=>$this->logo)); 
               } ?>
         </div>
         <div class="inspira_main_menu">
          <?php if(in_array('mainMenu',$this->options)){ ?>
          <ul class="navigation navigation_horizontal">
								<?php $countMenu = 0; ?>
                <?php foreach( $this->navigation as $link ): ?>
                <?php if( $countMenu < $this->menuCount ): ?>
                <?php 
                  $explodedString = explode(' ', $link->class);
                  $menuName = end($explodedString); 
                  $moduleName = str_replace('core_main_', '', $menuName);
                  if(strpos($moduleName, 'custom_') !== 0){
                    $moduleName = $moduleName.'_main';
                  }
                  ?>
                <?php $subMenus = Engine_Api::_()->getApi('menus', 'core')->getNavigation($moduleName); 
                  $menuSubArray = $subMenus->toArray();
                  ?>
                <li class="<?php echo $link->get('active') ? 'active' : '' ?>">
                  <a href='<?php echo $link->getHref() ?>' class="<?php echo $link->getClass() ? ' ' . $link->getClass() : ''  ?>"
                      <?php if( $link->get('target') ): ?> target='<?php echo $link->get('target') ?>' <?php endif; ?> >
                  <span><?php echo $this->translate($link->getlabel()) ?></span>
                  <?php if(count($menuSubArray) > 0 && $this->submenu): ?>
                  <i class="fa fa-angle-down"></i>
                  <?php endif; ?>
                  </a>
                  <?php if(count($menuSubArray) > 0 && $this->submenu): ?>
                  <ul class="main_menu_submenu">
                      <?php 
                        $counter = 0; 
                        foreach( $subMenus as $subMenu): 
                        $active = isset($menuSubArray[$counter]['active']) ? $menuSubArray[$counter]['active'] : 0;
                        ?>
                      <li class="clearfix <?php echo ($active) ? 'selected_sub_main_menu' : '' ?>">
                        <a href="<?php echo $subMenu->getHref(); ?>" <?php if( $subMenu->get('target') ): ?> target='<?php echo $subMenu->get('target') ?>' <?php endif; ?> class="<?php echo $subMenu->getClass(); ?>">
                        <i class="menu_icon <?php echo $subMenu->get('icon') ? $subMenu->get('icon') : 'fa fa-star' ?>"></i><span><?php echo $this->translate($subMenu->getLabel()); ?></span>
                        </a>
                      </li>
                      <?php 
                        $counter++;
                        endforeach; ?>
                  </ul>
                 <?php endif; ?>
               </li>
                 <?php else:?>
                <?php break;?>
               <?php endif;?>
              <?php $countMenu++;?>
              <?php endforeach; ?>
              <?php if (count($this->navigation) > $this->menuCount):?>
              <?php $countMenu = 0; ?>
              <li class="more_tab">
                <a href="javascript:void(0);">
                <span><?php echo $this->translate("More") ?></span>
                <i class="fa fa-angle-down"></i>
                </a>
                <ul class="main_menu_submenu">
                    <?php foreach( $this->navigation as  $link ): ?>
                    <?php if ($countMenu >= $this->menuCount): ?>
                    <?php 
                      $explodedString = explode(' ', $link->class);
                      $menuName = end($explodedString); 
                      $moduleName = str_replace('core_main_', '', $menuName);
                      if(strpos($moduleName, 'custom_') !== 0){
                        $moduleName = $moduleName.'_main';
                      }
                      ?>
                    <?php 
                      $subMenus = Engine_Api::_()->getApi('menus', 'core')->getNavigation($moduleName);
                      $menuSubArray = $subMenus->toArray();
                      ?>
                    <li class="<?php echo $link->get('active') ? 'active' : '' ?>">
                      <a href='<?php echo $link->getHref() ?>' class="<?php echo $link->getClass() ? ' ' . $link->getClass() : ''  ?>"
                          <?php if( $link->get('target') ): ?> target='<?php echo $link->get('target') ?>' <?php endif; ?> >
                      <span><?php echo $this->translate($link->getlabel()) ?></span>
                      </a>
                    </li>
                    <?php endif;?>
                    <?php $countMenu++;?>
                    <?php endforeach; ?>
                </ul>
              </li>
              <?php endif;?>
          </ul>
         <?php } ?>
   </div>
         <?php if(engine_in_array('miniMenu',$this->options)){ ?>
      
         <div class="header_menu_mini">
         <?php if(!empty($this->search_check) && engine_in_array('search',$this->options)){ ?>
            <div class="search_button" id="search_box_button">
              <a href="javascript:void(0)">  
                <i class="fa fa-search" aria-hidden="true"></i>
              </a>
            </div>
            <div class="header_search" id="search_box">
              <?php if(engine_in_array('search',$this->options)){ ?>
                <i class="fas fa-search"></i>
                <?php echo $this->content()->renderWidget("core.search-mini"); ?>
              <?php } ?>      
              </div>
              <?php } ?> 
            <?php echo $this->content()->renderWidget("core.menu-mini"); ?>
         </div>
         <?php } ?>
         
      </div>
   </div>

</header>
<script type="text/javascript">
   // Header Spacing
   en4.core.runonce.add(function() {
      var height = scriptJquery(".layout_page_header").height();
      if(document.getElementById("global_wrapper")) {
         scriptJquery("#global_wrapper").css("margin-top", height+"px");
      }
   }); 
  // Header Scroll
  scriptJquery(window).scroll(function() {
    if (scriptJquery(this).scrollTop() > 160){
    scriptJquery('.layout_inspira_landing_page_header ').addClass("sticyheader");
    } else {
    scriptJquery('.layout_inspira_landing_page_header').removeClass("sticyheader");
    }
  });

  // Search Box
scriptJquery('body').on('click', '#search_box_button', function () {
  var self = scriptJquery("#search_box");
  if (self.hasClass('open')) {
    scriptJquery('#search_box').removeClass('open');
      return false;
  }
  scriptJquery('#search_box').removeClass('open');
  self.toggleClass('open');
  hide = false;
});


</script>
