From 8df1d47084fb743d15f736acfa7d40c5c33cc1a9 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Wed, 20 Mar 2019 18:11:17 -0500 Subject: [PATCH] Add missing files in f25743cb1cdf7673e91a5f6661691ac059c3e7cc - refs BT#15394 #2801 --- main/calendar/planification.php | 52 +++++++++++++++ .../template/default/agenda/planification.tpl | 66 +++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 main/calendar/planification.php create mode 100644 main/template/default/agenda/planification.tpl diff --git a/main/calendar/planification.php b/main/calendar/planification.php new file mode 100644 index 0000000000..225692e96c --- /dev/null +++ b/main/calendar/planification.php @@ -0,0 +1,52 @@ +format('Y'); + +$searchYear = isset($_GET['year']) ? (int) $_GET['year'] : $currentYear; + +$userInfo = api_get_user_info(); +$userId = $userInfo['id']; + +$sessions = []; + +if (api_is_drh()) { + $count = SessionManager::get_sessions_followed_by_drh($userId, null, null, true); +} else { + $count = UserManager::get_sessions_by_category($userId, false, true, true, true); +} + +$sessionsList = UserManager::getSubscribedSessionsByYear($userInfo, $searchYear); + +if ($count > 50) { + $message = Display::return_message('TooMuchSessionsInPlanification', 'warning'); + + api_not_allowed(true, $message); +} + +$sessions = UserManager::getSessionsCalendarByYear($sessionsList, $searchYear); + +$colors = ChamiloApi::getColorPalette(false, true, count($sessions)); + +$toolName = get_lang('ViewSessionsPlanification'); + +$template = new Template($toolName); +$template->assign('student_id', $userId); +$template->assign('search_year', $searchYear); +$template->assign('colors', $colors); +$template->assign('sessions', $sessions); +$layout = $template->get_template('agenda/planification.tpl'); +$template->display($layout); diff --git a/main/template/default/agenda/planification.tpl b/main/template/default/agenda/planification.tpl new file mode 100644 index 0000000000..fb0077e271 --- /dev/null +++ b/main/template/default/agenda/planification.tpl @@ -0,0 +1,66 @@ +{% extends 'layout/layout_1_col.tpl'|get_template %} + +{% set user_id = student_id == _u.id ? 0 : student_id %} + +{% block content %} + + {% if sessions|length > 0 %} +
+ + + + + {% for i in 1..52 %} + + {% endfor %} + + + + {% for session in sessions %} + + + + {% if session.start > 0 %} + + {% endif %} + + + + {% if session.duration + session.start < 52 %} + + {% endif %} + + {% endfor %} + +
{{ 'Session'|get_lang }}{{ i }}
+ + {{ session.name }} + +   + {{ session.human_date }} +  
+
+ {% else %} +
+ {{ 'ThereIsNotStillASession'|get_lang }} +
+ {% endif %} +{% endblock %}