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 %}