Skip to content

Commit f9dd081

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 2e196eb + f380482 commit f9dd081

File tree

11 files changed

+117
-32
lines changed

11 files changed

+117
-32
lines changed

assets/vue/views/social/SocialLayout.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<component :is="currentComponent" />
99
</div>
1010
<div class="flex flex-col w-full md:w-1/4 lg:w-1/6" v-if="!isSearchPage">
11-
<MyGroupsCard />
11+
<MyGroupsCard v-if="!hideSocialGroupBlock" />
1212
<MyFriendsCard />
1313
<MySkillsCard />
1414
</div>
@@ -34,7 +34,10 @@ import { useSocialInfo } from "../../composables/useSocialInfo"
3434
import { useSocialStore } from "../../store/socialStore"
3535
import { useI18n } from "vue-i18n"
3636
import { useSecurityStore } from "../../store/securityStore"
37+
import { usePlatformConfig } from "../../store/platformConfig"
3738
39+
const platformConfigStore = usePlatformConfig()
40+
const hideSocialGroupBlock = "true" === platformConfigStore.getSetting("social.hide_social_groups_block")
3841
const route = useRoute()
3942
const { t } = useI18n()
4043
const securityStore = useSecurityStore()

public/main/inc/lib/sessionmanager.lib.php

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2893,7 +2893,7 @@ public static function add_courses_to_session(
28932893

28942894
// Subscribe all the users from the session to this course inside the session
28952895
self::insertUsersInCourse(
2896-
array_column($user_list, 'id'),
2896+
array_column($user_list, 'user_id'),
28972897
$courseId,
28982898
$sessionId,
28992899
['visibility' => $sessionVisibility],
@@ -9840,6 +9840,9 @@ public static function insertUsersInCourses(array $studentIds, array $courseIds,
98409840
}
98419841
}
98429842

9843+
/**
9844+
* @throws \Doctrine\ORM\Exception\ORMException
9845+
*/
98439846
public static function insertUsersInCourse(
98449847
array $studentIds,
98459848
int $courseId,
@@ -9856,25 +9859,17 @@ public static function insertUsersInCourse(
98569859

98579860
foreach ($studentIds as $studentId) {
98589861
$user = api_get_user_entity($studentId);
9862+
$session->addUserInCourse($relationInfo['status'], $user, $course)
9863+
->setVisibility($relationInfo['visibility']);
98599864

9860-
if (!$session->hasUserInCourse($user, $course)) {
9861-
$session->addUserInCourse($relationInfo['status'], $user, $course)
9862-
->setVisibility($relationInfo['visibility']);
9863-
9864-
Event::logUserSubscribedInCourseSession($user, $course, $session);
9865-
}
9866-
9867-
$subscription = new SessionRelUser();
9868-
$subscription->setUser($user);
9869-
$subscription->setSession($session);
9870-
$subscription->setRelationType(Session::STUDENT);
9865+
Event::logUserSubscribedInCourseSession($user, $course, $session);
98719866

9872-
if ($updateSession && !$session->hasUser($subscription)) {
9867+
if ($updateSession) {
98739868
$session->addUserInSession(Session::STUDENT, $user);
98749869
}
98759870
}
98769871

9877-
try {
9872+
try {
98789873
$em->persist($session);
98799874
$em->flush();
98809875
} catch (\Exception $e) {

public/main/template/default/my_space/user_details.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<div class="flex-auto lg:flex-1/3 px-4">
2020
{{ display.reporting_user_details(user) }}
2121
{% if user_extra.boss_list %}
22-
<h3 class="font-semibold mt-4">Student Boss:</h3>
22+
<h3 class="font-semibold mt-4">{{ 'Student\'s superior'|trans }}</h3>
2323
{% for boss in user_extra.boss_list %}
2424
<p>{{ boss }}</p>
2525
{% endfor %}

src/CoreBundle/Controller/PlatformConfigurationController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public function list(SettingsManager $settingsManager): Response
8181
'profile.allow_social_map_fields',
8282
'forum.global_forums_course_id',
8383
'document.students_download_folders',
84+
'social.hide_social_groups_block',
8485
];
8586

8687
$user = $this->userHelper->getCurrent();
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
6+
7+
use Chamilo\CoreBundle\Entity\ResourceLink;
8+
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
9+
use Chamilo\CoreBundle\Repository\Node\CourseRepository;
10+
use Chamilo\CoreBundle\Repository\ToolRepository;
11+
use Chamilo\CourseBundle\Entity\CTool;
12+
use Doctrine\DBAL\Schema\Schema;
13+
14+
final class Version20240509123200 extends AbstractMigrationChamilo
15+
{
16+
public function getDescription(): string
17+
{
18+
return 'Ensure all courses have the required tools post-migration.';
19+
}
20+
21+
public function up(Schema $schema): void
22+
{
23+
$courseRepo = $this->container->get(CourseRepository::class);
24+
$toolRepo = $this->container->get(ToolRepository::class);
25+
$admin = $this->getAdmin();
26+
27+
// Define your tool list
28+
$requiredTools = [
29+
'course_description',
30+
'document',
31+
'learnpath',
32+
'link',
33+
'quiz',
34+
'announcement',
35+
'gradebook',
36+
'glossary',
37+
'attendance',
38+
'course_progress',
39+
'agenda',
40+
'forum',
41+
'dropbox',
42+
'member',
43+
'group',
44+
'chat',
45+
'student_publication',
46+
'survey',
47+
'wiki',
48+
'notebook',
49+
'course_tool',
50+
'course_homepage',
51+
'tracking',
52+
'course_setting',
53+
'course_maintenance',
54+
];
55+
56+
$courses = $courseRepo->findAll();
57+
foreach ($courses as $course) {
58+
foreach ($requiredTools as $toolName) {
59+
$ctool = $course->getTools()->filter(
60+
fn(CTool $ct) => $ct->getTool()->getTitle() === $toolName
61+
)->first() ?? null;
62+
63+
if (!$ctool) {
64+
$tool = $toolRepo->findOneBy(['title' => $toolName]);
65+
if ($tool) {
66+
$linkVisibility = ($toolName == 'course_setting' || $toolName == 'course_maintenance')
67+
? ResourceLink::VISIBILITY_DRAFT : ResourceLink::VISIBILITY_PUBLISHED;
68+
69+
$ctool = new CTool();
70+
$ctool->setTool($tool);
71+
$ctool->setTitle($toolName);
72+
$ctool->setVisibility(true);
73+
$ctool->setParent($course);
74+
$ctool->setCreator($admin);
75+
$ctool->addCourseLink($course, null, null, $linkVisibility);
76+
$this->entityManager->persist($ctool);
77+
error_log("Tool '{$toolName}' needs to be added to course ID {$course->getId()}.");
78+
79+
$course->addTool($ctool);
80+
error_log("Tool '{$toolName}' created and linked to course.");
81+
}
82+
}
83+
}
84+
}
85+
$this->entityManager->flush();
86+
$this->entityManager->clear();
87+
}
88+
}

src/CoreBundle/Settings/SocialSettingsSchema.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public function buildSettings(AbstractSettingsBuilder $builder): void
2323
'disable_dislike_option' => 'false',
2424
'social_show_language_flag_in_profile' => 'false',
2525
'social_make_teachers_friend_all' => 'false',
26+
'hide_social_groups_block' => 'false',
2627
]
2728
)
2829
;
@@ -44,6 +45,7 @@ public function buildForm(FormBuilderInterface $builder): void
4445
->add('disable_dislike_option', YesNoType::class)
4546
->add('social_show_language_flag_in_profile', YesNoType::class)
4647
->add('social_make_teachers_friend_all', YesNoType::class)
48+
->add('hide_social_groups_block', YesNoType::class)
4749
;
4850

4951
$this->updateFormFieldsFromSettingsInfo($builder);

translations/messages.de.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22603,8 +22603,8 @@ msgstr "Frist für die Einreichung der Arbeit (Für den Lernenden sichtbar)"
2260322603
msgid "Follow up message about student %s"
2260422604
msgstr "Follow-up Nachricht über Lernende %s"
2260522605

22606-
msgid "Hi,<br/><br/>"
22607-
msgstr "Hallo,<br/><br/>"
22606+
msgid "Hi,<br/><br/>User %s sent a follow up message about student %s.<br/><br/>The message can be seen here %s"
22607+
msgstr "Hallo,<br/><br/>Benutzer %s hat eine Follow-up-Nachricht zum Lernenden %s gesendet.<br/><br/>Die Nachricht ist an %s sichtbar"
2260822608

2260922609
msgid "Include services"
2261022610
msgstr "Einschließlich Dienstleistungen"

translations/messages.en.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22487,8 +22487,8 @@ msgstr "Posted deadline for sending the work (Visible to the learner)"
2248722487
msgid "Follow up message about student %s"
2248822488
msgstr "Follow up message about student %s"
2248922489

22490-
msgid "Hi,<br/><br/>"
22491-
msgstr "Hi,<br/><br/>"
22490+
msgid "Hi,<br/><br/>User %s sent a follow up message about student %s.<br/><br/>The message can be seen here %s"
22491+
msgstr "Hi,<br/><br/>User %s sent a follow up message about student %s.<br/><br/>The message can be seen here %s"
2249222492

2249322493
msgid "Include services"
2249422494
msgstr "Include services"

translations/messages.es.po

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22515,8 +22515,8 @@ msgstr "Fecha límite publicada para enviar el trabajo (visible para el alumno)"
2251522515
msgid "Follow up message about student %s"
2251622516
msgstr "Mensaje de seguimiento sobre alumno %s"
2251722517

22518-
msgid "Hi,<br/><br/>"
22519-
msgstr "Hola,<br/><br/>"
22518+
msgid "Hi,<br/><br/>User %s sent a follow up message about student %s.<br/><br/>The message can be seen here %s"
22519+
msgstr "Hola,<br/><br/>El usuario %s ha enviado un mensaje de seguimiento sobre el alumno %s.<br/><br/>El mensaje se puede ver en %s"
2252022520

2252122521
msgid "Include services"
2252222522
msgstr "Incluir los servicios"
@@ -25276,7 +25276,6 @@ msgstr "Recordarme"
2527625276
msgid "My Skills"
2527725277
msgstr "Mis competencias"
2527825278

25279-
#, fuzzy
2528025279
msgid "Text appearing at the end of the test when the user has failed."
2528125280
msgstr "Texto que aparece al final del examen cuando el usuario no ha aprobado."
2528225281

@@ -25287,8 +25286,7 @@ msgid "Learn more about Chamilo and its use, official references links"
2528725286
msgstr "Aprenda más sobre Chamilo y su uso, enlaces a referencias oficiales"
2528825287

2528925288
msgid "Manage the skills of your users, through courses and badges"
25290-
msgstr ""
25291-
"Gestione las habilidades de sus usuarios, a través de cursos y distintivos"
25289+
msgstr "Gestione las habilidades de sus usuarios, a través de cursos y distintivos"
2529225290

2529325291
msgid "Signed in as"
2529425292
msgstr "Conectado como"
@@ -25308,13 +25306,11 @@ msgstr ""
2530825306
"Otros usuarios no podrán verlos."
2530925307

2531025308
msgid "Select 'Yes' to remove the button to delete all announcements, as this can be used by mistake by teachers."
25311-
msgstr ""
25312-
"Seleccione 'Sí' para eliminar el botón de borrar todos los anuncios, ya que "
25309+
msgstr "Seleccione 'Sí' para eliminar el botón de borrar todos los anuncios, ya que "
2531325310
"los formadores pueden usarlo por error."
2531425311

2531525312
msgid "This gives the HRM a little more power by allowing them to edit/delete agenda events in the course-session."
25316-
msgstr ""
25317-
"Esto otorga al responable RRHH un poco más de poder al permitirle editar/"
25313+
msgstr "Esto otorga al responable RRHH un poco más de poder al permitirle editar/"
2531825314
"eliminar eventos de la agenda en la sesión del curso."
2531925315

2532025316
msgid "Default calendar display mode"

translations/messages.fr.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23138,8 +23138,8 @@ msgstr "Date limite affichée d'envoi du travail (visible par l'apprenant)"
2313823138
msgid "Follow up message about student %s"
2313923139
msgstr "Message de suivi concernant l'apprenant %s"
2314023140

23141-
msgid "Hi,<br/><br/>"
23142-
msgstr "Bonjour,<br/><br/>"
23141+
msgid "Hi,<br/><br/>User %s sent a follow up message about student %s.<br/><br/>The message can be seen here %s"
23142+
msgstr "Bonjour,<br/><br/>L'utilisateur %s a envoyé un message de suivi concernant l'apprenant %s.<br/><br/>Le message est visible sur %s"
2314323143

2314423144
msgid "Include services"
2314523145
msgstr "Inclure les services"

0 commit comments

Comments
 (0)