25 require
'../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
37 $langs->loadLangs(array(
'agenda',
'admin',
'other'));
40 $actiontest =
GETPOST(
'test',
'alpha');
41 $actionsave =
GETPOST(
'save',
'alpha');
42 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'useragenda';
44 if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB = 5;
45 $MAXAGENDA = $conf->global->AGENDA_EXT_NB;
48 $colorlist = array(
'BECEDD',
'DDBECE',
'BFDDBE',
'F598B4',
'F68654',
'CBF654',
'A4A4A5');
52 $object =
new User($db);
53 $object->fetch($id,
'',
'', 1);
58 if ($user->socid > 0) $socid = $user->socid;
59 $feature2 = (($socid && $user->rights->user->self->creer) ?
'' :
'user');
61 $result =
restrictedArea($user,
'user', $id,
'user&user', $feature2);
64 if (($object->id != $user->id) && (!$user->rights->user->user->lire))
68 $hookmanager->initHooks(array(
'usercard',
'useragenda',
'globalcard'));
74 $parameters = array(
'id'=>$socid);
75 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
76 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
78 if (empty($reshook)) {
88 while ($i <= $MAXAGENDA) {
89 $name = trim(
GETPOST(
'AGENDA_EXT_NAME_'.$id.
'_'.$i,
'alpha'));
90 $src = trim(
GETPOST(
'AGENDA_EXT_SRC_'.$id.
'_'.$i,
'alpha'));
91 $offsettz = trim(
GETPOST(
'AGENDA_EXT_OFFSETTZ_'.$id.
'_'.$i,
'alpha'));
92 $color = trim(
GETPOST(
'AGENDA_EXT_COLOR_'.$id.
'_'.$i,
'alpha'));
96 $enabled = trim(
GETPOST(
'AGENDA_EXT_ENABLED_'.$id.
'_'.$i,
'alpha'));
105 $tabparam[
'AGENDA_EXT_NAME_'.$id.
'_'.$i] = $name;
106 $tabparam[
'AGENDA_EXT_SRC_'.$id.
'_'.$i] = $src;
107 $tabparam[
'AGENDA_EXT_OFFSETTZ_'.$id.
'_'.$i] = $offsettz;
108 $tabparam[
'AGENDA_EXT_COLOR_'.$id.
'_'.$i] = $color;
109 $tabparam[
'AGENDA_EXT_ENABLED_'.$id.
'_'.$i] = $enabled;
126 if (empty($errorsaved)) {
137 $form =
new Form($db);
141 $arrayofjs = array();
142 $arrayofcss = array();
144 llxHeader(
'', $langs->trans(
"UserSetup"),
'',
'', 0, 0, $arrayofjs, $arrayofcss);
147 print '<form name="extsitesconfig" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
148 print '<input type="hidden" name="id" value="'.$id.
'">';
149 print '<input type="hidden" name="token" value="'.newToken().
'">';
157 if ($user->rights->user->user->lire || $user->admin) {
158 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
161 dol_banner_tab($object,
'id', $linkback, $user->rights->user->user->lire || $user->admin);
164 print '<div class="underbanner clearboth"></div>';
167 print '<span class="opacitymedium">'.$langs->trans(
"AgendaExtSitesDesc").
"</span><br>\n";
170 $selectedvalue = $conf->global->AGENDA_DISABLE_EXT;
171 if ($selectedvalue == 1) $selectedvalue = 0;
else $selectedvalue = 1;
174 print '<div class="div-table-responsive">';
175 print '<table class="noborder centpercent">';
177 print "<tr class=\"liste_titre\">";
178 print "<td>".$langs->trans(
"Parameter").
"</td>";
179 print "<td>".$langs->trans(
"Name").
"</td>";
180 print "<td>".$langs->trans(
"ExtSiteUrlAgenda").
'<div class="hideonsmartphone">'.
" (".$langs->trans(
"Example").
': http://yoursite/agenda/agenda.ics)</div></td>';
181 print "<td>".$form->textwithpicto($langs->trans(
"FixTZ"), $langs->trans(
"FillFixTZOnlyIfRequired"), 1).
'</td>';
182 print '<td class="right">'.$langs->trans(
"Color").
'</td>';
186 while ($i <= $MAXAGENDA)
189 $name =
'AGENDA_EXT_NAME_'.$id.
'_'.$key;
190 $src =
'AGENDA_EXT_SRC_'.$id.
'_'.$key;
191 $offsettz =
'AGENDA_EXT_OFFSETTZ_'.$id.
'_'.$key;
192 $color =
'AGENDA_EXT_COLOR_'.$id.
'_'.$key;
195 print '<tr class="oddeven">';
197 print '<td class="maxwidth50onsmartphone">'.$langs->trans(
"AgendaExtNb", $key).
"</td>";
199 print '<td class="maxwidth50onsmartphone"><input type="text" class="flat hideifnotset minwidth100" name="AGENDA_EXT_NAME_'.$id.
'_'.$key.
'" value="'.(
GETPOST(
'AGENDA_EXT_NAME_'.$id.
'_'.$key) ?
GETPOST(
'AGENDA_EXT_NAME_'.$id.
'_'.$key) : $object->
conf->$name).
'"></td>';
201 print '<td class="maxwidth50onsmartphone"><input type="url" class="flat hideifnotset" name="AGENDA_EXT_SRC_'.$id.
'_'.$key.
'" value="'.(
GETPOST(
'AGENDA_EXT_SRC_'.$id.
'_'.$key) ?
GETPOST(
'AGENDA_EXT_SRC_'.$id.
'_'.$key) : $object->
conf->$src).
'"></td>';
203 print '<td><input type="text" class="flat hideifnotset" name="AGENDA_EXT_OFFSETTZ_'.$id.
'_'.$key.
'" value="'.(
GETPOST(
'AGENDA_EXT_OFFSETTZ_'.$id.
'_'.$key) ?
GETPOST(
'AGENDA_EXT_OFFSETTZ_'.$id.
'_'.$key) : $object->
conf->$offsettz).
'" size="1"></td>';
205 print '<td class="nowrap right">';
207 print $formother->selectColor((
GETPOST(
"AGENDA_EXT_COLOR_".$id.
'_'.$key) ?
GETPOST(
"AGENDA_EXT_COLOR_".$id.
'_'.$key) : $object->conf->$color),
"AGENDA_EXT_COLOR_".$id.
'_'.$key,
'extsitesconfig', 1,
'',
'hideifnotset');
217 print '<div class="center">';
218 print '<input type="submit" id="save" name="save" class="button hideifnotset button-save" value="'.$langs->trans(
"Save").
'">';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
user_prepare_head($object)
Prepare array with list of tabs.
conf($dolibarr_main_document_root)
Load conf file (file must exists)
Class to manage Dolibarr users.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
dol_is_url($url)
Return if path is an URL.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an 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 ...
dol_set_user_param($db, $conf, &$user, $tab)
Save personnal parameter.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_banner_tab($object, $paramid, $morehtml= '', $shownav=1, $fieldid= 'rowid', $fieldref= 'ref', $morehtmlref= '', $moreparam= '', $nodbprefix=0, $morehtmlleft= '', $morehtmlstatus= '', $onlybanner=0, $morehtmlright= '')
Show tab footer of a card.