<?php
$disabledBefore = \Components\Marketing\Automation\Progress::getDisabledIds();
\Components\Marketing\Automation\Progress::setDisabledIds(array_column(\Components\Marketing\Automation::getAll(), 'automation_id'));
try {
foreach ([3 => '2026-11-10 23:00:00', 4 => '2026-11-10 23:00:00', 5 => '2026-11-18 23:00:00'] as $examId => $registrationEnd) {
\Components\AF\Exams::save(['exam_id' => $examId, 'exam_registration_start_datetime' => date('Y-m-d H:i:s', strtotime('2026-10-01 00:00:00')), 'exam_registration_end_datetime' => date('Y-m-d H:i:s', strtotime($registrationEnd))]);
}
$categoryId = \Components\AF\Memberships\Products::getProductCategoryId();
if (!$categoryId) throw new \RuntimeException('Membership product category is not configured.');
\Components\Commerce\Products\Categories::addProductToCategory(519, $categoryId);
\Components\AF\Memberships\Products::save(['product_id' => 519, 'membership_products_type' => 'Individual', 'membership_products_duration' => '1 year', 'membership_products_hidden_in_course_selector' => 0]);
\Components\AF\Courses\Assignments::save(['assignment_id' => 12, 'assignment_deadline' => date('Y-m-d H:i:s', strtotime('2026-10-16 23:00:00'))]);
$borrowingItems = \Components\AF\Libraries\Documents\Borrowings\Items::getAll(['filter' => ['borrowing_id', 'IN', [17, 18]]]);
foreach ($borrowingItems as $item) {
\Components\AF\Libraries\Documents\Borrowings\Items::save(['borrowing_item_id' => $item['borrowing_item_id'], 'borrowing_item_expected_return_datetime' => date('Y-m-d H:i:s', strtotime('2026-10-27 00:00:00'))]);
}
$out = [];
foreach ([3, 4, 5] as $id) {
$out['exam_' . $id . '_registration_end'] = \Components\AF\Exams::getColumn($id, 'exam_registration_end_datetime');
}
$out['membership_categories'] = \Components\Commerce\Products\Categories::getAllIdsForProduct(519);
$out['assignment_deadline'] = \Components\AF\Courses\Assignments::getColumn(12, 'assignment_deadline');
$out['borrowing_items'] = \Components\AF\Libraries\Documents\Borrowings\Items::getAll(['filter' => ['borrowing_id', 'IN', [17, 18]]]);
$out['membership_card_html_ready'] = (bool) \Components\AF\Memberships::generateMembershipCardHTML(1394);
echo json_encode($out, JSON_PRETTY_PRINT);
} finally {
\Components\Marketing\Automation\Progress::setDisabledIds($disabledBefore);
}
|