changed git call from https to git readonly
[atutor.git] / mods / atalker / admin / admin_voice_html.php
1 <?php
2 /****************************************************************/
3 /* ATalker                                                                                                      */
4 /****************************************************************/
5 /* Copyright (c) 2002-2005 by Greg Gay                                  */
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: admin_voice_html.php 5123 2005-07-12 14:59:03Z greg
14
15 // Generate the HTML for the Administrator's  Voice Manager
16
17 ?>
18
19
20 <table class="data" style="width:95%;" summary="" rules="cols" >
21 <tfoot><tr><td colspan="3">             
22 <input type="submit" class="submit" name="create" value="<?php echo _AT('create_voice'); ?>" />
23 <input type="submit" class="submit" name="remove" value="<?php echo _AT('remove_voice'); ?>" />
24 </td></tr>
25 </tfoot>
26 <tbody>
27 <tr>
28 <td colspan="3">
29
30         <script type="text/javascript">
31         <!--
32         function Checkall(form){ 
33         for (var i = 0; i < form.elements.length; i++){    
34         eval("form.elements[" + i + "].checked = form.checkall.checked");  
35         } 
36         }
37         function selectCat(catID, cat) {
38                 for (var i=0;i<document.form.elements.length;i++) {
39                         var e = document.form.elements[i];
40                         if ((e.name == 'add_questions[' + catID + '][]') && (e.type=='checkbox'))
41                                 e.checked = cat.checked;
42                 }
43         }
44         -->
45         </script>
46         <br /><br />
47         <!-- Note that validation will fail here when language variable names begin with something other than a letter
48                 e.g _AT(404_blurb) fails
49         -->
50         
51         <h3><?php echo _AT('manage_atutor_voice'); ?></h3>
52
53 <?php
54
55         
56         $sql = "SELECT * from ".TABLE_PREFIX."language_text WHERE language_code = '".$_SESSION['lang']."' AND variable = '_template'";
57         $result = mysql_query($sql, $db);
58         $num_rows = mysql_num_rows($result);
59         $num_pages = ($num_rows/20);
60
61         if(!$_REQUEST['page'] || $_GET['page'] == '1'){
62                 $sql .= " LIMIT 20";
63         }else if($_REQUEST['page'] =="all"){
64         
65         }else{
66                 $start_limit = ((intval($_REQUEST['page'])-2)*20);
67                 $end_limit = ($start_limit +20);
68                 $sql .= " LIMIT ".$end_limit.', 20';
69         }
70 ?>
71         <table width="100%">
72                 <tr>
73                         <td colspan="3"><?php echo _AT('pages'); ?>:
74         
75         <?php
76                 // create the paginator
77                 $p = '1';
78                 for ($i=1; $i < $num_pages; $i++){
79                         if($i == $_REQUEST['page']){
80                                 echo ' '.$p.' |';
81                         }else{
82                                 echo '<a href="'.$_base_url.'mods/atalker/admin/admin_index.php?page='.$p.SEP.'tab='.$tab.SEP.'postdata='.urlencode($postdata).'">'.$p.'</a> |'."\n";
83                         }
84                         $p++;
85                 }
86                 
87         ?>
88                 <a href="<?php echo $base_url;?>mods/atalker/admin/admin_index.php?<?php echo 'page=all'.SEP.'tab='.$tab.SEP.'postdata='.urlencode($postdata); ?>"><?php echo _AT('all'); ?></a>
89                 
90                         </td>
91                 </tr>
92                 <tr>
93                         <th><input type="checkbox" name="checkall" onclick="Checkall(form);" id="selectall" title="<?php echo _AT('select_unselect'); ?>" />&nbsp;</th>
94                         <th scope="col"><?php echo _AT('variable'); ?></th><th scope="col"><?php echo _AT('text'); ?></th>
95                 </tr>
96         
97         <?php           
98         
99                 $result = mysql_query($sql, $db);
100                 while($row = mysql_fetch_array($result)){
101                         if(strlen($row['text']) > 100){
102                                 $chars = '('._AT(characters_total).' '.strlen($row['text']).')';
103                                 $truncate = "...";
104                         }
105                 echo '<tr><td valign="top"><input type="checkbox" id="'.$row['term'].'" name="check[]" value="'.$row['term'].'" /></td><td valign="top"><label for="'.$row['term'].'">';
106                 
107                 // check if template speech file exits, and create a link to the file if it does
108                 if(file_exists(AT_SPEECH_TEMPLATE_DIR.$row['term'].'.mp3')){
109                 
110                         //echo '<a href="'.AT_SPEECH_TEMPLATE_URL.$row['term'].'.mp3">'.$row['term'].' (mp3)</a>';
111                         echo '<a href="'.$base_url.'mods/atalker/admin/play_voice.php?play_voice='.$row['term'].'.mp3">'.$row['term'].' (mp3)</a>';
112                 
113                 }else if(file_exists(AT_SPEECH_TEMPLATE_DIR.$row['term'].'.ogg')){
114                 
115                         echo '<a href="'.$base_url.'mods/atalker/admin/play_voice.php?play_voice='.$row['term'].'.ogg">'.$row['term'].' (ogg)</a>';
116                         //echo '<a href="'.AT_SPEECH_TEMPLATE_URL.$row['term'].'.ogg">'.$row['term'].' (ogg)</a>';
117                 
118                 }else{
119                 echo $row['term'];
120                 }
121         
122                 echo '</label></td><td>'.stripslashes(htmlspecialchars($row['text'])).'</td></tr>'."\n";
123                         $truncate = "";
124                         $chars = '';
125                 }
126                 echo '</table>';
127         ?>
128         
129                         </td>
130                 </tr>
131         </tbody>
132         </table>