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 ***********************************************************************/
32 var $pagesize; // for printing
34 var $query_size; // table pager page length
35 var $graphic_links; // use graphic links
36 var $sticky_date; // save date on subsequent document entry
37 var $startup_tab; // default start-up menu tab
39 function user_prefs($user=null)
42 // set default values, used before login
43 global $dflt_lang, $dflt_date_sep, $dflt_date_fmt;
45 $this->date_sep = $dflt_date_sep;
46 $this->date_format = $dflt_date_fmt;
50 $this->language = $dflt_lang;
51 $this->theme = 'default';
55 $this->language = $user["language"];
56 $_SESSION['language']->set_language($this->language);
58 $this->qty_dec = $user["qty_dec"];
59 $this->price_dec = $user["prices_dec"];
60 $this->exrate_dec = $user["rates_dec"];
61 $this->percent_dec = $user["percent_dec"];
63 $this->show_gl_info = $user["show_gl"];
64 $this->show_codes = $user["show_codes"];
65 $this->date_format = $user["date_format"];
66 $this->date_sep = $user["date_sep"];
67 $this->tho_sep = $user["tho_sep"];
68 $this->dec_sep = $user["dec_sep"];
69 $this->theme = $user["theme"];
70 $this->pagesize = $user["page_size"];
71 $this->show_hints = $user["show_hints"];
72 $this->print_profile = $user["print_profile"];
73 $this->rep_popup = $user["rep_popup"];
74 $this->query_size = $user["query_size"];
75 $this->graphic_links = $user["graphic_links"];
76 if (isset($user["sticky_doc_date"]))
78 $this->sticky_date = $user["sticky_doc_date"];
79 $this->startup_tab = $user['startup_tab'];
83 $this->sticky_date = 0;
84 $this->startup_tab = "orders";
86 if (!file_exists("$path_to_root/themes/$this->theme"))
87 $this->theme = "default";
94 'language' => $this->language,
95 'qty_dec' => $this->qty_dec,
96 'prices_dec' => $this->price_dec,
97 'rates_dec' => $this->exrate_dec,
98 'percent_dec' => $this->percent_dec,
99 'show_gl' => $this->show_gl_info,
100 'show_codes' => $this->show_codes,
101 'date_format' =>$this->date_format,
102 'date_sep' => $this->date_sep,
103 'tho_sep' => $this->tho_sep,
104 'dec_sep' => $this->dec_sep,
105 'theme' => $this->theme,
106 'page_size' => $this->pagesize,
107 'show_hints' => $this->show_hints,
108 'print_profile' => $this->print_profile,
109 'rep_popup' => $this->rep_popup,
110 'query_size' => $this->query_size,
111 'graphic_links' => $this->graphic_links,
112 'sticky_doc_date' => $this->sticky_date,
113 'startup_tab' => $this->startup_tab);
118 return $this->language;
123 return $this->qty_dec;
128 return $this->price_dec;
131 function exrate_dec()
133 return $this->exrate_dec;
136 function percent_dec()
138 return $this->percent_dec;
141 function show_gl_info()
143 return $this->show_gl_info;
146 function show_codes()
148 return $this->show_codes;
151 function date_format()
153 return $this->date_format;
158 return $this->date_sep;
161 function date_display()
164 $sep = $dateseps[$this->date_sep];
165 if ($this->date_format == 0)
166 return "m".$sep."d".$sep."Y";
167 elseif ($this->date_format == 1)
168 return "d".$sep."m".$sep."Y";
169 elseif ($this->date_format == 2)
170 return "Y".$sep."m".$sep."d";
171 elseif ($this->date_format == 3)
172 return "M".$sep."j".$sep."Y";
173 elseif ($this->date_format == 4)
174 return "j".$sep."M".$sep."Y";
176 return "Y".$sep."M".$sep."j";
181 return $this->tho_sep;
186 return $this->dec_sep;
194 function get_pagesize()
196 return $this->pagesize;
199 function show_hints()
201 return $this->show_hints;
204 function print_profile()
206 return $this->print_profile;
211 return $this->rep_popup;
214 function query_size()
216 return $this->query_size;
219 function graphic_links()
221 return $this->graphic_links;
224 function sticky_date()
226 return $this->sticky_date;
229 function start_up_tab()
231 return $this->startup_tab;
234 function set_dec($price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes)
236 $this->price_dec = $price_dec;
237 $this->qty_dec = $qty_dec;
238 $this->exrate_dec = $exrate_dec;
239 $this->percent_dec = $percent_dec;
240 $this->show_gl_info = $showgl;
241 $this->show_codes = $showcodes;
244 function set_format($date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize)
246 $this->date_format = $date_format;
247 $this->date_sep = $date_sep;
248 $this->tho_sep = $tho_sep;
249 $this->dec_sep = $dec_sep;
250 $this->theme = $theme;
251 $this->pagesize = $pagesize;