Go to the documentation of this file.
28 require
'../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/agenda.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
41 $langs->loadLangs(array(
'agenda',
'admin',
'other'));
44 $action =
GETPOST(
'action',
'alpha');
46 if (empty($conf->global->AGENDA_EXT_NB)) {
47 $conf->global->AGENDA_EXT_NB = 5;
49 $MAXAGENDA = $conf->global->AGENDA_EXT_NB;
52 $colorlist = array(
'BECEDD',
'DDBECE',
'BFDDBE',
'F598B4',
'F68654',
'CBF654',
'A4A4A5');
62 if (preg_match(
'/set_(.*)/', $action, $reg)) {
71 $errors[] = $db->lasterror();
80 header(
'Location: ' . $_SERVER[
"PHP_SELF"]);
83 } elseif (preg_match(
'/del_(.*)/', $action, $reg)) {
91 $errors[] = $db->lasterror();
100 header(
'Location: ' . $_SERVER[
"PHP_SELF"]);
103 } elseif ($action ==
'save') {
106 $disableext =
GETPOST(
'AGENDA_DISABLE_EXT',
'alpha');
107 $res =
dolibarr_set_const($db,
'AGENDA_DISABLE_EXT', $disableext,
'chaine', 0,
'', $conf->entity);
109 $i = 1; $errorsaved = 0;
112 while ($i <= $MAXAGENDA) {
113 $name = trim(
GETPOST(
'AGENDA_EXT_NAME'.$i,
'alpha'));
114 $src = trim(
GETPOST(
'AGENDA_EXT_SRC'.$i,
'alpha'));
115 $offsettz = trim(
GETPOST(
'AGENDA_EXT_OFFSETTZ'.$i,
'alpha'));
116 $color = trim(
GETPOST(
'AGENDA_EXT_COLOR'.$i,
'alpha'));
117 if ($color ==
'-1') {
120 $enabled = trim(
GETPOST(
'AGENDA_EXT_ENABLED'.$i,
'alpha'));
130 $res =
dolibarr_set_const($db,
'AGENDA_EXT_NAME'.$i, $name,
'chaine', 0,
'', $conf->entity);
134 $res =
dolibarr_set_const($db,
'AGENDA_EXT_SRC'.$i, $src,
'chaine', 0,
'', $conf->entity);
138 $res =
dolibarr_set_const($db,
'AGENDA_EXT_OFFSETTZ'.$i, $offsettz,
'chaine', 0,
'', $conf->entity);
142 $res =
dolibarr_set_const($db,
'AGENDA_EXT_COLOR'.$i, $color,
'chaine', 0,
'', $conf->entity);
146 $res =
dolibarr_set_const($db,
'AGENDA_EXT_ENABLED'.$i, $enabled,
'chaine', 0,
'', $conf->entity);
159 if (empty($conf->global->AGENDA_EXT_NB)) {
160 $conf->global->AGENDA_EXT_NB = 5;
162 $MAXAGENDA = empty($conf->global->AGENDA_EXT_NB) ? 5 : $conf->global->AGENDA_EXT_NB;
170 if (empty($errorsaved)) {
184 $arrayofjs = array();
185 $arrayofcss = array();
187 $wikihelp =
'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
188 llxHeader(
'', $langs->trans(
"AgendaSetup"),
$wikihelp,
'', 0, 0, $arrayofjs, $arrayofcss);
190 $linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
191 print
load_fiche_titre($langs->trans(
"AgendaSetup"), $linkback,
'title_setup');
193 print
'<form name="extsitesconfig" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
194 print
'<input type="hidden" name="token" value="'.newToken().
'">';
195 print
'<input type="hidden" name="action" value="save">';
201 print
'<span class="opacitymedium">'.$langs->trans(
"AgendaExtSitesDesc").
"</span><br>\n";
205 $selectedvalue=$conf->global->AGENDA_DISABLE_EXT;
206 if ($selectedvalue==1) $selectedvalue=0;
else $selectedvalue=1;
208 print
"<table class=\"noborder\" width=\"100%\">";
210 print
"<tr class=\"liste_titre\">";
211 print
'<td>'.$langs->trans(
"Parameter").
"</td>";
212 print
'<td class="center">'.$langs->trans(
"Value").
"</td>";
217 print
'<tr class="oddeven">';
218 print
"<td>".$langs->trans(
"ExtSitesEnableThisTool").
"</td>";
219 print
'<td class="center">';
220 if ($conf->use_javascript_ajax) {
221 print
ajax_constantonoff(
'AGENDA_DISABLE_EXT', array(
'enabled'=>array(0=>
'.hideifnotset')),
null, 1);
223 if (empty($conf->global->AGENDA_DISABLE_EXT)) {
224 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?save=1&AGENDA_DISABLE_EXT=1">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
226 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?save=1&AGENDA_DISABLE_EXT=0">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
234 print
'<tr class="oddeven">';
235 print
"<td>".$langs->trans(
"ExtSitesNbOfAgenda").
"</td>";
236 print
'<td class="center">';
237 print
'<input class="flat hideifnotset" type="text" size="2" id="AGENDA_EXT_NB" name="AGENDA_EXT_NB" value="'.$conf->global->AGENDA_EXT_NB.
'">';
244 print
"<table class=\"noborder\" width=\"100%\">";
246 print
"<tr class=\"liste_titre\">";
247 print
"<td>".$langs->trans(
"Parameter").
"</td>";
248 print
"<td>".$langs->trans(
"Name").
"</td>";
249 print
"<td>".$langs->trans(
"ExtSiteUrlAgenda").
" (".$langs->trans(
"Example").
': http://yoursite/agenda/agenda.ics)</td>';
250 print
"<td>".$form->textwithpicto($langs->trans(
"FixTZ"), $langs->trans(
"FillFixTZOnlyIfRequired"), 1).
'</td>';
251 print
'<td class="right">'.$langs->trans(
"Color").
'</td>';
252 print
'<td class="right">'.$langs->trans(
"ActiveByDefault").
'</td>';
256 while ($i <= $MAXAGENDA) {
258 $name =
'AGENDA_EXT_NAME' . $key;
259 $src =
'AGENDA_EXT_SRC' . $key;
260 $offsettz =
'AGENDA_EXT_OFFSETTZ' . $key;
261 $color =
'AGENDA_EXT_COLOR' . $key;
262 $enabled =
'AGENDA_EXT_ENABLED' . $key;
263 $default =
'AGENDA_EXT_ACTIVEBYDEFAULT' . $key;
265 print
'<tr class="oddeven">';
267 print
'<td width="180" class="nowrap">' . $langs->trans(
"AgendaExtNb", $key) .
"</td>";
269 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>';
271 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>';
273 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>';
275 print
'<td class="nowrap right">';
277 print $formother->selectColor((
GETPOST(
"AGENDA_EXT_COLOR" . $key) ?
GETPOST(
"AGENDA_EXT_COLOR" . $key) :
getDolGlobalString($color)),
"AGENDA_EXT_COLOR" . $key,
'extsitesconfig', 1,
'',
'hideifnotset');
280 print
'<td class="nowrap right">';
281 if ($conf->use_javascript_ajax) {
284 if (empty($conf->global->{$default})) {
285 print
'<a href="' . $_SERVER[
'PHP_SELF'] .
'?action=set_AGENDA_EXT_ACTIVEBYDEFAULT' . $key .
'&token='.newToken().
'">' .
img_picto($langs->trans(
"Enabled"),
'on') .
'</a>';
287 print
'<a href="' . $_SERVER[
'PHP_SELF'] .
'?action=del_AGENDA_EXT_ACTIVEBYDEFAULT' . $key .
'&token='.newToken().
'">' .
img_picto($langs->trans(
"Disabled"),
'off') .
'</a>';
299 print
'<div class="center">';
300 print
'<input type="submit" id="save" name="save" class="button hideifnotset button-save" value="'.$langs->trans(
"Save").
'">';
dol_is_url($url)
Return if path is an URL.
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
agenda_prepare_head()
Prepare array with list of tabs.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
if($actionsave) if(!isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $wikihelp
View.
setEventMessage($mesgs, $style='mesgs')
Set event message in dol_events session object.
ajax_constantonoff($code, $input=array(), $entity=null, $revertonoff=0, $strict=0, $forcereload=0, $marginleftonlyshort=2, $forcenoajax=0, $setzeroinsteadofdel=0, $suffix='', $mode='')
On/off button for constant.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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).
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.