Files
Digital-Dabei-Hamburg-Job-M…/includes/class-dashboard.php
Viktor Miller da8c6b0542 feat(02-03): create dashboard template with job listing table
- Created templates/provider-dashboard.php with:
  - User role check (ddhh_provider)
  - WP_Query for current user's job_offer posts
  - Table display with German column headings
  - Status badges (Veröffentlicht/Ausstehend/Entwurf)
  - Edit and View action links
  - Empty state message
  - Responsive CSS styling

- Created includes/class-dashboard.php with:
  - Template loader method
  - Shortcode registration [ddhh_provider_dashboard]
  - Output buffering for shortcode content

Dashboard queries only current user's posts with proper capability checking.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-14 19:20:42 +09:00

58 lines
1.1 KiB
PHP

<?php
/**
* Provider Dashboard Class
*
* Handles dashboard template loading and shortcode registration
*
* @package DDHH_Job_Manager
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
/**
* Dashboard functionality
*/
class DDHH_JM_Dashboard {
/**
* Initialize dashboard functionality
*/
public static function init() {
// Register shortcode
add_shortcode( 'ddhh_provider_dashboard', array( __CLASS__, 'render_shortcode' ) );
}
/**
* Get template path
*
* @return string Path to dashboard template
*/
public static function get_template() {
return DDHH_JM_PLUGIN_DIR . 'templates/provider-dashboard.php';
}
/**
* Render dashboard shortcode
*
* @return string Dashboard HTML output
*/
public static function render_shortcode() {
// Start output buffering
ob_start();
// Load template
$template_path = self::get_template();
if ( file_exists( $template_path ) ) {
load_template( $template_path, false );
} else {
echo '<div class="ddhh-error-message">';
echo '<p>Dashboard-Vorlage konnte nicht gefunden werden.</p>';
echo '</div>';
}
// Return buffered output
return ob_get_clean();
}
}