dolibarr 21.0.0-beta
fichinter_xcal.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2008-2015 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
4 * Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
6 * Copyright (C) 2024 Charlene Benke <charlene@patas-monkey.com>
7 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
29// Load Dolibarr environment
30require '../main.inc.php';
31require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
32require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php';
33
34
46if (!$user->admin) {
48}
49
50// Load translation files required by the page
51$langs->loadLangs(array("admin", "other", "agenda"));
52
53$def = array();
54$actionsave = GETPOST('save', 'alpha');
55$MAIN_FICHINTER_XCAL_EXPORTKEY = getDolGlobalString('MAIN_FICHINTER_XCAL_EXPORTKEY');
56$MAIN_FICHINTER_EXPORT_PAST_DELAY = getDolGlobalString('MAIN_FICHINTER_EXPORT_PAST_DELAY', 100);
57$MAIN_FICHINTER_EXPORT_CACHE = getDolGlobalInt('MAIN_FICHINTER_EXPORT_CACHE');
58$MAIN_FICHINTER_EXPORT_FIX_TZ = getDolGlobalString('MAIN_FICHINTER_EXPORT_FIX_TZ');
59
60if (GETPOSTISSET('MAIN_FICHINTER_XCAL_EXPORTKEY')) {
61 $MAIN_FICHINTER_XCAL_EXPORTKEY = trim(GETPOST('MAIN_FICHINTER_XCAL_EXPORTKEY', 'alpha'));
62}
63if (GETPOSTISSET('MAIN_FICHINTER_EXPORT_PAST_DELAY')) {
64 $MAIN_FICHINTER_EXPORT_PAST_DELAY = intval(GETPOSTINT('MAIN_FICHINTER_EXPORT_PAST_DELAY'));
65}
66if (GETPOSTISSET('MAIN_FICHINTER_EXPORT_CACHE')) {
67 $MAIN_FICHINTER_EXPORT_CACHE = intval(GETPOSTINT('MAIN_FICHINTER_EXPORT_CACHE'));
68}
69if (GETPOSTISSET('MAIN_FICHINTER_EXPORT_FIX_TZ')) {
70 $MAIN_FICHINTER_EXPORT_FIX_TZ = trim(GETPOST('MAIN_FICHINTER_EXPORT_FIX_TZ', 'alpha'));
71}
72
73// Sauvegardes parameters
74if ($actionsave) {
75 $i = 0;
76
77 $db->begin();
78
79 $i += dolibarr_set_const($db, 'MAIN_FICHINTER_XCAL_EXPORTKEY', $MAIN_FICHINTER_XCAL_EXPORTKEY, 'chaine', 0, '', $conf->entity);
80 $i += dolibarr_set_const($db, 'MAIN_FICHINTER_EXPORT_PAST_DELAY', $MAIN_FICHINTER_EXPORT_PAST_DELAY, 'chaine', 0, '', $conf->entity);
81 $i += dolibarr_set_const($db, 'MAIN_FICHINTER_EXPORT_CACHE', $MAIN_FICHINTER_EXPORT_CACHE, 'chaine', 0, '', $conf->entity);
82 $i += dolibarr_set_const($db, 'MAIN_FICHINTER_EXPORT_FIX_TZ', $MAIN_FICHINTER_EXPORT_FIX_TZ, 'chaine', 0, '', $conf->entity);
83
84 if ($i >= 4) {
85 $db->commit();
86 setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
87 } else {
88 $db->rollback();
89 setEventMessages($langs->trans("SaveFailed"), null, 'errors');
90 }
91}
92
93
94
99if (!getDolGlobalString("MAIN_FICHINTER_EXPORT_PAST_DELAY")) {
100 $conf->global->MAIN_FICHINTER_EXPORT_PAST_DELAY = 100;
101}
102
103$wikihelp = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung';
104llxHeader('', $langs->trans("AgendaSetup"), $wikihelp, '', 0, 0, '', '', '', 'mod-admin page-agenda_xcal');
105
106$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
107print load_fiche_titre($langs->trans("AgendaSetup"), $linkback, 'title_setup');
108
109
110print '<form name="agendasetupform" action="'.$_SERVER["PHP_SELF"].'" method="post">';
111print '<input type="hidden" name="token" value="'.newToken().'">';
112
114
115print dol_get_fiche_head($head, 'xcal', $langs->trans("Agenda"), -1, 'action');
116
117print '<span class="opacitymedium">'.$langs->trans("AgendaSetupOtherDesc")."</span><br>\n";
118print "<br>\n";
119
120print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
121print '<table class="noborder centpercent">';
122
123print '<tr class="liste_titre">';
124print "<td>".$langs->trans("Parameter")."</td>";
125print "<td>".$langs->trans("Value")."</td>";
126//print "<td>".$langs->trans("Examples")."</td>";
127print "<td>&nbsp;</td>";
128print "</tr>";
129
130print '<tr class="oddeven">';
131print '<td class="fieldrequired">'.$langs->trans("PasswordTogetVCalExport")."</td>";
132print '<td><input required="required" type="text" class="flat minwidth100 maxwidth300 widthcentpercentminusx" id="MAIN_FICHINTER_XCAL_EXPORTKEY" name="MAIN_FICHINTER_XCAL_EXPORTKEY" value="'.dol_escape_htmltag($MAIN_FICHINTER_XCAL_EXPORTKEY).'">';
133if (!empty($conf->use_javascript_ajax)) {
134 print '&nbsp;'.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"');
135}
136print '</td>';
137print "<td>&nbsp;</td>";
138print "</tr>";
139
140print '<tr class="oddeven">';
141print "<td>".$langs->trans("PastDelayVCalExport")."</td>";
142print '<td><input type="text" class="flat width50 right" name="MAIN_FICHINTER_EXPORT_PAST_DELAY" value="'.$MAIN_FICHINTER_EXPORT_PAST_DELAY.'"> '.$langs->trans("days")."</td>";
143print "<td>&nbsp;</td>";
144print "</tr>";
145
146print '<tr class="oddeven">';
147print "<td>".$langs->trans("UseACacheDelay")."</td>";
148print '<td><input type="text" class="flat width50 right" name="MAIN_FICHINTER_EXPORT_CACHE" value="'.$MAIN_FICHINTER_EXPORT_CACHE.'"></td>';
149print "<td>&nbsp;</td>";
150print "</tr>";
151
152print '</table>';
153print '</div>';
154
155print '<br>';
156
157print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
158print '<table class="noborder centpercent">';
159
160print '<tr class="liste_titre">';
161print '<td width="25%">'.$langs->trans("Parameter")."</td>";
162print "<td>".$langs->trans("Value")."</td>";
163print "</tr>";
164print '<tr class="oddeven">';
165print '<td>'.$langs->trans("FixTZ")."</td>";
166print "<td>";
167print '<input class="flat" type="text" size="4" name="MAIN_FICHINTER_EXPORT_FIX_TZ" value="'.dol_escape_htmltag($MAIN_FICHINTER_EXPORT_FIX_TZ).'">';
168print ' &nbsp; '.$langs->trans("FillThisOnlyIfRequired");
169print "</td>";
170print "</tr>";
171
172print '</table>';
173print '</div>';
174
175print dol_get_fiche_end();
176
177print $form->buttonsSaveCancel("Save", '');
178
179print "</form>\n";
180
181
182clearstatcache();
183
184//if ($mesg) print "<br>$mesg<br>";
185print "<br>";
186
187
188// Define $urlwithroot
189$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
190$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
191//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
192$getentity = ($conf->entity > 1 ? "&entity=".$conf->entity : "");
193
194// Show message
195$message = '';
196
197$urlvcal = '<a href="'.$urlwithroot.'/public/fichinter/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_FICHINTER_XCAL_EXPORTKEY ? urlencode(getDolGlobalString('MAIN_FICHINTER_XCAL_EXPORTKEY')) : '...').'" target="_blank" rel="noopener noreferrer">';
198$urlvcal .= $urlwithroot.'/public/fichinter/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_FICHINTER_XCAL_EXPORTKEY ? urlencode(getDolGlobalString('MAIN_FICHINTER_XCAL_EXPORTKEY')) : 'KEYNOTDEFINED').'</a>';
199$message .= img_picto('', 'globe').' '.str_replace('{url}', $urlvcal, '<span class="opacitymedium">'.$langs->trans("WebCalUrlForVCalExport", 'vcal', '').'</span>');
200$message .= '<div class="urllink">';
201$message .= '<input type="text" id="onlinepaymenturl1" class="quatrevingtpercent" spellcheck="false" value="'.$urlwithroot.'/public/fichinter/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_FICHINTER_XCAL_EXPORTKEY ? urlencode(getDolGlobalString('MAIN_FICHINTER_XCAL_EXPORTKEY')) : '...').'">';
202if (getDolGlobalString('MAIN_FICHINTER_XCAL_EXPORTKEY')) {
203 $message .= ' <a href="'.$urlwithroot.'/public/fichinter/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_FICHINTER_XCAL_EXPORTKEY ? urlencode(getDolGlobalString('MAIN_FICHINTER_XCAL_EXPORTKEY')) : '...').'">'.img_picto('', 'download').'</a>';
204}
205$message .= '</div>';
206$message .= ajax_autoselect('onlinepaymenturl1');
207$message .= '<br>';
208
209$urlical = '<a href="'.$urlwithroot.'/public/fichinter/agendaexport.php?format=ical&type=event'.$getentity.'&exportkey='.($conf->global->MAIN_FICHINTER_XCAL_EXPORTKEY ? urlencode(getDolGlobalString('MAIN_FICHINTER_XCAL_EXPORTKEY')) : '...').'" target="_blank" rel="noopener noreferrer">';
210$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').'</a>';
211$message .= img_picto('', 'globe').' '.str_replace('{url}', $urlical, '<span class="opacitymedium">'.$langs->trans("WebCalUrlForVCalExport", 'ical/ics', '').'</span>');
212$message .= '<div class="urllink">';
213$message .= '<input type="text" id="onlinepaymenturl2" class="quatrevingtpercent" spellcheck="false" value="'.$urlwithroot.'/public/fichinter/agendaexport.php?format=ical'.$getentity.'&exportkey='.($conf->global->MAIN_FICHINTER_XCAL_EXPORTKEY ? urlencode(getDolGlobalString('MAIN_FICHINTER_XCAL_EXPORTKEY')) : '...').'">';
214if (getDolGlobalString('MAIN_FICHINTER_XCAL_EXPORTKEY')) {
215 $message .= ' <a href="'.$urlwithroot.'/public/fichinter/agendaexport.php?format=ical'.$getentity.'&exportkey='.($conf->global->MAIN_FICHINTER_XCAL_EXPORTKEY ? urlencode(getDolGlobalString('MAIN_FICHINTER_XCAL_EXPORTKEY')) : '...').'">'.img_picto('', 'download').'</a>';
216}
217$message .= '</div>';
218$message .= ajax_autoselect('onlinepaymenturl2');
219$message .= '<br>';
220
221$urlrss = '<a href="'.$urlwithroot.'/public/fichinter/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_FICHINTER_XCAL_EXPORTKEY ? urlencode(getDolGlobalString('MAIN_FICHINTER_XCAL_EXPORTKEY')) : '...').'" target="_blank" rel="noopener noreferrer">';
222$urlrss .= $urlwithroot.'/public/fichinter/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_FICHINTER_XCAL_EXPORTKEY ? urlencode(getDolGlobalString('MAIN_FICHINTER_XCAL_EXPORTKEY')) : 'KEYNOTDEFINED').'</a>';
223$message .= img_picto('', 'globe').' '.str_replace('{url}', $urlrss, '<span class="opacitymedium">'.$langs->trans("WebCalUrlForVCalExport", 'rss', '').'</span>');
224$message .= '<div class="urllink">';
225$message .= '<input type="text" id="onlinepaymenturl3" class="quatrevingtpercent" spellcheck="false" value="'.$urlwithroot.'/public/fichinter/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_FICHINTER_XCAL_EXPORTKEY ? urlencode(getDolGlobalString('MAIN_FICHINTER_XCAL_EXPORTKEY')) : '...').'">';
226if (getDolGlobalString('MAIN_FICHINTER_XCAL_EXPORTKEY')) {
227 $message .= ' <a href="'.$urlwithroot.'/public/fichinter/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_FICHINTER_XCAL_EXPORTKEY ? urlencode(getDolGlobalString('MAIN_FICHINTER_XCAL_EXPORTKEY')) : '...').'">'.img_picto('', 'download').'</a>';
228}
229$message .= '</div>';
230$message .= ajax_autoselect('onlinepaymenturl3');
231$message .= '<br>';
232
233print $message;
234
235$message = $langs->trans("AgendaUrlOptions1", $user->login, $user->login).'<br>';
236$message .= $langs->trans("AgendaUrlOptions3", $user->login, $user->login, $user->login).'<br>';
237$message .= $langs->trans("AgendaUrlOptions4", $user->login, $user->login).'<br>';
238$message .= $langs->trans("AgendaUrlOptionsProject", $user->login, $user->login).'<br>';
239$message .= $langs->trans("AgendaUrlOptionsType", 'systemauto|system').'<br>';
240$message .= $langs->trans("AgendaUrlOptionsCode", 'AC_COMPANY_CREATE,AC_PROPAL_VALIDATE,AC_CODE...').'<br>';
241$message .= $langs->trans("AgendaUrlOptionsIncludeHolidays", '1', '1').'<br>';
242//$defaultnotolderthan = getDolGlobalString('MAIN_FICHINTER_EXPORT_PAST_DELAY', 100);
243//$message .= $langs->trans("AgendaUrlOptionsLimitDays", $defaultnotolderthan, $defaultnotolderthan, $defaultnotolderthan).'<br>';
244$message .= $langs->trans("AgendaUrlOptionsLimit", '1000').'<br>';
245
246print info_admin($message);
247
248$constname = 'MAIN_FICHINTER_XCAL_EXPORTKEY';
249
250// Add button to autosuggest a key
251include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
252print dolJSToSetRandomPassword($constname);
253
254// End of page
255llxFooter();
256$db->close();
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:71
llxFooter()
Footer empty.
Definition document.php:107
fichinter_admin_prepare_head()
Return array head with list of tabs to view object information.
if(GETPOSTISSET( 'MAIN_FICHINTER_XCAL_EXPORTKEY')) if(GETPOSTISSET('MAIN_FICHINTER_EXPORT_PAST_DELAY')) if(GETPOSTISSET( 'MAIN_FICHINTER_EXPORT_CACHE')) if(GETPOSTISSET('MAIN_FICHINTER_EXPORT_FIX_TZ')) if( $actionsave) if(!getDolGlobalString("MAIN_FICHINTER_EXPORT_PAST_DELAY")) $wikihelp
View.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
ajax_autoselect($htmlname, $addlink='', $textonlink='Link')
Make content of an input box selected when we click into input field.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
dolJSToSetRandomPassword($htmlname, $htmlnameofbutton='generate_token', $generic=1)
Output javascript to autoset a generated password using default module into a HTML element.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.