noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
ajax_preference.php
Go to the documentation of this file.
00001 <?php
00002 /*
00003  *   This file is part of NOALYSS.
00004  *
00005  *   NOALYSS 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  *   NOALYSS 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 NOALYSS; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  */
00019 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00020 /**\file
00021  * \brief this file is always included and then executed
00022  *        it permits to change the user preferences
00023  * \see user_pref.php
00024  */
00025 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
00026 require_once('class_user.php');
00027 require_once("class_iselect.php");
00028 require_once("class_iperiod.php");
00029 require_once('class_acc_report.php');
00030 require_once('class_periode.php');
00031 echo HtmlInput::title_box(_('Préférence'), 'preference_div');
00032 echo '<DIV class="content">';
00033 echo '<p class="notice">';
00034 echo _("Si vous validez, la page sera rechargée et vous pourriez perdre ce que vous faisiez");
00035 echo '</p>';
00036 //----------------------------------------------------------------------
00037 //
00038 global $g_user;
00039 
00040 $g_user=new User($cn);
00041 $inside_dossier = false;
00042 
00043 if (isset($_REQUEST['gDossier']) && $_REQUEST['gDossier']<>0)
00044 {
00045     $g_user->load_global_pref();
00046     $msg = "";
00047     $cn = new Database($_REQUEST['gDossier']);
00048     $g_user->cn = $cn;
00049     $inside_dossier = true;
00050     $local_pref=$g_user->get_preference();
00051 }
00052 //////////////////////////////////////////////////////////////////////////
00053 // Theme
00054 //////////////////////////////////////////////////////////////////////////
00055 
00056     $repo = new Database();
00057 // charge tous les styles
00058     $res = $repo->exec_sql("select the_name from theme
00059                     order by the_name");
00060     $style = new ISelect('style_user');
00061     $style->value = $repo->make_array("select the_name,the_name
00062         from theme
00063         order by the_name");
00064     $style->selected =$_SESSION['g_theme'];
00065 ?>
00066 
00067 <div class="content" >
00068 
00069     <FORM  METHOD="POST">
00070         <fieldset style="margin: 1%"><legend><?php echo _('Options Générales')?></legend>
00071             <table>
00072                 <tr><td>
00073                         Mot de passe :
00074                     </td>
00075                     <td><input type="password" value="" class="input_text" name="pass_1" nohistory>
00076                         <input type="password" value="" class="input_text" name="pass_2" nohistory>
00077                     </td>
00078                 </tr>
00079 
00080                 <tr>
00081                     <td>
00082                         <?php echo _('Thème');?>
00083                     </td>
00084                     <td>
00085                         <?php echo $style->input();?>
00086                     </td>
00087                 </tr>
00088 
00089                 <?php
00090                 if ($inside_dossier)
00091                 {
00092                     $l_user_per = $g_user->get_periode();
00093                     if ($l_user_per == "")
00094                         $l_user_per = $cn->get_value("select min(p_id) from parm_periode where p_closed='f'");
00095 
00096 // if periode is closed then warns the users
00097                     $period = new Periode($cn, $l_user_per);
00098 
00099                     $period->p_id = $l_user_per;
00100                     $period->jrn_def_id = 0;
00101                     if ($period->is_closed($l_user_per) == 1)
00102                     {
00103                         $msg = _('Attention cette période est fermée, vous ne pourrez rien modifier dans le module comptable');
00104                         $msg = '<h2 class="notice">' . $msg . '</h2>';
00105                     }
00106 
00107                     $period = new IPeriod("period");
00108                     $period->user = $g_user;
00109                     $period->cn = $cn;
00110                     $period->filter_year = false;
00111                     $period->value = $l_user_per;
00112                     $period->type = ALL;
00113                     $l_form_per = $period->input();
00114                     ?>
00115                 <tr><td><?php echo _('Période');?></td>
00116                     <td>
00117                             <?php printf(' %s ', $l_form_per);?>
00118                     </td>
00119                     <td>  <?php echo $msg;?></td>
00120                 <tr>
00121                     <td><?php echo _('Taille des pages');?></td>
00122                     <td>
00123                         <SELECT NAME="p_size">
00124                             <option value="15">15
00125                             <option value="25">25
00126                             <option value="50">50
00127                             <option value="100">100
00128                             <option value="150">150
00129                             <option value="200">200
00130                             <option value="-1"><?php echo _('Illimité');?>
00131                                     <?php
00132                                     $label = ($_SESSION['g_pagesize'] == -1) ? _('Illimité') : $_SESSION['g_pagesize'];
00133                                     echo '<option value="' . $_SESSION['g_pagesize'] . '" selected>' . $label;
00134                                     ?>
00135                         </SELECT>
00136 
00137                     </td>
00138                 </tr>
00139                     <?php 
00140                 }
00141                 ?>
00142             </table>
00143         </fieldset>
00144         <?php
00145         if ($inside_dossier)
00146         {
00147             /* Pref for welcome page */
00148             echo '<fieldset style="margin: 1%">';
00149             echo '<legend>' . _('Options pour la page d\'accueil') . '</legend>';
00150             echo _('Mini-Rapport : ');
00151             $rapport = new Acc_Report($cn);
00152             $aRapport = $rapport->make_array();
00153             $aRapport[] = array("value" => 0, "label" => _('Aucun mini rapport'));
00154             $wRapport = new ISelect();
00155             $wRapport->name = "minirap";
00156             $wRapport->selected = $g_user->get_mini_report();
00157             $wRapport->value = $aRapport;
00158             echo $wRapport->input();
00159             echo '<span class="notice">' . _('Le mini rapport est un rapport qui s\'affiche  sur votre page d\'accueil') . '</span>';
00160             echo '</fieldset>';
00161         }
00162 
00163         echo '<fieldset  style="margin: 1%">';
00164         echo '<legend>' . _('Langue') . '</legend>';
00165         echo _('Selectionnez votre langue');
00166         $aLang = array(array(_('Français'), 'fr_FR.utf8'),
00167             array(_('Anglais'), 'en_US.utf8'),
00168             array(_('Néerlandais'), 'nl_NL.utf8'),
00169         );
00170         echo '<select name="lang" id="l">';
00171         for ($i = 0; $i < count($aLang); $i++)
00172         {
00173             $sel = "";
00174             if ($aLang[$i][1] == $_SESSION['g_lang'])
00175                 $sel = " selected ";
00176             printf('<option value="%s" %s>%s</option>', $aLang[$i][1], $sel, $aLang[$i][0]);
00177         }
00178         echo '</select>';
00179         echo '</fieldset>';
00180         
00181         echo '<p style="text-align:center">';
00182         echo HtmlInput::button_close('preference_div');
00183         echo HtmlInput::submit("set_preference", _("Valider"));
00184         echo '</p>';
00185         echo '</form>';
00186 
00187         echo "</DIV>";
00188         ?>
 All Data Structures Namespaces Files Functions Variables Enumerations