Merge branch '1.11.x' of github.com:chamilo/chamilo-lms into 1.11.x

pull/4448/head
Yannick Warnier 3 years ago
commit 2220dc5748
  1. 5
      main/course_info/about.php
  2. 9
      main/inc/lib/api.lib.php
  3. 28
      main/inc/lib/table_sort.class.php
  4. 1
      main/lang/english/trad4all.inc.php
  5. 1
      main/lang/french/trad4all.inc.php
  6. 1
      main/lang/spanish/trad4all.inc.php
  7. 3
      main/session/resume_session.php
  8. 14
      main/template/default/course_home/about.tpl
  9. 2
      main/user/user_export.php

@ -183,6 +183,11 @@ foreach ($requirements as $sequence) {
} }
} }
if ($hasRequirements) {
$sequenceList = $sequenceResourceRepo->checkRequirementsForUser($requirements, SequenceResource::COURSE_TYPE, $userId);
$allowSubscribe = $sequenceResourceRepo->checkSequenceAreCompleted($sequenceList);
}
$template = new Template($course->getTitle(), true, true, false, true, false); $template = new Template($course->getTitle(), true, true, false, true, false);
$template->assign('course', $courseItem); $template->assign('course', $courseItem);

@ -1328,22 +1328,22 @@ function api_protect_course_script($print_headers = false, $allow_session_admins
* @param bool Whether to allow session admins as well * @param bool Whether to allow session admins as well
* @param bool Whether to allow HR directors as well * @param bool Whether to allow HR directors as well
* @param string An optional message (already passed through get_lang) * @param string An optional message (already passed through get_lang)
* @param bool Whether to allow session coach as well
* *
* @return bool True if user is allowed, false otherwise. * @return bool True if user is allowed, false otherwise.
* The function also outputs an error message in case not allowed * The function also outputs an error message in case not allowed
* *
* @author Roan Embrechts (original author) * @author Roan Embrechts (original author)
*/ */
function api_protect_admin_script($allow_sessions_admins = false, $allow_drh = false, $message = null) function api_protect_admin_script($allow_sessions_admins = false, $allow_drh = false, $message = null, $allow_session_coach = false)
{ {
if (!api_is_platform_admin($allow_sessions_admins, $allow_drh)) { if (!api_is_platform_admin($allow_sessions_admins, $allow_drh)) {
if (!($allow_session_coach && api_is_coach())) {
api_not_allowed(true, $message); api_not_allowed(true, $message);
return false; return false;
} }
}
api_block_inactive_user(); api_block_inactive_user();
return true; return true;
} }
@ -3369,7 +3369,6 @@ function api_is_coach($session_id = 0, $courseId = null, $check_student_view = t
$sessionIsCoach = Database::store_result($result); $sessionIsCoach = Database::store_result($result);
} }
} }
return count($sessionIsCoach) > 0; return count($sessionIsCoach) > 0;
} }

