Exemplo n.º 1
0
if ($shortfilename == 'dolibarrcalendar') {
    $langs->load("main");
    $langs->load("errors");
    llxHeaderVierge();
    print '<div class="error">' . $langs->trans("ErrorWrongValueForParameterX", 'format') . '</div>';
    llxFooterVierge();
    exit;
}
$agenda = new ActionComm($db);
$cachedelay = 0;
if (!empty($conf->global->MAIN_AGENDA_EXPORT_CACHE)) {
    $cachedelay = $conf->global->MAIN_AGENDA_EXPORT_CACHE;
}
// Build file
if ($format == 'ical' || $format == 'vcal') {
    $result = $agenda->build_exportfile($format, $type, $cachedelay, $filename, $filters);
    if ($result >= 0) {
        $attachment = true;
        if (isset($_GET["attachment"])) {
            $attachment = $_GET["attachment"];
        }
        //$attachment = false;
        $contenttype = 'text/calendar';
        if (isset($_GET["contenttype"])) {
            $contenttype = $_GET["contenttype"];
        }
        //$contenttype='text/plain';
        $outputencoding = 'UTF-8';
        if ($contenttype) {
            header('Content-Type: ' . $contenttype . ($outputencoding ? '; charset=' . $outputencoding : ''));
        }