api_get_path(WEB_CODE_PATH)."group/group.php?".api_get_cidreq(), "name" => get_lang('Groups') ); $interbreadcrumb[] = array( "url" => api_get_path(WEB_CODE_PATH)."group/group_space.php?".api_get_cidreq(), "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(true); $allowToEdit = $agenda->getIsAllowedToEdit(); $this_section = SECTION_COURSES; if ($allowToEdit) { $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; } $tpl->assign('js_format_date', 'll'); $region_value = api_get_language_isocode(); if ($region_value == 'en') { $region_value = 'en-GB'; } $tpl->assign('region_value', $region_value); $export_icon = Display::return_icon( 'export.png', null, null, null, null, true, false ); $export_icon_low = Display::return_icon( 'export_low_fade.png', null, null, null, null, true, false ); $export_icon_high = Display::return_icon( 'export_high_fade.png', null, null, null, null, true, false ); $tpl->assign( 'export_ical_confidential_icon', Display::return_icon($export_icon_high, get_lang('ExportiCalConfidential')) ); $actions = $agenda->displayActions('calendar', $userId); $tpl->assign('toolbar', $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 (!empty($userId)) { $agenda_ajax_url = api_get_path(WEB_AJAX_PATH).'agenda.ajax.php?user_id='.$userId.'&type='.$type; } else { $agenda_ajax_url = api_get_path(WEB_AJAX_PATH).'agenda.ajax.php?type='.$type; } if ($type == 'course' && !empty($courseId)) { $agenda_ajax_url .= '&'.api_get_cidreq(); } if (isset($_GET['session_id'])) { $agenda_ajax_url .= '&session_id='.intval($_GET['session_id']); } $tpl->assign('web_agenda_ajax_url', $agenda_ajax_url); $form = new FormValidator( 'form', 'get', null, null, array('id' => 'add_event_form') ); $form->addHtml('
'); $sendTo = $agenda->parseAgendaFilter($userId); $addOnlyItemsInSendTo = true; if ($sendTo['everyone']) { $addOnlyItemsInSendTo = false; } $agenda->showToForm($form, $sendTo, array(), $addOnlyItemsInSendTo); $form->addHtml('
'); $form->addHtml(''); $form->addElement('label', get_lang('Agenda'), '
'); $form->addElement('label', get_lang('Date'), ''); $form->addElement('text', 'title', get_lang('Title'), array('id' => 'title')); $form->addHtmlEditor( 'content', get_lang('Description'), false, false, [ 'ToolbarSet' => 'TestProposedAnswer', 'Height' => '120' ] ); if ($agenda->type === 'course') { $form->addHtml(''); $form->addElement('textarea', 'comment', get_lang('Comment'), array('id' => 'comment')); } $tpl->assign('form_add', $form->returnForm()); $tpl->assign('legend_list', api_get_configuration_value('agenda_legend')); $templateName = $tpl->get_template('agenda/month.tpl'); $content = $tpl->fetch($templateName); $tpl->assign('content', $content); $tpl->display_one_col_template();