@ -73,12 +73,14 @@ class TableSort
switch ($type) { switch ($type) {
case SORT_NUMERIC: case SORT_NUMERIC:
$function = function ($a, $b) use ($column, $compareOperator) { $function = function ($a, $b) use ($column, $compareOperator) {
$result = strip_tags($a[$column]) <= strip_tags($b[$column]); $colA = strip_tags($a[$column]);
if ('>' === $compareOperator) { $colB = strip_tags($b[$column]);
$result = strip_tags($a[$column]) > strip_tags($b[$column]);
if ('>' === $compareOperator && $colA > $colB) {
return 1;
} }
return $result; return $colA < $colB ? -1 : 0;
}; };
break; break;
case SORT_IMAGE: case SORT_IMAGE:
@ -86,12 +88,12 @@ class TableSort
$result = api_strnatcmp( $result = api_strnatcmp(
api_strtolower(strip_tags($a[$column], "<img>")), api_strtolower(strip_tags($a[$column], "<img>")),
api_strtolower(strip_tags($b[$column], "<img>")) api_strtolower(strip_tags($b[$column], "<img>"))
) <= 0; );
if ('>' === $compareOperator) { if ('>' === $compareOperator) {
$result = api_strnatcmp( $result = api_strnatcmp(
api_strtolower(strip_tags($a[$column], "<img>")), api_strtolower(strip_tags($a[$column], "<img>")),
api_strtolower(strip_tags($b[$column], "<img>")) api_strtolower(strip_tags($b[$column], "<img>"))
) > 0; );
} }
return $result; return $result;
@ -100,12 +102,14 @@ class TableSort
break; break;
case SORT_DATE: case SORT_DATE:
$function = function ($a, $b) use ($column, $compareOperator) { $function = function ($a, $b) use ($column, $compareOperator) {
$result = strtotime(strip_tags($a[$column])) <= strtotime(strip_tags($b[$column])); $dateA = strtotime(strip_tags($a[$column]));
if ('>' === $compareOperator) { $dateB = strtotime(strip_tags($b[$column]));
$result = strtotime(strip_tags($a[$column])) > strtotime(strip_tags($b[$column]));
if ('>' === $compareOperator && $dateA > $dateB) {
return 1;
} }
return $result; return $dateA < $dateB ? -1 : 0;
}; };
break; break;
case SORT_STRING: case SORT_STRING:
@ -114,12 +118,12 @@ class TableSort
$result = api_strnatcmp( $result = api_strnatcmp(
api_strtolower(strip_tags($a[$column])), api_strtolower(strip_tags($a[$column])),
api_strtolower(strip_tags($b[$column])) api_strtolower(strip_tags($b[$column]))
) <= 0; );
if ('>' === $compareOperator) { if ('>' === $compareOperator) {
$result = api_strnatcmp( $result = api_strnatcmp(
api_strtolower(strip_tags($a[$column])), api_strtolower(strip_tags($a[$column])),
api_strtolower(strip_tags($b[$column])) api_strtolower(strip_tags($b[$column]))
) > 0; );
} }
return $result; return $result;

@ -5925,6 +5925,7 @@ $LowerCaseUser = "user";
$GenerateCertificates = "Generate certificates"; $GenerateCertificates = "Generate certificates";
$ExportAllCertificatesToPDF = "Export all certificates to PDF"; $ExportAllCertificatesToPDF = "Export all certificates to PDF";
$DeleteAllCertificates = "Delete all certificates"; $DeleteAllCertificates = "Delete all certificates";
$ClickToShowGraphs = "Click to show graphics";
$dateFormatLongNoDay = "%d %B %Y"; $dateFormatLongNoDay = "%d %B %Y";
$dateFormatOnlyDayName = "%A"; $dateFormatOnlyDayName = "%A";
$ReturnToCourseList = "Return to the course list"; $ReturnToCourseList = "Return to the course list";

@ -5914,6 +5914,7 @@ $LowerCaseUser = "utilisateur";
$GenerateCertificates = "Générer les certificats"; $GenerateCertificates = "Générer les certificats";
$ExportAllCertificatesToPDF = "Exporter tous les certificats à PDF"; $ExportAllCertificatesToPDF = "Exporter tous les certificats à PDF";
$DeleteAllCertificates = "Supprimer tous les certificats"; $DeleteAllCertificates = "Supprimer tous les certificats";
$ClickToShowGraphs = "Cliquer pour charger les graphiques";
$dateFormatLongNoDay = "%d %B %Y"; $dateFormatLongNoDay = "%d %B %Y";
$dateFormatOnlyDayName = "%A"; $dateFormatOnlyDayName = "%A";
$ReturnToCourseList = "Retour liste de cours"; $ReturnToCourseList = "Retour liste de cours";

@ -5923,6 +5923,7 @@ $LowerCaseUser = "usuario";
$GenerateCertificates = "Generar certificados"; $GenerateCertificates = "Generar certificados";
$ExportAllCertificatesToPDF = "Exportar todos los certificados a PDF"; $ExportAllCertificatesToPDF = "Exportar todos los certificados a PDF";
$DeleteAllCertificates = "Eliminar todos los certificados"; $DeleteAllCertificates = "Eliminar todos los certificados";
$ClickToShowGraphs = "Haga clic para ver los gráficos";
$dateFormatLongNoDay = "%d de %B de %Y"; $dateFormatLongNoDay = "%d de %B de %Y";
$dateFormatOnlyDayName = "%A"; $dateFormatOnlyDayName = "%A";
$ReturnToCourseList = "Regreso a lista de cursos"; $ReturnToCourseList = "Regreso a lista de cursos";

@ -8,6 +8,7 @@ use Chamilo\CoreBundle\Entity\Repository\SessionRepository;
use Chamilo\CoreBundle\Entity\SequenceResource; use Chamilo\CoreBundle\Entity\SequenceResource;
use Chamilo\CoreBundle\Entity\Session; use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Entity\SessionRelCourseRelUser; use Chamilo\CoreBundle\Entity\SessionRelCourseRelUser;
use ChamiloSession as PHPSession;
/** /**
* @author Bart Mollet, Julio Montoya lot of fixes * @author Bart Mollet, Julio Montoya lot of fixes
@ -23,7 +24,7 @@ $sessionId = isset($_GET['id_session']) ? (int) $_GET['id_session'] : null;
if (empty($sessionId)) { if (empty($sessionId)) {
api_not_allowed(true); api_not_allowed(true);
} }
PHPSession::write('id_session',$sessionId);
SessionManager::protectSession($sessionId); SessionManager::protectSession($sessionId);
$codePath = api_get_path(WEB_CODE_PATH); $codePath = api_get_path(WEB_CODE_PATH);

@ -107,9 +107,9 @@
</div> </div>
</div> </div>
<div class="col-sm-4"> <div class="col-sm-4">
{% if allow_subscribe == true %}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-body"> <div class="panel-body">
{% if allow_subscribe == true %}
{% if is_premium == false %} {% if is_premium == false %}
<div class="session-subscribe"> <div class="session-subscribe">
{# public course (open world) #} {# public course (open world) #}
@ -157,10 +157,19 @@
</div> </div>
</div> </div>
{% endif %} {% endif %}
{% else %}
<div class="session-subscribe">
<button class="btn btn-lg btn-default btn-block" disabled>
{{ 'Subscribe'|get_lang }}
</button>
</div>
{% endif %}
{% if has_requirements %} {% if has_requirements %}
<div class="session-requirements"> <div class="session-requirements">
<h5>{{ 'RequiredCourses'|get_lang }}</h5> <h5>{{ 'RequiredCourses'|get_lang }}</h5>
<p>
{{ subscribe_button }}
</p>
{% for sequence in sequences %} {% for sequence in sequences %}
{% if sequence.requirements %} {% if sequence.requirements %}
<p> <p>
@ -177,7 +186,6 @@
{% endif %} {% endif %}
</div> </div>
</div> </div>
{% endif %}
{% if course.teachers and not 'course_about_teacher_name_hide'|api_get_configuration_value %} {% if course.teachers and not 'course_about_teacher_name_hide'|api_get_configuration_value %}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-body"> <div class="panel-body">

@ -5,7 +5,7 @@
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_COURSES; $this_section = SECTION_COURSES;
api_protect_admin_script(true, true); api_protect_admin_script(true, true, null, true);
$export = []; $export = [];
$export['file_type'] = isset($_REQUEST['file_type']) ? $_REQUEST['file_type'] : null; $export['file_type'] = isset($_REQUEST['file_type']) ? $_REQUEST['file_type'] : null;

Loading…
Cancel
Save