Merge branch 'master' of github.com:chamilo/chamilo-lms

pull/5456/head
Yannick Warnier 2 years ago
commit 1e38d1e60f
  1. 9
      assets/css/app.scss
  2. 26
      assets/css/scss/atoms/_progressbar.scss
  3. 1
      assets/css/scss/index.scss
  4. 28
      assets/css/scss/molecules/_legacy_panel.scss
  5. 6
      assets/vue/components/social/UserProfileCard.vue
  6. 2
      public/main/admin/user_information.php
  7. 6
      public/main/exercise/exercise.class.php
  8. 20
      public/main/exercise/overview.php
  9. 9
      public/main/inc/lib/api.lib.php
  10. 28
      public/main/inc/lib/display.lib.php
  11. 6
      public/main/inc/lib/usermanager.lib.php
  12. 9
      public/main/lp/learnpath.class.php
  13. 29
      public/main/lp/lp_controller.php
  14. 11
      public/main/lp/lp_view.php
  15. 30
      src/CoreBundle/Resources/views/Account/edit.html.twig
  16. 3
      translations/messages.de.po
  17. 3
      translations/messages.fr.po
  18. 3
      translations/messages.pot

@ -47,15 +47,6 @@
}
@layer utilities {
.custom-collapse {
display: none;
}
.custom-collapse.active {
display: block;
}
.collapse {
visibility: inherit !important;
}
.border-gray-300 {
--tw-border-opacity: 1;
border-color: rgba(156, 163, 175, var(--tw-border-opacity));

@ -1,11 +1,31 @@
.p-progressbar {
@apply bg-gray-30 rounded-full border-none h-1.5;
@apply relative overflow-hidden;
&-determinate {
.p-progressbar-value {
@apply h-full w-0 absolute border-none flex items-center justify-center overflow-hidden;
&-animate {
@apply duration-1000 ease-in-out;
transition-property: width;
}
}
.p-progressbar-label {
@apply inline-flex;
}
}
}
.p-progressbar {
@apply bg-gray-30 rounded-lg border-none h-6;
&-value {
@apply bg-primary;
@apply border-none m-0 bg-primary;
}
&-label {
@apply text-white;
@apply text-white leading-normal;
}
}

@ -40,6 +40,7 @@
@import "molecules/empty_state";
@import "molecules/teacher_bar";
@import "molecules/toolbar";
@import "molecules/legacy_panel";
@import "organisms/cards";
@import "organisms/course_card";

@ -0,0 +1,28 @@
.display-panel-collapse {
@apply rounded-lg border-gray-25;
&__header {
@apply relative
before:content-[""] before:absolute before:rounded-l-lg before:bg-secondary before:w-1 before:h-full before:-left-1;
a {
@apply cursor-pointer p-2 block bg-support-6 rounded-r-lg;
&[aria-expanded=true] {
@apply rounded-b-none;
}
}
::before {
float: right;
}
}
&__collapsible {
@apply hidden p-3 rounded-b;
&.active {
@apply block shadow-lg;
}
}
}

@ -18,7 +18,7 @@
<i :class="`mdi mdi-flag-${languageInfo.code.toLowerCase()}`"></i>
</template>
<template v-else>
{{ languageInfo.code }}
{{ t(languageInfo.code) }}
</template>
</div>
@ -72,8 +72,8 @@
:key="item.variable"
>
<div v-if="item.value">
<dt v-if="item.variable !== 'langue_cible'">{{ item.label }}:</dt>
<dd v-if="item.variable !== 'langue_cible'">{{ item.value }}</dd>
<dt v-if="item.variable !== 'langue_cible'">{{ t(item.label) }}:</dt>
<dd v-if="item.variable !== 'langue_cible'">{{ t(item.value) }}</dd>
<div
v-if="item.variable === 'langue_cible'"

@ -405,7 +405,7 @@ if (count($sessions) > 0) {
$sessionInformation .= $courseToolInformationTotal;
}
} else {
$sessionInformation = '<p>'.get_lang('NoCourse sessionsForThisUser').'</p>';
$sessionInformation = '<p>'.get_lang('No course sessions for this user').'</p>';
}
$courseToolInformationTotal = '';

@ -9784,7 +9784,7 @@ class Exercise
];
}
public static function saveExerciseInLp($safe_item_id, $safe_exe_id)
public static function saveExerciseInLp($safe_item_id, $safe_exe_id, $course_id = null)
{
$lp = Session::read('oLP');
@ -9796,7 +9796,9 @@ class Exercise
}
$viewId = $lp->get_view_id();
$course_id = api_get_course_int_id();
if (!isset($course_id)) {
$course_id = api_get_course_int_id();
}
$userId = (int) api_get_user_id();
$viewId = (int) $viewId;

