Default theme and language for not logged user.
[fa-stable.git] / includes / prefs / userprefs.inc
1 <?php
2 /**********************************************************************
3     Copyright (C) FrontAccounting, LLC.
4         Released under the terms of the GNU General Public License, GPL, 
5         as published by the Free Software Foundation, either version 3 
6         of the License, or (at your option) any later version.
7     This program is distributed in the hope that it will be useful,
8     but WITHOUT ANY WARRANTY; without even the implied warranty of
9     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
10     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
11 ***********************************************************************/
12 class user_prefs 
13 {
14
15         var $language;
16
17         var $qty_dec;
18         var $price_dec;
19         var     $exrate_dec;
20         var     $percent_dec;
21
22         var     $show_gl_info;
23         var     $show_codes;
24
25         var $date_format;
26         var $date_sep;
27         var $tho_sep;
28         var $dec_sep;
29         var $theme;
30         var $print_profile;
31         var $rep_popup;
32         var $pagesize; // for printing
33         var $show_hints;
34         var $query_size; // table pager page length
35         var $graphic_links; // use graphic links
36
37         function user_prefs($user=null)
38         {
39                 if ($user == null) { 
40                         // set default values, used before login
41                         global $dflt_lang;
42                         
43                         $this->language = $dflt_lang;
44                         $this->theme = 'default';
45                         
46                 } else {
47                         $this->language = $user["language"];
48                         language::set_language($this->language);
49
50                         $this->qty_dec = $user["qty_dec"];
51                         $this->price_dec = $user["prices_dec"];
52                         $this->exrate_dec = $user["rates_dec"];
53                         $this->percent_dec = $user["percent_dec"];
54
55                         $this->show_gl_info = $user["show_gl"];
56                         $this->show_codes = $user["show_codes"];
57                         $this->date_format = $user["date_format"];
58                         $this->date_sep = $user["date_sep"];
59                         $this->tho_sep = $user["tho_sep"];
60                         $this->dec_sep = $user["dec_sep"];
61                         $this->theme = $user["theme"];
62                         $this->pagesize = $user["page_size"];
63                         $this->show_hints = $user["show_hints"];
64                         $this->print_profile = $user["print_profile"];
65                         $this->rep_popup = $user["rep_popup"];
66                         $this->query_size = $user["query_size"];
67                         $this->graphic_links = $user["graphic_links"];
68                 }
69         }
70
71         function language() 
72         {
73                 return $this->language;
74         }
75
76         function qty_dec() 
77         {
78                 return $this->qty_dec;
79         }
80
81         function price_dec() 
82         {
83                 return $this->price_dec;
84         }
85
86         function exrate_dec() 
87         {
88                 return $this->exrate_dec;
89         }
90
91         function percent_dec() 
92         {
93                 return $this->percent_dec;
94         }
95
96         function show_gl_info() 
97         {
98                 return $this->show_gl_info;
99         }
100
101         function show_codes() 
102         {
103                 return $this->show_codes;
104         }
105
106         function date_format() 
107         {
108                 return $this->date_format;
109         }
110
111         function date_sep() 
112         {
113                 return $this->date_sep;
114         }
115
116         function date_display() 
117         {
118                 global $dateseps;
119                 $sep = $dateseps[$this->date_sep];
120                 if ($this->date_format == 0)
121                         return "m".$sep."d".$sep."Y";
122                 elseif ($this->date_format == 1)
123                         return "d".$sep."m".$sep."Y";
124                 else
125                         return "Y".$sep."m".$sep."d";
126         }
127
128         function tho_sep() 
129         {
130                 return $this->tho_sep;
131         }
132
133         function dec_sep() 
134         {
135                 return $this->dec_sep;
136         }
137
138         function get_theme() 
139         {
140                 return $this->theme;
141         }
142
143         function get_pagesize() 
144         {
145                 return $this->pagesize;
146         }
147
148         function show_hints() 
149         {
150                 return $this->show_hints;
151         }
152
153         function print_profile() 
154         {
155                 return $this->print_profile;
156         }
157
158         function rep_popup() 
159         {
160                 return $this->rep_popup;
161         }
162
163         function query_size() 
164         {
165                 return $this->query_size;
166         }
167
168         function graphic_links() 
169         {
170                 return $this->graphic_links;
171         }
172
173         function set_dec($price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes) 
174         {
175                 $this->price_dec = $price_dec;
176                 $this->qty_dec = $qty_dec;
177                 $this->exrate_dec = $exrate_dec;
178                 $this->percent_dec = $percent_dec;
179                 $this->show_gl_info = $showgl;
180                 $this->show_codes = $showcodes;
181         }
182
183         function set_format($date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize) 
184         {
185                 $this->date_format = $date_format;
186                 $this->date_sep = $date_sep;
187                 $this->tho_sep = $tho_sep;
188                 $this->dec_sep = $dec_sep;
189                 $this->theme = $theme;
190                 $this->pagesize = $pagesize;
191         }
192
193 }
194
195 ?>