All checks were successful
CI / Coding Standards (push) Successful in 43s
CI / PHPStan (push) Successful in 52s
CI / Tests (PHP 8.1) (push) Successful in 47s
CI / Tests (PHP 8.2) (push) Successful in 49s
CI / Tests (PHP 8.3) (push) Successful in 37s
CI / No Debug Code (push) Successful in 2s
All classes are now organised by domain (Availability, Booking, Auth). Each domain package contains its value object, repository, admin controller, REST endpoint, and any shortcode pages under a matching sub-namespace. Cross-cutting wiring (Plugin, AdminMenu, RestRegistrar, ShortcodeRegistrar, Schema) lives at src/ root. Tests mirror the domain structure. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
32 lines
907 B
PHP
32 lines
907 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace Unsupervised\Schedular\Booking;
|
|
|
|
use Unsupervised\Schedular\Auth\RoleManager;
|
|
|
|
class LessonController {
|
|
|
|
public function __construct( private BookingRepository $repository ) {}
|
|
|
|
public function renderAdminDashboard(): void {
|
|
if ( ! current_user_can( 'manage_options' ) ) {
|
|
wp_die( esc_html__( 'You do not have permission to view this page.', 'unsupervised-schedular' ) );
|
|
}
|
|
|
|
$lessons = $this->repository->findAllUpcoming();
|
|
|
|
include USC_PLUGIN_DIR . 'templates/admin/lessons.php';
|
|
}
|
|
|
|
public function renderInstructorLessons(): void {
|
|
if ( ! current_user_can( RoleManager::CAP_VIEW_LESSONS ) ) {
|
|
wp_die( esc_html__( 'You do not have permission to view lessons.', 'unsupervised-schedular' ) );
|
|
}
|
|
|
|
$lessons = $this->repository->findUpcomingForInstructor( get_current_user_id() );
|
|
|
|
include USC_PLUGIN_DIR . 'templates/admin/lessons.php';
|
|
}
|
|
}
|