param_ihm.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  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 ($id) {
  37. // $user est le user qui edite, $id est l'id de l'utilisateur edite
  38. $caneditfield = ((($user->id == $id) && $user->hasRight("user", "self", "write"))
  39. || (($user->id != $id) && $user->hasRight("user", "user", "write")));
  40. }
  41. // Security check
  42. $socid = 0;
  43. if ($user->socid > 0) {
  44. $socid = $user->socid;
  45. }
  46. $feature2 = (($socid && $user->hasRight("user", "self", "write")) ? '' : 'user');
  47. $result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
  48. if ($user->id <> $id && !$canreaduser) {
  49. accessforbidden();
  50. }
  51. $dirtop = "../core/menus/standard";
  52. $dirleft = "../core/menus/standard";
  53. // Charge utilisateur edite
  54. $object = new User($db);
  55. $object->fetch($id, '', '', 1);
  56. $object->getrights();
  57. // Liste des zone de recherche permanentes supportees
  58. /* deprecated
  59. $searchform=array("main_searchform_societe","main_searchform_contact","main_searchform_produitservice");
  60. $searchformconst=array($conf->global->MAIN_SEARCHFORM_SOCIETE,$conf->global->MAIN_SEARCHFORM_CONTACT,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE);
  61. $searchformtitle=array($langs->trans("Companies"),$langs->trans("Contacts"),$langs->trans("ProductsAndServices"));
  62. */
  63. $form = new Form($db);
  64. $formadmin = new FormAdmin($db);
  65. // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
  66. $hookmanager->initHooks(array('usercard', 'userihm', 'globalcard'));
  67. /*
  68. * Actions
  69. */
  70. $parameters = array('id'=>$socid);
  71. $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
  72. if ($reshook < 0) {
  73. setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  74. }
  75. if (empty($reshook)) {
  76. if ($action == 'update' && ($caneditfield || !empty($user->admin))) {
  77. if (!GETPOST("cancel")) {
  78. $tabparam = array();
  79. if (GETPOST("check_MAIN_LANDING_PAGE") == "on") {
  80. $tabparam["MAIN_LANDING_PAGE"] = GETPOST("MAIN_LANDING_PAGE", 'alphanohtml');
  81. } else {
  82. $tabparam["MAIN_LANDING_PAGE"] = '';
  83. }
  84. if (GETPOST("check_MAIN_LANG_DEFAULT") == "on") {
  85. $tabparam["MAIN_LANG_DEFAULT"] = GETPOST("main_lang_default", 'aZ09');
  86. } else {
  87. $tabparam["MAIN_LANG_DEFAULT"] = '';
  88. }
  89. if (GETPOST("check_SIZE_LISTE_LIMIT") == "on") {
  90. $tabparam["MAIN_SIZE_LISTE_LIMIT"] = GETPOST("main_size_liste_limit", 'int');
  91. } else {
  92. $tabparam["MAIN_SIZE_LISTE_LIMIT"] = '';
  93. }
  94. if (GETPOST("check_AGENDA_DEFAULT_VIEW") == "on") {
  95. $tabparam["AGENDA_DEFAULT_VIEW"] = GETPOST("AGENDA_DEFAULT_VIEW", 'aZ09');
  96. } else {
  97. $tabparam["AGENDA_DEFAULT_VIEW"] = '';
  98. }
  99. if (GETPOST("check_MAIN_THEME") == "on") {
  100. $tabparam["MAIN_THEME"] = GETPOST('main_theme', 'aZ09');
  101. } else {
  102. $tabparam["MAIN_THEME"] = '';
  103. }
  104. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1', 'alphanohtml'), array()))));
  105. if ($val == '') {
  106. $tabparam['THEME_ELDY_TOPMENU_BACK1'] = '';
  107. } else {
  108. $tabparam['THEME_ELDY_TOPMENU_BACK1'] = join(
  109. ',',
  110. colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1', 'alphanohtml'), array())
  111. );
  112. }
  113. $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1', 'alphanohtml'), array()))));
  114. if ($val == '') {
  115. $tabparam['THEME_ELDY_BACKTITLE1'] = '';
  116. } else {
  117. $tabparam['THEME_ELDY_BACKTITLE1'] = join(
  118. ',',
  119. colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1', 'alphanohtml'), array())
  120. );
  121. }
  122. if (GETPOST('check_THEME_ELDY_USE_HOVER') == 'on') {
  123. $tabparam["THEME_ELDY_USE_HOVER"] = 1;
  124. } else {
  125. $tabparam["THEME_ELDY_USE_HOVER"] = 0;
  126. }
  127. if (GETPOST('check_THEME_ELDY_USE_CHECKED') == 'on') {
  128. $tabparam["THEME_ELDY_USE_CHECKED"] = 1;
  129. } else {
  130. $tabparam["THEME_ELDY_USE_CHECKED"] = 0;
  131. }
  132. if (GETPOST('MAIN_OPTIMIZEFORTEXTBROWSER')) {
  133. $tabparam["MAIN_OPTIMIZEFORTEXTBROWSER"] = 1;
  134. } else {
  135. $tabparam["MAIN_OPTIMIZEFORTEXTBROWSER"] = 0;
  136. }
  137. if (GETPOST('MAIN_OPTIMIZEFORCOLORBLIND')) {
  138. $tabparam["MAIN_OPTIMIZEFORCOLORBLIND"] = GETPOST('MAIN_OPTIMIZEFORCOLORBLIND', 'aZ09');
  139. } else {
  140. $tabparam["MAIN_OPTIMIZEFORCOLORBLIND"] = 0;
  141. }
  142. $result = dol_set_user_param($db, $conf, $object, $tabparam);
  143. header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
  144. exit;
  145. }
  146. }
  147. }
  148. /*
  149. * View
  150. */
  151. $person_name = !empty($object->firstname) ? $object->lastname.", ".$object->firstname : $object->lastname;
  152. $title = $person_name." - ".$langs->trans('Card');
  153. $help_url = '';
  154. llxHeader('', $title, $help_url);
  155. // List of possible landing pages
  156. $tmparray = array();
  157. $tmparray['index.php'] = array('label'=>'Dashboard', 'picto'=>'graph');
  158. if (isModEnabled("societe")) {
  159. $tmparray['societe/index.php?mainmenu=companies&leftmenu='] = array('label'=>'ThirdPartiesArea', 'picto'=>'company');
  160. }
  161. if (isModEnabled('project')) {
  162. $tmparray['projet/index.php?mainmenu=project&leftmenu='] = array('label'=>'ProjectsArea', 'picto'=>'project');
  163. if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) {
  164. $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');
  165. }
  166. }
  167. if (isModEnabled('holiday') || isModEnabled('expensereport')) {
  168. $tmparray['hrm/index.php?mainmenu=hrm&leftmenu='] = array('label'=>'HRMArea', 'picto'=>'user'); // TODO Complete list with first level of menus
  169. }
  170. if (isModEnabled("product") || isModEnabled("service")) {
  171. $tmparray['product/index.php?mainmenu=products&leftmenu='] = array('label'=>'ProductsAndServicesArea', 'picto'=>'product');
  172. }
  173. if (isModEnabled("propal") || isModEnabled('commande') || isModEnabled('ficheinter') || isModEnabled('contrat')) {
  174. $tmparray['comm/index.php?mainmenu=commercial&leftmenu='] = array('label'=>'CommercialArea', 'picto'=>'commercial');
  175. }
  176. if (isModEnabled('comptabilite') || isModEnabled('accounting')) {
  177. $tmparray['compta/index.php?mainmenu=compta&leftmenu='] = array('label'=>'AccountancyTreasuryArea', 'picto'=>'bill');
  178. }
  179. if (isModEnabled('adherent')) {
  180. $tmparray['adherents/index.php?mainmenu=members&leftmenu='] = array('label'=>'MembersArea', 'picto'=>'member');
  181. }
  182. if (isModEnabled('agenda')) {
  183. $tmparray['comm/action/index.php?mainmenu=agenda&leftmenu='] = array('label'=>'Agenda', 'picto'=>'action');
  184. }
  185. if (isModEnabled('ticket')) {
  186. $tmparray['ticket/list.php?mainmenu=ticket&leftmenu='] = array('label'=>'Tickets', 'picto'=>'ticket');
  187. }
  188. // add bookmarks to available landing pages
  189. if (empty($conf->global->MAIN_NO_BOOKMARKS_FOR_LANDING_PAGES)) {
  190. $sql = "SELECT b.rowid, b.fk_user, b.url, b.title";
  191. $sql .= " FROM ".MAIN_DB_PREFIX."bookmark as b";
  192. $sql .= " WHERE b.entity IN (".getEntity('bookmark').")";
  193. $sql .= " AND b.url NOT LIKE 'http%'";
  194. if (!$object->admin) {
  195. $sql .= " AND (b.fk_user = ".((int) $object->id)." OR b.fk_user is NULL OR b.fk_user = 0)";
  196. }
  197. $resql = $db->query($sql);
  198. if ($resql) {
  199. $i = 0;
  200. $num_rows = $db->num_rows($resql);
  201. if ($num_rows > 0) {
  202. $tmparray['sep'.$i] = '<span class="opacitymedium">--- '.$langs->trans("Bookmarks").'</span>';
  203. while ($i < $num_rows) {
  204. $obj = $db->fetch_object($resql);
  205. $landing_url = str_replace(DOL_URL_ROOT, '', $obj->url);
  206. $tmparray[$landing_url] = array('label'=>$obj->title, 'picto'=>'generic');
  207. $i++;
  208. }
  209. }
  210. }
  211. }
  212. // Hook for insertion new items in the List of possible landing pages
  213. $reshook = $hookmanager->executeHooks('addToLandingPageList', $tmparray, $object);
  214. if ($reshook < 0) {
  215. setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  216. } elseif ($reshook > 0) {
  217. $tmparray = $hookmanager->resArray;
  218. } elseif ($reshook == 0) {
  219. $tmparray = array_merge($tmparray, $hookmanager->resArray);
  220. }
  221. foreach ($tmparray as $key => $val) {
  222. $tmparray[$key]['data-html'] = img_picto($langs->trans($val['label']), $val['picto'], 'class="pictofixedwidth"').$langs->trans($val['label']);
  223. $tmparray[$key]['label'] = $langs->trans($val['label']);
  224. }
  225. $head = user_prepare_head($object);
  226. $title = $langs->trans("User");
  227. if ($action == 'edit') {
  228. print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
  229. print '<input type="hidden" name="token" value="'.newToken().'">';
  230. print '<input type="hidden" name="action" value="update">';
  231. print '<input type="hidden" name="id" value="'.$id.'">';
  232. }
  233. if ($action == 'edit') {
  234. print dol_get_fiche_head($head, 'guisetup', $title, -1, 'user');
  235. $linkback = '';
  236. if ($user->hasRight("user", "user", "read") || $user->admin) {
  237. $linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  238. }
  239. dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin);
  240. print '<div class="underbanner clearboth"></div>';
  241. print dol_get_fiche_end();
  242. if (!empty($conf->use_javascript_ajax)) {
  243. print '<script type="text/javascript">
  244. jQuery(document).ready(function() {
  245. function init_myfunc()
  246. {
  247. if (jQuery("#check_MAIN_LANDING_PAGE").prop("checked")) { jQuery("#MAIN_LANDING_PAGE").removeAttr(\'disabled\'); }
  248. else { jQuery("#MAIN_LANDING_PAGE").attr(\'disabled\',\'disabled\'); }
  249. if (jQuery("#check_MAIN_LANG_DEFAULT").prop("checked")) { jQuery("#main_lang_default").removeAttr(\'disabled\'); }
  250. else { jQuery("#main_lang_default").attr(\'disabled\',\'disabled\'); }
  251. if (jQuery("#check_SIZE_LISTE_LIMIT").prop("checked")) { jQuery("#main_size_liste_limit").removeAttr(\'disabled\'); }
  252. else { jQuery("#main_size_liste_limit").attr(\'disabled\',\'disabled\'); }
  253. if (jQuery("#check_AGENDA_DEFAULT_VIEW").prop("checked")) { jQuery("#AGENDA_DEFAULT_VIEW").removeAttr(\'disabled\'); }
  254. else { jQuery("#AGENDA_DEFAULT_VIEW").attr(\'disabled\',\'disabled\'); }
  255. if (jQuery("#check_MAIN_THEME").prop("checked")) { jQuery(".themethumbs").removeAttr(\'disabled\'); }
  256. else { jQuery(".themethumbs").attr(\'disabled\',\'disabled\'); }
  257. if (jQuery("#check_THEME_ELDY_TOPMENU_BACK1").prop("checked")) { jQuery("#colorpickerTHEME_ELDY_TOPMENU_BACK1").removeAttr(\'disabled\'); }
  258. else { jQuery("#colorpickerTHEME_ELDY_TOPMENU_BACK1").attr(\'disabled\',\'disabled\'); }
  259. }
  260. init_myfunc();
  261. jQuery("#check_MAIN_LANDING_PAGE").click(function() { init_myfunc(); });
  262. jQuery("#check_MAIN_LANG_DEFAULT").click(function() { init_myfunc(); });
  263. jQuery("#check_SIZE_LISTE_LIMIT").click(function() { init_myfunc(); });
  264. jQuery("#check_AGENDA_DEFAULT_VIEW").click(function() { init_myfunc(); });
  265. jQuery("#check_MAIN_THEME").click(function() { init_myfunc(); });
  266. jQuery("#check_THEME_ELDY_TOPMENU_BACK1").click(function() { init_myfunc(); });
  267. jQuery("#check_THEME_ELDY_BACKTITLE1").click(function() { init_myfunc(); });
  268. });
  269. </script>';
  270. }
  271. clearstatcache();
  272. print '<table class="noborder centpercent">';
  273. print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("DefaultValue").'</td><td>&nbsp;</td><td>'.$langs->trans("PersonalValue").'</td></tr>';
  274. // Language by default
  275. print '<tr class="oddeven"><td class="titlefieldmiddle">'.$langs->trans("Language").'</td>';
  276. print '<td>';
  277. $s = picto_from_langcode($conf->global->MAIN_LANG_DEFAULT);
  278. print $s ? $s.' ' : '';
  279. print ($conf->global->MAIN_LANG_DEFAULT == 'auto' ? $langs->trans("AutoDetectLang") : $langs->trans("Language_".$conf->global->MAIN_LANG_DEFAULT));
  280. print '</td>';
  281. 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" : "");
  282. print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
  283. print '> <label for="check_MAIN_LANG_DEFAULT">'.$langs->trans("UsePersonalValue").'</label></td>';
  284. print '<td>';
  285. 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)));
  286. print '</td></tr>';
  287. // Landing page
  288. print '<tr class="oddeven"><td>'.$langs->trans("LandingPage").'</td>';
  289. print '<td>';
  290. print (empty($conf->global->MAIN_LANDING_PAGE) ? '' : $conf->global->MAIN_LANDING_PAGE);
  291. print '</td>';
  292. 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" : "");
  293. print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
  294. print '> <label for="check_MAIN_LANDING_PAGE">'.$langs->trans("UsePersonalValue").'</label></td>';
  295. print '<td>';
  296. 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');
  297. //print info_admin($langs->trans("WarningYouMayLooseAccess"), 0, 0, 0);
  298. print '</td></tr>';
  299. // Landing page for Agenda - AGENDA_DEFAULT_VIEW
  300. print '<tr class="oddeven">'."\n";
  301. print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
  302. print '<td class="center">&nbsp;</td>'."\n";
  303. 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" : "");
  304. print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
  305. print '> <label for="check_AGENDA_DEFAULT_VIEW">'.$langs->trans("UsePersonalValue").'</label></td>';
  306. print '<td>'."\n";
  307. $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"));
  308. print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, (isset($object->conf->AGENDA_DEFAULT_VIEW) ? $object->conf->AGENDA_DEFAULT_VIEW : ''), 0, 0, 0, '');
  309. print '</td></tr>'."\n";
  310. // Max size of lists
  311. print '<tr class="oddeven"><td>'.$langs->trans("MaxSizeList").'</td>';
  312. print '<td>'.$conf->global->MAIN_SIZE_LISTE_LIMIT.'</td>';
  313. 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" : "");
  314. print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
  315. print '> <label for="check_SIZE_LISTE_LIMIT">'.$langs->trans("UsePersonalValue").'</label></td>';
  316. 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>';
  317. print '</table><br>';
  318. // Theme
  319. showSkins($object, (($user->admin || empty($dolibarr_main_demo)) ? 1 : 0), true);
  320. print $form->buttonsSaveCancel();
  321. } else {
  322. print dol_get_fiche_head($head, 'guisetup', $title, -1, 'user');
  323. $linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
  324. $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">';
  325. $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
  326. $morehtmlref .= '</a>';
  327. $urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id);
  328. $morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover');
  329. dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin, 'rowid', 'ref', $morehtmlref);
  330. print '<div class="fichecenter">';
  331. print '<div class="underbanner clearboth"></div>';
  332. print '<table class="border centpercent tableforfield">';
  333. // Login
  334. print '<tr><td class="titlefield">'.$langs->trans("Login").'</td>';
  335. if (!empty($object->ldap_sid) && $object->statut == 0) {
  336. print '<td class="error">';
  337. print $langs->trans("LoginAccountDisableInDolibarr");
  338. print '</td>';
  339. } else {
  340. print '<td>';
  341. $addadmin = '';
  342. if (property_exists($object, 'admin')) {
  343. if (isModEnabled('multicompany') && !empty($object->admin) && empty($object->entity)) {
  344. $addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"');
  345. } elseif (!empty($object->admin)) {
  346. $addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"');
  347. }
  348. }
  349. print showValueWithClipboardCPButton($object->login).$addadmin;
  350. print '</td>';
  351. }
  352. print '</tr>'."\n";
  353. print '</table>';
  354. print '</div>';
  355. print dol_get_fiche_end();
  356. print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
  357. print '<table class="noborder centpercent">';
  358. 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>';
  359. // Language
  360. print '<tr class="oddeven"><td>'.$langs->trans("Language").'</td>';
  361. print '<td>';
  362. $s = picto_from_langcode($conf->global->MAIN_LANG_DEFAULT);
  363. print ($s ? $s.' ' : '');
  364. print (isset($conf->global->MAIN_LANG_DEFAULT) && $conf->global->MAIN_LANG_DEFAULT == 'auto' ? $langs->trans("AutoDetectLang") : $langs->trans("Language_".$conf->global->MAIN_LANG_DEFAULT));
  365. print '</td>';
  366. print '<td class="nowrap"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->MAIN_LANG_DEFAULT) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").'</td>';
  367. print '<td>';
  368. $s = (isset($object->conf->MAIN_LANG_DEFAULT) ? picto_from_langcode($object->conf->MAIN_LANG_DEFAULT) : '');
  369. print ($s ? $s.' ' : '');
  370. 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) : ''));
  371. print '</td></tr>';
  372. // Landing page
  373. print '<tr class="oddeven"><td>'.$langs->trans("LandingPage").'</td>';
  374. print '<td>';
  375. print (empty($conf->global->MAIN_LANDING_PAGE) ? '' : $conf->global->MAIN_LANDING_PAGE);
  376. print '</td>';
  377. 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" : "");
  378. print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
  379. print '> '.$langs->trans("UsePersonalValue").'</td>';
  380. print '<td>';
  381. if (!empty($object->conf->MAIN_LANDING_PAGE)) {
  382. $urltoshow = '';
  383. if (!empty($tmparray[$object->conf->MAIN_LANDING_PAGE])) {
  384. if (is_array($tmparray[$object->conf->MAIN_LANDING_PAGE])) {
  385. $urltoshow = $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]['label']);
  386. } else {
  387. $urltoshow = $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]);
  388. }
  389. } else {
  390. $urltoshow = $object->conf->MAIN_LANDING_PAGE;
  391. }
  392. print ' <a href="'.DOL_URL_ROOT.'/'.$object->conf->MAIN_LANDING_PAGE.'" target="_blank" rel="noopener">';
  393. print img_picto($urltoshow, $tmparray[$object->conf->MAIN_LANDING_PAGE]['picto'], 'class="pictofixedwidth"');
  394. print $urltoshow;
  395. print img_picto($urltoshow, 'globe', 'class="paddingleft"');
  396. print '</a>';
  397. }
  398. print '</td></tr>';
  399. // Landing page for Agenda - AGENDA_DEFAULT_VIEW
  400. print '<tr class="oddeven">'."\n";
  401. print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
  402. print '<td class="center">&nbsp;</td>'."\n";
  403. print '<td class="nowrap" width="20%"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->AGENDA_DEFAULT_VIEW) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").'</td>';
  404. print '<td>'."\n";
  405. $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"));
  406. if (!empty($object->conf->AGENDA_DEFAULT_VIEW)) {
  407. print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $object->conf->AGENDA_DEFAULT_VIEW, 0, 0, 0, '', 0, 0, 1);
  408. }
  409. print '</td></tr>'."\n";
  410. // Max size for lists
  411. print '<tr class="oddeven"><td>'.$langs->trans("MaxSizeList").'</td>';
  412. print '<td>'.(!empty($conf->global->MAIN_SIZE_LISTE_LIMIT) ? $conf->global->MAIN_SIZE_LISTE_LIMIT : '&nbsp;').'</td>';
  413. print '<td class="nowrap" width="20%"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").'</td>';
  414. print '<td>'.(!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ? $object->conf->MAIN_SIZE_LISTE_LIMIT : '&nbsp;').'</td></tr>';
  415. print '</table>';
  416. print '</div>';
  417. print '<br>';
  418. // Skin
  419. showSkins($object, 0, true);
  420. print '<div class="tabsAction">';
  421. if (empty($user->admin) && !empty($dolibarr_main_demo)) {
  422. print '<a class="butActionRefused classfortooltip" title="'.$langs->trans("FeatureDisabledInDemo").'" href="#">'.$langs->trans("Modify").'</a>';
  423. } else {
  424. 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
  425. print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Modify").'</a>';
  426. } else {
  427. print '<a class="butActionRefused classfortooltip" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Modify").'</a>';
  428. }
  429. }
  430. print '</div>';
  431. }
  432. if ($action == 'edit') {
  433. print '</form>';
  434. }
  435. // End of page
  436. llxFooter();
  437. $db->close();