f8fa8915511b4e28667a73130c0d26491db57a3f
[fa-stable.git] / includes / prefs / userprefs.inc
1 <?php
2 /**********************************************************************
3     Copyright (C) FrontAccounting, LLC.
4         Released under the terms of the GNU Affero General Public License,
5         AGPL, as published by the Free Software Foundation, either version 
6         3 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/agpl-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) 
38         {
39
40                 $this->language = $user["language"];
41                 language::set_language($this->language);
42
43                 $this->qty_dec = $user["qty_dec"];
44                 $this->price_dec = $user["prices_dec"];
45                 $this->exrate_dec = $user["rates_dec"];
46                 $this->percent_dec = $user["percent_dec"];
47
48                 $this->show_gl_info = $user["show_gl"];
49                 $this->show_codes = $user["show_codes"];
50                 $this->date_format = $user["date_format"];
51                 $this->date_sep = $user["date_sep"];
52                 $this->tho_sep = $user["tho_sep"];
53                 $this->dec_sep = $user["dec_sep"];
54                 $this->theme = $user["theme"];
55                 $this->pagesize = $user["page_size"];
56                 $this->show_hints = $user["show_hints"];
57                 $this->print_profile = $user["print_profile"];
58                 $this->rep_popup = $user["rep_popup"];
59                 $this->query_size = $user["query_size"];
60                 $this->graphic_links = $user["graphic_links"];
61         }
62
63         function language() 
64         {
65                 return $this->language;
66         }
67
68         function qty_dec() 
69         {
70                 return $this->qty_dec;
71         }
72
73         function price_dec() 
74         {
75                 return $this->price_dec;
76         }
77
78         function exrate_dec() 
79         {
80                 return $this->exrate_dec;
81         }
82
83         function percent_dec() 
84         {
85                 return $this->percent_dec;
86         }
87
88         function show_gl_info() 
89         {
90                 return $this->show_gl_info;
91         }
92
93         function show_codes() 
94         {
95                 return $this->show_codes;
96         }
97
98         function date_format() 
99         {
100                 return $this->date_format;
101         }
102
103         function date_sep() 
104         {
105                 return $this->date_sep;
106         }
107
108         function date_display() 
109         {
110                 global $dateseps;
111                 $sep = $dateseps[$this->date_sep];
112                 if ($this->date_format == 0)
113                         return "m".$sep."d".$sep."Y";
114                 elseif ($this->date_format == 1)
115                         return "d".$sep."m".$sep."Y";
116                 else
117                         return "Y".$sep."m".$sep."d";
118         }
119
120         function tho_sep() 
121         {
122                 return $this->tho_sep;
123         }
124
125         function dec_sep() 
126         {
127                 return $this->dec_sep;
128         }
129
130         function get_theme() 
131         {
132                 return $this->theme;
133         }
134
135         function get_pagesize() 
136         {
137                 return $this->pagesize;
138         }
139
140         function show_hints() 
141         {
142                 return $this->show_hints;
143         }
144
145         function print_profile() 
146         {
147                 return $this->print_profile;
148         }
149
150         function rep_popup() 
151         {
152                 return $this->rep_popup;
153         }
154
155         function query_size() 
156         {
157                 return $this->query_size;
158         }
159
160         function graphic_links() 
161         {
162                 return $this->graphic_links;
163         }
164
165         function set_dec($price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes) 
166         {
167                 $this->price_dec = $price_dec;
168                 $this->qty_dec = $qty_dec;
169                 $this->exrate_dec = $exrate_dec;
170                 $this->percent_dec = $percent_dec;
171                 $this->show_gl_info = $showgl;
172                 $this->show_codes = $showcodes;
173         }
174
175         function set_format($date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize) 
176         {
177                 $this->date_format = $date_format;
178                 $this->date_sep = $date_sep;
179                 $this->tho_sep = $tho_sep;
180                 $this->dec_sep = $dec_sep;
181                 $this->theme = $theme;
182                 $this->pagesize = $pagesize;
183         }
184
185 }
186
187 ?>