25 require
'../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
29 $langs->loadLangs(array(
'users',
'admin'));
31 $action = (string)
GETPOST(
'action',
'aZ09');
32 $id = (int)
GETPOST(
'id',
'int');
36 if ($user->socid > 0) {
37 $socid = $user->socid;
39 $feature2 = (($socid && $user->rights->user->self->creer) ?
'' :
'user');
41 $result =
restrictedArea($user,
'user', $id,
'user&user', $feature2);
44 $hookmanager->initHooks(array(
'usercard',
'globalcard'));
51 $parameters = array(
'id'=>$socid);
52 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
57 if (empty($reshook)) {
58 if ($action ==
'update' && !
GETPOST(
'cancel',
'alpha')) {
59 $edituser =
new User($db);
60 $edituser->fetch($id);
62 $edituser->clicktodial_url = (string)
GETPOST(
"url",
"alpha");
63 $edituser->clicktodial_login = (string)
GETPOST(
"login",
"alpha");
64 $edituser->clicktodial_password = (string)
GETPOST(
"password",
"alpha");
65 $edituser->clicktodial_poste = (string)
GETPOST(
"poste",
"alpha");
67 $result = $edituser->update_clicktodial();
85 $object =
new User($db);
86 $object->fetch($id,
'',
'', 1);
88 $object->fetch_clicktodial();
93 $title = $langs->trans(
"User");
96 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'" method="post">';
97 print
'<input type="hidden" name="token" value="'.newToken().
'">';
98 print
'<input type="hidden" name="action" value="update">';
104 if ($user->rights->user->user->lire || $user->admin) {
105 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
108 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/user/vcard.php?id='.$object->id.
'" class="refid">';
109 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
110 $morehtmlref .=
'</a>';
112 dol_banner_tab($object,
'id', $linkback, $user->rights->user->user->lire || $user->admin,
'rowid',
'ref', $morehtmlref);
114 print
'<div class="fichecenter">';
115 print
'<div class="underbanner clearboth"></div>';
118 if ($action ==
'edit') {
119 print
'<table class="border centpercent">';
122 print
'<tr><td class="titlefield fieldrequired">ClickToDial URL</td>';
123 print
'<td class="valeur">';
124 print
'<input name="url" value="'.(!empty($object->clicktodial_url) ? $object->clicktodial_url :
'').
'" size="92">';
125 if (empty($conf->global->CLICKTODIAL_URL) && empty($object->clicktodial_url)) {
126 $langs->load(
"errors");
127 print
'<span class="error">'.$langs->trans(
"ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv(
"ClickToDial")).
'</span>';
129 print
' '.$form->textwithpicto($langs->trans(
"KeepEmptyToUseDefault").
': '.$conf->global->CLICKTODIAL_URL, $langs->trans(
"ClickToDialUrlDesc"));
135 print
'<tr><td class="titlefield fieldrequired">ClickToDial '.$langs->trans(
"IdPhoneCaller").
'</td>';
136 print
'<td class="valeur">';
137 print
'<input name="poste" value="'.(!empty($object->clicktodial_poste) ? $object->clicktodial_poste :
'').
'"></td>';
140 print
'<tr><td>ClickToDial '.$langs->trans(
"Login").
'</td>';
141 print
'<td class="valeur">';
142 print
'<input name="login" value="'.(!empty($object->clicktodial_login) ? $object->clicktodial_login :
'').
'"></td>';
145 print
'<tr><td>ClickToDial '.$langs->trans(
"Password").
'</td>';
146 print
'<td class="valeur">';
147 print
'<input type="password" name="password" value="'.dol_escape_htmltag(empty($object->clicktodial_password) ?
'' : $object->clicktodial_password).
'"></td>';
153 print
'<table class="border centpercent tableforfield">';
155 if (!empty($user->admin)) {
156 print
'<tr><td class="titlefield">ClickToDial URL</td>';
157 print
'<td class="valeur">';
158 if (!empty($conf->global->CLICKTODIAL_URL)) {
159 $url = $conf->global->CLICKTODIAL_URL;
161 if (!empty($object->clicktodial_url)) {
162 $url = $object->clicktodial_url;
165 $langs->load(
"errors");
166 print
'<span class="error">'.$langs->trans(
"ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv(
"ClickToDial")).
'</span>';
168 print
$form->textwithpicto((empty($object->clicktodial_url) ?
'<span class="opacitymedium">'.$langs->trans(
"DefaultLink").
':</span> ' :
'').$url, $langs->trans(
"ClickToDialUrlDesc"));
174 print
'<tr><td class="titlefield">ClickToDial '.$langs->trans(
"IdPhoneCaller").
'</td>';
175 print
'<td class="valeur">'.(!empty($object->clicktodial_poste) ? $object->clicktodial_poste :
'').
'</td>';
178 print
'<tr><td>ClickToDial '.$langs->trans(
"Login").
'</td>';
179 print
'<td class="valeur">'.(!empty($object->clicktodial_login) ? $object->clicktodial_login :
'').
'</td>';
182 print
'<tr><td>ClickToDial '.$langs->trans(
"Password").
'</td>';
183 print
'<td class="valeur">'.preg_replace(
'/./',
'*', (!empty($object->clicktodial_password) ? $object->clicktodial_password :
'')).
'</a></td>';
191 if ($action ==
'edit') {
193 print
'<div class="center"><input class="button button-save" type="submit" value="'.$langs->trans(
"Save").
'">';
194 print
' ';
195 print
'<input class="button button-cancel" type="submit" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
205 print
'<div class="tabsAction">';
207 if (!empty($user->admin) && $action <>
'edit') {
208 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&action=edit&token='.
newToken().
'">'.$langs->trans(
"Modify").
'</a>';
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.
Class to manage Dolibarr users.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
user_prepare_head(User $object)
Prepare array with list of tabs.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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.