@ -19,11 +19,13 @@ $this_section = SECTION_COURSES;
// Notice for unauthorized people.
api_protect_course_script(true);
$sessionId = api_get_session_id();
$courseCode = api_get_course_id();
$courseId = isset($_REQUEST['cid']) ? (int) $_REQUEST['cid'] : api_get_course_int_id();
$sessionId = isset($_REQUEST['sid']) ? (int) $_REQUEST['sid'] : api_get_session_id();
$courseInfo = api_get_course_info_by_id($courseId);
$courseCode = $courseInfo['code'];
$exercise_id = isset($_REQUEST['exerciseId']) ? (int) $_REQUEST['exerciseId'] : 0;
$objExercise = new Exercise();
$objExercise = new Exercise($courseId);
$result = $objExercise->read($exercise_id, true);
if (!$result) {
@ -32,7 +34,7 @@ if (!$result) {
if ('true' === api_get_plugin_setting('positioning', 'tool_enable')) {
$plugin = Positioning::create();
if ($plugin->blockFinalExercise(api_get_user_id(), $exercise_id, api_get_course_int_id(), $sessionId)) {
if ($plugin->blockFinalExercise(api_get_user_id(), $exercise_id, $courseId, $sessionId)) {
api_not_allowed(true);
}
}
@ -203,8 +205,8 @@ if (!api_is_allowed_to_session_edit()) {
$attempts = Event::getExerciseResultsByUser(
api_get_user_id(),
$objExercise->id,
api_get_course_int_id(),
api_get_session_id(),
$courseId,
$sessionId,
$learnpath_id,
$learnpath_item_id,
'desc'
@ -243,7 +245,7 @@ if (!empty($attempts)) {
$attempt_result['max_score'],
$objExercise,
$attempt_result['exe_user_id'],
api_get_course_int_id(),
$courseId,
$sessionId
);
}
@ -444,8 +446,8 @@ if ($disable && empty($exercise_stat_info)) {
$isLimitReached = ExerciseLib::isQuestionsLimitPerDayReached(
api_get_user_id(),
count($objExercise->get_validated_question_list()),
api_get_course_int_id(),
api_get_session_id()
$courseId,
$sessionId
);
if (!empty($exercise_url_button) && !$isLimitReached) {

@ -888,6 +888,9 @@ function api_valid_email($address)
function api_protect_course_script($print_headers = false, $allow_session_admins = false, string $checkTool = '', $cid = null): bool
{
$course_info = api_get_course_info();
if (empty($course_info) && isset($_REQUEST['cid'])) {
$course_info = api_get_course_info_by_id((int) $_REQUEST['cid']);
}
if (isset($cid)) {
$course_info = api_get_course_info_by_id($cid);
@ -2049,7 +2052,11 @@ function api_get_cidreq($addSessionId = true, $addGroupId = true, $origin = '')
if ($addSessionId) {
if (!empty($url)) {
$url .= 0 == api_get_session_id() ? '&sid=0' : '&sid='.api_get_session_id();
$sessionId = api_get_session_id();
if (0 === $sessionId && isset($_REQUEST['sid'])) {
$sessionId = (int) $_REQUEST['sid'];
}
$url .= 0 === $sessionId ? '&sid=0' : '&sid='.$sessionId;
}
}

@ -2458,25 +2458,23 @@ class Display
});
</script>';
$html = '
<div class="mt-4 rounded-lg bg-gray-15 display-panel-collapse mr-4">
<div class="bg-gray-25 border border-gray-30" id="card_'.$idAccordion.'">
<h5>
<a role="button"
class="cursor-pointer p-2 block mdi mdi-chevron-down"
data-toggle="collapse"
data-target="#collapse_'.$idAccordion.'"
aria-expanded="'.(($open) ? 'true' : 'false').'"
aria-controls="collapse_'.$idAccordion.'"
>
'.$title.'
</a>
</h5>
<div class="display-panel-collapse">
<div class="display-panel-collapse__header" id="card_'.$idAccordion.'">
<a role="button"
class="mdi mdi-chevron-down"
data-toggle="collapse"
data-target="#collapse_'.$idAccordion.'"
aria-expanded="'.(($open) ? 'true' : 'false').'"
aria-controls="collapse_'.$idAccordion.'"
>
'.$title.'
</a>
</div>
<div
id="collapse_'.$idAccordion.'"
class="px-4 border border-gray-30 bg-white collapse custom-collapse '.(($open) ? 'active' : '').'"
class="display-panel-collapse__collapsible '.(($open) ? 'active' : '').'"
>
<div id="collapse_contant_'.$idAccordion.'" class="card-body ">';
<div id="collapse_contant_'.$idAccordion.'">';
$html .= $content;
$html .= '</div></div></div>';

@ -4559,11 +4559,11 @@ class UserManager
if (1 == $num_rows) {
$row = Database::fetch_array($rs);
return $row['uid'];
return (int) $row['uid'];
} else {
$my_num_rows = $num_rows;
return Database::result($rs, $my_num_rows - 1, 'uid');
return (int) Database::result($rs, $my_num_rows - 1, 'uid');
}
} elseif ($session > 0) {
$sql = 'SELECT u.id as uid FROM '.$table_user.' u
@ -4576,7 +4576,7 @@ class UserManager
if (Database::num_rows($rs) > 0) {
$row = Database::fetch_assoc($rs);
return $row['uid'];
return (int) $row['uid'];
}
}

@ -2017,11 +2017,10 @@ class learnpath
{
$text = $percentage.$text_add;
return '<div class="progress">
<div id="progress_bar_value"
class="progress-bar progress-bar-success" role="progressbar"
aria-valuenow="'.$percentage.'" aria-valuemin="0" aria-valuemax="100" style="width: '.$text.';">
'.$text.'
return '<div class="p-progressbar p-progressbar-determinate"
role="progressbar" aria-valuenow="'.$percentage.'" aria-valuemin="0" aria-valuemax="100">
<div id="progress_bar_value" class="p-progressbar-value" style="width: '.$text.';">
<div class="p-progressbar-label">'.$text.'</div>
</div>
</div>';
}

@ -27,12 +27,12 @@ $debug = false;
$current_course_tool = TOOL_LEARNPATH;
$lpItemId = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
$lpId = isset($_REQUEST['lp_id']) ? (int) $_REQUEST['lp_id'] : 0;
$course_id = api_get_course_int_id();
$session_id = api_get_session_id();
$courseId = isset($_REQUEST['cid']) ? (int) $_REQUEST['cid'] : api_get_course_int_id();
$sessionId = isset($_REQUEST['sid']) ? (int) $_REQUEST['sid'] : api_get_session_id();
$lpRepo = Container::getLpRepository();
$lpItemRepo = Container::getLpItemRepository();
$courseInfo = api_get_course_info();
$course = api_get_course_entity();
$courseInfo = api_get_course_info_by_id($courseId);
$course = api_get_course_entity($courseId);
$userId = api_get_user_id();
$glossaryExtraTools = api_get_setting('show_glossary_in_extra_tools');
$showGlossary = in_array($glossaryExtraTools, ['true', 'lp', 'exercise_and_lp']);
@ -71,15 +71,15 @@ if (!empty($lpObject)) {
if (isset($oLP) && is_object($oLP)) {
if (1 == $myrefresh ||
empty($oLP->cc) ||
$oLP->cc != api_get_course_id() ||
$oLP->lp_view_session_id != $session_id
$oLP->cc != $course->getCode() ||
$oLP->lp_view_session_id != $sessionId
) {
if ($debug) {
error_log('Course has changed, discard lp object');
error_log('$oLP->lp_view_session_id: '.$oLP->lp_view_session_id);
error_log('api_get_session_id(): '.$session_id);
error_log('api_get_session_id(): '.$sessionId);
error_log('$oLP->cc: '.$oLP->cc);
error_log('api_get_course_id(): '.api_get_course_id());
error_log('api_get_course_id(): '.$course->getCode());
}
if (1 === $myrefresh) {
@ -237,11 +237,8 @@ switch ($action) {
case 'send_notify_teacher':
// Send notification to the teacher
$studentInfo = api_get_user_info();
$course_info = api_get_course_info();
$sessionId = api_get_session_id();
$courseName = $course_info['title'];
$courseUrl = $course_info['course_public_url'];
$courseName = $courseInfo['title'];
$courseUrl = $courseInfo['course_public_url'];
if (!empty($sessionId)) {
$sessionInfo = api_get_session_info($sessionId);
$courseName = $sessionInfo['name'];
@ -249,7 +246,7 @@ switch ($action) {
}
$url = Display::url($courseName, $courseUrl, ['title' => get_lang('Go to the course')]);
$coachList = CourseManager::get_coachs_from_course($sessionId, api_get_course_int_id());
$coachList = CourseManager::get_coachs_from_course($sessionId, $courseId);
foreach ($coachList as $coach_course) {
$recipientName = $coach_course['full_name'];
$coachInfo = api_get_user_info($coach_course['user_id']);
@ -693,7 +690,7 @@ switch ($action) {
if (!$lp_found) {
require 'lp_list.php';
} else {
$result = ScormExport::exportToPdf($lpId, api_get_course_info());
$result = ScormExport::exportToPdf($lpId, $courseInfo);
if (!$result) {
require 'lp_list.php';
}
@ -1005,7 +1002,7 @@ switch ($action) {
$redirectTo = isset($_GET['redirectTo']) ? $_GET['redirectTo'] : '';
switch ($redirectTo) {
case 'course_home':
$url = api_get_path(WEB_PATH).'course/'.api_get_course_int_id().'/home?'.api_get_cidreq();
$url = api_get_path(WEB_PATH).'course/'.$courseId.'/home?'.api_get_cidreq();
break;
case 'lp_list':
$url = 'lp_controller.php?'.api_get_cidreq();

@ -28,9 +28,12 @@ $lp_id = !empty($_GET['lp_id']) ? (int) $_GET['lp_id'] : 0;
if (empty($lp_id)) {
api_not_allowed();
}
$sessionId = api_get_session_id();
$course_code = api_get_course_id();
$course_id = api_get_course_int_id();
$course_id = isset($_REQUEST['cid']) ? (int) $_REQUEST['cid'] : api_get_course_int_id();
$sessionId = isset($_REQUEST['sid']) ? (int) $_REQUEST['sid'] : api_get_session_id();
$courseInfo = api_get_course_info_by_id($course_id);
$course_code = $courseInfo['code'];
$user_id = api_get_user_id();
$course = api_get_course_entity($course_id);
$session = api_get_session_entity($sessionId);
@ -282,7 +285,7 @@ if (!empty($_REQUEST['exeId']) &&
$safe_exe_id = (int) $_REQUEST['exeId'];
if (!empty($safe_id) && !empty($safe_item_id)) {
Exercise::saveExerciseInLp($safe_item_id, $safe_exe_id);
Exercise::saveExerciseInLp($safe_item_id, $safe_exe_id, $course_id);
}
if (EXERCISE_FEEDBACK_TYPE_END != intval($_GET['fb_type'])) {
$src = 'blank.php?msg=exerciseFinished&'.api_get_cidreq(true, true, 'learnpath');

@ -41,22 +41,30 @@
});
</script>
<h3>{{ user.userIdentifier }}</h3>
<div class="section-header section-header--h2">
<h2 class="section-header__title">{{ user.fullName }}</h2>
</div>
{# <a href="{{ url('app_forgot_password_request') }}" class="btn btn--primary">#}
{# Reset password#}
{# </a>#}
<img class="inline-block h-16 w-16 rounded-full ring-2 ring-white"
src="{{ user | illustration }}?w=120&h=120&fit=crop"
alt=""
/>
{{ form_start(form, { 'action': path('chamilo_core_account_edit'), 'attr': { 'class': 'edit' } }) }}
{{ form_widget(form, {'attr': {'class': 'flex flex-col gap-4'}}) }}
<div class="flex md:flex-row gap-4 mt-6">
<div class="w-16">
<img class="h-16 w-16 rounded-full mb-4"
src="{{ user | illustration }}?w=120&h=120&fit=crop"
alt=""
/>
</div>
<div class="flex-grow">
{{ form_start(form, { 'action': path('chamilo_core_account_edit'), 'attr': { 'class': 'edit' } }) }}
{{ form_widget(form, {'attr': {'class': 'flex flex-col gap-4'}}) }}
<div>
<button class="btn btn--primary" name="update_profile" type="submit">{{ 'Update profile'|trans }}</button>
<div>
<button class="btn btn--primary" name="update_profile" type="submit">{{ 'Update profile'|trans }}</button>
</div>
{{ form_end(form) }}
</div>
</div>
{{ form_end(form) }}
{% endautoescape %}
{% endblock %}

@ -25136,3 +25136,6 @@ msgstr "hat folgende Kompetenzen erworben"
msgid "Certificate Footer"
msgstr ""
msgid "No course session for this user"
msgstr "Keine Sessions für diesen Benutzer"

@ -29213,3 +29213,6 @@ msgstr "a obtenu les compétences suivantes "
msgid "Certificate Footer"
msgstr ""
msgid "No course session for this user"
msgstr "Pas de cours de session pour cet utilisateur"

@ -27515,3 +27515,6 @@ msgstr ""
msgid "Select date .."
msgstr ""
msgid "No course sessions for this user"
msgstr ""

Loading…
Cancel
Save