This commit is contained in:
Xes
2025-08-14 22:37:50 +02:00
parent fb6d5d5926
commit 3641e93527
9156 changed files with 1813532 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Responses to AJAX calls.
*/
require_once __DIR__.'/../global.inc.php';
api_protect_admin_script();
$action = $_REQUEST['a'];
switch ($action) {
case 'show_courses':
$categoryId = (int) $_REQUEST['id'];
$categoryInfo = CourseCategory::getCategoryById($categoryId);
if (!empty($categoryInfo)) {
$courses = CourseCategory::getCoursesInCategory($categoryInfo['code'], '', false, false);
$table = new HTML_Table(['class' => 'table table-hover table-striped data_table']);
$headers = [
get_lang('Name'),
];
$row = 0;
$column = 0;
foreach ($headers as $header) {
$table->setHeaderContents($row, $column, $header);
$column++;
}
$result = '';
foreach ($courses as $course) {
$row++;
$courseLink = '<a href="'.api_get_path(WEB_PATH).'courses/'.$course['directory'].'/index.php">'.$course['title'].'</a>';
$table->setCellContents($row, 0, $courseLink);
}
echo $table->toHtml();
exit;
}
break;
}
exit;