30require
'../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/agenda.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
50$langs->loadLangs(array(
'agenda',
'admin',
'other'));
53$action =
GETPOST(
'action',
'alpha');
58$colorlist = array(
'BECEDD',
'DDBECE',
'BFDDBE',
'F598B4',
'F68654',
'CBF654',
'A4A4A5');
70if (preg_match(
'/set_(.*)/', $action, $reg)) {
79 $errors[] = $db->lasterror();
84 setEventMessages(
'', $errors,
'errors');
87 setEventMessage($langs->trans(
'SetupSaved'));
88 header(
'Location: ' . $_SERVER[
"PHP_SELF"]);
91} elseif (preg_match(
'/del_(.*)/', $action, $reg)) {
99 $errors[] = $db->lasterror();
104 setEventMessages(
'', $errors,
'errors');
107 setEventMessage($langs->trans(
'SetupSaved'));
108 header(
'Location: ' . $_SERVER[
"PHP_SELF"]);
111} elseif ($action ==
'save') {
114 $disableext =
GETPOST(
'AGENDA_DISABLE_EXT',
'alpha');
121 while ($i <= $MAXAGENDA) {
122 $name = trim(
GETPOST(
'AGENDA_EXT_NAME'.$i,
'alpha'));
123 $src = trim(
GETPOST(
'AGENDA_EXT_SRC'.$i,
'alpha'));
124 $offsettz = trim(
GETPOST(
'AGENDA_EXT_OFFSETTZ'.$i,
'alpha'));
125 $color = trim(
GETPOST(
'AGENDA_EXT_COLOR'.$i,
'alpha'));
126 if ($color ==
'-1') {
129 $enabled = trim(
GETPOST(
'AGENDA_EXT_ENABLED'.$i,
'alpha'));
130 $cachedelay = (
GETPOSTINT(
'AGENDA_EXT_CACHE'.$i) > 0 ? (string)
GETPOSTINT(
'AGENDA_EXT_CACHE'.$i) :
'');
133 setEventMessages($langs->trans(
"ErrorParamMustBeAnUrl"),
null,
'errors');
172 setEventMessages($langs->trans(
"SetupSaved"),
null,
'mesgs');
175 if (empty($errorsaved)) {
176 setEventMessages($langs->trans(
"Error"),
null,
'errors');
185$form =
new Form($db);
190$arrayofcss = array();
192$wikihelp =
'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung';
193llxHeader(
'', $langs->trans(
"AgendaSetup"), $wikihelp,
'', 0, 0, $arrayofjs, $arrayofcss,
'',
'mod-admin page-agenda-extsites');
195$linkback =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/admin/modules.php', [
'restore_lastsearch_values' => 1]).
'">'.img_picto($langs->trans(
"BackToModuleList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToModuleList").
'</span></a>';
197print
load_fiche_titre($langs->trans(
"AgendaSetup"), $linkback,
'title_setup');
199print
'<form name="extsitesconfig" action="'.$_SERVER[
"PHP_SELF"].
'" method="post" spellcheck="false">';
200print
'<input type="hidden" name="token" value="'.newToken().
'">';
201print
'<input type="hidden" name="action" value="save">';
207print
'<div class="info">'.$langs->trans(
"AgendaExtSitesDesc").
"</div><br>\n";
211print
'<div class="div-table-responsive">';
212print
'<table class="noborder centpercent">'.
"\n";
214print
'<tr class="liste_titre">';
215print
'<td class="center">'.$langs->trans(
"AgendaExtNb",
"").
"</td>";
216print
"<td>".$langs->trans(
"Name").
"</td>";
217print
"<td>".$langs->trans(
"ExtSiteUrlAgenda");
218print
'<br><span class="hideonsmartphone opacitymedium">('.$langs->trans(
"Example").
': http://yoursite/agenda/agenda.ics)</span></td>';
219print
"<td>".$form->textwithpicto($langs->trans(
"FixTZ"), $langs->trans(
"FillFixTZOnlyIfRequired"), 1).
'</td>';
220print
'<td class="nowrap">'.$form->textwithpicto($langs->trans(
"AgendaExtCacheDelay"), $langs->trans(
"AgendaExtCacheDelayDesc", 300), 1).
'</td>';
221print
'<td class="center">'.$langs->trans(
"Color").
'</td>';
222print
'<td class="center">'.$langs->trans(
"Enabled").
'</td>';
223print
'<td class="center">'.$langs->trans(
"ActiveByDefault").
'</td>';
227while ($i <= $MAXAGENDA) {
229 $name =
'AGENDA_EXT_NAME' . $key;
230 $src =
'AGENDA_EXT_SRC' . $key;
231 $offsettz =
'AGENDA_EXT_OFFSETTZ' . $key;
232 $color =
'AGENDA_EXT_COLOR' . $key;
233 $cachedelay =
'AGENDA_EXT_CACHE' . $key;
234 $enabled =
'AGENDA_EXT_ENABLED' . $key;
235 $default =
'AGENDA_EXT_ACTIVEBYDEFAULT' . $key;
237 print
'<tr class="oddeven">';
240 print
'<td width="180" class="nowrap center">' . ((int) $key) .
"</td>";
243 print
'<td><input type="text" class="flat hideifnotset minwidth100 maxwidth100onsmartphone" name="AGENDA_EXT_NAME' . $key .
'" value="' . (
GETPOST(
'AGENDA_EXT_NAME' . $key) ?
GETPOST(
'AGENDA_EXT_NAME' . $key,
'alpha') :
getDolGlobalString($name)) .
'" size="28"></td>';
246 print
'<td><input type="url" class="flat hideifnotset width300" name="AGENDA_EXT_SRC' . $key .
'" value="' . (
GETPOST(
'AGENDA_EXT_SRC' . $key) ?
GETPOST(
'AGENDA_EXT_SRC' . $key,
'alpha') :
getDolGlobalString($src)) .
'" size="60"></td>';
249 print
'<td><input type="text" class="flat hideifnotset" name="AGENDA_EXT_OFFSETTZ' . $key .
'" value="' . (
GETPOST(
'AGENDA_EXT_OFFSETTZ' . $key) ?
GETPOST(
'AGENDA_EXT_OFFSETTZ' . $key) :
getDolGlobalString($offsettz)) .
'" size="2"></td>';
252 print
'<td><input type="number" min="0" class="flat hideifnotset width75" name="AGENDA_EXT_CACHE' . $key .
'" value="' . (
GETPOSTISSET(
'AGENDA_EXT_CACHE' . $key) ?
GETPOSTINT(
'AGENDA_EXT_CACHE' . $key) :
getDolGlobalString($cachedelay)) .
'" placeholder="300"></td>' .
"\n";
255 print
'<td class="nowraponall right">';
256 print $formother->selectColor((
GETPOST(
"AGENDA_EXT_COLOR" . $key) ?
GETPOST(
"AGENDA_EXT_COLOR" . $key) :
getDolGlobalString($color)),
"AGENDA_EXT_COLOR" . $key,
'', 1, array(),
'hideifnotset');
260 print
'<td class="nowrap center">';
261 if (!empty(
$conf->use_javascript_ajax)) {
262 print ajax_constantonoff(
'AGENDA_EXT_ENABLED' . $key, array(),
null, 0, 0, 1);
266 print
'<a href="' . $_SERVER[
'PHP_SELF'] .
'?action=del_AGENDA_EXT_ENABLED' . $key .
'&token='.newToken().
'">' . img_picto($langs->trans(
"Disabled"),
'off') .
'</a>';
268 print
'<a href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_AGENDA_EXT_ENABLED' . $key .
'&token='.newToken().
'">' . img_picto($langs->trans(
"Enabled"),
'on') .
'</a>';
274 print
'<td class="nowrap center">';
275 if (!empty(
$conf->use_javascript_ajax)) {
278 print ajax_constantonoff(
'EMPTYPARAM', array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'inline-block', 0,
'', $disabled);
280 print ajax_constantonoff(
'AGENDA_EXT_ACTIVEBYDEFAULT' . $key, array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'inline-block', 0,
'');
285 print
'<a href="' . $_SERVER[
'PHP_SELF'] .
'?action=del_AGENDA_EXT_ACTIVEBYDEFAULT' . $key .
'&token='.newToken().
'">' . img_picto($langs->trans(
"Disabled"),
'off') .
'</a>';
287 print
'<a href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_AGENDA_EXT_ACTIVEBYDEFAULT' . $key .
'&token='.newToken().
'">' . img_picto($langs->trans(
"Enabled"),
'on') .
'</a>';
300print
'<div class="center">';
301print
'<input type="submit" id="save" name="save" class="button hideifnotset button-save" value="'.$langs->trans(
"Save").
'">';
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).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
agenda_prepare_head()
Prepare array with list of tabs.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
dol_is_url($uri)
Return if path is an URI (the name of the method is misleading).
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.