made a copy
[atutor.git] / include / lib / pref_tab_functions.inc.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                                                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002-2008 by Greg Gay, Joel Kronenberg & Heidi Hazelton*/
6 /* Adaptive Technology Resource Centre / University of Toronto                  */
7 /* http://atutor.ca                                                                                                             */
8 /*                                                                                                                                              */
9 /* This program is free software. You can redistribute it and/or                */
10 /* modify it under the terms of the GNU General Public License                  */
11 /* as published by the Free Software Foundation.                                                */
12 /************************************************************************/
13 // $Id$
14
15 if (!defined('AT_INCLUDE_PATH')) { exit; }
16
17
18 function get_tabs() {
19         global $_config;
20
21         //these are the _AT(x) variable names and their include file
22         /* tabs[tab_id] = array(tab_name, file_name, accesskey) */
23         $tabs[0] = array('atutor_settings', 'atutor_settings.inc.php', 'n');
24         $tabs[1] = array('display_settings', 'display_settings.inc.php', 'p');
25         
26         if(!$_config['just_social']){
27                 $tabs[2] = array('content_settings', 'content_settings.inc.php', 'g');
28                 $tabs[3] = array('tool_settings', 'tool_settings.inc.php', 'r');
29                 $tabs[4] = array('control_settings', 'control_settings.inc.php', 'a');  
30         }
31         return $tabs;
32 }
33
34 function output_tabs($current_tab, $changes) {
35         global $_base_path;
36         $tabs = get_tabs();
37         $num_tabs = count($tabs);
38 ?>
39         <table class="etabbed-table" border="0" cellpadding="0" cellspacing="0">
40         <tr>            
41                 <?php 
42                 for ($i=0; $i < $num_tabs; $i++): 
43                         if ($current_tab == $i):?>
44                                 <td class="selected" style="white-space: nowrap">
45                                         <?php if ($changes[$i]): ?>
46                                                 <img src="<?php echo $_base_path; ?>images/changes_bullet.gif" alt="<?php echo _AT('usaved_changes_made'); ?>" height="12" width="15" />
47                                         <?php echo '<input type="submit" name="button_'.$i.'" value="'._AT($tabs[$i][0]).'" title="'._AT($tabs[$i][0]).' - alt '.$tabs[$i][2].'" class="buttontab" accesskey="'.$tabs[$i][2].'" onmouseover="this.style.cursor=\'pointer\';" '.$clickEvent.' />'; ?>
48                                         <?php endif; ?>
49                                         <?php echo _AT($tabs[$i][0]); ?>
50                                 </td>
51                                 <td class="tab-spacer">&nbsp;</td>
52                         <?php else: ?>
53                                 <td class="tab" style="white-space: nowrap">
54                                         <?php if ($changes[$i]): ?>
55                                                 <img src="<?php echo $_base_path; ?>images/changes_bullet.gif" alt="<?php echo _AT('usaved_changes_made'); ?>" height="12" width="15" />
56                                         <?php endif; ?>
57
58                                         <?php echo '<input type="submit" name="button_'.$i.'" value="'._AT($tabs[$i][0]).'" title="'._AT($tabs[$i][0]).' - alt '.$tabs[$i][2].'" class="buttontab" accesskey="'.$tabs[$i][2].'" onmouseover="this.style.cursor=\'pointer\';" '.$clickEvent.' />'; ?>
59                                 </td>
60                                 <td class="tab-spacer">&nbsp;</td>
61                         <?php endif; ?>
62                 <?php endfor; ?>
63                 <td >&nbsp;</td>
64         </tr>
65         </table>
66 <?php }
67
68 // returns given $languges in html <option> tag
69 function output_language_options($languages, $selected_lang)
70 {
71         foreach ($languages as $codes)
72         {
73                 $language = current($codes);
74                 
75                 $lang_code = $language->getCode();
76                 $lang_native_name = $language->getNativeName();
77                 $lang_english_name = $language->getEnglishName()
78 ?>
79                 <option value="<?php echo $lang_code ?>" <?php if ($selected_lang == $lang_code) echo 'selected="selected"'; ?>><?php echo $lang_english_name . ' - '. $lang_native_name; ?></option>
80 <?php
81         }
82 }
83
84 ?>