Testtool:

- Bugfix für gelevelte Gebiete
- Fortschrittsbalken bei gelevelten Gebieten
- Sound wird über Flash Plugin abgespielt
This commit is contained in:
Andreas Österreicher
2010-01-22 10:12:43 +00:00
parent 62309a12d0
commit 82210c5ebb
10 changed files with 282 additions and 14 deletions
+26 -5
View File
@@ -189,13 +189,14 @@ if(isset($_POST['submitaudio']))
{
$filename = $_FILES['audio']['tmp_name'];
//File oeffnen
$fp = fopen($filename,'r');
$content = file_get_contents($filename);
/*$fp = fopen($filename,'r');
//auslesen
$content = fread($fp, filesize($filename));
fclose($fp);
fclose($fp);*/
//die('<br><br>'.$content);
//base64 codieren
$content = base64_encode($content);
$frage = new frage();
if($frage->getFrageSprache($_GET['frage_id'], $sprache))
{
@@ -594,7 +595,16 @@ if($frage_id!='')
}
if($frage->audio!='')
{
echo '<br /><embed autostart="false" src="../sound.php?src=frage&amp;frage_id='.$frage->frage_id.'&amp;sprache='.$sprache.'" height="20" width="250"/>';
//echo '<br /><embed autostart="false" src="../sound.php?src=frage&amp;frage_id='.$frage->frage_id.'&amp;sprache='.$sprache.'" height="20" width="250"/>';
echo '
<script language="JavaScript" src="../audio-player/audio-player.js"></script>
<object type="application/x-shockwave-flash" data="../audio-player/player.swf" id="audioplayer1" height="24" width="290">
<param name="movie" value="../audio_player/player.swf" />
<param name="FlashVars" value="playerID=audioplayer1&amp;soundFile=../sound.php%3Fsrc%3Dfrage%26frage_id%3D'.$frage->frage_id.'%26sprache%3D'.$sprache.'" />
<param name="quality" value="high" />
<param name="menu" value="false" />
<param name="wmode" value="transparent" />
</object>';
}
echo '</td>';
//Zusaetzliche EingabeFelder anzeigen
@@ -671,7 +681,18 @@ if($frage_id!='')
<td><img src='../bild.php?src=vorschlag&amp;vorschlag_id=$vs->vorschlag_id&amp;sprache=$sprache' /></td>
<td>";
if($vs->audio!='')
echo "<embed autostart='false' src='../sound.php?src=vorschlag&amp;vorschlag_id=".$vs->vorschlag_id."&amp;sprache=".$sprache."' height='20' width='150'/>";
{
//echo "<embed autostart='false' src='../sound.php?src=vorschlag&amp;vorschlag_id=".$vs->vorschlag_id."&amp;sprache=".$sprache."' height='20' width='150'/>";
echo '
<script language="JavaScript" src="../audio-player/audio-player.js"></script>
<object type="application/x-shockwave-flash" data="../audio-player/player.swf" id="audioplayer1" height="24" width="290">
<param name="movie" value="../audio_player/player.swf" />
<param name="FlashVars" value="playerID=audioplayer1&amp;soundFile=../sound.php%3Fsrc%3Dvorschlag%26vorschlag_id%3D'.$vs->vorschlag_id.'%26sprache%3D'.$sprache.'" />
<param name="quality" value="high" />
<param name="menu" value="false" />
<param name="wmode" value="transparent" />
</object>';
}
echo " </td>
<td><a href='$PHP_SELF?gebiet_id=$gebiet_id&amp;nummer=$nummer&amp;frage_id=$frage->frage_id&amp;vorschlag_id=$vs->vorschlag_id'>edit</a></td>
<td><a href='$PHP_SELF?gebiet_id=$gebiet_id&amp;nummer=$nummer&amp;frage_id=$frage->frage_id&amp;vorschlag_id=$vs->vorschlag_id&amp;type=delete' onclick=\"return confirm('Wollen Sie diesen Eintrag wirklich loeschen?')\">delete</a></td>
@@ -0,0 +1 @@
var AudioPlayer=function(){var G=[];var D;var F="";var A={};var E=-1;function B(H){if(document.all&&!window[H]){for(var I=0;I<document.forms.length;I++){if(document.forms[I][H]){return document.forms[I][H];break}}}return document.all?window[H]:document[H]}function C(H,I,J){B(H).addListener(I,J)}return{setup:function(I,H){F=I;A=H},getPlayer:function(H){return B(H)},addListener:function(H,I,J){C(H,I,J)},embed:function(L,P){var J={};var N;var H;var Q;var I;var O={};var K={};var M={};for(N in A){J[N]=A[N]}for(N in P){J[N]=P[N]}if(J.transparentpagebg=="yes"){O.bgcolor="#FFFFFF";O.wmode="transparent"}else{if(J.pagebg){O.bgcolor="#"+J.pagebg}O.wmode="opaque"}O.menu="false";for(N in J){if(N=="pagebg"||N=="width"||N=="transparentpagebg"){continue}K[N]=J[N]}M.name=L;M.style="outline: none";K.playerID=L;audioplayer_swfobject.embedSWF(F,L,J.width.toString(),"24","9",false,K,O,M);G.push(L)},syncVolumes:function(H,J){E=J;for(var I=0;I<G.length;I++){if(G[I]!=H){B(G[I]).setVolume(E)}}},activate:function(H,I){if(D&&D!=H){B(D).close()}D=H},load:function(J,H,K,I){B(J).load(H,K,I)},close:function(H){B(H).close();if(H==D){D=null}},open:function(H,I){if(I==undefined){I=1}B(H).open(I==undefined?0:I-1)},getVolume:function(H){return E}}}()
@@ -0,0 +1,127 @@
var AudioPlayer = function () {
var instances = [];
var activePlayerID;
var playerURL = "";
var defaultOptions = {};
var currentVolume = -1;
function getPlayer(playerID) {
if (document.all && !window[playerID]) {
for (var i = 0; i < document.forms.length; i++) {
if (document.forms[i][playerID]) {
return document.forms[i][playerID];
break;
}
}
}
return document.all ? window[playerID] : document[playerID];
}
function addListener (playerID, type, func) {
getPlayer(playerID).addListener(type, func);
}
return {
setup: function (url, options) {
playerURL = url;
defaultOptions = options;
},
getPlayer: function (playerID) {
return getPlayer(playerID);
},
addListener: function (playerID, type, func) {
addListener(playerID, type, func);
},
embed: function (elementID, options) {
var instanceOptions = {};
var key;
var so;
var bgcolor;
var wmode;
var flashParams = {};
var flashVars = {};
var flashAttributes = {};
// Merge default options and instance options
for (key in defaultOptions) {
instanceOptions[key] = defaultOptions[key];
}
for (key in options) {
instanceOptions[key] = options[key];
}
if (instanceOptions.transparentpagebg == "yes") {
flashParams.bgcolor = "#FFFFFF";
flashParams.wmode = "transparent";
} else {
if (instanceOptions.pagebg) {
flashParams.bgcolor = "#" + instanceOptions.pagebg;
}
flashParams.wmode = "opaque";
}
flashParams.menu = "false";
for (key in instanceOptions) {
if (key == "pagebg" || key == "width" || key == "transparentpagebg") {
continue;
}
flashVars[key] = instanceOptions[key];
}
flashAttributes.name = elementID;
flashAttributes.style = "outline: none";
flashVars.playerID = elementID;
swfobject.embedSWF(playerURL, elementID, instanceOptions.width.toString(), "24", "9", false, flashVars, flashParams, flashAttributes);
instances.push(elementID);
},
syncVolumes: function (playerID, volume) {
currentVolume = volume;
for (var i = 0; i < instances.length; i++) {
if (instances[i] != playerID) {
getPlayer(instances[i]).setVolume(currentVolume);
}
}
},
activate: function (playerID, info) {
if (activePlayerID && activePlayerID != playerID) {
getPlayer(activePlayerID).close();
}
activePlayerID = playerID;
},
load: function (playerID, soundFile, titles, artists) {
getPlayer(playerID).load(soundFile, titles, artists);
},
close: function (playerID) {
getPlayer(playerID).close();
if (playerID == activePlayerID) {
activePlayerID = null;
}
},
open: function (playerID, index) {
if (index == undefined) {
index = 1;
}
getPlayer(playerID).open(index == undefined ? 0 : index-1);
},
getVolume: function (playerID) {
return currentVolume;
}
}
}();
File diff suppressed because one or more lines are too long
+19
View File
@@ -0,0 +1,19 @@
Copyright (c) 2008 Martin Laine
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Binary file not shown.
+93 -3
View File
@@ -297,8 +297,45 @@ if($result_pruefling = $db->db_query($qry_pruefling))
}
}
$fortschrittsbalken='';
if($levelgebiet)
{
$max = $gebiet->maxfragen;
$aktuell=0;
$qry = "SELECT count(*) as anzahl FROM testtool.tbl_pruefling_frage JOIN testtool.tbl_frage USING(frage_id)
WHERE pruefling_id='".addslashes($_SESSION['pruefling_id'])."'
AND gebiet_id='$gebiet_id'";
if($result_aktuell = $db->db_query($qry))
{
if($row_aktuell = $db->db_fetch_object($result_aktuell))
{
$aktuell = $row_aktuell->anzahl;
}
}
$psolved = $aktuell/$max*100;
//$fortschrittsbalken .= "$aktuell / $max";
$fortschrittsbalken .= '
<table width="300" style="border: 1px solid black;" cellpadding="0" cellspacing="0" background="../../skin/images/bg_.gif">
<tr>
<td valign="top" style="height:1px;font-size:2px;">
<table cellpadding="0" cellspacing="0" style="border:0px;height:1px;font-size:2px;">
<tr>
<td nowrap="nowrap" style="height:1px;font-size:2px;">
<font size="2" face="Arial, Helvetica, sans-serif">
<img src="../../skin/images/entry.gif" width="'.($psolved*3).'" height="10" alt="" border="1" />
</font>
</td>
</tr>
</table>
</td>
</tr>
</table>';
$fortschrittsbalken .= '<span class="smallb"><b> '.$aktuell.' / '.$max.'</b> ['.number_format($psolved,1,'.','').'%]</span>';
}
//Zeit des Gebietes holen
echo '<table width="100%"><tr><td>'.$info.'</td><td align="right">';
echo '<table width="100%"><tr><td valign="top">'.$info.'</td><td align="center">'.$fortschrittsbalken.'</td><td valign="top" align="right">';
if($demo)
{
@@ -392,7 +429,18 @@ if($frage->frage_id!='')
//Sound einbinden
if($frage->audio!='')
echo '<embed autostart="false" src="sound.php?src=frage&amp;frage_id='.$frage->frage_id.'&amp;sprache='.$_SESSION['sprache'].'" height="20" width="250"/><br />';
{
//echo '<embed autostart="false" src="sound.php?src=frage&amp;frage_id='.$frage->frage_id.'&amp;sprache='.$_SESSION['sprache'].'" height="20" width="250"/><br />';
echo '
<script language="JavaScript" src="audio-player/audio-player.js"></script>
<object type="application/x-shockwave-flash" data="audio-player/player.swf" id="audioplayer1" height="24" width="290">
<param name="movie" value="audio_player/player.swf" />
<param name="FlashVars" value="playerID=audioplayer1&amp;soundFile=sound.php%3Fsrc%3Dfrage%26frage_id%3D'.$frage->frage_id.'%26sprache%3D'.$_SESSION['sprache'].'" />
<param name="quality" value="high" />
<param name="menu" value="false" />
<param name="wmode" value="transparent" />
</object>';
}
echo "$frage->text<br/><br/>\n";
//Vorschlaege laden
@@ -435,7 +483,18 @@ if($frage->frage_id!='')
if($vorschlag->bild!='')
echo "<img class='testtoolvorschlag' src='bild.php?src=vorschlag&amp;vorschlag_id=$vorschlag->vorschlag_id&amp;sprache=".$_SESSION['sprache']."' /><br/>";
if($vorschlag->audio!='')
echo '<embed autostart="false" src="sound.php?src=vorschlag&amp;vorschlag_id='.$vorschlag->vorschlag_id.'&amp;sprache='.$_SESSION['sprache'].'" height="20" width="100"/><br />';
{
//echo '<embed autostart="false" src="sound.php?src=vorschlag&amp;vorschlag_id='.$vorschlag->vorschlag_id.'&amp;sprache='.$_SESSION['sprache'].'" height="20" width="100"/><br />';
echo '
<script language="JavaScript" src="audio-player/audio-player.js"></script>
<object type="application/x-shockwave-flash" data="audio-player/player.swf" id="audioplayer1" height="24" width="290">
<param name="movie" value="audio_player/player.swf" />
<param name="FlashVars" value="playerID=audioplayer1&amp;soundFile=sound.php%3Fsrc%3Dvorschlag%26vorschlag_id%3D'.$vs->vorschlag_id.'%26sprache%3D'.$_SESSION['sprache'].'" />
<param name="quality" value="high" />
<param name="menu" value="false" />
<param name="wmode" value="transparent" />
</object>';
}
if($vorschlag->text!='')
echo $vorschlag->text.'<br/>';
echo "</td>";
@@ -514,6 +573,37 @@ if($frage->frage_id!='')
}
}
}
else
{
//Naechste Frage holen und Weiter-Button anzeigen
$frage = new frage();
$nextfrage = $frage->getNextFrage($gebiet_id, $_SESSION['pruefling_id'], $frage_id, $demo);
if($nextfrage)
{
echo " <a href='$PHP_SELF?gebiet_id=$gebiet_id&amp;frage_id=$nextfrage' class='Item'>Weiter &gt;&gt;</a>";
}
else
{
if($demo)
{
//Naechste Frage holen und Weiter-Button anzeigen
//$frage = new frage();
//$nextfrage = $frage->getNextFrage($gebiet_id, $_SESSION['pruefling_id'], $frage_id, $demo);
$qry = "SELECT count(*) as anzahl FROM testtool.tbl_frage
WHERE tbl_frage.gebiet_id='".addslashes($gebiet_id)."'
AND demo ";
if($row = $db->db_fetch_object($db->db_query($qry)))
{
if($row->anzahl>1)
{
//Bei Demos den Weiter-Button nur anzeigen, wenn ausser der Startseite noch andere Demoseiten vorhanden sind
echo " <a href='$PHP_SELF?gebiet_id=$gebiet_id' class='Item'>Weiter &gt;&gt;</a>";
}
}
}
}
}
echo '</center>';
}
+1 -1
View File
@@ -31,6 +31,6 @@
<body>
<br><br><br>
<center><b>Die Maximalzeit für dieses Gebiet ist bereits abgelaufen!</b></center>
<center><b>Die Maximalzeit für dieses Gebiet ist abgelaufen, oder alle Fragen wurden beantwortet!</b></center>
</body>
</html>
+11 -4
View File
@@ -44,12 +44,19 @@ else
if($qry!='')
{
//Header fuer Sound schicken
header("Content-type: audio/mpeg");
//header("Content-type: audio/wav");
header("Content-type: audio/mp3");
//base64 Werte in Zeichen
$result = $db->db_query($qry);
$row = $db->db_fetch_object($result);
//base64 Werte in Zeichen umwandeln und ausgeben
echo base64_decode($row->audio);
$content = base64_decode($row->audio);
$len = strlen($content);
header("Content-Length: $len\n");
//header("Content-type: audio/wav");
//ausgeben
echo $content;
}
?>
-1
View File
@@ -29,7 +29,6 @@
</tr>
</table>
</td>
<td width="30">&nbsp;</td>
</tr>
</table>
</body>