Right Navigation Panel (right_nav.php) 🚀
A dynamic sidebar panel for the Freight Anywhere logistics portal. It renders different content based on user authentication status, customer attributes, and the current page template.
Overview
The Right Navigation panel provides:
- A Manage Your Account menu for authenticated customers.
- A customer login form for guests.
- A list of our services on the homepage.
It lives under linuxfront-v2-logistics/inc/panels/right_nav.php and relies on session data and a helper function getParent_id().
Dependencies & Context
-
Session Variables
$_SESSION['Customer_ID']– identifies a logged-in user.$_SESSION['Master_Customer_ID']– parent company account.$_SESSION['Customer_Billing_COUNTRY']– controls country-specific links.$_SESSION['international_quote']– toggles international quoting.
-
Helper Function
function getParent_id($id){ $res = Query("SELECT * FROM customers_relations WHERE customer_id='$id' LIMIT 1"); while($row = GetAccocArray($res)){ return $row["company_id"]; } return 0; }Retrieves the parent company ID for a customer.
-
Template Variable
$currnt_template– the current page identifier (e.g.,'index').
High-Level Flow
flowchart TD
A[Load Right Navigation Panel] --> B{Customer Logged In?}
B -- Yes --> C[Show "Manage Your Account" Menu]
B -- No --> D[Show Login Form]
C --> H{International Quotes Enabled?}
H -- Yes --> I[Show "International Quotes" Link]
H -- No --> G[Continue]
C & D --> E{Template == 'index'?}
E -- Yes --> F[Show "Our Services" List]
E -- No --> G[End]
Structure & Sections
1. Panel Container
<div id="right_panel">
<!-- Dynamic content here -->
</div>
Wraps the entire right-hand sidebar.
2. Manage Your Account (Authenticated)
Rendered when isset($_SESSION['Customer_ID']) && !empty($_SESSION['Customer_ID']).
Menu Header
<h3>Manage Your Account</h3>
<br />
Menu Items
| Link | Description |
|---|---|
| My Account | View/edit profile |
| Quote & Ship | Starts LTL quote (modal or page) |
| My Shipments | List of shipments |
| Address Book | Saved addresses |
| Product Catalog | Available products |
| Create BOL | Generate bill of lading |
| Locations | Branch/warehouse info |
| Apply For Credit | Credit application |
| Track Shipment | Shipment tracking |
| International Quotes* | International quoting (conditional) |
if ($_SESSION['Customer_Billing_COUNTRY']=='18') {
// Country-specific modal trigger
echo '<a href="javascript:{}" rel="ltl" class="startquoteclass">Quote & Ship</a>';
} else {
// Regular page
echo '<a href="start_quote.php">Quote & Ship</a>';
}
International Quotes appears only for select master customers with
$_SESSION['international_quote']=='Y'and specific IDs
3. Customer Login (Guest)
Rendered when no Customer_ID session exists.
<h3>customer login</h3>
<br />
<form id="lgnfrm" action="index.php" method="post">
<input type="hidden" name="action" value="login" />
<table>
<tr><td>Username / Email</td></tr>
<tr><td><input type="text" name="usr_email" /></td></tr>
<tr><td>Password</td></tr>
<tr><td><input type="password" name="pwd" /></td></tr>
<tr>
<td>
<input type="image" src="images/login.gif" />
<div style="color:#F00;"><?=$message?></div>
</td>
</tr>
<tr>
<td>
<ul>
<li><a href="forgot_password.php">Forgot your password?</a></li>
<li><a href="signup.php">Create an account</a></li>
</ul>
</td>
</tr>
</table>
</form>
- Error Display:
$messagefrom login attempt.
4. “Our Services Include” (Homepage Only)
Rendered when $currnt_template == 'index'.
<img src="images/line.gif" alt="" style="margin:5px 0;" />
<h3>our services include:</h3>
<ul>
<li>Transportation Management</li>
<li>Carrier Contract Negotiations</li>
<li>Uniform LTL Base Rates</li>
<li>Online Rating Engine</li>
<li>Automatic Pre-Pay & Add Calculator</li>
<li>Freight Bill Auditing including Small Package</li>
<li>Freight Payment Processing</li>
<li>Bill of Lading Matching</li>
<li>Loss & Damage Claims</li>
<li>Shipment Tracking & Visibility</li>
<li>Comprehensive Cost & Service Reporting</li>
<li>Account Code Reporting</li>
<li>Carrier Evaluations</li>
<li>Routing Guidance for General and Special Shipments</li>
<li>Vendor Routing Compliance Systems</li>
<li>Shipment Planning & Execution</li>
<li>Electronic Data Interchange (EDI)</li>
</ul>
<br clear="all" />
Highlights core service offerings on the home page.
Key Points & Design Decisions
- Session-Driven Rendering
Decouples UI from business logic; centralizes permissions in session flags. - Country-Specific Behavior
Billing country ‘18’ uses modal quote versus page redirect. - Feature Toggles
International quoting controlled via$_SESSION['international_quote']and master IDs. - Template Awareness
Alters sidebar content based on$currnt_templatefor contextual relevancy. - Minimal Dependencies
Only requires session state andgetParent_id()from shared functions.
Integration & Usage
- Include in Page Templates
<?php include 'inc/panels/right_nav.php'; ?> - Ensure Sessions
Callsession_start()and set relevant$_SESSIONvariables during login flows. - Functions File
Verifyfunctions.inc.php(or equivalent) is loaded before panel to providegetParent_id().
Summary
This right_nav panel dynamically adapts to user state, country, and page context to provide quick access to account management, quoting tools, and service information—all within a self-contained PHP/HTML snippet. It demonstrates session-based rendering, feature gating, and template-aware content.