Пример #1
0
}
/* 	Resource linker */
Session::write('source_type', 'Agenda');
//require_once '../resourcelinker/resourcelinker.inc.php';
$group_id = api_get_group_id();
$eventId = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;
$type = $event_type = isset($_GET['type']) ? $_GET['type'] : null;
$htmlHeadXtra[] = "<script>\n\nfunction plus_repeated_event() {\n    if (document.getElementById('options2').style.display == 'none') {\n        document.getElementById('options2').style.display = 'block';\n    } else {\n        document.getElementById('options2').style.display = 'none';\n    }\n}\n    \$(function() {\n        var checked = \$('input[name=repeat]').attr('checked');\n        if (checked) {\n            \$('#options2').show();\n        }\n    });\n</script>\n";
// setting the name of the tool
$nameTools = get_lang('Agenda');
Event::event_access_tool(TOOL_CALENDAR_EVENT);
// permission stuff - also used by loading from global in agenda.inc.php
$is_allowed_to_edit = api_is_allowed_to_edit(false, true) || api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous();
$agenda = new Agenda();
$agenda->type = $type;
$actions = $agenda->displayActions('calendar');
if ($type == 'fromjs') {
    $id_list = explode('_', $eventId);
    $eventId = $id_list[1];
    $event_type = $id_list[0];
}
if (!api_is_allowed_to_edit(null, true) && $event_type == 'course') {
    api_not_allowed(true);
}
if ($event_type == 'course') {
    $agendaUrl = api_get_path(WEB_CODE_PATH) . 'calendar/agenda_js.php?' . api_get_cidreq() . '&type=course';
} else {
    $agendaUrl = api_get_path(WEB_CODE_PATH) . 'calendar/agenda_js.php?&type=' . $event_type;
}
$course_info = api_get_course_info();
$agenda->type = $event_type;
Пример #2
0
$tpl->addGlobal('month_names_short', json_encode($months_short));
$tpl->addGlobal('day_names', json_encode($days));
$tpl->addGlobal('day_names_short', json_encode($day_short));
$tpl->addGlobal('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->addGlobal('js_format_date', 'D d M yy');
$region_value = api_get_language_isocode();
if ($region_value == 'en') {
    $region_value = 'en-GB';
}
$tpl->addGlobal('region_value', $region_value);
$export_icon = api_get_path(WEB_IMG_PATH) . 'img/export.png';
$export_icon_low = api_get_path(WEB_IMG_PATH) . 'img/export_low_fade.png';
$export_icon_high = api_get_path(WEB_IMG_PATH) . 'img/export_high_fade.png';
$tpl->addGlobal('export_ical_confidential_icon', Display::return_icon($export_icon_high, get_lang('ExportiCalConfidential')));
$actions = $agenda->displayActions('calendar', $userId);
$tpl->addGlobal('actions', $actions);
// Calendar Type : course, admin, personal
$tpl->addGlobal('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('agenda.default_calendar_view');
if (empty($defaultView)) {
    $defaultView = 'month';
}
/* month, basicWeek, agendaWeek, agendaDay */
$tpl->addGlobal('default_view', $defaultView);
Пример #3
0
} else {
    // Agenda is out of the course tool (e.g personal agenda)
    // Little hack to sort the events by start date in personal agenda (Agenda events List view - See #8014)
    usort($events, function ($a, $b) {
        $t1 = strtotime($a['start']);
        $t2 = strtotime($b['start']);
        return $t1 - $t2;
    });
    $url = false;
    foreach ($events as &$event) {
        $event['url'] = api_get_self() . '?cid=' . $event['course_id'] . '&type=' . $event['type'];
    }
}
$tpl = new Template(get_lang('Events'));
$tpl->assign('agenda_events', $events);
$actions = $agenda->displayActions('list');
$tpl->assign('url', $url);
$tpl->assign('actions', $actions);
$tpl->assign('is_allowed_to_edit', api_is_allowed_to_edit());
if (api_is_allowed_to_edit()) {
    if (isset($_GET['action']) && $_GET['action'] == 'change_visibility') {
        $courseInfo = api_get_course_info();
        if (empty($courseInfo)) {
            // This happens when list agenda is not inside a course
            if (($type == 'course' || $type == 'session') && isset($_GET['cid']) && intval($_GET['cid']) !== 0) {
                // For course and session event types
                // Just needs course ID
                $courseInfo = array('real_id' => intval($_GET['cid']));
                $agenda->changeVisibility($_GET['id'], $_GET['visibility'], $courseInfo);
            } else {
                // personal and admin do not have visibility property