Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions assets/vue/components/social/UserProfileCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@
{{ user.fullName }}
</div>

<div v-if="visibility.language && languageInfo">
<template v-if="flagIconExists(languageInfo.code)">
<i :class="`mdi mdi-flag-${languageInfo.code.toLowerCase()}`"></i>
</template>
<template v-else>
{{ t(languageInfo.code) }}
</template>
<div v-if="visibility.language && languageInfo" class="flex items-center gap-2">
<i v-if="countryFlag" :class="`flag-icon flag-icon-${countryFlag}`"></i>
<span>{{ languageDisplay }}</span>
</div>

<div class="mt-4">
Expand Down Expand Up @@ -273,4 +269,17 @@ async function handleUnsubscribe() {
console.error("[Push] No user id for unsubscription.")
}
}

const languageDisplay = computed(() => {
return languageInfo.value?.label
?? languageInfo.value?.value
?? languageInfo.value?.code?.toUpperCase()
?? ''
})

const countryFlag = computed(() => {
const code = languageInfo.value?.code || ''
const m = code.match(/[-_](?<region>[A-Za-z]{2})$/)
return m?.groups?.region?.toLowerCase() || null
})
</script>
13 changes: 12 additions & 1 deletion public/main/inc/lib/certificate.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -660,8 +660,17 @@ public function generateCustomCertificate(string $fileName = ''): string
}

$skill = new SkillModel();
// Ofaj
$skills = $skill->getStudentSkills($this->user_id, 2);
$allowAll = ('true' === api_get_setting('skill.allow_teacher_access_student_skills'));
$courseIdForSkills = $allowAll ? 0 : 0;
$sessionIdForSkills = $allowAll ? 0 : 0;
$skillsTable = $skill->getUserSkillsTable(
$this->user_id,
$courseIdForSkills,
$sessionIdForSkills,
false
);

$timeInSeconds = Tracking::get_time_spent_on_the_platform(
$this->user_id,
'ever'
Expand Down Expand Up @@ -710,6 +719,8 @@ public function generateCustomCertificate(string $fileName = ''): string
)
);
$tplContent->assign('skills', $skills);
$tplContent->assign('skills_table_html', $skillsTable['table']);
$tplContent->assign('skills_rows', $skillsTable['skills']);
$tplContent->assign('sessions', $sessionsApproved);
$tplContent->assign('courses', $coursesApproved);
$tplContent->assign('time_spent_in_lps', api_time_to_hms($totalTimeInLearningPaths));
Expand Down
62 changes: 45 additions & 17 deletions public/main/template/default/gradebook/custom_certificate.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<td style="border-collapse: collapse; padding: 0;">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td style="border-collapse: collapse; padding: 0;" bgcolor="#92c647" width=58 height="91">
<td style="border-collapse: collapse; padding: 0;" bgcolor="#92c647" width="58" height="91">
<img src="{{ theme_asset_base64('images/lado-b.png') }}" style="display:block;">
</td>
<td bgcolor="#92c647" width="700" height="91"
Expand Down Expand Up @@ -59,25 +59,55 @@
<br />
<p style="font-size: 16px;">{{ 'This preparation corresponds to a volume of approximately %s training hours.'|trans|format(time_spent_in_lps_in_hours)|raw }}</p>
<br />
<p style="font-size: 16px;">{{ 'The following contents have been validated'|trans|raw }}
:</p>
<p style="font-size: 16px;">{{ 'The following contents have been validated'|trans|raw }} :</p>

{% if sessions %}
<ul style="color: #672290; font-size: 16px;">
{% for session in sessions %}
<li> {{ session.session_name }}</li>
{% endfor %}
</ul>
{% endif %}<br />
<ul style="color: #672290; font-size: 16px;">
{% for session in sessions %}
<li>{{ session.session_name }}</li>
{% endfor %}
</ul>
{% endif %}

<br />
<h4 style="color: #672290; font-size: 16px;">{{ complete_name }}</h4>
<p style="color:#40ad49; font-size: 16px;">{{ 'Obtained the following skills'|trans|raw }}
:</p>
<p style="color:#40ad49; font-size: 16px;">{{ 'Obtained the following skills'|trans|raw }} :</p>

{# Lista simple de nombres de skills (si la quieres mantener) #}
{% if skills %}
<ul style="color: #672290; font-size: 16px;">
{% for skill in skills %}
<li>{{ skill.title }}</li>
{% endfor %}
</ul>
{% endif %}

{% if skills_table_html is defined and skills_table_html %}
<br />
<p style="color:#40ad49; font-size:16px;">{{ 'Badges obtained'|trans|raw }} :</p>
<div>
{{ skills_table_html|raw }}
</div>
{% endif %}

{% if (skills_table_html is not defined or not skills_table_html) and skills_rows is defined and skills_rows|length %}
<br />
<p style="color:#40ad49; font-size:16px;">{{ 'Badges obtained'|trans|raw }} :</p>
<table border="0" cellspacing="6" cellpadding="0">
<tr>
{% for r in skills_rows %}
<td align="center" valign="top" style="text-align:center;">
{{ r.skill_badge|raw }}
<div style="font-size:10px; line-height:1.2; color:#672290; max-width:90px;">
{{ r.skill_title }}
</div>
</td>
{% if loop.index % 6 == 0 %}</tr><tr>{% endif %}
{% endfor %}
</tr>
</table>
{% endif %}

<br />
<p style="color:#40ad49; font-size: 16px;">
{{ 'The'|trans }}
Expand All @@ -87,7 +117,7 @@
</p>
<br />
</td>
<td height=755 bgcolor="#92c647" style="border-collapse: collapse; padding: 0;">
<td height="755" bgcolor="#92c647" style="border-collapse: collapse; padding: 0;">
<img src="{{ theme_asset_base64('images/lado-b.png') }}" style="display:block;">
</td>
</tr>
Expand All @@ -98,16 +128,14 @@
<td style="border-collapse: collapse; padding: 0;">
<table border="0" cellspacing="0" cellpadding="0" width="100%" height="91">
<tr>
<td bgcolor="#92c647" width="58" height="91"
style="border-collapse: collapse; padding: 0;">
<td bgcolor="#92c647" width="58" height="91" style="border-collapse: collapse; padding: 0;">
<img src="{{ theme_asset_base64('images/lado-b.png') }}" style="display:block;">
</td>
<td bgcolor="#92c647" width=500 height=91
<td bgcolor="#92c647" width="500" height="91"
style="border-collapse: collapse; padding: 0; font-family:CourierSans-Light; line-height: 18px; color:#FFF;">
{{ 'Chamilo LMS'|trans|raw }}
</td>
<td bgcolor="#92c647" width="245" height="91"
style="border-collapse: collapse; padding: 0;">
<td bgcolor="#92c647" width="245" height="91" style="border-collapse: collapse; padding: 0;">
</td>
</tr>
</table>
Expand Down
Loading