Systematic audit and implementation of missing Master Trainer functionality with comprehensive WordPress best practices and security implementation. ## Features Implemented - Master Events Overview (/master-trainer/events/) - KPI dashboard with filtering - Import/Export Data Management (/master-trainer/import-export/) - CSV operations - Communication Templates (/trainer/communication-templates/) - Professional templates - Enhanced Announcements (/master-trainer/announcements/) - Dynamic shortcode integration - Pending Approvals System (/master-trainer/pending-approvals/) - Workflow management ## Navigation & UX Improvements - Removed redundant Events link from top-level navigation menu - Reorganized administrative functions under Tools dropdown - Enhanced navigation clarity and professional appearance - Full responsive design with accessibility compliance ## Architecture & Security - 5 new singleton manager classes following WordPress patterns - Comprehensive role-based access control (hvac_master_trainer) - Complete security implementation (nonces, sanitization, escaping) - Performance optimizations with transient caching and conditional loading - Professional error handling and user feedback systems ## Files Added (16 new files) - 4 manager classes: Import/Export, Events Overview, Pending Approvals, Communication Templates - 4 CSS files with responsive design and accessibility features - 4 JavaScript files with AJAX functionality and error handling - 2 new templates: Import/Export, Pending Approvals - 2 enhanced templates: Events Overview, Communication Templates ## Files Modified (14 files) - Core system integration in Plugin, Page Manager, Scripts/Styles classes - Navigation system cleanup in Master Menu System - Enhanced access control and role management - Template updates for dynamic content integration ## Testing & Deployment - Comprehensive testing with Playwright automation - Successful staging deployment and verification - All 5 missing pages now fully functional - Navigation improvements verified working Resolves master trainer area audit requirements with production-ready implementation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
		
			
				
	
	
		
			243 lines
		
	
	
		
			No EOL
		
	
	
		
			13 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			243 lines
		
	
	
		
			No EOL
		
	
	
		
			13 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| /**
 | |
|  * Template for Master Trainer Import/Export Page
 | |
|  *
 | |
|  * @package HVAC_Community_Events
 | |
|  * @since 1.0.0
 | |
|  */
 | |
| 
 | |
| // Security check
 | |
| if (!defined('ABSPATH')) {
 | |
|     exit;
 | |
| }
 | |
| 
 | |
| // Define template constant
 | |
| define('HVAC_IN_PAGE_TEMPLATE', true);
 | |
| 
 | |
| // Role-based access control
 | |
| $user = wp_get_current_user();
 | |
| if (!in_array('hvac_master_trainer', $user->roles) && !current_user_can('manage_options')) {
 | |
|     wp_die(__('Access denied. You do not have permission to view this page.', 'hvac-community-events'));
 | |
| }
 | |
| 
 | |
| get_header(); ?>
 | |
| 
 | |
| <div class="hvac-import-export-wrapper">
 | |
|     <div class="container">
 | |
|         
 | |
|         <?php
 | |
|         // Render breadcrumbs
 | |
|         if (class_exists('HVAC_Breadcrumbs')) {
 | |
|             HVAC_Breadcrumbs::instance()->render_breadcrumbs();
 | |
|         }
 | |
|         
 | |
|         // Render master navigation
 | |
|         if (class_exists('HVAC_Master_Menu_System')) {
 | |
|             HVAC_Master_Menu_System::instance()->render_master_menu();
 | |
|         }
 | |
|         ?>
 | |
|         
 | |
|         <main class="hvac-main-content">
 | |
|             <header class="hvac-page-header">
 | |
|                 <h1 class="hvac-page-title"><?php esc_html_e('Import/Export Data', 'hvac-community-events'); ?></h1>
 | |
|                 <p class="hvac-page-description">
 | |
|                     <?php esc_html_e('Manage trainer data, events, and user profiles through import and export operations.', 'hvac-community-events'); ?>
 | |
|                 </p>
 | |
|             </header>
 | |
|             
 | |
|             <div class="hvac-import-export-content">
 | |
|                 
 | |
|                 <!-- Export Section -->
 | |
|                 <section class="hvac-export-section">
 | |
|                     <h2 class="section-title">
 | |
|                         <span class="dashicons dashicons-download"></span>
 | |
|                         <?php esc_html_e('Export Data', 'hvac-community-events'); ?>
 | |
|                     </h2>
 | |
|                     
 | |
|                     <div class="export-options">
 | |
|                         <div class="export-card">
 | |
|                             <div class="card-header">
 | |
|                                 <h3><?php esc_html_e('Export Trainers', 'hvac-community-events'); ?></h3>
 | |
|                                 <p><?php esc_html_e('Export all trainer profiles with certification and business information.', 'hvac-community-events'); ?></p>
 | |
|                             </div>
 | |
|                             <div class="card-actions">
 | |
|                                 <button type="button" class="hvac-btn hvac-btn-primary" id="export-trainers">
 | |
|                                     <span class="dashicons dashicons-groups"></span>
 | |
