29require
'../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/agenda.lib.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
35require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
42$langs->loadLangs(array(
'agenda',
'admin',
'other'));
45$action =
GETPOST(
'action',
'alpha');
48 $conf->global->AGENDA_EXT_NB = 5;
50$MAXAGENDA = $conf->global->AGENDA_EXT_NB;
53$colorlist = array(
'BECEDD',
'DDBECE',
'BFDDBE',
'F598B4',
'F68654',
'CBF654',
'A4A4A5');
63if (preg_match(
'/set_(.*)/', $action, $reg)) {
72 $errors[] = $db->lasterror();
81 header(
'Location: ' . $_SERVER[
"PHP_SELF"]);
84} elseif (preg_match(
'/del_(.*)/', $action, $reg)) {
92 $errors[] = $db->lasterror();
101 header(
'Location: ' . $_SERVER[
"PHP_SELF"]);
104} elseif ($action ==
'save') {
107 $disableext =
GETPOST(
'AGENDA_DISABLE_EXT',
'alpha');
108 $res =
dolibarr_set_const($db,
'AGENDA_DISABLE_EXT', $disableext,
'chaine', 0,
'', $conf->entity);
114 while ($i <= $MAXAGENDA) {
115 $name = trim(
GETPOST(
'AGENDA_EXT_NAME'.$i,
'alpha'));
116 $src = trim(
GETPOST(
'AGENDA_EXT_SRC'.$i,
'alpha'));
117 $offsettz = trim(
GETPOST(
'AGENDA_EXT_OFFSETTZ'.$i,
'alpha'));
118 $color = trim(
GETPOST(
'AGENDA_EXT_COLOR'.$i,
'alpha'));
119 if ($color ==
'-1') {
122 $enabled = trim(
GETPOST(
'AGENDA_EXT_ENABLED'.$i,
'alpha'));
132 $res =
dolibarr_set_const($db,
'AGENDA_EXT_NAME'.$i, $name,
'chaine', 0,
'', $conf->entity);
136 $res =
dolibarr_set_const($db,
'AGENDA_EXT_SRC'.$i, $src,
'chaine', 0,
'', $conf->entity);
140 $res =
dolibarr_set_const($db,
'AGENDA_EXT_OFFSETTZ'.$i, $offsettz,
'chaine', 0,
'', $conf->entity);
144 $res =
dolibarr_set_const($db,
'AGENDA_EXT_COLOR'.$i, $color,
'chaine', 0,
'', $conf->entity);
148 $res =
dolibarr_set_const($db,
'AGENDA_EXT_ENABLED'.$i, $enabled,
'chaine', 0,
'', $conf->entity);
162 $conf->global->AGENDA_EXT_NB = 5;
172 if (empty($errorsaved)) {
182$form =
new Form($db);
187$arrayofcss = array();
189$wikihelp =
'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung';
190llxHeader(
'', $langs->trans(
"AgendaSetup"), $wikihelp,
'', 0, 0, $arrayofjs, $arrayofcss);
192$linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
193print
load_fiche_titre($langs->trans(
"AgendaSetup"), $linkback,
'title_setup');
195print
'<form name="extsitesconfig" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
196print
'<input type="hidden" name="token" value="'.newToken().
'">';
197print
'<input type="hidden" name="action" value="save">';
203print
'<span class="opacitymedium">'.$langs->trans(
"AgendaExtSitesDesc").
"</span><br>\n";
208if ($selectedvalue==1) {
214print
"<table class=\"noborder\" width=\"100%\">";
216print
"<tr class=\"liste_titre\">";
217print
'<td>'.$langs->trans(
"Parameter").
"</td>";
218print
'<td class="center">'.$langs->trans(
"Value").
"</td>";
223print
'<tr class="oddeven">';
224print
"<td>".$langs->trans(
"ExtSitesEnableThisTool").
"</td>";
225print
'<td class="center">';
226if ($conf->use_javascript_ajax) {
227 print ajax_constantonoff(
'AGENDA_DISABLE_EXT', array(
'enabled'=>array(0=>
'.hideifnotset')),
null, 1);
230 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?save=1&AGENDA_DISABLE_EXT=1">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
232 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?save=1&AGENDA_DISABLE_EXT=0">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
240print
'<tr class="oddeven">';
241print
"<td>".$langs->trans(
"ExtSitesNbOfAgenda").
"</td>";
242print
'<td class="center">';
243print
'<input class="flat hideifnotset" type="text" size="2" id="AGENDA_EXT_NB" name="AGENDA_EXT_NB" value="' .
getDolGlobalString(
'AGENDA_EXT_NB').
'">';
250print
"<table class=\"noborder\" width=\"100%\">";
252print
"<tr class=\"liste_titre\">";
253print
"<td>".$langs->trans(
"Parameter").
"</td>";
254print
"<td>".$langs->trans(
"Name").
"</td>";
255print
"<td>".$langs->trans(
"ExtSiteUrlAgenda").
" (".$langs->trans(
"Example").
': http://yoursite/agenda/agenda.ics)</td>';
256print
"<td>".$form->textwithpicto($langs->trans(
"FixTZ"), $langs->trans(
"FillFixTZOnlyIfRequired"), 1).
'</td>';
257print
'<td class="right">'.$langs->trans(
"Color").
'</td>';
258print
'<td class="right">'.$langs->trans(
"ActiveByDefault").
'</td>';
262while ($i <= $MAXAGENDA) {
264 $name =
'AGENDA_EXT_NAME' . $key;
265 $src =
'AGENDA_EXT_SRC' . $key;
266 $offsettz =
'AGENDA_EXT_OFFSETTZ' . $key;
267 $color =
'AGENDA_EXT_COLOR' . $key;
268 $enabled =
'AGENDA_EXT_ENABLED' . $key;
269 $default =
'AGENDA_EXT_ACTIVEBYDEFAULT' . $key;
271 print
'<tr class="oddeven">';
273 print
'<td width="180" class="nowrap">' . $langs->trans(
"AgendaExtNb", $key) .
"</td>";
275 print
'<td><input type="text" class="flat hideifnotset" name="AGENDA_EXT_NAME' . $key .
'" value="' . (
GETPOST(
'AGENDA_EXT_NAME' . $key) ?
GETPOST(
'AGENDA_EXT_NAME' . $key,
'alpha') :
getDolGlobalString($name)) .
'" size="28"></td>';
277 print
'<td><input type="url" class="flat hideifnotset" name="AGENDA_EXT_SRC' . $key .
'" value="' . (
GETPOST(
'AGENDA_EXT_SRC' . $key) ?
GETPOST(
'AGENDA_EXT_SRC' . $key,
'alpha') :
getDolGlobalString($src)) .
'" size="60"></td>';
279 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>';
281 print
'<td class="nowrap right">';
282 print $formother->selectColor((
GETPOST(
"AGENDA_EXT_COLOR" . $key) ?
GETPOST(
"AGENDA_EXT_COLOR" . $key) :
getDolGlobalString($color)),
"AGENDA_EXT_COLOR" . $key,
'extsitesconfig', 1,
'',
'hideifnotset');
285 print
'<td class="nowrap right">';
286 if (!empty($conf->use_javascript_ajax)) {
287 print ajax_constantonoff(
'AGENDA_EXT_ACTIVEBYDEFAULT' . $key);
290 print
'<a href="' . $_SERVER[
'PHP_SELF'] .
'?action=del_AGENDA_EXT_ACTIVEBYDEFAULT' . $key .
'&token='.newToken().
'">' .
img_picto($langs->trans(
"Disabled"),
'off') .
'</a>';
292 print
'<a href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_AGENDA_EXT_ACTIVEBYDEFAULT' . $key .
'&token='.newToken().
'">' .
img_picto($langs->trans(
"Enabled"),
'on') .
'</a>';
304print
'<div class="center">';
305print
'<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.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
dol_is_url($url)
Return if path is an URL.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.