move code up one directory
[atutor.git] / themes / default / users / preferences.tmpl.php
1 <?php 
2
3 $tabs = get_tabs();     
4 $num_tabs = count($tabs);
5
6 $current_tab = 0;  // set default tab
7 $switch_tab = false;
8
9 for ($i=0; $i < $num_tabs; $i++) 
10 {
11         if (isset($_POST['button_'.$i]) && ($_POST['button_'.$i] != -1)) 
12         { 
13                 $current_tab = $i;
14                 $switch_tab = true;
15                 break;
16         }
17 }
18
19 if (!$switch_tab && isset($_REQUEST['current_tab'])) {
20         $current_tab = intval($_REQUEST['current_tab']);
21 }
22
23 if ($current_tab == 1)
24 {
25         global $_custom_head, $onload;
26         
27         $_custom_head = "<script language=\"JavaScript\" src=\"jscripts/lib/TILE.js\" type=\"text/javascript\"></script>";
28         $onload = "setPreviewFace(); setPreviewSize(); setPreviewColours();";
29 }
30
31 require(AT_INCLUDE_PATH.'header.inc.php'); 
32
33 if($_SESSION['course_id'] == "-1"){
34 echo '<div id="container"><br />';
35 }
36
37 ?>
38
39 <form action="<?php echo $_SERVER['PHP_SELF']; ?>"  method="post" name="form" enctype="multipart/form-data">
40
41         <div>
42                 <?php output_tabs($current_tab, $changes_made); ?>
43         </div>
44
45         <div class="input-form">
46                 <input type="hidden" name="current_tab" value="<?php echo $current_tab; ?>" />
47 <?php
48         if ($current_tab != 0) 
49         {
50                 // save selected options on tab 0 (ATutor settings)
51                 if (isset($_POST['theme']))
52                         echo '  <input type="hidden" name="theme" value="'.$_POST['theme'].'" />'."\n\r";
53                 else if (isset($_SESSION['prefs']['PREF_THEME']))
54                         echo '  <input type="hidden" name="theme" value="'.$_SESSION['prefs']['PREF_THEME'].'" />'."\n\r";
55                 
56                 if (isset($_POST['mnot']))
57                         echo '  <input type="hidden" name="mnot" value="'.$_POST['mnot'].'" />'."\n\r";
58                 else if (isset($this->notify))
59                         echo '  <input type="hidden" name="mnot" value="'.$this->notify.'" />'."\n\r";
60
61                 if (isset($_POST['time_zone']))
62                         echo '  <input type="hidden" name="time_zone" value="'.$_POST['time_zone'].'" />'."\n\r";
63                 else if (isset($_SESSION['prefs']['PREF_TIMEZONE']))
64                         echo '  <input type="hidden" name="time_zone" value="'.$_SESSION['prefs']['PREF_TIMEZONE'].'" />'."\n\r";
65                 
66                 if (isset($_POST['numbering']))
67                         echo '  <input type="hidden" name="numbering" value="'.$_POST['numbering'].'" />'."\n\r";
68                 else if (isset($_SESSION['prefs']['PREF_NUMBERING']))
69                         echo '  <input type="hidden" name="numbering" value="'.$_SESSION['prefs']['PREF_NUMBERING'].'" />'."\n\r";
70                 
71                 if (isset($_POST['use_jump_redirect']))
72                         echo '  <input type="hidden" name="use_jump_redirect" value="'.$_POST['use_jump_redirect'].'" />'."\n\r";
73                 else if (isset($_SESSION['prefs']['PREF_JUMP_REDIRECT']))
74                         echo '  <input type="hidden" name="use_jump_redirect" value="'.$_SESSION['prefs']['PREF_JUMP_REDIRECT'].'" />'."\n\r";
75                 
76                 if (isset($_POST['auto']))
77                         echo '  <input type="hidden" name="auto" value="'.$_POST['auto'].'" />'."\n\r";
78                 else if (isset($this->is_auto_login))
79                         echo '  <input type="hidden" name="auto" value="'.$this->is_auto_login.'" />'."\n\r";
80                 
81                 if (isset($_POST['form_focus']))
82                         echo '  <input type="hidden" name="form_focus" value="'.$_POST['form_focus'].'" />'."\n\r";
83                 else if (isset($_SESSION['prefs']['PREF_FORM_FOCUS']))
84                         echo '  <input type="hidden" name="form_focus" value="'.$_SESSION['prefs']['PREF_FORM_FOCUS'].'" />'."\n\r";
85                 
86                 if (isset($_POST['show_guide']))
87                         echo '  <input type="hidden" name="show_guide" value="'.$_POST['show_guide'].'" />'."\n\r";
88                 else if (isset($_SESSION['prefs']['PREF_SHOW_GUIDE']))
89                         echo '  <input type="hidden" name="show_guide" value="'.$_SESSION['prefs']['PREF_SHOW_GUIDE'].'" />'."\n\r";
90         
91                 if (isset($_POST['content_editor']))
92                         echo '  <input type="hidden" name="content_editor" value="'.$_POST['content_editor'].'" />'."\n\r";
93                 else if (isset($_SESSION['prefs']['PREF_CONTENT_EDITOR']))
94                         echo '  <input type="hidden" name="content_editor" value="'.$_SESSION['prefs']['PREF_CONTENT_EDITOR'].'" />'."\n\r";
95         }
96
97         if ($current_tab != 1) 
98         {
99                 // save selected options on tab 1 (display settings)
100                 if (isset($_POST['fontface']))
101                         echo '  <input type="hidden" name="fontface" value="'.$_POST['fontface'].'" />'."\n\r";
102                 else if (isset($_SESSION['prefs']['PREF_FONT_FACE']))
103                         echo '  <input type="hidden" name="fontface" value="'.$_SESSION['prefs']['PREF_FONT_FACE'].'" />'."\n\r";
104
105                 if (isset($_POST['font_times']))
106                         echo '  <input type="hidden" name="font_times" value="'.$_POST['font_times'].'" />'."\n\r";
107                 else if (isset($_SESSION['prefs']['PREF_FONT_TIMES']))
108                         echo '  <input type="hidden" name="font_times" value="'.$_SESSION['prefs']['PREF_FONT_TIMES'].'" />'."\n\r";
109
110                 if (isset($_POST['fg']))
111                         echo '  <input type="hidden" name="fg" value="'.$_POST['fg'].'" />'."\n\r";
112                 else if (isset($_SESSION['prefs']['PREF_FG_COLOUR']))
113                         echo '  <input type="hidden" name="fg" value="'.$_SESSION['prefs']['PREF_FG_COLOUR'].'" />'."\n\r";
114
115                 if (isset($_POST['bg']))
116                         echo '  <input type="hidden" name="bg" value="'.$_POST['bg'].'" />'."\n\r";
117                 else if (isset($_SESSION['prefs']['PREF_BG_COLOUR']))
118                         echo '  <input type="hidden" name="bg" value="'.$_SESSION['prefs']['PREF_BG_COLOUR'].'" />'."\n\r";
119
120                 if (isset($_POST['hl']))
121                         echo '  <input type="hidden" name="hl" value="'.$_POST['hl'].'" />'."\n\r";
122                 else if (isset($_SESSION['prefs']['PREF_HL_COLOUR']))
123                         echo '  <input type="hidden" name="hl" value="'.$_SESSION['prefs']['PREF_HL_COLOUR'].'" />'."\n\r";
124         }
125                 
126         if ($current_tab != 2) 
127         {
128                 // save selected options on tab 2 (content settings)
129                 if (isset($_POST['use_alternative_to_text']))
130                         echo '  <input type="hidden" name="use_alternative_to_text" value="'.$_POST['use_alternative_to_text'].'" />'."\n\r";
131                 else if (isset($_SESSION['prefs']['PREF_USE_ALTERNATIVE_TO_TEXT']))
132                         echo '  <input type="hidden" name="use_alternative_to_text" value="'.$_SESSION['prefs']['PREF_USE_ALTERNATIVE_TO_TEXT'].'" />'."\n\r";
133
134                 if (isset($_POST['preferred_alt_to_text']))
135                         echo '  <input type="hidden" name="preferred_alt_to_text" value="'.$_POST['preferred_alt_to_text'].'" />'."\n\r";
136                 else if (isset($_SESSION['prefs']['PREF_ALT_TO_TEXT']))
137                         echo '  <input type="hidden" name="preferred_alt_to_text" value="'.$_SESSION['prefs']['PREF_ALT_TO_TEXT'].'" />'."\n\r";
138                 
139                 if (isset($_POST['alt_to_text_append_or_replace']))
140                 echo '  <input type="hidden" name="alt_to_text_append_or_replace" value="'.$_POST['alt_to_text_append_or_replace'].'" />'."\n\r";
141                 else if (isset($_SESSION['prefs']['PREF_ALT_TO_TEXT_APPEND_OR_REPLACE']))
142                 echo '  <input type="hidden" name="alt_to_text_append_or_replace" value="'.$_SESSION['prefs']['PREF_ALT_TO_TEXT_APPEND_OR_REPLACE'].'" />'."\n\r";
143                 
144                 if (isset($_POST['alt_text_prefer_lang']))
145                 echo '  <input type="hidden" name="alt_text_prefer_lang" value="'.$_POST['alt_text_prefer_lang'].'" />'."\n\r";
146                 else if (isset($_SESSION['prefs']['PREF_ALT_TEXT_PREFER_LANG']))
147                 echo '  <input type="hidden" name="alt_text_prefer_lang" value="'.$_SESSION['prefs']['PREF_ALT_TEXT_PREFER_LANG'].'" />'."\n\r";
148                 
149                 if (isset($_POST['use_alternative_to_audio']))
150                 echo '  <input type="hidden" name="use_alternative_to_audio" value="'.$_POST['use_alternative_to_audio'].'" />'."\n\r";
151                 else if (isset($_SESSION['prefs']['PREF_USE_ALTERNATIVE_TO_AUDIO']))
152                 echo '  <input type="hidden" name="use_alternative_to_audio" value="'.$_SESSION['prefs']['PREF_USE_ALTERNATIVE_TO_AUDIO'].'" />'."\n\r";
153                 
154                 if (isset($_POST['preferred_alt_to_audio']))
155                 echo '  <input type="hidden" name="preferred_alt_to_audio" value="'.$_POST['preferred_alt_to_audio'].'" />'."\n\r";
156                 else if (isset($_SESSION['prefs']['PREF_ALT_TO_AUDIO']))
157                 echo '  <input type="hidden" name="preferred_alt_to_audio" value="'.$_SESSION['prefs']['PREF_ALT_TO_AUDIO'].'" />'."\n\r";
158                 
159                 if (isset($_POST['alt_to_audio_append_or_replace']))
160                 echo '  <input type="hidden" name="alt_to_audio_append_or_replace" value="'.$_POST['alt_to_audio_append_or_replace'].'" />'."\n\r";
161                 else if (isset($_SESSION['prefs']['PREF_ALT_TO_AUDIO_APPEND_OR_REPLACE']))
162                 echo '  <input type="hidden" name="alt_to_audio_append_or_replace" value="'.$_SESSION['prefs']['PREF_ALT_TO_AUDIO_APPEND_OR_REPLACE'].'" />'."\n\r";
163                 
164                 if (isset($_POST['alt_audio_prefer_lang']))
165                 echo '  <input type="hidden" name="alt_audio_prefer_lang" value="'.$_POST['alt_audio_prefer_lang'].'" />'."\n\r";
166                 else if (isset($_SESSION['prefs']['PREF_ALT_AUDIO_PREFER_LANG']))
167                 echo '  <input type="hidden" name="alt_audio_prefer_lang" value="'.$_SESSION['prefs']['PREF_ALT_AUDIO_PREFER_LANG'].'" />'."\n\r";
168                 
169                 if (isset($_POST['use_alternative_to_visual']))
170                 echo '  <input type="hidden" name="use_alternative_to_visual" value="'.$_POST['use_alternative_to_visual'].'" />'."\n\r";
171                 else if (isset($_SESSION['prefs']['PREF_USE_ALTERNATIVE_TO_VISUAL']))
172                 echo '  <input type="hidden" name="use_alternative_to_visual" value="'.$_SESSION['prefs']['PREF_USE_ALTERNATIVE_TO_VISUAL'].'" />'."\n\r";
173                 
174                 if (isset($_POST['preferred_alt_to_visual']))
175                 echo '  <input type="hidden" name="preferred_alt_to_visual" value="'.$_POST['preferred_alt_to_visual'].'" />'."\n\r";
176                 else if (isset($_SESSION['prefs']['PREF_ALT_TO_VISUAL']))
177                 echo '  <input type="hidden" name="preferred_alt_to_visual" value="'.$_SESSION['prefs']['PREF_ALT_TO_VISUAL'].'" />'."\n\r";
178                 
179                 if (isset($_POST['alt_to_visual_append_or_replace']))
180                 echo '  <input type="hidden" name="alt_to_visual_append_or_replace" value="'.$_POST['alt_to_visual_append_or_replace'].'" />'."\n\r";
181                 else if (isset($_SESSION['prefs']['PREF_ALT_TO_VISUAL_APPEND_OR_REPLACE']))
182                 echo '  <input type="hidden" name="alt_to_visual_append_or_replace" value="'.$_SESSION['prefs']['PREF_ALT_TO_VISUAL_APPEND_OR_REPLACE'].'" />'."\n\r";
183                 
184                 if (isset($_POST['alt_visual_prefer_lang']))
185                 echo '  <input type="hidden" name="alt_visual_prefer_lang" value="'.$_POST['alt_visual_prefer_lang'].'" />'."\n\r";
186                 else if (isset($_SESSION['prefs']['PREF_ALT_VISUAL_PREFER_LANG']))
187                 echo '  <input type="hidden" name="alt_visual_prefer_lang" value="'.$_SESSION['prefs']['PREF_ALT_VISUAL_PREFER_LANG'].'" />'."\n\r";
188         }
189
190         if ($current_tab != 3) 
191         {
192                 // save selected options on tab 3 (tool settings)
193                 if (isset($_POST['dictionary_val']))
194                         echo '  <input type="hidden" name="dictionary_val" value="'.$_POST['dictionary_val'].'" />'."\n\r";
195                 else if (isset($_SESSION['prefs']['PREF_DICTIONARY']))
196                         echo '  <input type="hidden" name="dictionary_val" value="'.$_SESSION['prefs']['PREF_DICTIONARY'].'" />'."\n\r";
197
198                 if (isset($_POST['thesaurus_val']))
199                         echo '  <input type="hidden" name="thesaurus_val" value="'.$_POST['thesaurus_val'].'" />'."\n\r";
200                 else if (isset($_SESSION['prefs']['PREF_THESAURUS']))
201                         echo '  <input type="hidden" name="thesaurus_val" value="'.$_SESSION['prefs']['PREF_THESAURUS'].'" />'."\n\r";
202
203                 if (isset($_POST['encyclopedia_val']))
204                         echo '  <input type="hidden" name="encyclopedia_val" value="'.$_POST['encyclopedia_val'].'" />'."\n\r";
205                 else if (isset($_SESSION['prefs']['PREF_ENCYCLOPEDIA']))
206                         echo '  <input type="hidden" name="encyclopedia_val" value="'.$_SESSION['prefs']['PREF_ENCYCLOPEDIA'].'" />'."\n\r";
207
208                 if (isset($_POST['atlas_val']))
209                         echo '  <input type="hidden" name="atlas_val" value="'.$_POST['atlas_val'].'" />'."\n\r";
210                 else if (isset($_SESSION['prefs']['PREF_ATLAS']))
211                         echo '  <input type="hidden" name="atlas_val" value="'.$_SESSION['prefs']['PREF_ATLAS'].'" />'."\n\r";
212
213                 if (isset($_POST['note_taking_val']))
214                         echo '  <input type="hidden" name="note_taking_val" value="'.$_POST['note_taking_val'].'" />'."\n\r";
215                 else if (isset($_SESSION['prefs']['PREF_NOTE_TAKING']))
216                         echo '  <input type="hidden" name="note_taking_val" value="'.$_SESSION['prefs']['PREF_NOTE_TAKING'].'" />'."\n\r";
217
218                 if (isset($_POST['calculator_val']))
219                         echo '  <input type="hidden" name="calculator_val" value="'.$_POST['calculator_val'].'" />'."\n\r";
220                 else if (isset($_SESSION['prefs']['PREF_CALCULATOR']))
221                         echo '  <input type="hidden" name="calculator_val" value="'.$_SESSION['prefs']['PREF_CALCULATOR'].'" />'."\n\r";
222
223                 if (isset($_POST['abacus_val']))
224                         echo '  <input type="hidden" name="abacus_val" value="'.$_POST['abacus_val'].'" />'."\n\r";
225                 else if (isset($_SESSION['prefs']['PREF_ABACUS']))
226                         echo '  <input type="hidden" name="abacus_val" value="'.$_SESSION['prefs']['PREF_ABACUS'].'" />'."\n\r";
227         }
228         
229         if ($current_tab != 4) 
230         {
231                 // save selected options on tab 4 (control settings)
232                 if (isset($_POST['show_contents']))
233                         echo '  <input type="hidden" name="show_contents" value="'.$_POST['show_contents'].'" />'."\n\r";
234                 else if (isset($_SESSION['prefs']['PREF_SHOW_CONTENTS']))
235                         echo '  <input type="hidden" name="show_contents" value="'.$_SESSION['prefs']['PREF_SHOW_CONTENTS'].'" />'."\n\r";
236
237                 if (isset($_POST['show_next_previous_buttons']))
238                         echo '  <input type="hidden" name="show_next_previous_buttons" value="'.$_POST['show_next_previous_buttons'].'" />'."\n\r";
239                 else if (isset($_SESSION['prefs']['PREF_SHOW_NEXT_PREVIOUS_BUTTONS']))
240                         echo '  <input type="hidden" name="show_next_previous_buttons" value="'.$_SESSION['prefs']['PREF_SHOW_NEXT_PREVIOUS_BUTTONS'].'" />'."\n\r";
241
242                 if (isset($_POST['show_bread_crumbs']))
243                         echo '  <input type="hidden" name="show_bread_crumbs" value="'.$_POST['show_bread_crumbs'].'" />'."\n\r";
244                 else if (isset($_SESSION['prefs']['PREF_SHOW_BREAD_CRUMBS']))
245                         echo '  <input type="hidden" name="show_bread_crumbs" value="'.$_SESSION['prefs']['PREF_SHOW_BREAD_CRUMBS'].'" />'."\n\r";
246         }
247
248         echo '<fieldset class="group_form">';
249         include(AT_INCLUDE_PATH .'../users/'.$tabs[$current_tab][1]);
250         echo '</fieldset>';
251 //      include(getcwd().'/'.$tabs[$current_tab][1]);
252
253 ?>
254         <div class="row buttons">
255 <?php 
256 if ($_SESSION['course_id'] == -1) // admin login 
257 {
258 ?>
259                 <input type="submit" name="set_default" value="<?php echo _AT('factory_default'); ?>" accesskey="d" />
260 <?php 
261 }
262 else  // user login 
263 {
264 ?>
265                 <input type="submit" name="set_default" value="<?php echo _AT('reapply_default'); ?>" accesskey="d" title="<?php echo _AT('reapply_default'); ?> - Alt-d" style="float:left;"/>
266 <?php 
267 }
268 ?>
269                 <input type="submit" name="submit" value="<?php echo _AT('apply'); ?>" accesskey="s" />
270                 <input type="reset" name="reset" value="<?php echo _AT('reset'); ?>" />
271         </div>
272 </div>
273 </form> 
274 <?php
275 if($_SESSION['course_id'] == "-1"){
276 echo '</div>';
277
278 }
279
280
281 require(AT_INCLUDE_PATH.'footer.inc.php'); ?>