26require
'../main.inc.php';
27require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
33$langs->loadLangs(array(
"users",
"companies",
"admin",
"website"));
38$action =
GETPOST(
'action',
'aZ09');
39$dol_openinpopup =
GETPOST(
'dol_openinpopup',
'aZ09');
41if (empty($id) && empty($ref)) {
45$expand = $_COOKIE[
'virtualcard_expand'];
48if ($id > 0 || !empty($ref)) {
49 $result =
$object->fetch($id, $ref,
'', 1);
55if ($user->socid > 0) {
56 $socid = $user->socid;
58$feature2 = (($socid && $user->hasRight(
'user',
'self',
'creer')) ?
'' :
'user');
60$result =
restrictedArea($user,
'user', $id,
'user&user', $feature2);
63if ((
$object->id != $user->id) && !$user->hasRight(
'user',
'user',
'lire')) {
67$permissiontoedit = (((
$object->id == $user->id) && $user->hasRight(
'user',
'self',
'creer')) || $user->hasRight(
'user',
'user',
'creer'));
74if ($action ==
'update' && $permissiontoedit) {
76 $tmparray[
'USER_PUBLIC_MORE'] =
GETPOST(
'USER_PUBLIC_MORE',
'alphanohtml');
78 dol_set_user_param($db, $conf, $object, array(
'USER_PUBLIC_MORE' => $tmparray[
'USER_PUBLIC_MORE']));
81if ($action ==
'setUSER_ENABLE_PUBLIC' && $permissiontoedit) {
83 $tmparray = array(
'USER_ENABLE_PUBLIC' => 1);
85 $tmparray = array(
'USER_ENABLE_PUBLIC' => 0);
98$title = $person_name.
" - ".$langs->trans(
'Info');
101llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-virtualcard');
104$title = $langs->trans(
"User");
108print
'<div class="fichecenter">';
112$param =
'&id='.((int)
$object->id);
113if (GETPOSTISSET(
'dol_openinpopup')) {
114 $param .=
'&dol_openinpopup='.urlencode(
GETPOST(
'dol_openinpopup',
'aZ09'));
117$enabledisablehtml = $langs->trans(
"EnablePublicVirtualCard").
' ';
120 $enabledisablehtml .=
'<a class="reposition valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?action=setUSER_ENABLE_PUBLIC&token='.
newToken().
'&value=1'.$param.
'">';
121 $enabledisablehtml .=
img_picto($langs->trans(
"Disabled"),
'switch_off');
122 $enabledisablehtml .=
'</a>';
124 $enabledisablehtml .=
'<br><br><span class="opacitymedium">'.$langs->trans(
"UserPublicPageDesc").
'</span><br><br>';
127 $enabledisablehtml .=
'<a class="reposition valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?action=setUSER_ENABLE_PUBLIC&token='.
newToken().
'&value=0'.$param.
'">';
128 $enabledisablehtml .=
img_picto($langs->trans(
"Activated"),
'switch_on');
129 $enabledisablehtml .=
'</a>';
131print $enabledisablehtml;
132print
'<input type="hidden" id="USER_ENABLE_PUBLIC" name="USER_ENABLE_PUBLIC" value="'.(getDolGlobalString(
'USER_ENABLE_PUBLIC') ? 1 : 0).
'">';
136print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">';
139 print
'<input type="hidden" name="action" value="update">';
140 print
'<input type="hidden" name="id" value="'.$object->id.
'">';
141 print
'<input type="hidden" name="token" value="'.newToken().
'">';
144 print
img_picto(
'',
'globe').
' <span class="opacitymedium">'.$langs->trans(
'PublicVirtualCardUrl').
'</span><br>';
146 $fullexternaleurltovirtualcard =
$object->getOnlineVirtualCardUrl(
'',
'external');
147 $fullinternalurltovirtualcard =
$object->getOnlineVirtualCardUrl(
'',
'internal');
149 $showUserSocialNetworks = !
getDolUserString(
'USER_PUBLIC_HIDE_SOCIALNETWORKS',
'', $object);
150 $showSocieteSocialNetworks = !
getDolUserString(
'USER_PUBLIC_HIDE_SOCIALNETWORKS_BUSINESS',
'', $object);
152 print
'<div class="urllink">';
153 print
'<input type="text" id="publicurluser" class="quatrevingtpercentminusx" value="'.$fullexternaleurltovirtualcard.
'">';
154 print
'<a target="_blank" rel="noopener noreferrer" href="'.$fullexternaleurltovirtualcard.
'">'.
img_picto(
'',
'globe',
'class="paddingleft marginrightonly paddingright"').$langs->trans(
"GoTo").
'...</a>';
162 print
'<div class="centpercent margintoponly marginbottomonly">';
163 print
img_picto(
'',
'setup',
'class="pictofixedwidth"').
'<a id="lnk" href="#">'.$langs->trans(
"ShowAdvancedOptions").
'...</a>';
166 print
'<script type="text/javascript">
167 jQuery(document).ready(function() {
168 jQuery("#lnk").click(function(event) {
169 event.preventDefault();
170 console.log("We click on link to show virtual card options");
175 function hideoptions(domelem) {
176 const div = document.getElementById("div_container_sub_exportoptions");
178 if (div.style.display === "none") {
179 div.style.display = "block";
180 domelem.innerText="'.dol_escape_js($langs->transnoentitiesnoconv(
"HideAdvancedoptions")).
'";
181 var date = new Date();
182 date.setTime(date.getTime() + (1 * 24 * 60 * 60 * 1000));
183 document.cookie = "virtualcard_expand=1; expires=" + date.toUTCString() + "; path=/";
185 div.style.display = "none";
186 domelem.innerText="'.
dol_escape_js($langs->transnoentitiesnoconv(
"ShowAdvancedOptions")).
'...";
187 var date = new Date();
188 date.setTime(date.getTime() - (1 * 24 * 60 * 60 * 1000));
189 document.cookie = "virtualcard_expand=0; expires=" + date.toUTCString() + "; path=/";
195 print
'<div id="div_container_sub_exportoptions" style="'.($expand ?
'' :
'display: none;').
'">';
197 print
'<div class="div-table-responsive-no-min">';
198 print
'<table class="noborder centpercent">';
200 print
'<tr class="liste_titre">';
201 print
'<td>'.$langs->trans(
"User").
'</td>';
206 print
'<tr class="oddeven" id="tredit"><td>';
207 print $langs->trans(
"HideOnVCard", $langs->transnoentitiesnoconv(
"Photo"));
209 print ajax_constantonoff(
"USER_PUBLIC_HIDE_PHOTO", array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition',
$object->id);
210 print
"</td></tr>\n";
213 print
'<tr class="oddeven" id="tredit"><td>';
214 print $langs->trans(
"HideOnVCard", $langs->transnoentitiesnoconv(
"PostOrFunction"));
216 print ajax_constantonoff(
"USER_PUBLIC_HIDE_JOBPOSITION", array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition',
$object->id);
217 print
"</td></tr>\n";
220 print
'<tr class="oddeven" id="tredit"><td>';
221 print $langs->trans(
"HideOnVCard", $langs->transnoentitiesnoconv(
"Email"));
223 print ajax_constantonoff(
"USER_PUBLIC_HIDE_EMAIL", array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition',
$object->id);
224 print
"</td></tr>\n";
227 print
'<tr class="oddeven" id="tredit"><td>';
228 print $langs->trans(
"HideOnVCard", $langs->transnoentitiesnoconv(
"PhonePro"));
230 print ajax_constantonoff(
"USER_PUBLIC_HIDE_OFFICE_PHONE", array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition',
$object->id);
231 print
"</td></tr>\n";
234 print
'<tr class="oddeven" id="tredit"><td>';
235 print $langs->trans(
"HideOnVCard", $langs->transnoentitiesnoconv(
"Fax"));
237 print ajax_constantonoff(
"USER_PUBLIC_HIDE_OFFICE_FAX", array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition',
$object->id);
238 print
"</td></tr>\n";
241 print
'<tr class="oddeven" id="tredit"><td>';
242 print $langs->trans(
"HideOnVCard", $langs->transnoentitiesnoconv(
"PhoneMobile"));
244 print ajax_constantonoff(
"USER_PUBLIC_HIDE_USER_MOBILE", array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition',
$object->id);
245 print
"</td></tr>\n";
248 print
'<tr class="oddeven" id="tredit"><td>';
249 print $langs->trans(
"HideOnVCard", $langs->transnoentitiesnoconv(
"SocialNetworksInformation"));
251 print ajax_constantonoff(
"USER_PUBLIC_HIDE_SOCIALNETWORKS", array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition',
$object->id);
252 print
"</td></tr>\n";
255 if ($showUserSocialNetworks) {
256 $socialnetworks =
$object->socialnetworks;
258 if (!empty($socialnetworks)) {
259 foreach ($socialnetworks as $key => $networkVal) {
260 print
'<tr class="oddeven">';
261 print
'<td> '.$langs->trans(
"Hide").
' '.
dol_escape_htmltag($key).
'</td><td>';
262 print ajax_constantonoff(
'USER_SOCIALNETWORK_'.strtoupper($key), array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition',
$object->id);
270 print
'<tr class="oddeven" id="tredit"><td>';
271 print $langs->trans(
"ShowOnVCard", $langs->transnoentitiesnoconv(
"Birthdate"));
273 print ajax_constantonoff(
"USER_PUBLIC_SHOW_BIRTH", array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition',
$object->id);
274 print
"</td></tr>\n";
277 print
'<tr class="oddeven" id="tredit"><td>';
278 print $langs->trans(
"ShowOnVCard", $langs->transnoentitiesnoconv(
"Address"));
280 print ajax_constantonoff(
"USER_PUBLIC_SHOW_ADDRESS", array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition',
$object->id);
281 print
"</td></tr>\n";
283 print
'<tr class="liste_titre">';
284 print
'<td>'.$langs->trans(
"Company").
'</td>';
289 print
'<tr class="oddeven" id="tramount"><td>';
290 print $langs->trans(
"HideOnVCard", $langs->transnoentitiesnoconv(
"CompanySection"));
292 print ajax_constantonoff(
"USER_PUBLIC_HIDE_COMPANY", array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition',
$object->id);
293 print
"</td></tr>\n";
297 print
'<tr class="oddeven" id="tredit"><td>';
298 print $langs->trans(
"HideOnVCard", $langs->transnoentitiesnoconv(
"SocialNetworksInformation"));
300 print ajax_constantonoff(
"USER_PUBLIC_HIDE_SOCIALNETWORKS_BUSINESS", array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition',
$object->id);
301 print
"</td></tr>\n";
304 if ($showSocieteSocialNetworks) {
305 $listofnetworks = $mysoc->socialnetworks;
307 if (!empty($listofnetworks)) {
308 foreach ($listofnetworks as $key => $networkVal) {
309 print
'<tr class="oddeven">';
310 print
'<td> '.$langs->trans(
"Hide").
' '.
dol_escape_htmltag($key).
'</td><td>';
311 print ajax_constantonoff(
'SOCIETE_PUBLIC_SOCIALNETWORKS_'.strtoupper($key), array(),
null, 0, 0, 1, 2, 0, 0,
'',
'',
'reposition',
$object->id);
319 print
'<tr class="liste_titre">';
320 print
'<td>'.$langs->trans(
"Other").
'</td>';
325 print
'<tr class="oddeven" id="tredit"><td>';
326 print $langs->trans(
"Text");
328 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
330 $doleditor =
new DolEditor(
'USER_PUBLIC_MORE',
getDolUserString(
'USER_PUBLIC_MORE',
'', $object),
'', 160,
'dolibarr_notes',
'',
false,
false, $extendededitor, ROWS_5,
'90%');
331 $doleditor->Create();
332 print
"</td></tr>\n";
337 print
'<div class="center">';
338 print $form->buttonsSaveCancel(
"Save",
'', array(), 0,
'', $dol_openinpopup);
348 print
'<div class="center">';
349 print
'<span class="opacitymedium">'.$langs->trans(
"Preview").
'</span><br>';
350 print
'<div class="virtualcard-div">';
351 print
'<a target="_blank" rel="noopener noreferrer cursorpointer" href="'.$fullexternaleurltovirtualcard.
'">'.
"\n";
352 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...
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.