Main Page | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

pref.inc.php

Go to the documentation of this file.
00001 <?
00002 /*
00003  *   This file is part of PhpCompta.
00004  *
00005  *   PhpCompta is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU General Public License as published by
00007  *   the Free Software Foundation; either version 2 of the License, or
00008  *   (at your option) any later version.
00009  *
00010  *   PhpCompta is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with PhpCompta; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 /* $Revision: 1.4 $ */
00020 // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
00025 echo '<DIV class="u_content">';
00026 
00027 if ( isset ($_POST['spass']) ) {
00028   if ( $_POST['pass_1'] != $_POST['pass_2'] ) {
00029 ?>
00030 <script>
00031    alert("Les mots de passe ne correspondent pas. Mot de passe inchangé");
00032 </script>
00033 <?
00034     }
00035     else {
00036       $l_pass=md5($_POST['pass_1']);
00037       $Res=ExecSql($Rep,"update ac_users set use_pass='$l_pass' where use_login='".$_SESSION['g_user']."'");
00038       $pass=$_POST['pass_1'];
00039       $_SESSION['g_pass']=$_POST['pass_1'];
00040       $g_pass=$_POST['pass_1'];
00041     }
00042   }
00043 $url=$_SERVER['REQUEST_URI'];
00044 
00045 ?>
00046 <H2 CLASS="info"> Password</H2>
00047 
00048 <FORM ACTION="<?echo $url;?>" METHOD="POST">
00049 <TABLE ALIGN="CENTER">
00050 <TR><TD><input type="password" name="pass_1"></TD></TR>
00051 <TR><TD><input type="password" name="pass_2"></TD></TR>
00052 <TR><TD><input type="submit" name="spass" value="Change mot de passe"></TD></TR>
00053 </TABLE>
00054 </FORM>
00055 <?
00056 $Rep=DbConnect();
00057 
00058 // charge tous les styles
00059 $res=ExecSql($Rep,"select the_name from theme
00060                       order by the_name");
00061 for ($i=0;$i < pg_NumRows($res);$i++){
00062   $st=pg_fetch_array($res,$i);
00063   $style[]=$st['the_name'];
00064 }
00065 // Formatte le display
00066 $disp_style="<SELECT NAME=\"style_user\" >";
00067 foreach ($style as $st){
00068   if ( $st == $_SESSION['g_theme'] ) {
00069     $disp_style.='<OPTION VALUE="'.$st.'" SELECTED>'.$st;
00070   } else {
00071     $disp_style.='<OPTION VALUE="'.$st.'">'.$st;
00072   }
00073 }
00074 $disp_style.="</SELECT>";
00075 ?>
00076 <H2 class="info">Thème</H2>
00077 <FORM ACTION="<? echo $url; ?>" METHOD="post">
00078 <TABLE ALIGN="center">
00079 <TR>
00080    <TD> Style </TD>
00081    <TD> <? print $disp_style;?> </TD>
00082 </TR>
00083 <TR>
00084    <td colspan=2> <INPUT TYPE="submit" Value="Sauve"></TD>
00085 </TR>
00086 </TABLE>
00087 </FORM>
00088 
00089 <?
00090 
00091 // Si utilise un dossier alors propose de changer
00092 // la periode par defaut
00093 if ( isset ($_SESSION['g_dossier']) ) {
00094 
00095   include_once("preference.php");
00096   $msg=""; 
00097 
00098   if ( isset ($_POST["sub_periode"] ) ) {
00099     $periode=$_POST["periode"];
00100     $User->SetPeriode($periode);
00101     echo_debug('pref.inc',__LINE__,"Periode returns ".PeriodeClosed($cn,$periode));
00102   }
00103 
00104   $l_user_per=$User->GetPeriode();
00105   // if periode is closed then warns the users
00106   if ( PeriodeClosed($cn,$l_user_per)=='t')
00107   {
00108     $msg= '<h2 class="error">Attention cette période est fermée, vous ne pourrez rien modifier dans le module comptable</h2>';
00109   }
00110 
00111 
00112   $l_form_per=FormPeriode($cn,$l_user_per,ALL);
00113 
00114 ?>
00115 <H2 CLASS="info"> Période</H2>
00116   <? echo $msg; ?>
00117 <FORM ACTION="<? echo $url;?>" METHOD="POST">
00118 <TABLE ALIGN="CENTER">
00119 <TR><TD>PERIODE</TD>
00120 <?    printf('<TD> %s </TD></TR>',$l_form_per); ?>
00121 <TR><TD><input type="submit" name="sub_periode" value="Sauve"></TD></TR>
00122 </TABLE>
00123 </FORM>
00124 
00125 <H2 CLASS="info"> Taille des pages</H2>
00126 <FORM ACTION="<? echo $url;?>" METHOD="POST">
00127 <TABLE ALIGN="CENTER">
00128 <TR><TD>Taille des pages</TD>
00129 <TD>
00130 <SELECT NAME="p_size">
00131 <option value="15">15
00132 <option value="25">25
00133 <option value="50">50
00134 <option value="100">100
00135 <option value="150">150
00136 <option value="200">200
00137 <option value="-1">Illimité
00138 <?
00139         $label=($_SESSION['g_pagesize'] == -1)?'Illimité':$_SESSION['g_pagesize'];
00140         echo '<option value="'.$_SESSION['g_pagesize'].'" selected>'.$label;
00141 ?>
00142 </SELECT>
00143 </TD></TR>
00144 <TR><TD><input type="submit" name="sub_taille" value="Sauve"></TD></TR>
00145 </TABLE>
00146 </FORM>
00147 
00148 
00149 <?
00150 }
00151      
00152 echo "</DIV>";
00153 ?>