|                                     <?php esc_html_e('Export Trainers', 'hvac-community-events'); ?>
 | |
|                                 </button>
 | |
|                             </div>
 | |
|                         </div>
 | |
|                         
 | |
|                         <div class="export-card">
 | |
|                             <div class="card-header">
 | |
|                                 <h3><?php esc_html_e('Export Events', 'hvac-community-events'); ?></h3>
 | |
|                                 <p><?php esc_html_e('Export all training events with dates, venues, and organizer information.', 'hvac-community-events'); ?></p>
 | |
|                             </div>
 | |
|                             <div class="card-actions">
 | |
|                                 <button type="button" class="hvac-btn hvac-btn-primary" id="export-events">
 | |
|                                     <span class="dashicons dashicons-calendar-alt"></span>
 | |
|                                     <?php esc_html_e('Export Events', 'hvac-community-events'); ?>
 | |
|                                 </button>
 | |
|                             </div>
 | |
|                         </div>
 | |
|                         
 | |
|                         <div class="export-card">
 | |
|                             <div class="card-header">
 | |
|                                 <h3><?php esc_html_e('Export User Profiles', 'hvac-community-events'); ?></h3>
 | |
|                                 <p><?php esc_html_e('Export complete user profiles with all metadata for backup or analysis.', 'hvac-community-events'); ?></p>
 | |
|                             </div>
 | |
|                             <div class="card-actions">
 | |
|                                 <button type="button" class="hvac-btn hvac-btn-primary" id="export-user-profiles">
 | |
|                                     <span class="dashicons dashicons-admin-users"></span>
 | |
|                                     <?php esc_html_e('Export User Profiles', 'hvac-community-events'); ?>
 | |
|                                 </button>
 | |
|                             </div>
 | |
|                         </div>
 | |
|                     </div>
 | |
|                 </section>
 | |
|                 
 | |
|                 <!-- Import Section -->
 | |
|                 <section class="hvac-import-section">
 | |
|                     <h2 class="section-title">
 | |
|                         <span class="dashicons dashicons-upload"></span>
 | |
|                         <?php esc_html_e('Import Data', 'hvac-community-events'); ?>
 | |
|                     </h2>
 | |
|                     
 | |
|                     <div class="import-options">
 | |
|                         <div class="import-card">
 | |
|                             <div class="card-header">
 | |
|                                 <h3><?php esc_html_e('Import Trainer Profiles', 'hvac-community-events'); ?></h3>
 | |
|                                 <p><?php esc_html_e('Update trainer profiles from CSV file. Existing trainers will be updated based on email address.', 'hvac-community-events'); ?></p>
 | |
|                             </div>
 | |
|                             <div class="card-content">
 | |
|                                 <form id="import-trainer-profiles-form" enctype="multipart/form-data">
 | |
|                                     <div class="file-input-wrapper">
 | |
|                                         <input type="file" id="trainer-profiles-file" name="import_file" accept=".csv" required>
 | |
|                                         <label for="trainer-profiles-file" class="file-input-label">
 | |
|                                             <span class="dashicons dashicons-paperclip"></span>
 | |
|                                             <?php esc_html_e('Choose CSV File', 'hvac-community-events'); ?>
 | |
|                                         </label>
 | |
|                                         <span class="file-name"></span>
 | |
|                                     </div>
 | |
|                                     <div class="card-actions">
 | |
|                                         <button type="submit" class="hvac-btn hvac-btn-secondary">
 | |
|                                             <span class="dashicons dashicons-groups"></span>
 | |
|                                             <?php esc_html_e('Import Trainer Profiles', 'hvac-community-events'); ?>
 | |
|                                         </button>
 | |
|                                     </div>
 | |
|                                 </form>
 | |
|                             </div>
 | |
|                         </div>
 | |
|                         
 | |
|                         <div class="import-card">
 | |
|                             <div class="card-header">
 | |
|                                 <h3><?php esc_html_e('Import Events', 'hvac-community-events'); ?></h3>
 | |
|                                 <p><?php esc_html_e('Import training events from CSV file. Events with matching titles will be updated.', 'hvac-community-events'); ?></p>
 | |
|                             </div>
 | |
|                             <div class="card-content">
 | |
|                                 <form id="import-events-form" enctype="multipart/form-data">
 | |
|                                     <div class="file-input-wrapper">
 | |
|                                         <input type="file" id="events-file" name="import_file" accept=".csv" required>
 | |
|                                         <label for="events-file" class="file-input-label">
 | |
|                                             <span class="dashicons dashicons-paperclip"></span>
 | |
|                                             <?php esc_html_e('Choose CSV File', 'hvac-community-events'); ?>
 | |
|                                         </label>
 | |
|                                         <span class="file-name"></span>
 | |
|                                     </div>
 | |
|                                     <div class="card-actions">
 | |
|                                         <button type="submit" class="hvac-btn hvac-btn-secondary">
 | |
|                                             <span class="dashicons dashicons-calendar-alt"></span>
 | |
|                                             <?php esc_html_e('Import Events', 'hvac-community-events'); ?>
 | |
