1 <?php
3 /*
4 This code is part of GOsa (https://gosa.gonicus.de)
5 Copyright (C) 2007 Fabian Hickert
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
23 class setup_step_1 extends setup_step
24 {
25 var $lang = "en_EN";
26 var $languages = array();
27 var $attributes = array("lang","force_global_lang");
28 var $force_global_lang = FALSE;
30 function setup_step_1()
31 {
32 $this->lang = get_browser_language();
34 $this->is_enabled = TRUE;
35 $this->is_active = TRUE;
37 $this->update_strings();
38 }
40 function update_strings()
41 {
42 $this->s_title = _("Language selection");
43 $this->s_title_long = _("Please choose a language");
44 $this->s_info = _("This step is allows you to define your prefered language.");
45 }
47 function execute()
48 {
49 $this->languages = array("de_DE" => _("German"),
50 "fr_FR" => _("French"),
51 "en_EN" => _("English"),
52 "ru_RU" => _("Russian"));
54 $smarty = get_smarty();
55 $smarty->assign("languages", $this->languages);
56 $smarty->assign("lang", $this->lang);
57 $smarty->assign("force_global_lang", $this->force_global_lang);
58 return($smarty->fetch(get_template_path("setup_step1.tpl",TRUE,dirname(__FILE__))));
59 }
61 function save_object()
62 {
63 if((isset($_POST['lang'])) && isset($this->languages[$_POST['lang']])) {
64 $this->lang = $_POST['lang'];
65 $this->is_completed = TRUE;
66 $_SESSION['lang'] = $this->lang;
68 if(isset($_POST['force_global_lang'])){
69 if($_POST['force_global_lang'] == 1 ){
70 $this->force_global_lang = TRUE;
71 }else{
72 $this->force_global_lang = FALSE;
73 }
74 }
75 }
76 }
77 }
79 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
80 ?>