[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/user/ -> param_ihm.php (source)

   1  <?php
   2  /* Copyright (C) 2005 Laurent Destailleur  <eldy@users.sourceforge.net>
   3   *
   4   * This program is free software; you can redistribute it and/or modify
   5   * it under the terms of the GNU General Public License as published by
   6   * the Free Software Foundation; either version 2 of the License, or
   7   * (at your option) any later version.
   8   *
   9   * This program is distributed in the hope that it will be useful,
  10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12   * GNU General Public License for more details.
  13   *
  14   * You should have received a copy of the GNU General Public License
  15   * along with this program; if not, write to the Free Software
  16   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17   *
  18   * $Id: param_ihm.php,v 1.7 2005/10/29 23:42:56 eldy Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/user/param_ihm.php,v $
  20   */
  21  
  22  /**
  23          \file       htdocs/user/param_ihm.php
  24          \brief      Onglet parametrage de la fiche utilisateur
  25          \version    $Revision: 1.7 $
  26  */
  27  
  28  
  29  require ("./pre.inc.php");
  30  
  31  $langs->load("companies");
  32  $langs->load("products");
  33  $langs->load("admin");
  34  $langs->load("users");
  35  
  36  $id=isset($_GET["id"])?$_GET["id"]:$_POST["id"];
  37  $dirtop = "../includes/menus/barre_top";
  38  $dirleft = "../includes/menus/barre_left";
  39  $dirtheme = "../theme";
  40  
  41  // Charge utilisateur edité
  42  $fuser = new User($db, $id);
  43  $fuser->fetch();
  44  $fuser->getrights();
  45  
  46  // Liste des zone de recherche permanantes supportées
  47  $searchform=array("main_searchform_societe","main_searchform_contact","main_searchform_produitservice");
  48  $searchformconst=array($conf->global->MAIN_SEARCHFORM_SOCIETE,$conf->global->MAIN_SEARCHFORM_CONTACT,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE);
  49  $searchformtitle=array($langs->trans("Companies"),$langs->trans("Contacts"),$langs->trans("ProductsAndServices"));
  50  
  51  
  52  
  53  /*
  54   * Actions
  55   */
  56  if ($_POST["action"] == 'update')
  57  {
  58      if ($_POST["cancel"])
  59      {
  60          $_GET["id"]=$_POST["id"];
  61      }
  62      else 
  63      {
  64          $tabparam=array();
  65          
  66          if ($_POST["check_MAIN_LANG_DEFAULT"]=="on") $tabparam["MAIN_LANG_DEFAULT"]=$_POST["main_lang_default"];
  67          else $tabparam["MAIN_LANG_DEFAULT"]='';
  68          
  69          $tabparam["MAIN_MENU_BARRETOP"]=$_POST["main_menu_barretop"];
  70          $tabparam["MAIN_MENU_BARRELEFT"]=$_POST["main_menu_barreleft"];
  71      
  72          if ($_POST["check_SIZE_LISTE_LIMIT"]=="on") $tabparam["SIZE_LISTE_LIMIT"]=$_POST["size_liste_limit"];
  73          else $tabparam["SIZE_LISTE_LIMIT"]='';
  74      
  75          if ($_POST["check_MAIN_THEME"]=="on") $tabparam["MAIN_THEME"]=$_POST["main_theme"];
  76          else $tabparam["MAIN_THEME"]='';
  77  
  78          $tabparam["MAIN_SEARCHFORM_CONTACT"]=$_POST["main_searchform_contact"];
  79          $tabparam["MAIN_SEARCHFORM_SOCIETE"]=$_POST["main_searchform_societe"];
  80          $tabparam["MAIN_SEARCHFORM_PRODUITSERVICE"]=$_POST["main_searchform_produitservice"];
  81      
  82          dolibarr_set_user_page_param($db, $fuser, '', $tabparam);
  83          
  84          $_SESSION["mainmenu"]="";   // Le gestionnaire de menu a pu changer
  85      
  86          Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$_POST["id"]);
  87          exit;
  88      }
  89  }
  90  
  91  
  92  
  93  llxHeader();
  94  
  95  
  96  
  97  /*
  98   * Affichage onglets
  99   */
 100  
 101  $h = 0;
 102  
 103  $head[$h][0] = DOL_URL_ROOT.'/user/fiche.php?id='.$fuser->id;
 104  $head[$h][1] = $langs->trans("UserCard");
 105  $h++;
 106  
 107  $head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$fuser->id;
 108  $head[$h][1] = $langs->trans("UserRights");
 109  $h++;
 110  
 111  $head[$h][0] = DOL_URL_ROOT.'/user/param_ihm.php?id='.$fuser->id;
 112  $head[$h][1] = $langs->trans("UserGUISetup");
 113  $hselected=$h;
 114  $h++;
 115  
 116  if ($conf->bookmark4u->enabled)
 117  {
 118      $head[$h][0] = DOL_URL_ROOT.'/user/addon.php?id='.$fuser->id;
 119      $head[$h][1] = $langs->trans("Bookmark4u");
 120      $h++;
 121  }
 122  
 123  if ($conf->clicktodial->enabled)
 124  {
 125      $head[$h][0] = DOL_URL_ROOT.'/user/clicktodial.php?id='.$fuser->id;
 126      $head[$h][1] = $langs->trans("ClickToDial");
 127      $h++;
 128  }
 129  
 130  dolibarr_fiche_head($head, $hselected, $langs->trans("User").": ".$fuser->fullname);
 131  
 132  
 133  
 134  
 135  if ($_GET["action"] == 'edit')
 136  {
 137      print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
 138      print '<input type="hidden" name="action" value="update">';
 139      print '<input type="hidden" name="id" value="'.$_GET["id"].'">';
 140  
 141      clearstatcache();
 142      $var=true;
 143      
 144      print '<table class="noborder" width="100%">';
 145      print '<tr class="liste_titre"><td width="25%">'.$langs->trans("Parameter").'</td><td width="25%">'.$langs->trans("DefaultValue").'</td><td>&nbsp;</td><td>'.$langs->trans("PersonalValue").'</td></tr>';
 146  
 147      // Langue par defaut
 148      $var=!$var;
 149      print '<tr '.$bc[$var].'><td>'.$langs->trans("Language").'</td>';
 150      print '<td>'.($conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$conf->global->MAIN_LANG_DEFAULT).'</td>';
 151      print '<td align="left" nowrap="nowrap" width="20%"><input name="check_MAIN_LANG_DEFAULT" type="checkbox" '.($fuser->conf->MAIN_LANG_DEFAULT?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
 152      print '<td>';
 153      $html=new Form($db);
 154      $html->select_lang($fuser->conf->MAIN_LANG_DEFAULT,'main_lang_default',1);
 155      print '</td></tr>';
 156  
 157      // Taille max des listes
 158      $var=!$var;
 159      print '<tr '.$bc[$var].'><td>'.$langs->trans("MaxSizeList").'</td>';
 160      print '<td>'.$conf->global->SIZE_LISTE_LIMIT.'</td>';
 161      print '<td align="left" nowrap="nowrap" width="20%"><input name="check_SIZE_LISTE_LIMIT" type="checkbox" '.($fuser->conf->SIZE_LISTE_LIMIT?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
 162      print '<td><input class="flat" name="size_liste_limit" size="4" value="' . $fuser->conf->SIZE_LISTE_LIMIT . '"></td></tr>';
 163  
 164      print '</table><br>';
 165  
 166  
 167      // Theme
 168      show_theme($fuser,1);
 169  
 170      print '</div>';
 171  
 172      print '<center>';
 173      print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
 174      print ' &nbsp; &nbsp; ';
 175      print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
 176      print '</center>';
 177      print '</form>';
 178      
 179  }
 180  else
 181  {
 182      $var=true;
 183  
 184      print '<table class="noborder" width="100%">';
 185      print '<tr class="liste_titre"><td width="25%">'.$langs->trans("Parameter").'</td><td width="25%">'.$langs->trans("DefaultValue").'</td><td>&nbsp;</td><td>'.$langs->trans("PersonalValue").'</td></tr>';
 186  
 187      $var=!$var;
 188      print '<tr '.$bc[$var].'><td>'.$langs->trans("Language").'</td>';
 189      print '<td>'.($conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$conf->global->MAIN_LANG_DEFAULT).'</td>';
 190      print '<td align="left" nowrap="nowrap" width="20%"><input type="checkbox" disabled '.($fuser->conf->MAIN_LANG_DEFAULT?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
 191      print '<td>'.($fuser->conf->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$fuser->conf->MAIN_LANG_DEFAULT).'</td></tr>';
 192  
 193      $var=!$var;
 194      print '<tr '.$bc[$var].'><td>'.$langs->trans("MaxSizeList").'</td>';
 195      print '<td>'.$conf->global->SIZE_LISTE_LIMIT.'</td>';
 196      print '<td align="left" nowrap="nowrap" width="20%"><input type="checkbox" disabled '.($fuser->conf->SIZE_LISTE_LIMIT?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
 197      print '<td>' . $fuser->conf->SIZE_LISTE_LIMIT . '</td></tr>';
 198  
 199      print '</table><br>';
 200  
 201  
 202      // Skin
 203      show_theme($fuser,0);
 204  
 205      print '</div>';
 206  
 207      print '<div class="tabsAction">';
 208      if ($fuser->id == $user->id)       // Si utilisateur édité = utilisateur courant
 209      {
 210          print '<a class="tabAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&amp;id='.$_GET["id"].'">'.$langs->trans("Edit").'</a>';
 211      }
 212      print '</div>';
 213  
 214  }
 215  
 216  $db->close();
 217  
 218  llxFooter('$Date: 2005/10/29 23:42:56 $ - $Revision: 1.7 $');
 219  
 220  
 221  function show_theme($fuser,$edit=0) 
 222  {
 223      global $conf,$langs,$dirtheme,$bc;
 224      
 225      $thumbsbyrow=6;
 226      
 227      print '<table class="noborder" width="100%">';
 228      print '<tr class="liste_titre"><td width="25%">'.$langs->trans("Parameter").'</td><td width="25%">'.$langs->trans("DefaultValue").'</td><td colspan="2">&nbsp;</td></tr>';
 229  
 230      $var=false;
 231  
 232      print '<tr '.$bc[$var].'><td>'.$langs->trans("DefaultSkin").'</td>';
 233      print '<td>'.$conf->global->MAIN_THEME.'</td>';
 234      print '<td '.$bc[$var].' align="left" nowrap="nowrap" width="20%"><input name="check_MAIN_THEME"'.($edit?'':' disabled').' type="checkbox" '.($fuser->conf->MAIN_THEME?" checked":"").'> '.$langs->trans("UsePersonalValue").'</td>';
 235      print '<td '.$bc[$var].'>&nbsp;</td></tr>';
 236  
 237      $var=!$var;
 238      print '<tr '.$bc[$var].'><td colspan="4">';
 239  
 240      print '<table class="notopnoleftnoright" width="100%">';
 241      $handle=opendir($dirtheme);
 242      $i=0;
 243      while (($subdir = readdir($handle))!==false)
 244      {
 245          if (is_dir($dirtheme."/".$subdir) && substr($subdir, 0, 1) <> '.' && substr($subdir, 0, 3) <> 'CVS')
 246          {
 247              if ($i % $thumbsbyrow == 0)
 248              {
 249                  print '<tr '.$bc[$var].'>';
 250              }
 251              
 252              print '<td align="center">';
 253              $file=$dirtheme."/".$subdir."/thumb.png";
 254              if (! file_exists($file)) $file=$dirtheme."/nophoto.jpg";
 255              print '<table><tr><td><img src="'.$file.'" width="80" height="60"></td></tr><tr><td align="center">';
 256              if ($subdir == $fuser->conf->MAIN_THEME)
 257              {
 258                  print '<input '.($edit?'':'disabled').' type="radio" '.$bc[$var].' style="border: 0px;" checked name="main_theme" value="'.$subdir.'"> <b>'.$subdir.'</b>';
 259              }
 260              else
 261              {
 262                  print '<input '.($edit?'':'disabled').' type="radio" '.$bc[$var].' style="border: 0px;" name="main_theme" value="'.$subdir.'"> '.$subdir;
 263              }
 264              print '</td></tr></table></td>';
 265  
 266              $i++;
 267  
 268              if ($i % $thumbsbyrow == 0) print '</tr>';
 269          }
 270      }
 271      if ($i % $thumbsbyrow != 0) {
 272          while ($i % $thumbsbyrow != 0) {
 273              print '<td>&nbsp;</td>';
 274              $i++;
 275          }
 276          print '</tr>';
 277      }    
 278      print '</table>';
 279  
 280      print '</td></tr>';
 281      print '</table>';
 282  }
 283  
 284  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics