changed git call from https to git readonly
[atutor.git] / mods / atalker / template_reader.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: template_reader.php 5123 2005-07-12 14:59:03Z greg $
14
15 // This file is called into the _AT() function used to generate language (see include/lib/output.inc.php), to wrap a
16 // SPAN element with a mouseover/onfocus around it 
17 // e.g.  
18 //              global $_base_path;
19 //              /////wrap a speech mouseover if audio file exists
20 //              require($_SERVER['DOCUMENT_ROOT'].$_base_path.'mods/atalker/template_reader.php');
21 //
22 // This script accommodatesinterface sound for MSIE and Mozilla browsers. 
23 // See the ATalker theme header.html.php file for the evalSound and playSound javascripts
24
25         global $atalker_on;
26
27                 if($_SESSION['atalker_on'] == '1'){
28
29                         global $_base_path, $_base_href, $_SESSION;
30                         define('AT_SPEECH_TEMPLATE_DIR', $_SERVER['DOCUMENT_ROOT'].$_base_path.'content/template/'.$_SESSION['lang'].'/');
31                         define('AT_SPEECH_TEMPLATE_URL', $_base_href.'content/template/'.$_SESSION['lang'].'/');
32
33
34                         // If the browser is MSIE, handle interface sound a little differently
35                         if(stristr( $_SERVER['HTTP_USER_AGENT'], "MSIE")){
36
37                                 if(file_exists(AT_SPEECH_TEMPLATE_DIR.$format.'.ogg')){
38                                         
39                                         $outString =$outString ='<span onmouseover="playSound(\''.AT_SPEECH_TEMPLATE_URL.$format.'.ogg\')" onfocus="playSound(\''.AT_SPEECH_TEMPLATE_URL.$format.'.ogg\')"> '.$outString.'</span>';
40
41                                 }else if(file_exists(AT_SPEECH_TEMPLATE_DIR.$format.'.mp3')){
42         
43                                         $outString ='<span onmouseover="playSound(\''.AT_SPEECH_TEMPLATE_URL.$format.'.mp3\')"  onfocus="playSound(\''.AT_SPEECH_TEMPLATE_URL.$format.'.mp3\')"> '.$outString.'</span>';
44                                 }
45
46                         }else{
47                         
48                         // Mozilla browsers
49                                 if(file_exists(AT_SPEECH_TEMPLATE_DIR.$format.'.ogg')){
50                                         /* Modified by Eura Ercolani: mimetype support - BEGIN */
51                                         
52                                         //$outString ='<span onmouseover="javascript:evalSound(\''.$format.'\')" onfocus="javascript:evalSound(\''.$format.'\')"> '.$outString.'</span>';
53                                         $outString ='<span onMouseOver="evalSound(\''.$format.'\');" onMouseOut="stopSound(\''.$format.'\');"> '.$outString.'</span>';
54                                         /* Modified by Eura Ercolani: mimetype support - END */
55
56                                         if(!$embed[$format]){
57         
58                                                 /* Modified by Eura Ercolani: mimetype support - BEGIN */
59                                                 //$embed[$format] ='<embed src="'.AT_SPEECH_TEMPLATE_URL.$format.'.ogg" autostart="false" hidden="true" volumn="8" id="'.$format.'"  name="'.$format.'" enablejavascript="true"></embed>'."\n";
60
61                                                 $embed[$format] ='<embed src="'.AT_SPEECH_TEMPLATE_URL.$format.'.ogg" autostart="false" hidden="true" volumn="8" id="'.$format.'"  name="'.$format.'" enablejavascript="true" type="'.$_SESSION['mp3HiddenMimeType'].'"></embed>'."\n";
62                                                 /* Modified by Eura Ercolani: mimetype support - BEGIN */
63
64                                                 $outString .= $embed[$format];
65                                         }
66         
67                                 }else if(file_exists(AT_SPEECH_TEMPLATE_DIR.$format.'.mp3')){
68         
69         
70                                         /* Modified by Eura Ercolani: mimetype support - BEGIN */
71                                         //$outString ='<span onmouseover="javascript:evalSound(\''.$format.'\')" onfocus="javascript:evalSound(\''.$format.'\')"> '.$outString.'</span>';
72                                         $outString ='<span onMouseOver="evalSound(\''.$format.'\');" onMouseOut="stopSound(\''.$format.'\')"> '.$outString.'</span>';
73                                         /* Modified by Eura Ercolani: mimetype support - END */
74         
75                                         if(!$embed[$format]){
76                                                 /* Modified by Eura Ercolani: mimetype support - BEGIN */
77                                                 //$embed[$format] ='<embed src="'.AT_SPEECH_TEMPLATE_URL.$format.'.mp3" autostart="false" hidden="true" volumn="8" id="'.$format.'"  name="'.$format.'" enablejavascript="true"></embed>'."\n";
78                                                 $embed[$format] ='<embed src="'.AT_SPEECH_TEMPLATE_URL.$format.'.mp3" autostart="false" hidden="true" volumn="8" id="'.$format.'"  name="'.$format.'" enablejavascript="true" type="'.$_SESSION['mp3HiddenMimeType'].'"></embed>'."\n";
79                                                 /* Modified by Eura Ercolani: mimetype support - END */
80                                                 $outString .= $embed[$format];
81                                         }
82                                 }
83                         }
84
85                 }
86 ?>