* Copyright (C) 2010-2015 Regis Houssin * Copyright (C) 2013 Florian Henry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/user/param_ihm.php * \brief Page to show user setup for display */ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; $langs->load("companies"); $langs->load("products"); $langs->load("admin"); $langs->load("users"); $langs->load("languages"); // Defini si peux lire/modifier permisssions $canreaduser=($user->admin || $user->rights->user->user->lire); $id = GETPOST('id','int'); $action = GETPOST('action','alpha'); if ($id) { // $user est le user qui edite, $id est l'id de l'utilisateur edite $caneditfield=((($user->id == $id) && $user->rights->user->self->creer) || (($user->id != $id) && $user->rights->user->user->creer)); } // Security check $socid=0; if ($user->societe_id > 0) $socid = $user->societe_id; $feature2 = (($socid && $user->rights->user->self->creer)?'':'user'); if ($user->id == $id) // A user can always read its own card { $feature2=''; $canreaduser=1; } $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); if ($user->id <> $id && ! $canreaduser) accessforbidden(); $dirtop = "../core/menus/standard"; $dirleft = "../core/menus/standard"; // Charge utilisateur edite $object = new User($db); $object->fetch($id); $object->getrights(); // Liste des zone de recherche permanentes supportees $searchform=array("main_searchform_societe","main_searchform_contact","main_searchform_produitservice"); $searchformconst=array($conf->global->MAIN_SEARCHFORM_SOCIETE,$conf->global->MAIN_SEARCHFORM_CONTACT,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE); $searchformtitle=array($langs->trans("Companies"),$langs->trans("Contacts"),$langs->trans("ProductsAndServices")); $form = new Form($db); $formadmin=new FormAdmin($db); /* * Actions */ if ($action == 'update' && ($caneditfield || ! empty($user->admin))) { if (! $_POST["cancel"]) { $tabparam=array(); if ($_POST["check_MAIN_LANG_DEFAULT"]=="on") $tabparam["MAIN_LANG_DEFAULT"]=$_POST["main_lang_default"]; else $tabparam["MAIN_LANG_DEFAULT"]=''; if ($_POST["check_SIZE_LISTE_LIMIT"]=="on") $tabparam["MAIN_SIZE_LISTE_LIMIT"]=$_POST["main_size_liste_limit"]; else $tabparam["MAIN_SIZE_LISTE_LIMIT"]=''; if ($_POST["check_MAIN_THEME"]=="on") $tabparam["MAIN_THEME"]=$_POST["main_theme"]; else $tabparam["MAIN_THEME"]=''; $tabparam["MAIN_SEARCHFORM_CONTACT"]=$_POST["main_searchform_contact"]; $tabparam["MAIN_SEARCHFORM_SOCIETE"]=$_POST["main_searchform_societe"]; $tabparam["MAIN_SEARCHFORM_PRODUITSERVICE"]=$_POST["main_searchform_produitservice"]; $result=dol_set_user_param($db, $conf, $object, $tabparam); header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); exit; } } /* * View */ llxHeader(); $head = user_prepare_head($object); $title = $langs->trans("User"); if ($action == 'edit') { print '
'; print ''; print ''; print ''; } dol_fiche_head($head, 'guisetup', $title, 0, 'user'); print ''; // Ref print ''; print ''; print ''; // LastName print ''; print ''; print "\n"; // FirstName print ''; print ''; print "\n"; print '
'.$langs->trans("Ref").''; print $form->showrefnav($object,'id','',$user->rights->user->user->lire || $user->admin); print '
'.$langs->trans("LastName").''.$object->lastname.'
'.$langs->trans("FirstName").''.$object->firstname.'

'; if ($action == 'edit') { print ''; clearstatcache(); $var=true; print ''; print ''; // Langue par defaut $var=!$var; print ''; print ''; print ''; print ''; // Taille max des listes $var=!$var; print ''; print ''; print ''; print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("DefaultValue").' '.$langs->trans("PersonalValue").'
'.$langs->trans("Language").''; $s=picto_from_langcode($conf->global->MAIN_LANG_DEFAULT); print $s?$s.' ':''; print ($conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$langs->trans("Language_".$conf->global->MAIN_LANG_DEFAULT)); print 'conf->MAIN_LANG_DEFAULT)?" checked":""); print empty($dolibarr_main_demo)?'':' disabled="disabled"'; // Disabled for demo print '> '.$langs->trans("UsePersonalValue").''; 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))); print '
'.$langs->trans("MaxSizeList").''.$conf->global->MAIN_SIZE_LISTE_LIMIT.'conf->MAIN_SIZE_LISTE_LIMIT)?" checked":""); print empty($dolibarr_main_demo)?'':' disabled="disabled"'; // Disabled for demo print '> '.$langs->trans("UsePersonalValue").'

'; // Theme show_theme($object,(($user->admin || empty($dolibarr_main_demo))?1:0),true); dol_fiche_end(); print '
'; print ''; print '     '; print ''; print '
'; print '
'; } else { $var=true; print ''; print ''; $var=!$var; print ''; print ''; print ''; print ''; $var=!$var; print ''; print ''; print ''; print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("DefaultValue").' '.$langs->trans("PersonalValue").'
'.$langs->trans("Language").''; $s=picto_from_langcode($conf->global->MAIN_LANG_DEFAULT); print ($s?$s.' ':''); print (isset($conf->global->MAIN_LANG_DEFAULT) && $conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$langs->trans("Language_".$conf->global->MAIN_LANG_DEFAULT)); print 'conf->MAIN_LANG_DEFAULT)?" checked":"").'> '.$langs->trans("UsePersonalValue").''; $s=(isset($object->conf->MAIN_LANG_DEFAULT) ? picto_from_langcode($object->conf->MAIN_LANG_DEFAULT) : ''); print ($s?$s.' ':''); 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):'')); print '
'.$langs->trans("MaxSizeList").''.(! empty($conf->global->MAIN_SIZE_LISTE_LIMIT)?$conf->global->MAIN_SIZE_LISTE_LIMIT:' ').'conf->MAIN_SIZE_LISTE_LIMIT)?" checked":"").'> '.$langs->trans("UsePersonalValue").'' . (! empty($object->conf->MAIN_SIZE_LISTE_LIMIT)?$object->conf->MAIN_SIZE_LISTE_LIMIT:' ') . '

'; // Skin show_theme($object,0,true); dol_fiche_end(); print '
'; if (empty($user->admin) && ! empty($dolibarr_main_demo)) { print "trans("FeatureDisabledInDemo")."\" href=\"#\">".$langs->trans("Modify").""; } else { 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 { print 'id.'">'.$langs->trans("Modify").''; } else { print "trans("NotEnoughPermissions")."\" href=\"#\">".$langs->trans("Modify").""; } } print '
'; } dol_fiche_end(); llxFooter(); $db->close();