27require
'../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
43$langs->loadLangs(array(
"users",
"companies",
"admin",
"website"));
48$action =
GETPOST(
'action',
'aZ09');
49$dol_openinpopup =
GETPOST(
'dol_openinpopup',
'aZ09');
51if (empty($id) && empty($ref)) {
55$expand = $_COOKIE[
'virtualcard_expand'];
58if ($id > 0 || !empty($ref)) {
59 $result =
$object->fetch($id, $ref,
'', 1);
65if ($user->socid > 0) {
66 $socid = $user->socid;
68$feature2 = (($socid && $user->hasRight(
'user',
'self',
'creer')) ?
'' :
'user');
70$result =
restrictedArea($user,
'user', $id,
'user&user', $feature2);
73if ((
$object->id != $user->id) && !$user->hasRight(
'user',
'user',
'lire')) {
77$permissiontoedit = (((
$object->id == $user->id) && $user->hasRight(
'user',
'self',
'creer')) || $user->hasRight(
'user',
'user',
'creer'));
84if ($action ==
'update' && $permissiontoedit) {
86 $tmparray[
'USER_PUBLIC_MORE'] =
GETPOST(
'USER_PUBLIC_MORE',
'alphanohtml');
91if ($action ==
'setUSER_ENABLE_PUBLIC' && $permissiontoedit) {
93 $tmparray = array(
'USER_ENABLE_PUBLIC' => 1);
95 $tmparray = array(
'USER_ENABLE_PUBLIC' => 0);
105$form =
new Form($db);
108$title = $person_name.
" - ".$langs->trans(
'Info');
111llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-virtualcard');
114$title = $langs->trans(
"User");
118print
'<div class="fichecenter">';
122$param =
'&id='.((int)
$object->id);
123if (GETPOSTISSET(
'dol_openinpopup')) {
124 $param .=
'&dol_openinpopup='.urlencode(
GETPOST(
'dol_openinpopup',
'aZ09'));
127$enabledisablehtml = $langs->trans(
"EnablePublicVirtualCard").
' ';
130 $enabledisablehtml .=
'<a class="reposition valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?action=setUSER_ENABLE_PUBLIC&token='.
newToken().
'&value=1'.$param.
'">';
131 $enabledisablehtml .=
img_picto($langs->trans(
"Disabled"),
'switch_off');
132 $enabledisablehtml .=
'</a>';
134 $enabledisablehtml .=
'<br><br><div class="opacitymedium justify">'.$langs->trans(
"UserPublicPageDesc").
'</div>';
137 $enabledisablehtml .=
'<a class="reposition valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?action=setUSER_ENABLE_PUBLIC&token='.
newToken().
'&value=0'.$param.
'">';
138 $enabledisablehtml .=
img_picto($langs->trans(
"Activated"),
'switch_on');
139 $enabledisablehtml .=
'</a>';
141print $enabledisablehtml;
142print
'<input type="hidden" id="USER_ENABLE_PUBLIC" name="USER_ENABLE_PUBLIC" value="'.(getDolUserInt(
'USER_ENABLE_PUBLIC') ? 1 : 0).
'">';
145print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
150 print
'<input type="hidden" name="action" value="update">';
151 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
152 print
'<input type="hidden" name="token" value="'.newToken().
'">';
155 print
img_picto(
'',
'globe').
' <span class="opacitymedium">'.$langs->trans(
'PublicVirtualCardUrl').
'</span><br>';
157 $fullexternaleurltovirtualcard =
$object->getOnlineVirtualCardUrl(
'',
'external');
158 $fullinternalurltovirtualcard =
$object->getOnlineVirtualCardUrl(
'',
'internal');
160 $showUserSocialNetworks = !
getDolUserString(
'USER_PUBLIC_HIDE_SOCIALNETWORKS',
'', $object);
161 $showSocieteSocialNetworks = !
getDolUserString(
'USER_PUBLIC_HIDE_SOCIALNETWORKS_BUSINESS',
'', $object);
163 print
'<div class="urllink">';
164 print
'<input type="text" id="publicurluser" class="quatrevingtpercentminusx" value="'.$fullexternaleurltovirtualcard.
'">';
165 print
'<a target="_blank" rel="noopener noreferrer" href="'.$fullexternaleurltovirtualcard.
'">'.
img_picto(
'',
'globe',
'class="paddingleft marginrightonly paddingright"').$langs->trans(
"GoTo").
'...</a>';
173 print
'<div class="centpercent margintoponly marginbottomonly">';
174 print
img_picto(
'',
'setup',
'class="pictofixedwidth"').
'<a id="lnk" href="#">'.$langs->trans(
"ShowAdvancedOptions").
'...</a>';
177 print
'<script type="text/javascript">
178 jQuery(document).ready(function() {
179 jQuery("#lnk").click(function(event) {
180 event.preventDefault();
181 console.log("We click on link to show virtual card options");
186 function hideoptions(domelem) {
187 const div = document.getElementById("div_container_sub_exportoptions");
189 if (div.style.display === "none") {
190 div.style.display = "block";
191 domelem.innerText="'.dol_escape_js($langs->transnoentitiesnoconv(
"HideAdvancedoptions")).
'";
192 var date = new Date();
193 date.setTime(date.getTime() + (1 * 24 * 60 * 60 * 1000));
194 document.cookie = "virtualcard_expand=1; expires=" + date.toUTCString() + "; path=/";
196 div.style.display = "none";
197 domelem.innerText="'.
dol_escape_js($langs->transnoentitiesnoconv(
"ShowAdvancedOptions")).
'...";
198 var date = new Date();
199 date.setTime(date.getTime() - (1 * 24 * 60 * 60 * 1000));
200 document.cookie = "virtualcard_expand=0; expires=" + date.toUTCString() + "; path=/";
206 print
'<div id="div_container_sub_exportoptions" style="'.($expand ?
'' :
'display: none;').
'">';
208 print
'<div class="div-table-responsive-no-min">';
209 print
'<table class="noborder centpercent">';
211 print
'<tr class="liste_titre">';
212 print
'<td>'.$langs->trans(
"User").
'</td>';
217 print
'<tr class="oddeven" id="tredit"><td>';
218 print $langs->trans(
"HideOnVCard", $langs->transnoentitiesnoconv(
"Photo"));
220 print ajax_constantonoff(
"USER_PUBLIC_HIDE_PHOTO", array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition', $object);
221 print
"</td></tr>\n";
224 print
'<tr class="oddeven" id="tredit"><td>';
225 print $langs->trans(
"HideOnVCard", $langs->transnoentitiesnoconv(
"PostOrFunction"));
227 print ajax_constantonoff(
"USER_PUBLIC_HIDE_JOBPOSITION", array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition', $object);
228 print
"</td></tr>\n";
231 print
'<tr class="oddeven" id="tredit"><td>';
232 print $langs->trans(
"HideOnVCard", $langs->transnoentitiesnoconv(
"Email"));
234 print ajax_constantonoff(
"USER_PUBLIC_HIDE_EMAIL", array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition', $object);
235 print
"</td></tr>\n";
238 print
'<tr class="oddeven" id="tredit"><td>';
239 print $langs->trans(
"HideOnVCard", $langs->transnoentitiesnoconv(
"PhonePro"));
241 print ajax_constantonoff(
"USER_PUBLIC_HIDE_OFFICE_PHONE", array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition', $object);
242 print
"</td></tr>\n";
245 print
'<tr class="oddeven" id="tredit"><td>';
246 print $langs->trans(
"HideOnVCard", $langs->transnoentitiesnoconv(
"Fax"));
248 print ajax_constantonoff(
"USER_PUBLIC_HIDE_OFFICE_FAX", array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition', $object);
249 print
"</td></tr>\n";
252 print
'<tr class="oddeven" id="tredit"><td>';
253 print $langs->trans(
"HideOnVCard", $langs->transnoentitiesnoconv(
"PhoneMobile"));
255 print ajax_constantonoff(
"USER_PUBLIC_HIDE_USER_MOBILE", array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition', $object);
256 print
"</td></tr>\n";
259 print
'<tr class="oddeven" id="tredit"><td>';
260 print $langs->trans(
"HideOnVCard", $langs->transnoentitiesnoconv(
"SocialNetworksInformation"));
262 print ajax_constantonoff(
"USER_PUBLIC_HIDE_SOCIALNETWORKS", array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition', $object);
263 print
"</td></tr>\n";
266 if ($showUserSocialNetworks) {
267 $socialnetworks =
$object->socialnetworks;
268 if (!empty($socialnetworks)) {
269 foreach ($socialnetworks as $key => $networkVal) {
270 print
'<tr class="oddeven">';
271 print
'<td> '.$langs->trans(
"Hide").
' '.
dol_escape_htmltag($key).
'</td><td>';
272 print ajax_constantonoff(
'USER_PUBLIC_HIDE_SOCIALNETWORKS_'.strtoupper($key), array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition', $object);
280 print
'<tr class="oddeven" id="tredit"><td>';
281 print $langs->trans(
"ShowOnVCard", $langs->transnoentitiesnoconv(
"Birthdate"));
283 print ajax_constantonoff(
"USER_PUBLIC_SHOW_BIRTH", array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition', $object);
284 print
"</td></tr>\n";
287 print
'<tr class="oddeven" id="tredit"><td>';
288 print $langs->trans(
"ShowOnVCard", $langs->transnoentitiesnoconv(
"Address"));
290 print ajax_constantonoff(
"USER_PUBLIC_SHOW_ADDRESS", array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition', $object);
291 print
"</td></tr>\n";
293 print
'<tr class="liste_titre">';
294 print
'<td>'.$langs->trans(
"Company").
'</td>';
299 print
'<tr class="oddeven" id="tramount"><td>';
300 print $langs->trans(
"HideOnVCard", $langs->transnoentitiesnoconv(
"CompanySection"));
302 print ajax_constantonoff(
"USER_PUBLIC_HIDE_COMPANY", array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition', $object);
303 print
"</td></tr>\n";
307 print
'<tr class="oddeven" id="tredit"><td>';
308 print $langs->trans(
"HideOnVCard", $langs->transnoentitiesnoconv(
"Email"));
310 print ajax_constantonoff(
"SOCIETE_PUBLIC_HIDE_EMAIL", array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition', $object);
311 print
"</td></tr>\n";
314 print
'<tr class="oddeven" id="tredit"><td>';
315 print $langs->trans(
"HideOnVCard", $langs->transnoentitiesnoconv(
"URL"));
317 print ajax_constantonoff(
"SOCIETE_PUBLIC_HIDE_URL", array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition', $object);
318 print
"</td></tr>\n";
321 print
'<tr class="oddeven" id="tredit"><td>';
322 print $langs->trans(
"HideOnVCard", $langs->transnoentitiesnoconv(
"Phone"));
324 print ajax_constantonoff(
"SOCIETE_PUBLIC_HIDE_OFFICE_PHONE", array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition', $object);
325 print
"</td></tr>\n";
328 print
'<tr class="oddeven" id="tredit"><td>';
329 print $langs->trans(
"HideOnVCard", $langs->transnoentitiesnoconv(
"Fax"));
331 print ajax_constantonoff(
"SOCIETE_PUBLIC_HIDE_OFFICE_FAX", array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition', $object);
332 print
"</td></tr>\n";
335 print
'<tr class="oddeven" id="tredit"><td>';
336 print $langs->trans(
"HideOnVCard", $langs->transnoentitiesnoconv(
"SocialNetworksInformation"));
338 print ajax_constantonoff(
"USER_PUBLIC_HIDE_SOCIALNETWORKS_BUSINESS", array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition', $object);
339 print
"</td></tr>\n";
342 if ($showSocieteSocialNetworks) {
343 $listofnetworks = $mysoc->socialnetworks;
345 if (!empty($listofnetworks)) {
346 foreach ($listofnetworks as $key => $networkVal) {
347 print
'<tr class="oddeven">';
348 print
'<td> '.$langs->trans(
"Hide").
' '.
dol_escape_htmltag($key).
'</td><td>';
349 print ajax_constantonoff(
'SOCIETE_PUBLIC_HIDE_SOCIALNETWORKS_'.strtoupper($key), array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition', $object);
357 print
'<tr class="liste_titre">';
358 print
'<td>'.$langs->trans(
"Other").
'</td>';
363 print
'<tr class="oddeven" id="tredit"><td>';
364 print $langs->trans(
"Text");
366 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
368 $doleditor =
new DolEditor(
'USER_PUBLIC_MORE',
getDolUserString(
'USER_PUBLIC_MORE',
'', $object),
'', 160,
'dolibarr_notes',
'',
false,
false, $extendededitor, ROWS_5,
'90%');
369 $doleditor->Create();
370 print
"</td></tr>\n";
375 print
'<div class="center">';
376 print $form->buttonsSaveCancel(
"Save",
'', array(), 0,
'', $dol_openinpopup);
386 print
'<div class="center">';
387 print
'<span class="opacitymedium">'.$langs->trans(
"Preview").
'</span><br>';
388 print
'<div class="virtualcard-div">';
389 print
'<a target="_blank" rel="noopener noreferrer cursorpointer" href="'.$fullexternaleurltovirtualcard.
'">'.
"\n";
390 print
'<iframe id="virtualcard-iframe" title="" class="center" src="'.$fullinternalurltovirtualcard.
'&mode=preview">';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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.
Class to manage a WYSIWYG editor.
Class to manage Dolibarr users.
dol_set_user_param($db, $conf, &$user, $tab)
Save personal parameter.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolUserInt($key, $default=0, $tmpuser=null)
Return Dolibarr user constant int value.
getDolUserString($key, $default='', $tmpuser=null)
Return Dolibarr user constant string value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
ajax_autoselect($htmlname, $addlink='', $textonlink='Link')
Make content of an input box selected when we click into input field.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
restrictedArea(User $user, $features, $object=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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.