"../group/group.php", "name" => get_lang('Groups')); $interbreadcrumb[] = array("url" => "../group/group_space.php?gidReq=".$group_id, "name" => get_lang('GroupSpace').' '.$group_properties['name']); } $tpl = new Template(get_lang('Agenda')); $tpl->assign('use_google_calendar', 0); $can_add_events = 0; switch ($type) { case 'admin': api_protect_admin_script(); $this_section = SECTION_PLATFORM_ADMIN; if (api_is_platform_admin()) { $can_add_events = 1; } break; case 'course': api_protect_course_script(); $this_section = SECTION_COURSES; if (api_is_allowed_to_edit()) { $can_add_events = 1; } if (!empty($group_id)) { if ($is_group_tutor) { $can_add_events = 1; } } break; case 'personal': if (api_is_anonymous()) { api_not_allowed(true); } $extra_field_data = UserManager::get_extra_user_data_by_field(api_get_user_id(), 'google_calendar_url'); if (!empty($extra_field_data) && isset($extra_field_data['google_calendar_url']) && !empty($extra_field_data['google_calendar_url'])) { $tpl->assign('use_google_calendar', 1); $tpl->assign('google_calendar_url', $extra_field_data['google_calendar_url']); } $this_section = SECTION_MYAGENDA; if (!api_is_anonymous()) { $can_add_events = 1; } break; } //Setting translations $day_short = api_get_week_days_short(); $days = api_get_week_days_long(); $months = api_get_months_long(); $months_short = api_get_months_short(); //Setting calendar translations $tpl->assign('month_names', json_encode($months)); $tpl->assign('month_names_short', json_encode($months_short)); $tpl->assign('day_names', json_encode($days)); $tpl->assign('day_names_short', json_encode($day_short)); $tpl->assign('button_text', json_encode(array( 'today' => get_lang('Today'), 'month' => get_lang('Month'), 'week' => get_lang('Week'), 'day' => get_lang('Day') )) ); //see http://docs.jquery.com/UI/Datepicker/$.datepicker.formatDate $tpl->assign('js_format_date', 'D d M yy'); $region_value = api_get_language_isocode(); if ($region_value == 'en') { $region_value = 'en-GB'; } $tpl->assign('region_value', $region_value); $export_icon = '../img/export.png'; $export_icon_low = '../img/export_low_fade.png'; $export_icon_high = '../img/export_high_fade.png'; $tpl->assign('export_ical_confidential_icon', Display::return_icon($export_icon_high, get_lang('ExportiCalConfidential'))); $actions = null; if (api_is_allowed_to_edit(false, true) OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()) && api_is_allowed_to_session_edit(false, true) OR $is_group_tutor ) { if ($type == 'course') { if (isset($_GET['user_id'])) { $filter = $_GET['user_id']; } $actions = display_courseadmin_links($filter); } } else { if ($type == 'course') { $actions = "".Display::return_icon('week.png', get_lang('Agenda'), '', ICON_SIZE_MEDIUM).""; } } $tpl->assign('actions', $actions); //Calendar Type : course, admin, personal $tpl->assign('type', $type); $type_event_class = $type.'_event'; $type_label = get_lang(ucfirst($type).'Calendar'); if ($type == 'course' && !empty($group_id)) { $type_event_class = 'group_event'; $type_label = get_lang('GroupCalendar'); } $defaultView = api_get_setting('default_calendar_view'); if (empty($defaultView)) { $defaultView = 'month'; } /* month, basicWeek,agendaWeek,agendaDay */ $tpl->assign('default_view', $defaultView); if ($type == 'course' && !empty($session_id)) { $type_event_class = 'session_event'; $type_label = get_lang('SessionCalendar'); } $tpl->assign('type_label', $type_label); $tpl->assign('type_event_class', $type_event_class); //Current user can add event? $tpl->assign('can_add_events', $can_add_events); //Setting AJAX caller if (isset($_GET['user_id'])) { $user_id = $_GET['user_id']; $agenda_ajax_url = api_get_path(WEB_AJAX_PATH).'agenda.ajax.php?user_id='.$user_id.'&type='.$type; } else { $agenda_ajax_url = api_get_path(WEB_AJAX_PATH).'agenda.ajax.php?type='.$type; } $tpl->assign('web_agenda_ajax_url', $agenda_ajax_url); $course_code = api_get_course_id(); if ((api_is_allowed_to_edit() || $is_group_tutor) && $course_code != '-1' && $type == 'course') { $order = 'lastname'; if (api_is_western_name_order()) { $order = 'firstname'; } if (!empty($group_id)) { $group_list = array($group_id => $group_properties); $user_list = GroupManager::get_subscribed_users($group_id); } else { $user_list = CourseManager::get_user_list_from_course_code(api_get_course_id(), api_get_session_id(), null, $order); $group_list = CourseManager::get_group_list_of_course(api_get_course_id(), api_get_session_id()); } $agenda = new Agenda(); //This will fill the select called #users_to_send_id $select = $agenda->construct_not_selected_select_form($group_list, $user_list, array()); $tpl->assign('visible_to', $select); } // Loading Agenda template $content = $tpl->fetch('default/agenda/month.tpl'); $tpl->assign('content', $content); // Loading main Chamilo 1 col template $tpl->display_one_col_template();