Skip to content

Commit 2b42777

Browse files
committed
Merge branch 'master' of github.com:chamilo/chamilo-lms
2 parents 4071712 + 3387a60 commit 2b42777

File tree

13 files changed

+123
-28
lines changed

13 files changed

+123
-28
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
@tailwind base;
2+
3+
@layer base {
4+
:root {
5+
--color-primary-base: 46 117 163;
6+
--color-primary-gradient: 36 77 103;
7+
--color-primary-button-text: 46 117 163;
8+
--color-primary-button-alternative-text: 255 255 255;
9+
10+
--color-secondary-base: 243 126 47;
11+
--color-secondary-gradient: 224 100 16;
12+
--color-secondary-button-text: 255 255 255;
13+
14+
--color-tertiary-base: 51 51 51;
15+
--color-tertiary-gradient: 0 0 0;
16+
--color-tertiary-button-text: 255 255 255;
17+
18+
--color-success-base: 119 170 12;
19+
--color-success-gradient: 83 127 0;
20+
--color-success-button-text: 255 255 255;
21+
22+
--color-info-base: 13 123 253;
23+
--color-info-gradient: 0 84 211;
24+
--color-info-button-text: 255 255 255;
25+
26+
--color-warning-base: 245 206 1;
27+
--color-warning-gradient: 186 152 0;
28+
--color-warning-button-text: 0 0 0;
29+
30+
--color-danger-base: 223 59 59;
31+
--color-danger-gradient: 180 0 21;
32+
--color-danger-button-text: 255 255 255;
33+
34+
--color-form-base: 46 117 163;
35+
}
36+
}
37+
38+
@import "../scss/libs/mediaelementjs/styles";

assets/js/legacy/frameReadyLoader.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { useMediaElementLoader } from "../../vue/composables/mediaElementLoader"
2+
import "../../css/legacy/frameReadyLoader.scss"
3+
4+
const { domLoader: mejsLoader } = useMediaElementLoader()
5+
6+
mejsLoader()

assets/vue/composables/mediaElementLoader.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ function loader() {
5656
}
5757

5858
function domLoader() {
59-
document.addEventListener("DOMContentLoaded", function () {
60-
loader()
61-
})
59+
addedNodesCallback(document)
6260
}
6361

6462
export function useMediaElementLoader() {

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/display.lib.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Chamilo\CoreBundle\Entity\ExtraField;
1010
use Chamilo\CoreBundle\Entity\ExtraFieldValues;
1111
use Chamilo\CoreBundle\Framework\Container;
12+
use Chamilo\CoreBundle\Repository\ColorThemeRepository;
1213
use ChamiloSession as Session;
1314
use Symfony\Component\HttpFoundation\Response;
1415

@@ -2660,4 +2661,31 @@ public static function prose(string $contents): string
26602661
</div>
26612662
";
26622663
}
2664+
2665+
public static function getFrameReadyBlock(
2666+
string $frameName,
2667+
string $itemType = '',
2668+
string $jsConditionalFunction = 'function () { return false; }'
2669+
): string {
2670+
$colorThemeRepo = Container::$container->get(ColorThemeRepository::class);
2671+
$router = Container::getRouter();
2672+
2673+
$colorTheme = $colorThemeRepo->getActiveOne();
2674+
$colorThemeItem = '';
2675+
2676+
if ($colorTheme) {
2677+
$colorThemeItem = '{ type: "stylesheet", src: "'.$router->generate('chamilo_color_theme').'" },';
2678+
}
2679+
2680+
return '$.frameReady(function() {},
2681+
"'.$frameName.'",
2682+
[
2683+
{ type: "script", src: "/build/runtime.js" },
2684+
{ type: "script", src: "/build/legacy_framereadyloader.js" },
2685+
{ type: "stylesheet", src: "/build/legacy_framereadyloader.css" },
2686+
'.$colorThemeItem.'
2687+
],
2688+
'.$jsConditionalFunction
2689+
.');';
2690+
}
26632691
}

