Header Inner Panel (header-inner - Copy.php)

This panel renders the top and bottom header sections for the LinuxFront-V2 Logistics frontend. It builds dynamic navigation based on session state, static page configuration, and customer context. Built with PHP, HTML, and Bootstrap, it adapts for desktop and mobile views.


🔍 Purpose

  • Display a toll-free contact strip.
  • Render site-wide navigation links from a static pages array.
  • Show user-specific menus when logged in.
  • Present the logo, primary navbar, and a company/location selector for tracking shipments.

🏗 Structure Overview

  1. Top Strip
  2. Static Pages Navigation
  3. User Navigation (if logged in)
  4. Bottom Strip
    • Logo
    • Main Menu
    • Track & Switch Company/Location

1. Top Strip

A slim bar showing contact info.

<div id="mw-header" class="mw-header-one">
  <div class="mw-topstrip">
    <div class="container">
      <div class="row">
        <div class="col-md-3">
          <ul class="mw-contact-num">
            <li><i class="fa fa-phone"></i><span>Toll-Free: 800.641.5300</span></li>
          </ul>
        </div>
        <!-- … -->
  • CSS Classes: mw-topstrip, mw-contact-num
  • Icon: FontAwesome phone (<i class="fa fa-phone">)
  • Emoji: 📞 represents the call indicator

2. Static Pages Navigation

Dynamically iterates over $staticPagesArray to render sidebar links.

<?php foreach($staticPagesArray as $pageArray): ?>
  <?php if($pageArray["include_in_side_bar"] == 'Y'): ?>
    <a href="<?= $pageArray["page_key"] ?>.php"
       <?= ($currnt_file_name == $pageArray["page_key"] . ".php") ? 'class="active_link"' : '' ?>>
      <?= $pageArray["page_name"] ?>
    </a>
  <?php endif; ?>
<?php endforeach; ?>
  • Variables
    • $staticPagesArray: Array of pages with keys page_key, page_name, include_in_side_bar.
    • $currnt_file_name: Current script filename.
  • Active Link: Adds class="active_link" when the link matches the current file.

3. User Navigation (Conditional)

Displays when $_SESSION['Customer_ID'] is set.

<?php if(!empty($_SESSION['Customer_ID'])): ?>
  <div id="nav-user" class="ddsmoothmenu">
    <ul>
      <li><a href="my_account.php" <?= in_array($currnt_file_name, $myaccount_pages) ? 'class="active_link"' : '' ?>>My Account</a>
        <ul>
          <li>
            <?php if($_SESSION['Customer_Billing_COUNTRY'] == '18'): ?>
              <a href="javascript:{}" rel="ltl" class="startquoteclass">Quote &amp; Ship</a>
            <?php else: ?>
              <a href="start_quote.php">Quote &amp; Ship</a>
            <?php endif; ?>
          </li>
          <!-- Other submenu items… -->
        </ul>
      </li>
      <li><a href="my_shipments.php" <?= $currnt_file_name == "my_shipments.php" ? 'class="active_link"' : '' ?>>My Shipments</a></li>
      <li><a class="logout" href="logout.php">Logout</a></li>
    </ul>
  </div>
<?php endif; ?>
  • Menus
    • My Account dropdown 📋
    • My Shipments quick link 🚚
    • Logout button 🚪
  • Page Arrays for active highlighting:
MyAccount Pages Quote Wizard Pages
my_account.php start_quote.php
address_book.php select_carrier.php
address_add.php provide_details.php
add_product.php bookit.php
product_catalog.php finish_shipment.php
create_bol.php shipment_success.php
manage_bol.php
locations.php
apply_for_credit.php
my_claims.php

4. Bottom Strip

<a href="index.php" class="mw-logo">
  <img src="images/logo_TL.png" alt="Logo">
</a>
  • Class: mw-logo
  • Clicking returns to HOME 🏠

4.2 Main Menu

<nav class="navbar navbar-default">
  <!-- Mobile toggle -->
  <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#teach-menu">
    <span class="sr-only">Toggle navigation</span>
    <span class="icon-bar"></span> …
  </button>
  <!-- Links -->
  <div class="collapse navbar-collapse" id="teach-menu">
    <ul class="nav navbar-nav">
      <li class="active"><a href="index.php">HOME</a></li>
      <li><a href="start_quote.php">Quote & Ship</a></li>
      <li><a href="contact_us.php">CONTACT US</a></li>
    </ul>
  </div>
</nav>
  • Bootstrap classes: navbar, navbar-toggle, collapse
  • Responsive: Collapsible on small screens 📱

4.3 Track & Switch Company/Location

When logged in, displays user email and a dropdown to switch active company or location:

<?php
  // Determine form action & dropdown
  if(isset($_SESSION['ADMIN_ID_FRONT'], $_SESSION['Customer_ID'])) {
    $formAction = "customer_select.php";
    $actionField = "customer_id";
    $topHeaderComboBox = getCompaniesTreeCombo('customer_id', $_SESSION['Customer_ID'], 'class="top-bar-select-menu"');
  } elseif(isset($_SESSION['Customer_ID'])) {
    $formAction = "customer_select.php";
    $actionField = "location_id";
    // Build $ComboWhere based on Master vs. Location types
    $topHeaderComboBox = GenerateCustomersTreeDDL('location_id', $ComboWhere, $_SESSION['Customer_ID'], '', 'class="top-bar-select-menu"');
  }
?>
<div id="top-bar">
  <a class="logout" href="logout.php">Logout</a>
  <span><?= $_SESSION['Customer_email'] ?></span>
  <form id="top_header_companies_frm" action="<?= $formAction ?>" method="post">
    <input type="hidden" name="action" value="<?= $actionField ?>" />
    <a href="javascript:;" id="submit-auto-login-frm"><img src="images/btn-go.gif" alt="Go" /></a>
    <?= $topHeaderComboBox ?>
  </form>
</div>
  • Helper Functions
    • getCompaniesTreeCombo()
    • GenerateCustomersTreeDDL()
  • Session Keys
    • ADMIN_ID_FRONT, Customer_ID, Customer_email, Master_Customer_Type, etc.

🔗 Dependencies & Integration

  • Session Management: Relies on PHP $_SESSION variables set during login.
  • Helper Libraries:
    • getCompaniesTreeCombo(), GenerateCustomersTreeDDL() generate <select> dropdowns.
  • Bootstrap & jQuery: Provides the responsive navbar and toggle behavior.
  • FontAwesome: Renders icons (fa-phone).

🎨 Styling

Element CSS Classes
Top strip container mw-topstrip, container, row
Contact number mw-contact-num
Static navigation links active_link (for current page)
User menu ddsmoothmenu, logout
Bottom logo link mw-logo
Navbar navbar, navbar-default
Collapsible menu navbar-toggle, collapse
Track bar #top-bar, top-bar-select-menu

📦 Usage

  1. Include this panel at the top of each page:
    <?php include 'inc/panels/header-inner.php'; ?>
    
  2. Ensure session variables are initialized via your authentication logic.
  3. Configure $staticPagesArray before inclusion:
    $staticPagesArray = [
        ['page_key'=>'about_us','page_name'=>'About Us','include_in_side_bar'=>'Y'],
        // ...
    ];
    
  4. Implement or import helper functions for dropdown generation.

📝 Summary

This Header Inner panel provides a unified, responsive header combining:

  • A contact strip for customer support
  • Dynamic navigation for static pages
  • User-specific menus and company/location switching
  • A logo and main menu powered by Bootstrap

Its modular design allows easy reuse across all frontend pages.