Upgrade 1-11.38

This commit is contained in:
xesmyd
2026-03-30 14:10:30 +02:00
parent f2a7e6d1fc
commit ac648ef29d
24665 changed files with 69682 additions and 2205004 deletions
+63 -14
View File
@@ -8,6 +8,7 @@ use Chamilo\CoreBundle\Entity\Repository\SequenceResourceRepository;
use Chamilo\CoreBundle\Entity\SequenceResource;
use Chamilo\CourseBundle\Component\CourseCopy\CourseBuilder;
use Chamilo\CourseBundle\Component\CourseCopy\CourseRestorer;
use Chamilo\CourseBundle\Entity\CCourseDescription;
use ChamiloSession as Session;
use Doctrine\Common\Collections\Criteria;
@@ -93,7 +94,7 @@ class CourseManager
// Create the course keys
$keys = AddCourse::define_course_keys($params['wanted_code']);
$params['exemplary_content'] = isset($params['exemplary_content']) ? $params['exemplary_content'] : false;
$params['exemplary_content'] = $params['exemplary_content'] ?? false;
if (count($keys)) {
$params['code'] = $keys['currentCourseCode'];
@@ -2436,7 +2437,7 @@ class CourseManager
return [];
}
$session_id != 0 ? $session_condition = ' WHERE g.session_id IN(1,'.intval($session_id).')' : $session_condition = ' WHERE g.session_id = 0';
$session_id != 0 ? $session_condition = ' WHERE g.session_id = '.intval($session_id) : $session_condition = ' WHERE g.session_id = 0';
if ($in_get_empty_group == 0) {
// get only groups that are not empty
$sql = "SELECT DISTINCT g.id, g.iid, g.name
@@ -3442,24 +3443,24 @@ class CourseManager
/**
* Lists details of the course description.
*
* @param array The course description
* @param string The encoding
* @param bool If true is displayed if false is hidden
* @param array<int, CCourseDescription> $descriptions The course description
* @param string $charset The encoding
* @param bool $action_show If true is displayed if false is hidden
*
* @return string The course description in html
*/
public static function get_details_course_description_html(
$descriptions,
$charset,
$action_show = true
) {
array $descriptions,
string $charset,
bool $action_show = true
): ?string {
$data = null;
if (isset($descriptions) && count($descriptions) > 0) {
if (count($descriptions) > 0) {
foreach ($descriptions as $description) {
$data .= '<div class="sectiontitle">';
if (api_is_allowed_to_edit() && $action_show) {
//delete
$data .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete&description_id='.$description->id.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(
$data .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=delete&description_id='.$description->getIid().'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(
get_lang('ConfirmYourChoice'),
ENT_QUOTES,
$charset
@@ -3471,7 +3472,7 @@ class CourseManager
);
$data .= '</a> ';
//edit
$data .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&description_id='.$description->id.'">';
$data .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&description_id='.$description->getIid().'">';
$data .= Display::return_icon(
'edit.png',
get_lang('Edit'),
@@ -3480,10 +3481,10 @@ class CourseManager
);
$data .= '</a> ';
}
$data .= $description->title;
$data .= Security::remove_XSS($description->getTitle());
$data .= '</div>';
$data .= '<div class="sectioncomment">';
$data .= Security::remove_XSS($description->content);
$data .= Security::remove_XSS($description->getContent());
$data .= '</div>';
}
} else {
@@ -7435,6 +7436,54 @@ class CourseManager
return $logo;
}
public static function searchCourse(string $searchTerm, ?int $sessionId = null): array
{
if (!empty($sessionId)) {
//if session is defined, lets find only courses of this session
return SessionManager::get_course_list_by_session_id(
$sessionId,
$searchTerm
);
}
//if session is not defined lets search all courses STARTING with $searchTerm
//TODO change this function to search not only courses STARTING with $searchTerm
if (api_is_platform_admin()) {
return CourseManager::get_courses_list(
0,
0,
'title',
'ASC',
-1,
$searchTerm,
null,
true
);
}
if (api_is_teacher()) {
$courseList = CourseManager::get_course_list_of_user_as_course_admin(api_get_user_id(), $searchTerm);
$category = api_get_configuration_value('course_category_code_to_use_as_model');
if (!empty($category)) {
$alreadyAdded = [];
if (!empty($courseList)) {
$alreadyAdded = array_column($courseList, 'id');
}
$coursesInCategory = CourseCategory::getCoursesInCategory($category, $searchTerm);
foreach ($coursesInCategory as $course) {
if (!in_array($course['id'], $alreadyAdded)) {
$courseList[] = $course;
}
}
}
return $courseList;
}
return [];
}
/**
* Check if a specific access-url-related setting is a problem or not.
*