<?php
function tovideo($fn) {
	$fp = fopen($fn . '.html', 'w');
	$fnn = substr($fn, 0, -4 );
	fwrite($fp, "<!DOCTYPE HTML PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'>" );
	fwrite($fp, "<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='fr' lang='fr'>" );
	fwrite($fp, "<head>" );
	fwrite($fp, "<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />" );
	fwrite($fp, "<title>Vidéo projet Transferts (AUF/OIF/Bamako/Niamey/Ouagadougou/Nanterre)</title>" );
	fwrite($fp, "<link rel='stylesheet' type='text/css' href='styles.css'>" );
	fwrite($fp, "</head>" );
	fwrite($fp, "<body>" );
	fwrite($fp, "<style>" );
	fwrite($fp, "video {" );
	fwrite($fp, "padding: 15px;" );
	fwrite($fp, "margin:	0px;" );
	fwrite($fp, "border:	5px solid black;" );
	fwrite($fp, "border-radius:  15px;");
	fwrite($fp, "box-shadow: 10px 10px 5px gray;");
	fwrite($fp, "box-sizing: border-box;");
	fwrite($fp, "}" );
	fwrite($fp, "<!--[if IE]>" );
	fwrite($fp, "<style>" );
	fwrite($fp, "video {" );
	fwrite($fp, "padding: 15px;" );
	fwrite($fp, "margin:	0px;" );
	fwrite($fp, "border:	5px solid black;" );
	fwrite($fp, "}" );
	fwrite($fp, "</style>" );
	fwrite($fp, "<![endif]-->" );

	fwrite($fp, "<h2>Vidéo projet Transferts (AUF/OIF/Bamako/Niamey/Ouagadougou/Nanterre)</h2>" );
	fwrite($fp, "<!--[if lt IE 9]>" );
	fwrite($fp, "<h1>Attention utiliser Internet Explorer 9 ou une version plus récente de Internet Explorer (ou un autre navigateur)</h1>" );
	fwrite($fp, "<![endif]-->" );
	fwrite($fp, "<!--[if IE]>" );
	fwrite($fp, "<video id='vsd' poster='$fnn.png' controls>" );
	fwrite($fp, "<source src='$fnn.mp4' type='video/mp4'>" );
	fwrite($fp, "</video>" );
	fwrite($fp, "<![endif]-->" );
	fwrite($fp, "<!--[if !IE]> -->" );
	fwrite($fp, "<video id='vsd' poster='$fnn.png' controls>" );
	fwrite($fp, "<source src='$fnn.mp4' type='video/mp4'>" );
	fwrite($fp, "<source src='$fnn.ogv' type='video/ogg'>" );
	fwrite($fp, "<source src='$fnn.webm' type='video/webm'>" );
	fwrite($fp, "</video>" );
	fwrite($fp, "<!-- <![endif]-->" );
	fclose($fp);
}
function tochat($fn) {
	$fp = fopen($fn . '.html', 'w');
	fwrite($fp, '<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN">' );
	fwrite($fp, '<html><head><meta content="text/html; charset=utf-8" http-equiv="content-type"><title>');
	fwrite($fp, 'Fichier CHAT ' . $fn);
	fwrite($fp, '</title><head><body>');
	fwrite($fp, '<b>Transcription en format CHAT ' . $fn . ' A télécharger <a href="' . $fn . '">ICI</a></b><br />');
	fwrite($fp, '<pre style="font-family:monospace">');
	fwrite($fp, file_get_contents($fn));
	fwrite($fp, '</pre></body></html>');
	fclose($fp);
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<style type="text/css">
		h1 {
		    margin-top: 0;
		    margin-bottom: 0;
		    margin-left: 2em;
		    font-size: 140%;
		}
		h2 {
		    margin-top: 0;
		    margin-bottom: 0;
		    margin-left: 4em;
		    font-size: 120%;
		}
	</style>
	<title>Projet Transferts AUF/OIF</title>
</head>
<body  style="background-image: url(../img/fond4.png);">
<img style="width: 1280px; height: 350px;" alt="Animaux" src="../img/animaux2.png">
	<br/>
	<?php
	
	$auth_realm = "Transferts d'apprentissage";
	
	require_once '../auth.php';
	
	// echo "You've logged in as {$_SESSION['username']}<br>";
	echo "<p>Vous êtes identifié. &nbsp;&nbsp;";
	echo '<a href="?action=logOut">Se déloger</a></p>'
	
	?>
        <?php
            $dir = scandir('.');
        ?>
        <h1>Liste des fichiers Songhay du projet Transferts AUF/OIF/Niger</h1>
        <hr />
        <h1><a name="videos" />Vidéos</h1>
        <h3>Liste des vidéos pour utiliser avec CLAN</h3>
        <p>Les videos sont en petit format plus facilement téléchargable et utilisable sur un ordinateur portable.</p>
        <?php
            foreach($dir as $fn) {
            	    if (preg_match("/Mson.*\.(mov)$/i",$fn) && !preg_match("/-gf\./i",$fn)) {
            	    	    tovideo($fn);
            	    	    echo "Fichier vidéo : <a href='$fn.html'>$fn <small>(afficher)</small></a> --- Télécharger au format MOV pour CLAN: <a href='$fn'>ICI</a><br />";
            	    }
            }
        ?>
        <br />
        <h3>Liste des vidéos en grand format</h3>
        <p>Les videos en grand format qualité DVD.</p>
        <?php
            foreach($dir as $fn) {
                if (preg_match("/Mson.*-gf\.(mov)|(mp4)/i",$fn) && preg_match("/pf\./i",$fn)) echo "Fichier vidéo (grand format): <a href='$fn'>$fn</a><br />";
            }
        ?>
        <h1>Transcriptions</h1>
        <p>Fichiers CHAT/CLAN</p>
        <?php
            foreach($dir as $fn) {
            	    if (preg_match("/Mson.*\.cha$/i",$fn)) {
            	    	    tochat($fn);
            	    	    echo "Fichier CLAN: <a href='$fn.html'>$fn <small>(afficher)</small></a> --- Télécharger: <a href='$fn'>ICI</a><br />";
            	    }
            }
        ?>
        <br />
        <p>Récupérer tous les fichiers transcriptions zippés : </p>
        <?php
            foreach($dir as $fn) {
                if (preg_match("/Mson.*\.zip/i",$fn)) echo "Zipfile: <a href='$fn'>$fn</a><br />";
            }
        ?>
        <br />
        <hr />
        <h1><a name="sons" />Sons </h1>
        <?php
            foreach($dir as $fn) {
                if (preg_match("/Mson.*\.(wav|aif|mp3)/i",$fn)) echo "Fichier son: <a href='$fn'>$fn</a><br />";
            }
        ?>
        <br />
        <hr />
        <h1><a name="photos" />Photos </h1>
        <?php
            foreach($dir as $fn) {
                if (preg_match("/Mson.*\.(jpg|jpeg)/i",$fn)) echo "Fichier image: <a href='$fn'>$fn&nbsp;&nbsp;<img src='$fn' height='40px' /></a><br />";
            }
        ?>
	<br/><a href='/transferts/'>Retour à la page principale du site</a><br/>
        <p><small>Webmaster: Christophe Parisse - Contacts: Colette Noyau (colette.noyau@free.fr) et Christophe Parisse (cparisse@u-paris10.fr)</small></p>
        <img src="../img/financement.png" height="70"><br/>
        <img src="../img/u-sud.png" height="70"><br/>
        <img src="../img/logo_modyco_bandeau2.jpg" height="60"><br/>
    </body>
</html>
