diff --git a/main/course_info/about.php b/main/course_info/about.php
index 93cd7c80a1..bf3170e474 100644
--- a/main/course_info/about.php
+++ b/main/course_info/about.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->assign('course', $courseItem);
diff --git a/main/inc/lib/api.lib.php b/main/inc/lib/api.lib.php
old mode 100644
new mode 100755
index 2d6f4dbe26..a8a2ad04df
--- a/main/inc/lib/api.lib.php
+++ b/main/inc/lib/api.lib.php
@@ -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 HR directors as well
* @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.
* The function also outputs an error message in case not allowed
*
* @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)) {
- api_not_allowed(true, $message);
-
- return false;
+ if (!($allow_session_coach && api_is_coach())) {
+ api_not_allowed(true, $message);
+ return false;
+ }
}
-
api_block_inactive_user();
-
return true;
}
@@ -3369,7 +3369,6 @@ function api_is_coach($session_id = 0, $courseId = null, $check_student_view = t
$sessionIsCoach = Database::store_result($result);
}
}
-
return count($sessionIsCoach) > 0;
}
diff --git a/main/inc/lib/table_sort.class.php b/main/inc/lib/table_sort.class.php
index 5f85f4d489..16df084739 100755
--- a/main/inc/lib/table_sort.class.php
+++ b/main/inc/lib/table_sort.class.php
@@ -73,12 +73,14 @@ class TableSort
switch ($type) {
case SORT_NUMERIC:
$function = function ($a, $b) use ($column, $compareOperator) {
- $result = strip_tags($a[$column]) <= strip_tags($b[$column]);
- if ('>' === $compareOperator) {
- $result = strip_tags($a[$column]) > strip_tags($b[$column]);
+ $colA = strip_tags($a[$column]);
+ $colB = strip_tags($b[$column]);
+
+ if ('>' === $compareOperator && $colA > $colB) {
+ return 1;
}
- return $result;
+ return $colA < $colB ? -1 : 0;
};
break;
case SORT_IMAGE:
@@ -86,12 +88,12 @@ class TableSort
$result = api_strnatcmp(
api_strtolower(strip_tags($a[$column], "")),
api_strtolower(strip_tags($b[$column], "
"))
- ) <= 0;
+ );
if ('>' === $compareOperator) {
$result = api_strnatcmp(
api_strtolower(strip_tags($a[$column], "
")),
api_strtolower(strip_tags($b[$column], "
"))
- ) > 0;
+ );
}
return $result;
@@ -100,12 +102,14 @@ class TableSort
break;
case SORT_DATE:
$function = function ($a, $b) use ($column, $compareOperator) {
- $result = strtotime(strip_tags($a[$column])) <= strtotime(strip_tags($b[$column]));
- if ('>' === $compareOperator) {
- $result = strtotime(strip_tags($a[$column])) > strtotime(strip_tags($b[$column]));
+ $dateA = strtotime(strip_tags($a[$column]));
+ $dateB = strtotime(strip_tags($b[$column]));
+
+ if ('>' === $compareOperator && $dateA > $dateB) {
+ return 1;
}
- return $result;
+ return $dateA < $dateB ? -1 : 0;
};
break;
case SORT_STRING:
@@ -114,12 +118,12 @@ class TableSort
$result = api_strnatcmp(
api_strtolower(strip_tags($a[$column])),
api_strtolower(strip_tags($b[$column]))
- ) <= 0;
+ );
if ('>' === $compareOperator) {
$result = api_strnatcmp(
api_strtolower(strip_tags($a[$column])),
api_strtolower(strip_tags($b[$column]))
- ) > 0;
+ );
}
return $result;
diff --git a/main/lang/english/trad4all.inc.php b/main/lang/english/trad4all.inc.php
index 3dd75e17c9..1d3dd4479a 100644
--- a/main/lang/english/trad4all.inc.php
+++ b/main/lang/english/trad4all.inc.php
@@ -5925,6 +5925,7 @@ $LowerCaseUser = "user";
$GenerateCertificates = "Generate certificates";
$ExportAllCertificatesToPDF = "Export all certificates to PDF";
$DeleteAllCertificates = "Delete all certificates";
+$ClickToShowGraphs = "Click to show graphics";
$dateFormatLongNoDay = "%d %B %Y";
$dateFormatOnlyDayName = "%A";
$ReturnToCourseList = "Return to the course list";
diff --git a/main/lang/french/trad4all.inc.php b/main/lang/french/trad4all.inc.php
index ce3edf953c..65cf9af220 100644
--- a/main/lang/french/trad4all.inc.php
+++ b/main/lang/french/trad4all.inc.php
@@ -5914,6 +5914,7 @@ $LowerCaseUser = "utilisateur";
$GenerateCertificates = "Générer les certificats";
$ExportAllCertificatesToPDF = "Exporter tous les certificats à PDF";
$DeleteAllCertificates = "Supprimer tous les certificats";
+$ClickToShowGraphs = "Cliquer pour charger les graphiques";
$dateFormatLongNoDay = "%d %B %Y";
$dateFormatOnlyDayName = "%A";
$ReturnToCourseList = "Retour liste de cours";
diff --git a/main/lang/spanish/trad4all.inc.php b/main/lang/spanish/trad4all.inc.php
index 60b72f9482..bf2ddd4ca5 100644
--- a/main/lang/spanish/trad4all.inc.php
+++ b/main/lang/spanish/trad4all.inc.php
@@ -5923,6 +5923,7 @@ $LowerCaseUser = "usuario";
$GenerateCertificates = "Generar certificados";
$ExportAllCertificatesToPDF = "Exportar todos los certificados a PDF";
$DeleteAllCertificates = "Eliminar todos los certificados";
+$ClickToShowGraphs = "Haga clic para ver los gráficos";
$dateFormatLongNoDay = "%d de %B de %Y";
$dateFormatOnlyDayName = "%A";
$ReturnToCourseList = "Regreso a lista de cursos";
diff --git a/main/session/resume_session.php b/main/session/resume_session.php
index 5bf51e62a0..6a6660f826 100644
--- a/main/session/resume_session.php
+++ b/main/session/resume_session.php
@@ -8,6 +8,7 @@ use Chamilo\CoreBundle\Entity\Repository\SessionRepository;
use Chamilo\CoreBundle\Entity\SequenceResource;
use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Entity\SessionRelCourseRelUser;
+use ChamiloSession as PHPSession;
/**
* @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)) {
api_not_allowed(true);
}
-
+PHPSession::write('id_session',$sessionId);
SessionManager::protectSession($sessionId);
$codePath = api_get_path(WEB_CODE_PATH);
diff --git a/main/template/default/course_home/about.tpl b/main/template/default/course_home/about.tpl
index e58b395d14..2595019c29 100644
--- a/main/template/default/course_home/about.tpl
+++ b/main/template/default/course_home/about.tpl
@@ -107,77 +107,85 @@
+ {{ subscribe_button }} +
{% for sequence in sequences %} - {% if sequence.requirements %} -- {{ sequence.name }} : - {% for requirement in sequence.requirements %} - - {{ requirement.title | remove_xss }} - - {% endfor %} -
- {% endif %} + {% if sequence.requirements %} ++ {{ sequence.name }} : + {% for requirement in sequence.requirements %} + + {{ requirement.title | remove_xss }} + + {% endfor %} +
+ {% endif %} {% endfor %}