CI / Tests (PHP 8.2) (pull_request) Successful in 47s
CI / Tests (PHP 8.1) (pull_request) Successful in 38s
CI / No Debug Code (pull_request) Successful in 2s
CI / Coding Standards (pull_request) Successful in 2m50s
CI / PHPStan (pull_request) Successful in 2m54s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m42s
CI / Build Plugin Zip (pull_request) Skipped
Instructors can now see their own group classes under My Lessons → My Group Classes (view_own_lessons): each class shows its active enrolment count against capacity plus a roster of enrolled students with enrolment and payment status. GroupClassController gains renderInstructorPage(), backed by the existing per-instructor enrolment query and a newly injected PaymentRepository for payment status. Wired as a submenu under the existing My Lessons menu, inside the same !view_all_lessons guard so owner-operators don't get a duplicate item. Closes #71 Co-Authored-By: Claude Opus 4.8 <[email protected]>
65 lines
2.8 KiB
PHP
65 lines
2.8 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
if (! defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
/** @var list<array{title: string, capacity: int|null, enrolled: int, roster: list<array{student: string, status: string, payment: string|null}>}> $classes */
|
|
?>
|
|
<div class="wrap">
|
|
<h1><?php esc_html_e('My Group Classes', 'unsupervised-schedular'); ?></h1>
|
|
<p class="description"><?php esc_html_e('Your group classes and their rosters.', 'unsupervised-schedular'); ?></p>
|
|
|
|
<?php if (empty($classes)) : ?>
|
|
<p><?php esc_html_e('You have no group classes.', 'unsupervised-schedular'); ?></p>
|
|
<?php else : ?>
|
|
<?php foreach ($classes as $class) : ?>
|
|
<h2>
|
|
<?php echo esc_html($class['title']); ?>
|
|
<span class="count">
|
|
<?php
|
|
if (null === $class['capacity']) {
|
|
printf(
|
|
/* translators: %d: number of enrolled students. */
|
|
esc_html__('(%d enrolled)', 'unsupervised-schedular'),
|
|
(int) $class['enrolled']
|
|
);
|
|
} else {
|
|
printf(
|
|
/* translators: 1: number of enrolled students, 2: class capacity. */
|
|
esc_html__('(%1$d / %2$d enrolled)', 'unsupervised-schedular'),
|
|
(int) $class['enrolled'],
|
|
(int) $class['capacity']
|
|
);
|
|
}
|
|
?>
|
|
</span>
|
|
</h2>
|
|
|
|
<?php if (empty($class['roster'])) : ?>
|
|
<p><?php esc_html_e('No enrolments yet.', 'unsupervised-schedular'); ?></p>
|
|
<?php else : ?>
|
|
<table class="wp-list-table widefat fixed striped">
|
|
<thead>
|
|
<tr>
|
|
<th><?php esc_html_e('Student', 'unsupervised-schedular'); ?></th>
|
|
<th><?php esc_html_e('Enrolment', 'unsupervised-schedular'); ?></th>
|
|
<th><?php esc_html_e('Payment', 'unsupervised-schedular'); ?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($class['roster'] as $entry) : ?>
|
|
<tr>
|
|
<td><?php echo esc_html($entry['student']); ?></td>
|
|
<td><?php echo esc_html($entry['status']); ?></td>
|
|
<td><?php echo esc_html($entry['payment'] ?? '—'); ?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
<?php endif; ?>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</div>
|