80 print
'</body></html>';
86$entity = (!empty($_GET[
'entity']) ? (int) $_GET[
'entity'] : (!empty($_POST[
'entity']) ? (int) $_POST[
'entity'] : 1));
87if (is_numeric($entity)) {
88 define(
"DOLENTITY", $entity);
92require
'../../main.inc.php';
93require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
99 $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY = 100;
105if (
GETPOST(
"format",
'alpha')) {
106 $format =
GETPOST(
"format",
'alpha');
109 $type =
GETPOST(
"type",
'alpha');
125if (
GETPOST(
"project",
'alpha')) {
126 $filters[
'project'] =
GETPOST(
"project",
'alpha');
128if (
GETPOST(
"logina",
'alpha')) {
129 $filters[
'logina'] =
GETPOST(
"logina",
'alpha');
131if (
GETPOST(
"logint",
'alpha')) {
132 $filters[
'logint'] =
GETPOST(
"logint",
'alpha');
134if (
GETPOST(
"notactiontype",
'alpha')) {
135 $filters[
'notactiontype'] =
GETPOST(
"notactiontype",
'alpha');
137if (
GETPOST(
"actiontype",
'alpha')) {
138 $filters[
'actiontype'] =
GETPOST(
"actiontype",
'alpha');
140if (
GETPOST(
"actioncode",
'alpha')) {
141 $filters[
'actioncode'] =
GETPOST(
"actioncode",
'alpha');
144 $filters[
'notolderthan'] =
GETPOSTINT(
"notolderthan");
151 $filters[
'limit'] = 1000;
153if (
GETPOST(
"module",
'alpha')) {
154 $filters[
'module'] =
GETPOST(
"module",
'alpha');
156if (
GETPOST(
"status",
"intcomma")) {
157 $filters[
'status'] =
GETPOST(
"status",
"intcomma");
161if (!isModEnabled(
'agenda')) {
177 print
'<div class="error">Module Agenda was not configured properly.</div>';
183$hookmanager->initHooks(array(
'agendaexport'));
185$reshook = $hookmanager->executeHooks(
'doActions', $filters);
190 if (!empty($hookmanager->errors) && is_array($hookmanager->errors)) {
191 print
'<div class="error">'.implode(
'<br>', $hookmanager->errors).
'</div>';
193 print
'<div class="error">'.$hookmanager->error.
'</div>';
196} elseif (empty($reshook)) {
204 print
'<div class="error">Bad value for key.</div>';
212$shortfilename =
'calendar';
213$filename = $shortfilename;
215foreach ($filters as $key => $value) {
217 if ($key ==
'year') {
218 $filename .=
'-year'.$value;
221 $filename .=
'-id'.$value;
223 if ($key ==
'idfrom') {
224 $filename .=
'-idfrom'.$value;
226 if ($key ==
'idto') {
227 $filename .=
'-idto'.$value;
229 if ($key ==
'project') {
230 $filename .=
'-project'.$value;
231 $shortfilename .=
'-project'.$value;
233 if ($key ==
'logina') {
234 $filename .=
'-logina'.$value;
236 if ($key ==
'logint') {
237 $filename .=
'-logint'.$value;
239 if ($key ==
'notactiontype') {
240 $filename .=
'-notactiontype'.$value;
242 if ($key ==
'actiontype') {
243 $filename .=
'-actiontype'.$value;
245 if ($key ==
'actioncode') {
246 $filename .=
'-actioncode'.$value;
248 if ($key ==
'module') {
249 $filename .=
'-module'.$value;
250 if ($value ==
'project@eventorganization') {
251 $shortfilename .=
'-project';
252 } elseif ($value ==
'conforbooth@eventorganization') {
253 $shortfilename .=
'-conforbooth';
256 if ($key ==
'status') {
257 $filename .=
'-status'.$value;
261if ($format ==
'vcal') {
262 $shortfilename .=
'.vcs';
265if ($format ==
'ical') {
266 $shortfilename .=
'.ics';
269if ($format ==
'rss') {
270 $shortfilename .=
'.rss';
273if ($shortfilename ==
'dolibarrcalendar') {
274 $langs->load(
"errors");
279 print
'<div class="error">'.$langs->trans(
"ErrorWrongValueForParameterX",
'format').
'</div>';
291$exportholidays =
GETPOSTINT(
'includeholidays');
294if ($format ==
'ical' || $format ==
'vcal') {
296 if (!empty($filters[
'project']) && !empty($filters[
'module']) && ($filters[
'module'] ==
'project@eventorganization' || $filters[
'module'] ==
'conforbooth@eventorganization')) {
297 $filters[
'notolderthan'] =
null;
300 $result = $agenda->build_exportfile($format, $type, $cachedelay, $filename, $filters, $exportholidays);
303 if (GETPOSTISSET(
"attachment")) {
304 $attachment =
GETPOST(
"attachment");
307 $contenttype =
'text/calendar';
308 if (GETPOSTISSET(
"contenttype")) {
309 $contenttype =
GETPOST(
"contenttype");
312 $outputencoding =
'UTF-8';
315 header(
'Content-Type: '.$contenttype.($outputencoding ?
'; charset='.$outputencoding :
''));
318 header(
'Content-Disposition: attachment; filename="'.$shortfilename.
'"');
322 header(
'Cache-Control: max-age='.$cachedelay.
', private, must-revalidate');
324 header(
'Cache-Control: private, must-revalidate');
327 header(
"X-Frame-Options: SAMEORIGIN");
330 $outputfile = $conf->agenda->dir_temp.
'/'.$filename;
331 $result = readfile($outputfile);
333 print
'File '.$outputfile.
' was empty.';
341 print
'Error '.$agenda->error;
347if ($format ==
'rss') {
348 $result = $agenda->build_exportfile($format, $type, $cachedelay, $filename, $filters, $exportholidays);
351 if (GETPOSTISSET(
"attachment")) {
352 $attachment =
GETPOST(
"attachment");
355 $contenttype =
'application/rss+xml';
356 if (GETPOSTISSET(
"contenttype")) {
357 $contenttype =
GETPOST(
"contenttype");
360 $outputencoding =
'UTF-8';
363 header(
'Content-Type: '.$contenttype.($outputencoding ?
'; charset='.$outputencoding :
''));
366 header(
'Content-Disposition: attachment; filename="'.$filename.
'"');
368 header(
'Content-Disposition: inline; filename="'.$filename.
'"');
375 header(
'Cache-Control: max-age='.$cachedelay.
', private, must-revalidate');
377 header(
'Cache-Control: private, must-revalidate');
380 header(
"X-Frame-Options: SAMEORIGIN");
383 $outputfile = $conf->agenda->dir_temp.
'/'.$filename;
384 $result = readfile($outputfile);
386 print
'File '.$outputfile.
' was empty.';
394 print
'Error '.$agenda->error;
if(!defined( 'NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined( 'NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) if(!defined( 'NOLOGIN')) if(!defined('NOCSRFCHECK')) if(!defined( 'NOIPCHECK')) llxHeaderVierge($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs=[], $arrayofcss=[])
Header function.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.