* Copyright (C) 2012-2013 Juanjo Menent * Copyright (C) 2012 Regis Houssin * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2024 Charlene Benke * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/admin/fichinter_xcal.php * \ingroup agenda * \brief Page to setup miscellaneous options of agenda module */ // Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php'; if (!$user->admin) { accessforbidden(); } // Load translation files required by the page $langs->loadLangs(array("admin", "other", "agenda")); $def = array(); $actionsave = GETPOST('save', 'alpha'); $MAIN_FICHINTER_XCAL_EXPORTKEY = getDolGlobalString('MAIN_FICHINTER_XCAL_EXPORTKEY'); $MAIN_FICHINTER_EXPORT_PAST_DELAY = getDolGlobalString('MAIN_FICHINTER_EXPORT_PAST_DELAY', 100); $MAIN_FICHINTER_EXPORT_CACHE = getDolGlobalInt('MAIN_FICHINTER_EXPORT_CACHE'); $MAIN_FICHINTER_EXPORT_FIX_TZ = getDolGlobalString('MAIN_FICHINTER_EXPORT_FIX_TZ'); if (GETPOSTISSET('MAIN_FICHINTER_XCAL_EXPORTKEY')) { $MAIN_FICHINTER_XCAL_EXPORTKEY = trim(GETPOST('MAIN_FICHINTER_XCAL_EXPORTKEY', 'alpha')); } if (GETPOSTISSET('MAIN_FICHINTER_EXPORT_PAST_DELAY')) { $MAIN_FICHINTER_EXPORT_PAST_DELAY = intval(GETPOSTINT('MAIN_FICHINTER_EXPORT_PAST_DELAY')); } if (GETPOSTISSET('MAIN_FICHINTER_EXPORT_CACHE')) { $MAIN_FICHINTER_EXPORT_CACHE = intval(GETPOSTINT('MAIN_FICHINTER_EXPORT_CACHE')); } if (GETPOSTISSET('MAIN_FICHINTER_EXPORT_FIX_TZ')) { $MAIN_FICHINTER_EXPORT_FIX_TZ = trim(GETPOST('MAIN_FICHINTER_EXPORT_FIX_TZ', 'alpha')); } // Sauvegardes parameters if ($actionsave) { $i = 0; $db->begin(); $i += dolibarr_set_const($db, 'MAIN_FICHINTER_XCAL_EXPORTKEY', $MAIN_FICHINTER_XCAL_EXPORTKEY, 'chaine', 0, '', $conf->entity); $i += dolibarr_set_const($db, 'MAIN_FICHINTER_EXPORT_PAST_DELAY', $MAIN_FICHINTER_EXPORT_PAST_DELAY, 'chaine', 0, '', $conf->entity); $i += dolibarr_set_const($db, 'MAIN_FICHINTER_EXPORT_CACHE', $MAIN_FICHINTER_EXPORT_CACHE, 'chaine', 0, '', $conf->entity); $i += dolibarr_set_const($db, 'MAIN_FICHINTER_EXPORT_FIX_TZ', $MAIN_FICHINTER_EXPORT_FIX_TZ, 'chaine', 0, '', $conf->entity); if ($i >= 4) { $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { $db->rollback(); setEventMessages($langs->trans("SaveFailed"), null, 'errors'); } } /** * View */ if (!getDolGlobalString("MAIN_FICHINTER_EXPORT_PAST_DELAY")) { $conf->global->MAIN_FICHINTER_EXPORT_PAST_DELAY = 100; } $wikihelp = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung'; llxHeader('', $langs->trans("AgendaSetup"), $wikihelp, '', 0, 0, '', '', '', 'mod-admin page-agenda_xcal'); $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("AgendaSetup"), $linkback, 'title_setup'); print '
'; print ''; $head = fichinter_admin_prepare_head(); print dol_get_fiche_head($head, 'xcal', $langs->trans("Agenda"), -1, 'action'); print ''.$langs->trans("AgendaSetupOtherDesc")."
\n"; print "
\n"; print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table print ''; print ''; print ""; print ""; //print ""; print ""; print ""; print ''; print '"; print ''; print ""; print ""; print ''; print ""; print '"; print ""; print ""; print ''; print ""; print ''; print ""; print ""; print '
".$langs->trans("Parameter")."".$langs->trans("Value")."".$langs->trans("Examples")." 
'.$langs->trans("PasswordTogetVCalExport")."'; if (!empty($conf->use_javascript_ajax)) { print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"'); } print ' 
".$langs->trans("PastDelayVCalExport")." '.$langs->trans("days")." 
".$langs->trans("UseACacheDelay")." 
'; print '
'; print '
'; print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table print ''; print ''; print '"; print ""; print ""; print ''; print '"; print ""; print ""; print '
'.$langs->trans("Parameter")."".$langs->trans("Value")."
'.$langs->trans("FixTZ").""; print ''; print '   '.$langs->trans("FillThisOnlyIfRequired"); print "
'; print '
'; print dol_get_fiche_end(); print $form->buttonsSaveCancel("Save", ''); print "
\n"; clearstatcache(); //if ($mesg) print "
$mesg
"; print "
"; // Define $urlwithroot $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current $getentity = ($conf->entity > 1 ? "&entity=".$conf->entity : ""); // Show message $message = ''; $urlvcal = ''; $urlvcal .= $urlwithroot.'/public/fichinter/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_FICHINTER_XCAL_EXPORTKEY ? urlencode(getDolGlobalString('MAIN_FICHINTER_XCAL_EXPORTKEY')) : 'KEYNOTDEFINED').''; $message .= img_picto('', 'globe').' '.str_replace('{url}', $urlvcal, ''.$langs->trans("WebCalUrlForVCalExport", 'vcal', '').''); $message .= ''; $message .= ajax_autoselect('onlinepaymenturl1'); $message .= '
'; $urlical = ''; $urlical .= $urlwithroot.'/public/fichinter/agendaexport.php?format=ical&type=event'.$getentity.'&exportkey='.($conf->global->MAIN_FICHINTER_XCAL_EXPORTKEY ? urlencode(getDolGlobalString('MAIN_FICHINTER_XCAL_EXPORTKEY')) : 'KEYNOTDEFINED').''; $message .= img_picto('', 'globe').' '.str_replace('{url}', $urlical, ''.$langs->trans("WebCalUrlForVCalExport", 'ical/ics', '').''); $message .= ''; $message .= ajax_autoselect('onlinepaymenturl2'); $message .= '
'; $urlrss = ''; $urlrss .= $urlwithroot.'/public/fichinter/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_FICHINTER_XCAL_EXPORTKEY ? urlencode(getDolGlobalString('MAIN_FICHINTER_XCAL_EXPORTKEY')) : 'KEYNOTDEFINED').''; $message .= img_picto('', 'globe').' '.str_replace('{url}', $urlrss, ''.$langs->trans("WebCalUrlForVCalExport", 'rss', '').''); $message .= ''; $message .= ajax_autoselect('onlinepaymenturl3'); $message .= '
'; print $message; $message = $langs->trans("AgendaUrlOptions1", $user->login, $user->login).'
'; $message .= $langs->trans("AgendaUrlOptions3", $user->login, $user->login, $user->login).'
'; $message .= $langs->trans("AgendaUrlOptions4", $user->login, $user->login).'
'; $message .= $langs->trans("AgendaUrlOptionsProject", $user->login, $user->login).'
'; $message .= $langs->trans("AgendaUrlOptionsType", 'systemauto|system').'
'; $message .= $langs->trans("AgendaUrlOptionsCode", 'AC_COMPANY_CREATE,AC_PROPAL_VALIDATE,AC_CODE...').'
'; $message .= $langs->trans("AgendaUrlOptionsIncludeHolidays", '1', '1').'
'; //$defaultnotolderthan = getDolGlobalString('MAIN_FICHINTER_EXPORT_PAST_DELAY', 100); //$message .= $langs->trans("AgendaUrlOptionsLimitDays", $defaultnotolderthan, $defaultnotolderthan, $defaultnotolderthan).'
'; $message .= $langs->trans("AgendaUrlOptionsLimit", '1000').'
'; print info_admin($message); $constname = 'MAIN_FICHINTER_XCAL_EXPORTKEY'; // Add button to autosuggest a key include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; print dolJSToSetRandomPassword($constname); // End of page llxFooter(); $db->close();