|                                         </button>
 | |
|                                     </div>
 | |
|                                 </form>
 | |
|                             </div>
 | |
|                         </div>
 | |
|                         
 | |
|                         <div class="import-card">
 | |
|                             <div class="card-header">
 | |
|                                 <h3><?php esc_html_e('Bulk Update Users', 'hvac-community-events'); ?></h3>
 | |
|                                 <p><?php esc_html_e('Perform bulk updates on user accounts and metadata from CSV file.', 'hvac-community-events'); ?></p>
 | |
|                             </div>
 | |
|                             <div class="card-content">
 | |
|                                 <form id="bulk-update-users-form" enctype="multipart/form-data">
 | |
|                                     <div class="file-input-wrapper">
 | |
|                                         <input type="file" id="bulk-update-file" name="import_file" accept=".csv" required>
 | |
|                                         <label for="bulk-update-file" class="file-input-label">
 | |
|                                             <span class="dashicons dashicons-paperclip"></span>
 | |
|                                             <?php esc_html_e('Choose CSV File', 'hvac-community-events'); ?>
 | |
|                                         </label>
 | |
|                                         <span class="file-name"></span>
 | |
|                                     </div>
 | |
|                                     <div class="card-actions">
 | |
|                                         <button type="submit" class="hvac-btn hvac-btn-secondary">
 | |
|                                             <span class="dashicons dashicons-admin-users"></span>
 | |
|                                             <?php esc_html_e('Bulk Update Users', 'hvac-community-events'); ?>
 | |
|                                         </button>
 | |
|                                     </div>
 | |
|                                 </form>
 | |
|                             </div>
 | |
|                         </div>
 | |
|                     </div>
 | |
|                 </section>
 | |
|                 
 | |
|                 <!-- Security Notice -->
 | |
|                 <section class="hvac-security-notice">
 | |
|                     <div class="notice-content">
 | |
|                         <h3>
 | |
|                             <span class="dashicons dashicons-shield-alt"></span>
 | |
|                             <?php esc_html_e('Security & File Format Requirements', 'hvac-community-events'); ?>
 | |
|                         </h3>
 | |
|                         <ul>
 | |
|                             <li><?php esc_html_e('Only CSV files are accepted for import operations.', 'hvac-community-events'); ?></li>
 | |
|                             <li><?php esc_html_e('Maximum file size limit: 10MB per upload.', 'hvac-community-events'); ?></li>
 | |
|                             <li><?php esc_html_e('Import operations are irreversible - please backup your data before importing.', 'hvac-community-events'); ?></li>
 | |
|                             <li><?php esc_html_e('All uploads are scanned for security and file type validation.', 'hvac-community-events'); ?></li>
 | |
|                             <li><?php esc_html_e('Export files contain sensitive data - handle with appropriate security measures.', 'hvac-community-events'); ?></li>
 | |
|                         </ul>
 | |
|                     </div>
 | |
|                 </section>
 | |
|                 
 | |
|             </div>
 | |
|             
 | |
|             <!-- Progress Modal -->
 | |
|             <div id="hvac-progress-modal" class="hvac-modal" style="display: none;">
 | |
|                 <div class="hvac-modal-content">
 | |
|                     <div class="hvac-modal-header">
 | |
|                         <h3 id="progress-title"><?php esc_html_e('Processing...', 'hvac-community-events'); ?></h3>
 | |
|                     </div>
 | |
|                     <div class="hvac-modal-body">
 | |
|                         <div class="progress-bar-container">
 | |
|                             <div class="progress-bar">
 | |
|                                 <div class="progress-bar-fill"></div>
 | |
|                             </div>
 | |
|                         </div>
 | |
|                         <p id="progress-message"><?php esc_html_e('Please wait while we process your request...', 'hvac-community-events'); ?></p>
 | |
|                     </div>
 | |
|                 </div>
 | |
|             </div>
 | |
|             
 | |
|             <!-- Results Modal -->
 | |
|             <div id="hvac-results-modal" class="hvac-modal" style="display: none;">
 | |
|                 <div class="hvac-modal-content">
 | |
|                     <div class="hvac-modal-header">
 | |
|                         <h3 id="results-title"><?php esc_html_e('Operation Complete', 'hvac-community-events'); ?></h3>
 | |
|                         <button type="button" class="hvac-modal-close">×</button>
 | |
|                     </div>
 | |
|                     <div class="hvac-modal-body">
 | |
|                         <div id="results-content"></div>
 | |
|                     </div>
 | |
|                     <div class="hvac-modal-footer">
 | |
|                         <button type="button" class="hvac-btn hvac-btn-primary hvac-modal-close">
 | |
|                             <?php esc_html_e('Close', 'hvac-community-events'); ?>
 | |
|                         </button>
 | |
|                     </div>
 | |
|                 </div>
 | |
|             </div>
 | |
|             
 | |
|         </main>
 | |
|         
 | |
|     </div>
 | |
| </div>
 | |
| 
 | |
| <?php get_footer(); ?>
 |