php js css php js css

Scripts

Save Script Run
Attached Artifacts
Title
PHP Code
<?php $out = []; foreach ([376,377,378] as $courseId) { foreach (\Components\AF\Courses\Units::getAllForCourse($courseId) as $unit) { if ($unit['unit_date'] < '2026-10-08') \Components\AF\Courses\Units::save(['unit_id' => $unit['unit_id'], 'unit_teacher_present' => 1]); } } $rows = \Components\Customers\Contacts::getAll(['filter' => ['contact_email', '=', 'af-presentation-robin@example.invalid'], 'limit' => 1]); $out['hidden_teacher'] = $rows ? reset($rows)['contact_id'] : \Components\Customers\Contacts::save(['contact_email' => 'af-presentation-robin@example.invalid', 'contact_first_name' => 'Robin', 'contact_last_name' => 'Salaried - Presentation Demo', 'contact_type' => 'Individual', 'contact_email_marketing_status' => 'unsubscribed', 'country_id' => 'AUS']); \Components\Customers\Groups::addContactToGroup($out['hidden_teacher'], ['/teachers/']); \Components\AF\Teachers::setIsHiddenFromHoursReport($out['hidden_teacher'], true); $rows = \Components\AF\Teachers\Hours::getAll(['filter' => ['hour_comment', '=', 'Presentation Demo - salaried teacher work'], 'limit' => 1]); if (!$rows) \Components\AF\Teachers\Hours::save(['hour_comment' => 'Presentation Demo - salaried teacher work', 'teacher_id' => $out['hidden_teacher'], 'hour_type_id' => 32, 'hour_date' => '2026-10-06', 'hour_start_time' => '11:00:00', 'hour_end_time' => '12:00:00', 'hour_billing_status' => 'unpaid']); $hours = \Components\AF\Teachers\Hours::getFilteredHours(['teacher_id' => 1393, 'date_from' => strtotime('2026-10-01'), 'date_to' => strtotime('2026-11-30 23:59:59')]); foreach ($hours as $type => $row) $out['teacher_hours'][$type] = is_array($row) ? $row['count'] : $row; $out['courses'] = []; foreach ([376,377] as $id) { $course = \Components\AF\Courses::get($id); $out['courses'][$id] = ['code' => $course['course_code'], 'total_hours' => $course['course_total_hours'], 'online_reasons' => \Components\AF\Courses::getCourseNotVisibleReasons($course)]; } echo json_encode($out, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);

Run Log

▼ Today 4:33am ✓ Completed 0.3s
{
    "hidden_teacher": "1398",
    "teacher_hours": {
        "Exam": 9,
        "Collective Course": 2,
        "Private Course": 1,
        "Administration - Presentation Demo": 2,
        "days_worked": 5
    },
    "courses": {
        "376": {
            "code": "PRESENTATION-20261008-A1-FRI",
            "total_hours": "22.00",
            "online_reasons": []
        },
        "377": {
            "code": "PRESENTATION-20261008-A1-WED",
            "total_hours": "22.00",
            "online_reasons": []
        }
    }
}