param_ihm.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. <?php
  2. /* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2010-2015 Regis Houssin <regis.houssin@inodbox.com>
  4. * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro.com>
  5. * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  19. */
  20. /**
  21. * \file htdocs/user/param_ihm.php
  22. * \brief Page to show user setup for display
  23. */
  24. // Load Dolibarr environment
  25. require '../main.inc.php';
  26. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  27. require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
  29. // Load translation files required by page
  30. $langs->loadLangs(array('companies', 'products', 'admin', 'users', 'languages', 'projects', 'members'));
  31. // Defini si peux lire/modifier permisssions
  32. $canreaduser = ($user->admin || $user->hasRight("user", "user", "read"));
  33. $id = GETPOST('id', 'int');
  34. $action = GETPOST('action', 'aZ09');
  35. $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'userihm'; // To manage different context of search
  36. if (!isset($id) || empty($id)) {
  37. accessforbidden();
  38. }
  39. if ($id) {
  40. // $user est le user qui edite, $id est l'id de l'utilisateur edite
  41. $caneditfield = ((($user->id == $id) && $user->hasRight("user", "self", "write"))
  42. || (($user->id != $id) && $user->hasRight("user", "user", "write")));
  43. }
  44. // Security check
  45. $socid = 0;
  46. if ($user->socid > 0) {
  47. $socid = $user->socid;
  48. }
  49. $feature2 = (($socid && $user->hasRight("user", "self", "write")) ? '' : 'user');
  50. $result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
  51. if ($user->id != $id && !$canreaduser) {
  52. accessforbidden();
  53. }
  54. $dirtop = "../core/menus/standard";
  55. $dirleft = "../core/menus/standard";
  56. // Charge utilisateur edite
  57. $object = new User($db);
  58. $object->fetch($id, '', '', 1);
  59. $object->getrights();
  60. // Liste des zone de recherche permanentes supportees
  61. /* deprecated
  62. $searchform=array("main_searchform_societe","main_searchform_contact","main_searchform_produitservice");
  63. $searchformconst=array($conf->global->MAIN_SEARCHFORM_SOCIETE,$conf->global->MAIN_SEARCHFORM_CONTACT,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE);
  64. $searchformtitle=array($langs->trans("Companies"),$langs->trans("Contacts"),$langs->trans("ProductsAndServices"));
  65. */
  66. $form = new Form($db);
  67. $formadmin = new FormAdmin($db);
  68. // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
  69. $hookmanager->initHooks(array('usercard', 'userihm', 'globalcard'));
  70. /*
  71. * Actions
  72. */
  73. $parameters = array('id'=>$socid);
  74. $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
  75. if ($reshook < 0) {
  76. setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  77. }
  78. if (empty($reshook)) {
  79. if ($action == 'update' && ($caneditfield || !empty($user->admin))) {
  80. if (!GETPOST("cancel")) {
  81. $tabparam = array();
  82. if (GETPOST("check_MAIN_LANDING_PAGE") == "on") {
  83. $tabparam["MAIN_LANDING_PAGE"] = GETPOST("MAIN_LANDING_PAGE", 'alphanohtml');
  84. } else {
  85. $tabparam["MAIN_LANDING_PAGE"] = '';
  86. }
  87. if (GETPOST("check_MAIN_LANG_DEFAULT") == "on") {
  88. $tabparam["MAIN_LANG_DEFAULT"] = GETPOST("main_lang_default", 'aZ09');
  89. } else {
  90. $tabparam["MAIN_LANG_DEFAULT"] = '';
  91. }
  92. if (GETPOST("check_SIZE_LISTE_LIMIT") == "on") {
  93. $tabparam["MAIN_SIZE_LISTE_LIMIT"] = GETPOST("MAIN_SIZE_LISTE_LIMIT", 'int');
  94. } else {
  95. $tabparam["MAIN_SIZE_LISTE_LIMIT"] = '';
  96. }
  97. if (GETPOST("check_AGENDA_DEFAULT_VIEW") == "on") {
  98. $tabparam["AGENDA_DEFAULT_VIEW"] = GETPOST("AGENDA_DEFAULT_VIEW", 'aZ09');
  99. } else {
  100. $tabparam["AGENDA_DEFAULT_VIEW"] = '';
  101. }
  102. if (GETPOST("check_MAIN_THEME") == "on") {
  103. $tabparam["MAIN_THEME"] = GETPOST('main_theme', 'aZ09');
  104. } else {
  105. $tabparam["MAIN_THEME"] = '';
  106. }
  107. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1', 'alphanohtml'), array()))));
  108. if ($val == '') {
  109. $tabparam['THEME_ELDY_TOPMENU_BACK1'] = '';
  110. } else {
  111. $tabparam['THEME_ELDY_TOPMENU_BACK1'] = join(
  112. ',',
  113. colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1', 'alphanohtml'), array())
  114. );
  115. }
  116. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1', 'alphanohtml'), array()))));
  117. if ($val == '') {
  118. $tabparam['THEME_ELDY_BACKTITLE1'] = '';
  119. } else {
  120. $tabparam['THEME_ELDY_BACKTITLE1'] = join(
  121. ',',
  122. colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1', 'alphanohtml'), array())
  123. );
  124. }
  125. if (GETPOST('check_THEME_ELDY_USE_HOVER') == 'on') {
  126. $tabparam["THEME_ELDY_USE_HOVER"] = 1;
  127. } else {
  128. $tabparam["THEME_ELDY_USE_HOVER"] = 0;
  129. }
  130. if (GETPOST('check_THEME_ELDY_USE_CHECKED') == 'on') {
  131. $tabparam["THEME_ELDY_USE_CHECKED"] = 1;
  132. } else {
  133. $tabparam["THEME_ELDY_USE_CHECKED"] = 0;
  134. }
  135. if (GETPOST('MAIN_OPTIMIZEFORTEXTBROWSER')) {
  136. $tabparam["MAIN_OPTIMIZEFORTEXTBROWSER"] = 1;
  137. } else {
  138. $tabparam["MAIN_OPTIMIZEFORTEXTBROWSER"] = 0;
  139. }
  140. if (GETPOST('MAIN_OPTIMIZEFORCOLORBLIND')) {
  141. $tabparam["MAIN_OPTIMIZEFORCOLORBLIND"] = GETPOST('MAIN_OPTIMIZEFORCOLORBLIND', 'aZ09');
  142. } else {
  143. $tabparam["MAIN_OPTIMIZEFORCOLORBLIND"] = 0;
  144. }
  145. $result = dol_set_user_param($db, $conf, $object, $tabparam);
  146. header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
  147. exit;
  148. }
  149. }
  150. }
  151. /*
  152. * View
  153. */
  154. $person_name = !empty($object->firstname) ? $object->lastname.", ".$object->firstname : $object->lastname;
  155. $title = $person_name." - ".$langs->trans('Card');
  156. $help_url = '';
  157. llxHeader('', $title, $help_url);
  158. // List of possible landing pages
  159. $tmparray = array();
  160. $tmparray['index.php'] = array('label'=>'Dashboard', 'picto'=>'graph');
  161. if (isModEnabled("societe")) {
  162. $tmparray['societe/index.php?mainmenu=companies&leftmenu='] = array('label'=>'ThirdPartiesArea', 'picto'=>'company');
  163. }
  164. if (isModEnabled('project')) {
  165. $tmparray['projet/index.php?mainmenu=project&leftmenu='] = array('label'=>'ProjectsArea', 'picto'=>'project');
  166. if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) {
  167. $tmparray['projet/list.php?mainmenu=project&leftmenu=&search_usage_opportunity=1&search_status=99&search_opp_status=openedopp&contextpage=lead'] = array('label'=>'ListOpenLeads', 'picto'=>'project');
  168. }
  169. }
  170. if (isModEnabled('holiday') || isModEnabled('expensereport')) {
  171. $tmparray['hrm/index.php?mainmenu=hrm&leftmenu='] = array('label'=>'HRMArea', 'picto'=>'user'); // TODO Complete list with first level of menus
  172. }
  173. if (isModEnabled("product") || isModEnabled("service")) {
  174. $tmparray['product/index.php?mainmenu=products&leftmenu='] = array('label'=>'ProductsAndServicesArea', 'picto'=>'product');
  175. }
  176. if (isModEnabled("propal") || isModEnabled('commande') || isModEnabled('ficheinter') || isModEnabled('contrat')) {
  177. $tmparray['comm/index.php?mainmenu=commercial&leftmenu='] = array('label'=>'CommercialArea', 'picto'=>'commercial');
  178. }
  179. if (isModEnabled('facture')) {
  180. $tmparray['compta/index.php?mainmenu=billing&leftmenu='] = array('label'=>'InvoicesArea', 'picto'=>'bill');
  181. }
  182. if (isModEnabled('comptabilite') || isModEnabled('accounting')) {
  183. $tmparray['compta/index.php?mainmenu=accountancy&leftmenu='] = array('label'=>'AccountancyTreasuryArea', 'picto'=>'bill');
  184. }
  185. if (isModEnabled('adherent')) {
  186. $tmparray['adherents/index.php?mainmenu=members&leftmenu='] = array('label'=>'MembersArea', 'picto'=>'member');
  187. }
  188. if (isModEnabled('agenda')) {
  189. $tmparray['comm/action/index.php?mainmenu=agenda&leftmenu='] = array('label'=>'Agenda', 'picto'=>'action');
  190. }
  191. if (isModEnabled('ticket')) {
  192. $tmparray['ticket/list.php?mainmenu=ticket&leftmenu='] = array('label'=>'Tickets', 'picto'=>'ticket');
  193. }
  194. // add bookmarks to available landing pages
  195. if (!getDolGlobalString('MAIN_NO_BOOKMARKS_FOR_LANDING_PAGES')) {
  196. $sql = "SELECT b.rowid, b.fk_user, b.url, b.title";
  197. $sql .= " FROM ".MAIN_DB_PREFIX."bookmark as b";
  198. $sql .= " WHERE b.entity IN (".getEntity('bookmark').")";
  199. $sql .= " AND b.url NOT LIKE 'http%'";
  200. if (!$object->admin) {
  201. $sql .= " AND (b.fk_user = ".((int) $object->id)." OR b.fk_user is NULL OR b.fk_user = 0)";
  202. }
  203. $resql = $db->query($sql);
  204. if ($resql) {
  205. $i = 0;
  206. $num_rows = $db->num_rows($resql);
  207. if ($num_rows > 0) {
  208. $tmparray['sep'.$i] = array('data-html'=>'<span class="opacitymedium">--- '.$langs->trans("Bookmarks").'</span>', 'label'=>'--- '.$langs->trans("Bookmarks"));
  209. while ($i < $num_rows) {
  210. $obj = $db->fetch_object($resql);
  211. $landing_url = str_replace(DOL_URL_ROOT, '', $obj->url);
  212. $tmparray[$landing_url] = array('label'=>$obj->title, 'picto'=>'generic');
  213. $i++;
  214. }
  215. }
  216. }
  217. }
  218. // Hook for insertion new items in the List of possible landing pages
  219. $reshook = $hookmanager->executeHooks('addToLandingPageList', $tmparray, $object);
  220. if ($reshook < 0) {
  221. setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  222. } elseif ($reshook > 0) {
  223. $tmparray = $hookmanager->resArray;
  224. } elseif ($reshook == 0) {
  225. $tmparray = array_merge($tmparray, $hookmanager->resArray);
  226. }
  227. foreach ($tmparray as $key => $val) {
  228. $tmparray[$key]['data-html'] = img_picto($langs->trans($val['label']), empty($val['picto']) ? 'generic' : $val['picto'], 'class="pictofixedwidth"').$langs->trans($val['label']);
  229. $tmparray[$key]['label'] = $langs->trans($val['label']);
  230. }
  231. $head = user_prepare_head($object);
  232. $title = $langs->trans("User");
  233. if ($action == 'edit') {
  234. print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
  235. print '<input type="hidden" name="token" value="'.newToken().'">';
  236. print '<input type="hidden" name="action" value="update">';
  237. print '<input type="hidden" name="id" value="'.$id.'">';
  238. }
  239. if ($action == 'edit') {
  240. print dol_get_fiche_head($head, 'guisetup', $title, -1, 'user');
  241. $linkback = '';
  242. if ($user->hasRight("user", "user", "read") || $user->admin) {
  243. $linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  244. }
  245. dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin);
  246. print '<div class="underbanner clearboth"></div>';
  247. print dol_get_fiche_end();
  248. if (!empty($conf->use_javascript_ajax)) {
  249. print '<script type="text/javascript">
  250. jQuery(document).ready(function() {
  251. function init_myfunc()
  252. {
  253. if (jQuery("#check_MAIN_LANDING_PAGE").prop("checked")) { jQuery("#MAIN_LANDING_PAGE").removeAttr(\'disabled\'); }
  254. else { jQuery("#MAIN_LANDING_PAGE").attr(\'disabled\',\'disabled\'); }
  255. if (jQuery("#check_MAIN_LANG_DEFAULT").prop("checked")) { jQuery("#main_lang_default").removeAttr(\'disabled\'); }
  256. else { jQuery("#main_lang_default").attr(\'disabled\',\'disabled\'); }
  257. if (jQuery("#check_SIZE_LISTE_LIMIT").prop("checked")) { jQuery("#MAIN_SIZE_LISTE_LIMIT").removeAttr(\'disabled\'); }
  258. else { jQuery("#MAIN_SIZE_LISTE_LIMIT").attr(\'disabled\',\'disabled\'); }
  259. if (jQuery("#check_AGENDA_DEFAULT_VIEW").prop("checked")) { jQuery("#AGENDA_DEFAULT_VIEW").removeAttr(\'disabled\'); }
  260. else { jQuery("#AGENDA_DEFAULT_VIEW").attr(\'disabled\',\'disabled\'); }
  261. if (jQuery("#check_MAIN_THEME").prop("checked")) { jQuery(".themethumbs").removeAttr(\'disabled\'); }
  262. else { jQuery(".themethumbs").attr(\'disabled\',\'disabled\'); }
  263. if (jQuery("#check_THEME_ELDY_TOPMENU_BACK1").prop("checked")) { jQuery("#colorpickerTHEME_ELDY_TOPMENU_BACK1").removeAttr(\'disabled\'); }
  264. else { jQuery("#colorpickerTHEME_ELDY_TOPMENU_BACK1").attr(\'disabled\',\'disabled\'); }
  265. }
  266. init_myfunc();
  267. jQuery("#check_MAIN_LANDING_PAGE").click(function() { init_myfunc(); });
  268. jQuery("#check_MAIN_LANG_DEFAULT").click(function() { init_myfunc(); });
  269. jQuery("#check_SIZE_LISTE_LIMIT").click(function() { init_myfunc(); });
  270. jQuery("#check_AGENDA_DEFAULT_VIEW").click(function() { init_myfunc(); });
  271. jQuery("#check_MAIN_THEME").click(function() { init_myfunc(); });
  272. jQuery("#check_THEME_ELDY_TOPMENU_BACK1").click(function() { init_myfunc(); });
  273. jQuery("#check_THEME_ELDY_BACKTITLE1").click(function() { init_myfunc(); });
  274. });
  275. </script>';
  276. }
  277. clearstatcache();
  278. print '<table class="noborder centpercent">';
  279. print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("DefaultValue").'</td><td>&nbsp;</td><td>'.$langs->trans("PersonalValue").'</td></tr>';
  280. // Language by default
  281. print '<tr class="oddeven"><td class="titlefieldmiddle">'.$langs->trans("Language").'</td>';
  282. print '<td>';
  283. $s = picto_from_langcode($conf->global->MAIN_LANG_DEFAULT);
  284. print $s ? $s.' ' : '';
  285. print(getDolGlobalString('MAIN_LANG_DEFAULT') == 'auto' ? $langs->trans("AutoDetectLang") : $langs->trans("Language_" . getDolGlobalString('MAIN_LANG_DEFAULT')));
  286. print '</td>';
  287. print '<td class="nowrap" width="20%"><input class="oddeven" name="check_MAIN_LANG_DEFAULT" id="check_MAIN_LANG_DEFAULT" type="checkbox" '.(!empty($object->conf->MAIN_LANG_DEFAULT) ? " checked" : "");
  288. print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
  289. print '> <label for="check_MAIN_LANG_DEFAULT">'.$langs->trans("UsePersonalValue").'</label></td>';
  290. print '<td>';
  291. print $formadmin->select_language((!empty($object->conf->MAIN_LANG_DEFAULT) ? $object->conf->MAIN_LANG_DEFAULT : ''), 'main_lang_default', 1, null, 0, 0, (!empty($dolibarr_main_demo)));
  292. print '</td></tr>';
  293. // Landing page
  294. print '<tr class="oddeven"><td>'.$langs->trans("LandingPage").'</td>';
  295. print '<td>';
  296. print(!getDolGlobalString('MAIN_LANDING_PAGE') ? '' : $conf->global->MAIN_LANDING_PAGE);
  297. print '</td>';
  298. print '<td class="nowrap" width="20%"><input class="oddeven" name="check_MAIN_LANDING_PAGE" id="check_MAIN_LANDING_PAGE" type="checkbox" '.(!empty($object->conf->MAIN_LANDING_PAGE) ? " checked" : "");
  299. print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
  300. print '> <label for="check_MAIN_LANDING_PAGE">'.$langs->trans("UsePersonalValue").'</label></td>';
  301. print '<td>';
  302. print $form->selectarray('MAIN_LANDING_PAGE', $tmparray, (!empty($object->conf->MAIN_LANDING_PAGE) ? $object->conf->MAIN_LANDING_PAGE : ''), 0, 0, 0, '', 0, 0, 0, '', 'maxwidth250');
  303. //print info_admin($langs->trans("WarningYouMayLooseAccess"), 0, 0, 0);
  304. print '</td></tr>';
  305. // Landing page for Agenda - AGENDA_DEFAULT_VIEW
  306. print '<tr class="oddeven">'."\n";
  307. print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
  308. print '<td class="center">&nbsp;</td>'."\n";
  309. print '<td class="nowrap" width="20%"><input class="oddeven" name="check_AGENDA_DEFAULT_VIEW" id="check_AGENDA_DEFAULT_VIEW" type="checkbox" '.(!empty($object->conf->AGENDA_DEFAULT_VIEW) ? " checked" : "");
  310. print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
  311. print '> <label for="check_AGENDA_DEFAULT_VIEW">'.$langs->trans("UsePersonalValue").'</label></td>';
  312. print '<td>'."\n";
  313. $tmplist = array(''=>'&nbsp;', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser"));
  314. print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, (isset($object->conf->AGENDA_DEFAULT_VIEW) ? $object->conf->AGENDA_DEFAULT_VIEW : ''), 0, 0, 0, '');
  315. print '</td></tr>'."\n";
  316. // Max size of lists
  317. print '<tr class="oddeven"><td>'.$langs->trans("MaxSizeList").'</td>';
  318. print '<td>' . getDolGlobalString('MAIN_SIZE_LISTE_LIMIT').'</td>';
  319. print '<td class="nowrap" width="20%"><input class="oddeven" name="check_SIZE_LISTE_LIMIT" id="check_SIZE_LISTE_LIMIT" type="checkbox" '.(!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ? " checked" : "");
  320. print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
  321. print '> <label for="check_SIZE_LISTE_LIMIT">'.$langs->trans("UsePersonalValue").'</label></td>';
  322. print '<td><input class="flat" name="MAIN_SIZE_LISTE_LIMIT" id="MAIN_SIZE_LISTE_LIMIT" size="4" value="'.(!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ? $object->conf->MAIN_SIZE_LISTE_LIMIT : '').'"></td></tr>';
  323. print '</table><br>';
  324. // Theme
  325. showSkins($object, (($user->admin || empty($dolibarr_main_demo)) ? 1 : 0), true);
  326. print $form->buttonsSaveCancel();
  327. } else {
  328. print dol_get_fiche_head($head, 'guisetup', $title, -1, 'user');
  329. $linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  330. $morehtmlref = '<a href="'.DOL_URL_ROOT.'/user/vcard.php?id='.$object->id.'&output=file&file='.urlencode(dol_sanitizeFileName($object->getFullName($langs).'.vcf')).'" class="refid" rel="noopener">';
  331. $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
  332. $morehtmlref .= '</a>';
  333. $urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id);
  334. $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->transnoentitiesnoconv("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover');
  335. dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin, 'rowid', 'ref', $morehtmlref);
  336. print '<div class="fichecenter">';
  337. print '<div class="underbanner clearboth"></div>';
  338. print '<table class="border centpercent tableforfield">';
  339. // Login
  340. print '<tr><td class="titlefield">'.$langs->trans("Login").'</td>';
  341. if (!empty($object->ldap_sid) && $object->statut == 0) {
  342. print '<td class="error">';
  343. print $langs->trans("LoginAccountDisableInDolibarr");
  344. print '</td>';
  345. } else {
  346. print '<td>';
  347. $addadmin = '';
  348. if (property_exists($object, 'admin')) {
  349. if (isModEnabled('multicompany') && !empty($object->admin) && empty($object->entity)) {
  350. $addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"');
  351. } elseif (!empty($object->admin)) {
  352. $addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"');
  353. }
  354. }
  355. print showValueWithClipboardCPButton($object->login).$addadmin;
  356. print '</td>';
  357. }
  358. print '</tr>'."\n";
  359. print '</table>';
  360. print '</div>';
  361. print dol_get_fiche_end();
  362. print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
  363. print '<table class="noborder centpercent">';
  364. print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("DefaultValue").'</td><td>&nbsp;</td><td>'.$langs->trans("PersonalValue").'</td></tr>';
  365. // Language
  366. print '<tr class="oddeven"><td>'.$langs->trans("Language").'</td>';
  367. print '<td>';
  368. $s = picto_from_langcode($conf->global->MAIN_LANG_DEFAULT);
  369. print($s ? $s.' ' : '');
  370. print(getDolGlobalString('MAIN_LANG_DEFAULT') == 'auto' ? $langs->trans("AutoDetectLang") : $langs->trans("Language_" . getDolGlobalString('MAIN_LANG_DEFAULT')));
  371. print '</td>';
  372. print '<td class="nowrap"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->MAIN_LANG_DEFAULT) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").'</td>';
  373. print '<td>';
  374. $s = (isset($object->conf->MAIN_LANG_DEFAULT) ? picto_from_langcode($object->conf->MAIN_LANG_DEFAULT) : '');
  375. print($s ? $s.' ' : '');
  376. print(isset($object->conf->MAIN_LANG_DEFAULT) && $object->conf->MAIN_LANG_DEFAULT == 'auto' ? $langs->trans("AutoDetectLang") : (!empty($object->conf->MAIN_LANG_DEFAULT) ? $langs->trans("Language_".$object->conf->MAIN_LANG_DEFAULT) : ''));
  377. print '</td></tr>';
  378. // Landing page
  379. print '<tr class="oddeven"><td>'.$langs->trans("LandingPage").'</td>';
  380. print '<td>';
  381. print(!getDolGlobalString('MAIN_LANDING_PAGE') ? '' : $conf->global->MAIN_LANDING_PAGE);
  382. print '</td>';
  383. print '<td class="nowrap"><input class="oddeven" name="check_MAIN_LANDING_PAGE" disabled id="check_MAIN_LANDING_PAGE" type="checkbox" '.(!empty($object->conf->MAIN_LANDING_PAGE) ? " checked" : "");
  384. print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
  385. print '> '.$langs->trans("UsePersonalValue").'</td>';
  386. print '<td class="tdoverflowmax300">';
  387. if (!empty($object->conf->MAIN_LANDING_PAGE)) {
  388. $urltoshow = '';
  389. if (!empty($tmparray[$object->conf->MAIN_LANDING_PAGE])) {
  390. if (is_array($tmparray[$object->conf->MAIN_LANDING_PAGE])) {
  391. $urltoshow = $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]['label']);
  392. } else {
  393. $urltoshow = $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]);
  394. }
  395. } else {
  396. $urltoshow = $object->conf->MAIN_LANDING_PAGE;
  397. }
  398. print '<a href="'.DOL_URL_ROOT.'/'.$object->conf->MAIN_LANDING_PAGE.'" target="_blank" rel="noopener">';
  399. $s = '';
  400. if (!empty($tmparray[$object->conf->MAIN_LANDING_PAGE]['picto'])) {
  401. $s = img_picto($urltoshow, $tmparray[$object->conf->MAIN_LANDING_PAGE]['picto'], 'class="pictofixedwidth"');
  402. }
  403. if (empty($s)) {
  404. print img_picto($urltoshow, 'globe', 'class="pictofixedwidth"');
  405. } else {
  406. print $s;
  407. }
  408. print $urltoshow;
  409. print '</a>';
  410. }
  411. print '</td></tr>';
  412. // Landing page for Agenda - AGENDA_DEFAULT_VIEW
  413. print '<tr class="oddeven">'."\n";
  414. print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
  415. print '<td class="center">&nbsp;</td>'."\n";
  416. print '<td class="nowrap" width="20%"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->AGENDA_DEFAULT_VIEW) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").'</td>';
  417. print '<td>'."\n";
  418. $tmplist = array(''=>'&nbsp;', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser"));
  419. if (!empty($object->conf->AGENDA_DEFAULT_VIEW)) {
  420. print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $object->conf->AGENDA_DEFAULT_VIEW, 0, 0, 0, '', 0, 0, 1);
  421. }
  422. print '</td></tr>'."\n";
  423. // Max size for lists
  424. print '<tr class="oddeven"><td>'.$langs->trans("MaxSizeList").'</td>';
  425. print '<td>'.(getDolGlobalString('MAIN_SIZE_LISTE_LIMIT') ? $conf->global->MAIN_SIZE_LISTE_LIMIT : '&nbsp;').'</td>';
  426. print '<td class="nowrap" width="20%"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").'</td>';
  427. print '<td>'.(!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ? $object->conf->MAIN_SIZE_LISTE_LIMIT : '&nbsp;').'</td></tr>';
  428. print '</table>';
  429. print '</div>';
  430. print '<br>';
  431. // Skin
  432. showSkins($object, 0, true);
  433. print '<div class="tabsAction">';
  434. if (empty($user->admin) && !empty($dolibarr_main_demo)) {
  435. print '<a class="butActionRefused classfortooltip" title="'.$langs->trans("FeatureDisabledInDemo").'" href="#">'.$langs->trans("Modify").'</a>';
  436. } else {
  437. if ($caneditfield || !empty($user->admin)) { // Si utilisateur edite = utilisateur courant (pas besoin de droits particulier car il s'agit d'une page de modif d'output et non de données) ou si admin
  438. print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Modify").'</a>';
  439. } else {
  440. print '<a class="butActionRefused classfortooltip" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Modify").'</a>';
  441. }
  442. }
  443. print '</div>';
  444. }
  445. if ($action == 'edit') {
  446. print '</form>';
  447. }
  448. // End of page
  449. llxFooter();
  450. $db->close();