move code up one directory
[atutor.git] / users / atutor_settings.inc.php
1 <?php 
2 function print_theme_selectbox($theme_list, $selected_theme, $type) {
3         if (!is_array($theme_list) || count($theme_list) == 0) return ;
4 ?>
5         <div class="row">
6                 <label for="<?php if ($type == DESKTOP_DEVICE) echo "theme"; else echo "mobile_theme"; ?>"><?php if ($type == DESKTOP_DEVICE) echo _AT('desktop_theme'); else echo _AT('mobile_theme'); ?></label><br />
7                 <select name="<?php if ($type == DESKTOP_DEVICE) echo "theme"; else echo "mobile_theme"; ?>" id="<?php if ($type == DESKTOP_DEVICE) echo "theme"; else echo "mobile_theme"; ?>"><?php
8                         foreach ($theme_list as $theme) {
9                                 if (!$theme) {
10                                         continue;
11                                 }
12
13                                 $theme_fldr = get_folder($theme);
14
15                                 if ($theme_fldr == $selected_theme) {
16                                         echo '<option value="'.$theme_fldr.'" selected="selected">'.$theme.'</option>';
17                                 } else {
18                                         echo '<option value="'.$theme_fldr.'">'.$theme.'</option>';
19                                 }
20                         }
21                 ?>
22                 </select>
23         </div>
24 <?php }?>
25
26 <legend><strong><?php echo _AT("atutor_settings"); ?></strong> </legend>  
27 <div id="feedback" style="width:90%;">
28 <?php echo _AT('prefs_set_atutor'); ?> 
29 </div>
30 <?php if (defined('AT_ENABLE_CATEGORY_THEMES') && AT_ENABLE_CATEGORY_THEMES){
31         echo _AT('themes_disabled'); 
32 } else { 
33         if (isset($_POST['theme']))
34                 $selected_theme = $_POST['theme'];
35         else
36                 $selected_theme = $_SESSION['prefs']['PREF_THEME'];
37                 
38         $_themes = get_enabled_themes(DESKTOP_DEVICE);
39         print_theme_selectbox($_themes, $selected_theme, DESKTOP_DEVICE);
40         
41         if (isset($_POST['mobile_theme']))
42                 $selected_theme = $_POST['mobile_theme'];
43         else
44                 $selected_theme = $_SESSION['prefs']['PREF_MOBILE_THEME'];
45                 
46         $_themes = get_enabled_themes(MOBILE_DEVICE);
47         print_theme_selectbox($_themes, $selected_theme, MOBILE_DEVICE);
48 }
49 ?>
50         
51         <div class="row">
52                 <?php echo _AT('time_zone');  ?><br />
53                 
54                 
55                 <?php
56                 // Replace this hack to use the PHP timezone functions when the PHP requirement is raised to 5.2
57                 global $utc_timezones; // set in include/lib/constants.inc.php
58                 $local_offset = (((date(Z)/3600)+$_config['time_zone']));
59                 echo '<select name="time_zone">';       
60                         echo '<option value="0">'._AT('none').'</option>';
61                 foreach ($utc_timezones as $zone => $offset){
62                         if(($offset[1]) == $_SESSION['prefs']['PREF_TIMEZONE']){
63                         echo '<option value="'.($offset[1]).'" selected="selected">'.$offset[0].'</option>';
64                         }else{
65                         echo '<option value="'.($offset[1]).'">'.$offset[0].'</option>';
66
67                         }
68                 }
69                 echo "</select>";
70                 // end of hack
71                 echo "&nbsp;".AT_date(_AT('server_date_format'), '', AT_DATE_MYSQL_DATETIME);
72                 ?>
73         </div>
74         
75         <div class="row">
76                 <?php echo _AT('inbox_notification'); ?><br />
77                 <?php
78                         $yes = $no  = '';
79                         
80                         if (isset($_POST["mnot"]))
81                                 $selected_mnot = $_POST["mnot"];
82                         else
83                                 $selected_mnot = $this->notify;
84                                 
85                         if ($selected_mnot == 1) {
86                                 $yes = ' checked="checked"';
87                         } else {
88                                 $no  = ' checked="checked"';
89                         }
90                 ?>
91                 <input type="radio" name="mnot" id="mnot_yes" value="1" <?php echo $yes; ?> /><label for="mnot_yes"><?php echo _AT('enable'); ?></label> 
92                 <input type="radio" name="mnot" id="mnot_no" value="0" <?php echo $no; ?> /><label for="mnot_no"><?php echo _AT('disable'); ?></label>          
93         </div>
94
95         <div class="row">
96                 <?php echo _AT('show_numbers');  ?><br />
97                 <?php
98                         if (isset($_POST['numbering']))
99                                 $selected_numbering = $_POST['numbering'];
100                         else
101                                 $selected_numbering = $_SESSION['prefs']['PREF_NUMBERING'];
102                                 
103                         $num = $num2 = '';
104                         if ($selected_numbering == 1) {
105                                 $num = ' checked="checked"';
106                         } else {
107                                 $num2 = ' checked="checked"';
108                         }
109                         ?><input type="radio" name ="numbering" id="num_en" value="1" <?php echo $num; ?> /><label for="num_en"><?php echo _AT('enable');  ?></label> 
110                         <input type="radio" name ="numbering" id="num_dis" value="0" <?php echo $num2; ?> /><label for="num_dis"><?php echo _AT('disable');  ?></label>
111         </div>
112
113         <div class="row">
114                 <?php echo _AT('jump_redirect'); ?><br />
115                 <?php
116                         if (isset($_POST['use_jump_redirect']))
117                                 $selected_numbering = $_POST['use_jump_redirect'];
118                         else
119                                 $selected_numbering = $_SESSION['prefs']['PREF_JUMP_REDIRECT'];
120                                 
121                         $num = $num2 = '';
122                         if ($selected_numbering == 1) {
123                                 $num = ' checked="checked"';
124                         } else {
125                                 $num2 = ' checked="checked"';
126                         }
127                         ?><input type="radio" name ="use_jump_redirect" id="jump_en" value="1" <?php echo $num; ?> /><label for="jump_en"><?php echo _AT('enable');  ?></label> 
128                         <input type="radio" name ="use_jump_redirect" id="jump_dis" value="0" <?php echo $num2; ?> /><label for="jump_dis"><?php echo _AT('disable');  ?></label>
129         </div>
130
131         <div class="row">
132                 <?php echo _AT('auto_login1');  ?><br /><?php
133                         $auto_en = $auto_dis = '';
134
135                         // Check flag $is_auto_login instead of session vars !empty($_SESSION['ATLogin']) is because 
136                         // the set cookies are only accessible at the next page reload
137                         if ( $this->is_auto_login == "enable") {
138                                 $auto_en = 'checked="checked"';
139                         } else {
140                                 $auto_dis = 'checked="checked"';
141                         }
142                 ?><input type="radio" name ="auto" id="auto_en" value="enable" <?php echo $auto_en; ?> /><label for="auto_en"><?php echo _AT('enable');  ?></label> 
143                 <input type="radio" name ="auto" id="auto_dis" value="disable" <?php echo $auto_dis; ?> /><label for="auto_dis"><?php echo _AT('disable');  ?></label>
144         </div>
145
146         <div class="row">
147                 <?php echo _AT('form_focus');  ?><br />
148                 <?php
149                         if (isset($_POST['form_focus']))
150                                 $selected_form_focus = $_POST['form_focus'];
151                         else
152                                 $selected_form_focus = $_SESSION['prefs']['PREF_FORM_FOCUS'];
153                                 
154                         $num = $num2 = '';
155                         if ($selected_form_focus == 1) {
156                                 $num = ' checked="checked"';
157                         } else {
158                                 $num2 = ' checked="checked"';
159                         }
160                         ?><input type="radio" name ="form_focus" id="focus_on" value="1" <?php echo $num; ?> /><label for="focus_on"><?php echo _AT('enable');  ?></label> 
161                         <input type="radio" name ="form_focus" id="focus_off" value="0" <?php echo $num2; ?> /><label for="focus_off"><?php echo _AT('disable');  ?></label>
162         </div>
163
164         <div class="row">
165                 <?php echo _AT('show_guide');  ?><br />
166                 <?php
167                         if (isset($_POST['show_guide']))
168                                 $selected_show_guide = $_POST['show_guide'];
169                         else if (isset($_SESSION['prefs']['PREF_SHOW_GUIDE']))
170                                 $selected_show_guide = $_SESSION['prefs']['PREF_SHOW_GUIDE'];
171                         else
172                                 $selected_show_guide = 1;
173                                 
174                         $num = $num2 = '';
175                         if ($selected_show_guide == 1) {
176                                 $num = ' checked="checked"';
177                         } else {
178                                 $num2 = ' checked="checked"';
179                         }
180                         ?><input type="radio" name ="show_guide" id="show_guide_on" value="1" <?php echo $num; ?> /><label for="show_guide_on"><?php echo _AT('enable');  ?></label> 
181                         <input type="radio" name ="show_guide" id="show_guide_off" value="0" <?php echo $num2; ?> /><label for="show_guide_off"><?php echo _AT('disable');  ?></label>
182         </div>
183
184         <div class="row">
185                 <?php
186                         if (isset($_POST['content_editor']))
187                                 $selected_content_editor = $_POST['content_editor'];
188                         else
189                                 $selected_content_editor = $_SESSION['prefs']['PREF_CONTENT_EDITOR'];
190                                 
191                         $num0 = $num1 = $num2 = '';
192                         if ($selected_content_editor == 1) {
193                                 $num1 = ' checked="checked"';
194                         } else if ($_SESSION['prefs']['PREF_CONTENT_EDITOR'] == 2) {
195                                 $num2 = ' checked="checked"';
196                         } else {
197                                 $num0 = ' checked="checked"';
198                         }
199                 ?>
200                 <?php echo _AT('content_editor'); ?><br />
201                 <input type="radio" name="content_editor" id="ce_0" value="0" <?php echo $num0; ?>/><label for="ce_0"><?php echo _AT('plain_text');?></label>
202                 <input type="radio" name="content_editor" id="ce_1" value="1" <?php echo $num1; ?>/><label for="ce_1"><?php echo _AT('html'); ?></label>
203                 <input type="radio" name="content_editor" id="ce_2" value="2" <?php echo $num2; ?>/><label for="ce_2"><?php echo _AT('html') . ' - '. _AT('visual_editor'); ?></label>
204         </div>