upskill-event-manager/includes/class-hvac-event-navigation.php
bengizmo 40274d98ad feat: Implement comprehensive user role field and certification tracking system
• Add user role field to registration, profile display, and profile edit
  - 10 role options: technician, installer, supervisor, manager, trainer, consultant, sales rep, engineer, business owner, other
  - Required field with server-side validation
  - Radio buttons in registration, dropdown in profile edit
  - Displays in profile with proper capitalization

• Implement advanced certification tracking system
  - Date Certified: HTML5 date picker with validation (no future dates)
  - Certification Type: dropdown with "Certified measureQuick Trainer" and "Certified measureQuick Champion"
  - Certification Status: color-coded status badges (Active/Expired/Pending/Disabled)

• Add sophisticated role-based access control
  - Regular trainers: read-only access to certification fields
  - Administrators & master trainers: full edit access to certification fields
  - Visual indicators for read-only fields
  - Server-side permission validation

• Enhance plugin activation system
  - Initialize all 36 user meta fields for existing users
  - Smart default assignment based on user capabilities
  - Backward compatibility maintained

• Add professional UI styling
  - Blue-bordered certification section with trophy icon
  - Color-coded status badges with proper contrast
  - Read-only field styling with visual indicators
  - Enhanced form controls with focus states

• Comprehensive testing and documentation
  - E2E test coverage with visual verification
  - Updated API reference with new meta fields
  - Access control patterns documented
  - 100% test pass rate on staging environment

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-01 10:52:11 -03:00

167 lines
No EOL
6.4 KiB
PHP

<?php
/**
* HVAC Event Navigation Shortcode
*
* Provides a shortcode for adding navigation to event-related pages
*
* @package HVAC_Community_Events
* @since 1.0.0
*/
if (!defined('ABSPATH')) {
exit;
}
class HVAC_Event_Navigation {
/**
* Constructor - DISABLED: Replaced with HVAC_Menu_System
*/
public function __construct() {
// Old event navigation disabled to prevent conflicts with new WordPress menu system
// All functionality moved to HVAC_Menu_System class
// // Register the shortcode
// add_shortcode('hvac_event_navigation', array($this, 'render_navigation'));
}
/**
* Render the navigation shortcode
*/
public function render_navigation($atts = array()) {
// Parse attributes
$atts = shortcode_atts(array(
'page_title' => '',
'show_instructions' => 'no'
), $atts);
// Start output buffering
ob_start();
// Check if Help System is available for tooltips
$help_available = class_exists('HVAC_Help_System');
?>
<div class="hvac-dashboard-header">
<?php if (!empty($atts['page_title'])) : ?>
<h1 class="entry-title"><?php echo esc_html($atts['page_title']); ?></h1>
<?php endif; ?>
<div class="hvac-dashboard-nav">
<?php
// Dashboard link
if ($help_available) {
echo HVAC_Help_System::add_tooltip(
'<a href="' . esc_url(home_url('/hvac-dashboard/')) . '" class="ast-button ast-button-secondary">Dashboard</a>',
'Return to your main dashboard to view stats and manage events'
);
} else {
echo '<a href="' . esc_url(home_url('/hvac-dashboard/')) . '" class="ast-button ast-button-secondary">Dashboard</a>';
}
// Generate Certificates link
if ($help_available) {
echo HVAC_Help_System::add_tooltip(
'<a href="' . esc_url(home_url('/generate-certificates/')) . '" class="ast-button ast-button-primary">Generate Certificates</a>',
'Create professional certificates for attendees who completed your training'
);
} else {
echo '<a href="' . esc_url(home_url('/generate-certificates/')) . '" class="ast-button ast-button-primary">Generate Certificates</a>';
}
// Certificate Reports link
if ($help_available) {
echo HVAC_Help_System::add_tooltip(
'<a href="' . esc_url(home_url('/certificate-reports/')) . '" class="ast-button ast-button-primary">Certificate Reports</a>',
'View and manage all certificates you\'ve issued to attendees'
);
} else {
echo '<a href="' . esc_url(home_url('/certificate-reports/')) . '" class="ast-button ast-button-primary">Certificate Reports</a>';
}
// Trainer Profile link
if ($help_available) {
echo HVAC_Help_System::add_tooltip(
'<a href="' . esc_url(home_url('/trainer-profile/')) . '" class="ast-button ast-button-secondary">View Profile</a>',
'Update your professional credentials, business information, and training specialties'
);
} else {
echo '<a href="' . esc_url(home_url('/trainer-profile/')) . '" class="ast-button ast-button-secondary">View Profile</a>';
}
// Help and Logout links
?>
<a href="<?php echo esc_url(home_url('/hvac-documentation/')); ?>" class="ast-button ast-button-secondary">Help</a>
<a href="<?php echo esc_url(wp_logout_url(home_url('/community-login/'))); ?>" class="ast-button ast-button-secondary">Logout</a>
</div>
</div>
<?php if ($atts['show_instructions'] === 'yes') : ?>
<div class="hvac-info-section">
<div class="hvac-instruction-text">
<p><strong>📝 Create Your Training Event:</strong> Fill in the required fields below including event title, dates, and pricing. All fields marked with an asterisk (*) are required for publication.</p>
<p><strong>🎯 Event Visibility:</strong> Your published events will appear in the main events directory and your trainer dashboard, where attendees can register and make payments.</p>
<p><strong>💼 Professional Features:</strong> Each event includes automatic attendee management, certificate generation capabilities, and integrated payment processing through PayPal.</p>
</div>
</div>
<?php endif; ?>
<style>
.hvac-dashboard-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
flex-wrap: wrap;
}
.hvac-dashboard-nav {
display: flex;
gap: 10px;
flex-wrap: wrap;
}
.hvac-info-section {
background: #f8f9fa;
border: 1px solid #e9ecef;
border-radius: 8px;
padding: 20px;
margin: 20px 0 30px 0;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.hvac-instruction-text {
font-size: 0.95rem;
line-height: 1.6;
color: #495057;
}
.hvac-instruction-text p {
margin: 0 0 12px 0;
}
.hvac-instruction-text p:last-child {
margin-bottom: 0;
}
.hvac-instruction-text strong {
color: #212529;
font-weight: 600;
}
@media (max-width: 768px) {
.hvac-dashboard-header {
flex-direction: column;
align-items: flex-start;
}
.hvac-dashboard-nav {
margin-top: 15px;
width: 100%;
}
}
</style>
<?php
return ob_get_clean();
}
}