public/main/lp/ScormApi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ public static function saveItem(
561561
$return .= "updateGamification('$stars', '$score'); \n";
562562

563563
$position = $myLP->isFirstOrLastItem($item_id);
564-
$return .= "checkCurrentItemPosition('$position'); \n";
564+
$return .= "checkCurrentItemPosition('$item_id'); \n";
565565

566566
if ($mediaplayer) {
567567
$return .= $mediaplayer;

public/main/lp/lp_view.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,12 @@
188188
$get_toc_list = $oLP->get_toc();
189189
$get_teacher_buttons = $oLP->get_teacher_toc_buttons();
190190

191+
$itemType = '';
191192
$type_quiz = false;
192193
foreach ($get_toc_list as $toc) {
193-
if ($toc['id'] == $lp_item_id && 'quiz' === $toc['type']) {
194-
$type_quiz = true;
194+
if ($toc['id'] == $lp_item_id) {
195+
$itemType = $toc['type'];
196+
$type_quiz = 'quiz' === $toc['type'];
195197
}
196198
}
197199

@@ -559,9 +561,16 @@
559561
$template->assign('disable_js_in_lp_view', (int) ('true' === api_get_setting('lp.disable_js_in_lp_view')));
560562
$template->assign('lp_preview_image', '<img src="'.$lpPreviewImagePath.'" alt="'.$oLP->getNameNoTags().'" />');
561563

562-
//$frameReady = Display::getFrameReadyBlock('#content_id, #content_id_blank');
563-
//$template->assign('frame_ready', $frameReady);
564-
$template->assign('frame_ready', '');
564+
$frameReady = Display::getFrameReadyBlock(
565+
'#content_id, #content_id_blank',
566+
$itemType,
567+
'function () {
568+
var arr = ["link", "sco", "xapi", "quiz", "h5p"];
569+
570+
return $.inArray(olms.lms_item_type, arr) !== -1;
571+
}'
572+
);
573+
$template->assign('frame_ready', $frameReady);
565574
$template->displayTemplate('@ChamiloCore/LearnPath/view.html.twig');
566575

567576
// Restore a global setting.

public/main/lp/scorm_api.php

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,28 +1713,37 @@ function switch_item(current_item, next_item)
17131713

17141714
// @todo add loadForumThread inside lp_nav.php to do only one request instead of 3!
17151715
//loadForumThread(olms.lms_lp_id, next_item);
1716-
//checkCurrentItemPosition(olms.lms_item_id);
1716+
checkCurrentItemPosition(olms.lms_item_id);
17171717

17181718
return true;
17191719
}
17201720

17211721
/**
17221722
* Hide or show the navigation buttons if the current item is the First or Last
17231723
*/
1724-
var checkCurrentItemPosition = function(position) {
1725-
if (position == 'first') {
1726-
$("#scorm-previous").hide();
1727-
$("#scorm-next").show();
1728-
} else if (position == 'none') {
1729-
$("#scorm-previous").show();
1730-
$("#scorm-next").show();
1731-
} else if (position == 'last') {
1732-
$("#scorm-previous").show();
1733-
$("#scorm-next").hide();
1734-
} else if (position == 'both') {
1735-
$("#scorm-previous").hide();
1736-
$("#scorm-next").hide();
1737-
}
1724+
var checkCurrentItemPosition = function(lpItemId) {
1725+
var currentItem = $.getJSON(
1726+
'<?php echo api_get_path(WEB_AJAX_PATH); ?>lp.ajax.php' + courseUrl,
1727+
{
1728+
a: 'check_item_position',
1729+
lp_item: lpItemId
1730+
}
1731+
).done(function(parsedResponse,statusText,jqXhr) {
1732+
var position = jqXhr.responseJSON;
1733+
if (position == 'first') {
1734+
$("#scorm-previous").hide();
1735+
$("#scorm-next").show();
1736+
} else if (position == 'none') {
1737+
$("#scorm-previous").show();
1738+
$("#scorm-next").show();
1739+
} else if (position == 'last') {
1740+
$("#scorm-previous").show();
1741+
$("#scorm-next").hide();
1742+
} else if (position == 'both') {
1743+
$("#scorm-previous").hide();
1744+
$("#scorm-next").hide();
1745+
}
1746+
});
17381747
}
17391748

17401749
/**

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();

src/CoreBundle/Migrations/Schema/V200/Version20240509123200.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ public function up(Schema $schema): void
5757
foreach ($courses as $course) {
5858
foreach ($requiredTools as $toolName) {
5959
$ctool = $course->getTools()->filter(
60-
fn(CTool $ct) => $ct->getTool()->getTitle() === $toolName
60+
fn (CTool $ct) => $ct->getTool()->getTitle() === $toolName
6161
)->first() ?? null;
6262

6363
if (!$ctool) {
6464
$tool = $toolRepo->findOneBy(['title' => $toolName]);
6565
if ($tool) {
66-
$linkVisibility = ($toolName == 'course_setting' || $toolName == 'course_maintenance')
66+
$linkVisibility = ('course_setting' == $toolName || 'course_maintenance' == $toolName)
6767
? ResourceLink::VISIBILITY_DRAFT : ResourceLink::VISIBILITY_PUBLISHED;
6868

6969
$ctool = new CTool();

0 commit comments

Comments
 (0)