Header-Home.php Documentation
This document describes the linuxfront-v2-logistics/inc/panels/header-home.php file. It renders the responsive site header, dynamic navigation menu, user account controls, shipment tracking form, breadcrumbs, and login/2FA logic for the logistics frontend.
Overview
This PHP/HTML template builds the top section of every page:
- 🔍 Retrieves user‐specific features from the database
- ⚙️ Determines available functionality (e.g., quoting, parcel, reports)
- 🏠 Renders company logo, contact info, and main navigation
- 👤 Shows account menu for logged‐in users or login/track for guests
- 📜 Generates breadcrumb trail based on current page
- 💻 Implements AJAX login with optional two‐factor authentication
Dependencies & Prerequisites
- Session variables populated by login logic
- Functions defined elsewhere:
get_customer_location_features($masterId, $custId)– fetches feature flagsisCreateBOL($custDetailId)– checks BOL creation permissionQuery($sql)/GetObj($result)– database access
- Bootstrap 5, jQuery, and SVG icons for styling & interactivity
Session Variables
| Variable | Type | Description |
|---|---|---|
Master_Customer_ID |
int | Parent company identifier |
Customer_ID |
int | Active customer/location ID |
Customer_Detail_ID |
int | Used to determine BOL creation rights |
user_id |
int | Logged‐in user identifier |
access_loaded |
'Y'/'N' |
Tracks whether access permissions have been loaded |
Customer_email |
string | Email address of the logged‐in customer |
rating_check |
'Y'/'N' |
Enables "Quote & Ship" link |
small_package |
'Y'/'N' |
Shows "Parcel" submenu |
my_shipments_check |
'Y'/'N' |
Enables "My Shipments" link |
enable_claims |
'Y'/'N' |
Displays "Claims" link |
dashboard, itools |
'Y'/'N' |
Controls "Auditing" submenu |
carrier_perform |
'Y'/'N' |
Shows "Reports" submenu |
shipment_coupon |
'Y'/'N' |
Enables "Vendor Codes" link |
tech_logistics_access |
'Y'/'N' |
(Unused) |
Initialization & Permission Loading
-
Load location features into
$retvia:$ret = get_customer_location_features( $_SESSION['Master_Customer_ID'], $_SESSION['Customer_ID'] ); -
Determine BOL creation capability:
if (isset($_SESSION['Customer_Detail_ID'])) { $isbol = isCreateBOL($_SESSION['Customer_Detail_ID']); } else { $isbol = 'N'; } -
Query user‐location access for product catalog & address book:
$checkRatingQuery = " SELECT product_catalog_check, address_book, access_customer_id FROM customers_users_locations_access WHERE user_id = '".$_SESSION['user_id']."' "; $ratingResult = Query($checkRatingQuery);Iterate results to set flags and collect
$shipment_customer_ids. -
Generate
implode(',', $shipment_customer_ids)for multi‐location links.
HTML Structure
1. Main Header & Logo
<header class="main-header sticky-top bg-white shadow" id="hideOnScroll">
<div class="container-fluid content-header">
<div class="row">
<div class="company-logo">
<a href="index.php" class="ltl-logo">
<img src="images/Tech-Logistic-logo.webp" alt="Tech Logistics" width="323" />
</a>
</div>
<!-- Contact Info… -->
</div>
</div>
<!-- Navigation… -->
</header>
.sticky-topkeeps header fixed when scrolling.- Responsive grid via Bootstrap’s
.rowand.col-…classes. - Company logo links to home.
2. Contact Items
- Toll-Free and Quote phone numbers
- SVG icons for clarity
- Accessible
<a href="tel:…">links
3. Navigation Menu
- Built with Bootstrap 5
.navbarand.collapse - Primary links:
- Home 🏠
- Our Services with dropdown sub‐items
- About Us
- Carrier Login (external link)
- Mobile toggle uses hidden checkbox and
<label>hack for smooth open/close.
Dynamic User Controls
Logged‐In Users
- Manage Account button shows email and toggles account menu.
- Menu items appear based on session flags:
| Menu Item | Session Flag | Icon |
|---|---|---|
| My Profile | – | 👤 |
| Quote & Ship | rating_check == 'Y' |
🚀 |
| Parcel | small_package == 'Y' |
📦 |
| My Shipments | my_shipments_check == 'Y' |
📑 |
| Claims | enable_claims == 'Y' |
🛠️ |
| Auditing | dashboard or itools |
📊 |
| Settings | product and/or address flags | ⚙️ |
| Reports | carrier_perform == 'Y' |
📈 |
| Vendor Codes | shipment_coupon == 'Y' |
🔖 |
| Logout | – | 🔴 |
Guest Users
- Shipment Tracking form on home page
- LOGIN button toggles credentials form
- AJAX login with two‐factor flow:
- On submit: POST to
../login.php - If
two_fa_enabled == 'Y', prompt OTP and verify - Redirect to
welcome.phpon success
- On submit: POST to
Breadcrumb Trail
<?php
$page_name = basename($_SERVER['PHP_SELF'], ".php");
$breadcrumb_label = ucwords(str_replace('_', ' ', $page_name));
if ($page_name not in ['index','contact_us']) { … render <ol class="breadcrumb"> … }
?>
- Automatically builds from file name.
- Hidden on home & contact pages.
Interactive Flowchart
flowchart TD
A[Load Location Features] --> B[Query Access Permissions]
B --> C{Permission Flags}
C -->|product_catalog| Settings
C -->|address_book| Settings
C -->|rating_check| Quote & Ship
C -->|small_package| Parcel
C -->|my_shipments_check| My Shipments
C -->|enable_claims| Claims
C -->|dashboard/itools| Auditing
C -->|carrier_perform| Reports
C -->|shipment_coupon| Vendor Codes
Conclusion
The header-home.php template centralizes header logic and presentation, tailoring available features per user and device. It ensures:
- Consistency across pages
- Security by checking session and DB‐driven permissions
- Responsiveness for mobile and desktop
- Extensibility via session flags and database controls
All dynamic links and UI elements stem from the initial permission loading, making the header a single point of truth for user access.