Commit 4b90f8c6 authored by Mathieu Loiseau's avatar Mathieu Loiseau
Browse files

Choix langue

parent aa62f173
function changeParameters(pageNot) {
var choixLang = document.getElementById("chooseLang").value;
alert('ça marche');
function changeParameters(pageNot, action) {
var req = new XMLHttpRequest();
req.open("GET","update_userlang_game.php?userlang_game="+choixLang+"&page_not="+pageNot, true);
var address = "update_userlang_game.php?page_not=" + pageNot ;
console.log(address);
if(action == "lang"){
address += "&userlang_game=" +
document.getElementById("chooseLang").value ;
}
else if (action == "level"){
address += "&game_lvl=" +
document.getElementById("chooseLevel").value ;
}
console.log(address);
req.open("GET",address, true);
req.onreadystatechange = function(aEvt){
if (req.readyState == 4) {
if(req.status == 200){
......
......@@ -64,11 +64,11 @@ $lang['start_describe'] = 'Start your description :';
$lang['record'] = 'Play';
$lang['send_description'] = 'Send your description !';
$lang['erase'] = 'Erase and restart';
//$lang['giveUp']=' You did not send your record, Therefore you will loose 10 points as Oracle but you will get 5 points as Druide';
//$lang['giveUp']=' You did not send your record, Therefore you will loose 10 points as Oracle but you will get 5 points as Druide';
//$lang['giveUpWithoutPoints'] = 'You did not send your record. But you have not enought points to loose. So you don\'t loose points for this time... Be carefull the next time ;)';
$pointsCoeff = $points*0.5;
$lang['pointsOracle'] = ' The record has been sent. you will gain or loose '.$pointsCoeff.' points according the Druid/Oracle points.';
$lang['pointsOracle'] = ' The record has been sent. you will gain or loose '.$pointsCoeff.' points according the Druid/Oracle points.';
$lang['giveUpOracle'] = ' The record has not been sent to the server.';
......@@ -131,11 +131,11 @@ $lang["restart"] ='Play again ? ';
$lang["start"] ='It\'s time to play the game !';
$lang['start_playback']="Play recording";
$lang['give_up'] = 'Give up';
$lang['devin-nope'] = 'Not the word';
$lang['devin-nope'] = 'Not the word�';
$lang["game"] ='Start the game';
//Rsultats, Scores et Points
//R�sultats, Scores et Points
$lang['well_done'] = 'Congratulation!';
$lang['points'] = ' +'.$points.' Points';
$lang['too_bad'] = 'Too bad !';
......@@ -159,7 +159,7 @@ $lang['oracle_timeout'] = 'You did not make a description in time';
$lang['oracle_card_timeout'] = 'You did not answer the card in time';
//Triche
//Triche
$lang['sanction']='We are sory but it seems that you leave suddenly the plateforme! So, you loose 5 points!';
$lang['sanction_without_points']='We are sory but it seems that you leave suddenly the plateforme! You are lucky this time, you don\'t have points to loose! But be careful the next time...';
......@@ -173,8 +173,8 @@ $lang['subj']='Select your subject or create a new one';
//Erreurs
$lang['unavailable_card'] = 'Access card denied. The card does\'nt exist';
$lang['without_card']= 'Sorry, There is no card to play, Would you create one.';
$lang['no_card']= ' Access card denied: maybe the card does\'nt exist in this language or you are the creator of the card and so, you can not play this card.';
$lang['no_card_active']= ' Card production is not available for the other languages; is just available for french.';
$lang['no_card']= ' Access card denied: maybe the card does\'nt exist in this language or you are the creator of the card and so, you can not play this card.';
$lang['no_card_active']= ' Card production is not available for the other languages; is just available for french.';
$lang['user_name']= 'Please enter a user name';
$lang['email']= 'Please enter an email address';
$lang['password']= 'Please enter a password';
......@@ -190,18 +190,26 @@ $lang['enter_language']= 'You must choose a language';
$lang['enter_nativelang']='Please enter your native language';
$lang['tabooWords']= 'The word to find in the card must be diffrent from the taboo words';
$lang['noCardBD']= ' There is no card to play in the Data base';
$lang['noEnregistrement']= ' There is no available record';
$lang['noEnregistrement']= ' There is no available record';
$lang['Becareful']= 'Attention!';
$lang['Word2find'] = "The word to find is:";
$lang['home_miss_lang_game'] = 'Please select a game language in your profile.';
$lang["languePlay"] = "You are playing in ";
$lang["languePlay"] = "Language: ";
$lang['level'] = 'Game level: ';
$lang['levelChange'] = 'Level of next game:';
$lang['Oracle_easy'] = "Only one forbidden word and 1′30″ recording time (stake: 10 points).";
$lang['Oracle_medium'] = "Three forbidden words and 1′ recording time (stake: 20 points).";
$lang['Oracle_hard'] = "Six forbidden words and 30″ recording time (stake: 30 points).";
$lang['Devin_easy'] = "Twice the duration of the recording, for a 10 points stake.";
$lang['Devin_medium'] = "1.5 times the duration of the recording, for a 20 points stake.";
$lang['Devin_hard'] = "Recording duration + 8″, for a 30 points stake.";
//Erreur upload
$lang['file_unupload'] = 'Attention, the file was not fully uploaded.';
$lang['sizeOfUp'] = 'The uploaded file is too large.';
$lang['extUp'] = 'The uploaded file format is not supported (accepted formats are: png,gif,jpg,jpeg).';
$lang['uploadProb'] = 'The file has not been uploaded yet...';
$lang['extUp'] = 'The uploaded file format is not supported (accepted formats are: png,gif,jpg,jpeg).';
$lang['uploadProb'] = 'The file has not been uploaded yet...';
//
$lang['same_lang'] = ' You have chosen twice the same language in langues parlées';
......
......@@ -28,7 +28,7 @@ $lang['login'] = 'Connexion';
$lang['logout'] = 'Déconnexion';
$lang['langue_apprentissage'] = 'Indiquez la/les langue(s) que vous apprenez:';
$lang['ajout_langue'] = 'ajouter une langue parlée';
//Menu et boutons de formulaires
//Menu et boutons de formulaires
$lang['cmd_submit'] = 'Valider';
$lang['cmd_cancel'] = 'Annuler';
$lang['register'] = 'Enregistrer';
......@@ -153,7 +153,7 @@ $lang['diviner_timeout'] = 'Tu n\'as pas fourni de réponse dans le temps impart
$lang['oracle_timeout'] = 'Tu n\'as pas fourni de description dans le temps imparti';
$lang['oracle_card_timeout'] = 'Tu n\'as pas répondu à la carte dans le temps imparti';
//Triche
//Triche
$lang['sanction'] = 'Il semblerait que vous avez subitement quitté la précédente partie. Par conséquent, vous serez sanctionné de 5 points...';
$lang['sanction_without_points'] = 'Il semblerait que vous ayez subitement quitté la partie précédente. Néamoins vous n\'avez pas de point pour le moment, vous ne serez donc pas sanctionné! Mais gare à vous la prochaine fois ;)';
......@@ -190,6 +190,14 @@ $lang['Word2find'] = 'Le mot à trouver était : ';
$lang['home_miss_lang_game'] = 'Veuillez sélectionner une langue de jeu dans votre profil.';
$lang['languePlay'] = 'Vous jouez en ';
$lang['level'] = 'au niveau ';
$lang['levelChange'] = 'Niveau de la prochaine partie :';
$lang['Oracle_easy'] = "Un seul mot interdit et 1′30″ d'enregistrement (mise : 10 points).";
$lang['Oracle_medium'] = "Trois mots interdits et 1′ d'enregistrement (mise : 20 points).";
$lang['Oracle_hard'] = "Six mots interdits et 30″ d'enregistrement (mise : 30 points).";
$lang['Devin_easy'] = "2 fois la durée de l'enregistrement pour une mise de 10 points.";
$lang['Devin_medium'] = "1,5 fois la durée de l'enregistrement pour une mise de 20 points.";
$lang['Devin_hard'] = "Enregistrement + 8″ pour une mise de 30 points.";
//Erreur upload
$lang['file_unupload'] = 'Attention le fichier a mal été uploadé.';
......@@ -200,4 +208,4 @@ $lang['uploadProb'] = 'Le fichier n\'a pas été uploadé...';
//
$lang['same_lang'] = 'Vous avez choisi deux fois la même langue dans langues parlées ';
//Administration cartes
$lang['admin'] = "Administration : Cliquer sur la croix pour supprimer la carte";
\ No newline at end of file
$lang['admin'] = "Administration : Cliquer sur la croix pour supprimer la carte";
......@@ -47,7 +47,7 @@ class ItemFactory //a quick and dirty class…
$this->query = "SELECT `cartes`.`idCarte` as `zeId` FROM `cartes`
WHERE `cartes`.`idEraser` IS NULL
AND `cartes`.`langue`='$this->lang'
AND `cartes`.`idDruide` != '$this->user_id'
AND `cartes`.`idDruide` != '$this->user_id'
AND `cartes`.`idCarte` NOT IN (
SELECT `enregistrement`.`carteID` as`cardId` FROM `enregistrement` WHERE `enregistrement`.`idOracle`='$this->user_id'
UNION SELECT `enregistrement`.`carteID` as`cardId` FROM `arbitrage`,`enregistrement` WHERE `arbitrage`.`enregistrementID` = `enregistrement`.`enregistrementID` AND `arbitrage`.`idDruide`='$this->user_id'
......@@ -78,18 +78,18 @@ class ItemFactory //a quick and dirty class…
AND `cartes`.`idCarte` = `enregistrement`.`carteID`
AND `cartes`.`idDruide` != '$this->user_id'
AND `enregistrement`.`validation` = 'valid'
AND `enregistrement`.`idOracle` != '$this->user_id'
AND `enregistrement`.`idOracle` != '$this->user_id'
AND `enregistrement`.`carteID` NOT IN (
SELECT `enregistrement`.`carteID` as`cardId` FROM `arbitrage`,`enregistrement` WHERE `arbitrage`.`enregistrementID` = `enregistrement`.`enregistrementID` AND `arbitrage`.`idDruide`='$this->user_id'
UNION SELECT `enregistrement`.`carteID` as`cardId` FROM `parties`,`enregistrement` WHERE `parties`.`enregistrementID` = `enregistrement`.`enregistrementID` AND `parties`.`idDevin`='$this->user_id'
) ORDER BY RAND() $forOne;";
break;
case self::CARD_FROM_LEXICON: //ICITE tester la requête l'intégrer à innova class pour pouvoir allouer la variable de session et faire l'affichage en fonction de son existence(disabled ou non) et de celle du dico (pas d'affichage)
case self::CARD_FROM_LEXICON:
if(isset($parameter)){
$this->query = "SELECT `cartes`.`idCarte` as `zeId` FROM `cartes`
WHERE `cartes`.`idEraser` IS NULL
AND `cartes`.`langue`='$this->lang'
AND `cartes`.`idDruide` != '$this->user_id'
AND `cartes`.`idDruide` != '$this->user_id'
AND `cartes`.`idCarte` NOT IN (
SELECT `enregistrement`.`carteID` as`cardId` FROM `enregistrement` WHERE `enregistrement`.`idOracle`='$this->user_id'
UNION SELECT `enregistrement`.`carteID` as`cardId` FROM `arbitrage`,`enregistrement` WHERE `arbitrage`.`enregistrementID` = `enregistrement`.`enregistrementID` AND `arbitrage`.`idDruide`='$this->user_id'
......@@ -179,4 +179,4 @@ class ItemFactory //a quick and dirty class…
return $res;
}
}
?>
\ No newline at end of file
?>
......@@ -8,7 +8,7 @@
}
#card tbody td p{
float:left;
float:left;
margin-left: 10%;
font-family: playball;
font-size:20px;
......@@ -19,7 +19,7 @@
font-size: 25px;
font-style: normal;
background-color:#CFFFCD;
border-radius:15px;
border-radius:15px;
text-align:center;
}
......@@ -28,14 +28,14 @@
}
.timer{
border-radius:15px;
border-radius:15px;
font-style:bold;
font-align:center;
width:5px;padding-top:10px;
padding-bottom:10px;
padding-left:40px;
padding-right:40px;
background-color:#FF5757;
padding-right:40px;
background-color:#FF5757;
}
.messageUtil{
font-family: playball;
......@@ -122,9 +122,9 @@
}
#notificationsMess {
background-color: rgba(96, 103, 207, 0.7);
border-radius:5px;
border-radius:5px;
min-height:64px;
text-align:center;
text-align:center;
margin-top : 5px;
margin-bottom : 5px;
}
......@@ -138,7 +138,7 @@
float:left;
position:relative;
width:64px;
height:64px;
height:64px;
}
#delete{
float:right;
......@@ -182,4 +182,11 @@ footer{
padding-right:1em;
padding-top:0.3em;
padding-bottom:0.5em;
}
\ No newline at end of file
}
.info{
background-color: rgb(238,238,238);
color:rgb(77,77,77);
font-size:small;
padding:2px;
}
......@@ -5,30 +5,54 @@
require_once('./controllers/notificationMessage.php');
require('./models/userlvl.class.php');
require('./languages/language.php');
require_once('./sys/load_iso.php');
$lang_iso = new IsoLang();
$user = user::getInstance();
$sql = "UPDATE user SET userlang_game ='"
. $_GET['userlang_game']
. "' WHERE userid = '" . intval($user->id)."'";
$db = db::getInstance();
echo $sql;
if ($db->query($sql)){
echo "update succed";
if(isset($_GET['page_not'])){
$role = "profil/".strtolower($_GET['page_not']);
if(isset($_GET['userlang_game'])){
require_once('./sys/load_iso.php');
$lang_iso = new IsoLang();
$sql = "UPDATE user SET userlang_game ='"
. $_GET['userlang_game']
. "' WHERE userid = '" . intval($user->id)."'";
echo $sql;
if ($db->query($sql)){
echo "update succed";
$mess = $_GET['page_not']." : ".$lang["languePlay"].$lang_iso->french_for($_GET['userlang_game']);
$role = strtolower($_GET['page_not']);
$role = "profil/".$role;
$mess = $_GET['page_not']." : ".$lang["languePlay"].$lang_iso->french_for($_GET['userlang_game']);
$notif = new Notification;
$notif->initNotif();
$notif->addNotifGAME($user->id,$mess,$role);
}
else {
echo "update fails";
}
$_SESSION["langDevin"] = $_GET['userlang_game'];
}
elseif (isset($_GET['game_lvl'])) {
$sql = "UPDATE `user` SET `userlvl` ='"
. $_GET['game_lvl']
. "' WHERE userid = '" . intval($user->id)."'";
echo $sql;
if ($db->query($sql)){
echo "update success";
$notif = new Notification;
$notif->initNotif();
$notif->addNotifGAME($user->id,$mess,$role);
$mess = $_GET['page_not']." : ".$lang["levelChange"].$lang["level_".$_GET['game_lvl']]."→".$lang[$_GET['page_not']."_".$_GET['game_lvl']];
} else {
echo "update fails";
$notif = new Notification;
$notif->initNotif();
$notif->addNotifGAME($user->id,$mess,$role);
}
else {
echo "update fails";
}
$_SESSION["langDevin"] = $_GET['userlang_game'];
}
else{
echo "no query...";
}
}
else{
echo "missing origin…";
}
$_SESSION["langDevin"] = $_GET['userlang_game'];
?>
......@@ -17,10 +17,13 @@ include('./sys/load_used_iso.php');
if(strcmp($_SESSION["langDevin"],$short) == 0){ echo " selected"; }
}
elseif (strcmp($user->langGame,$short) == 0) { echo " selected"; }
echo ">" . $long . "</option>";
echo ">" . $long . "</option>";
}
?>
</select>
<?php include_once("./views/level.menu.php");
print_level_choice('Devin',$lang,$user);
?>
</h2>
</form>
<h2><?php echo $lang['start']; ?></h2>
......@@ -42,4 +45,3 @@ function saveLangue() {
<?php
include('./views/page.footer.html');
?>
......@@ -10,7 +10,7 @@ require_once('./sys/load_iso.php');
<!-- cette formulaire sert � choisir la langue de jeu-->
<form id="select_lang">
<h2><?php echo $lang['learning'];?>
<select name="chooseLang" size="1" id="chooseLang" onchange="changeParameters('Druide')">
<select name="chooseLang" size="1" id="chooseLang" onchange="changeParameters('Druide','lang')">
<?php
foreach (explode(';',$user->spoken_lang) as $l) {
if (strlen($l) > 0) {
......
<script type="text/javascript">
//make sure changeParameters is loaded
if(typeof changeParameters != "function"){
var script= document.createElement('script');
script.type= 'text/javascript';
script.src= './controllersJS/menu_lang.js';
document.getElementsByTagName('head')[0].appendChild(script);
/* peut nécessiter un setTimeout(function(){alert('loaded ' + typeof changeParameters);}, 10);*/
}
</script>
<?php
function print_level_choice($role,$lang,$user){
echo $lang['level'];
if(!isset($user)){
throw new Exception("Pas d'utilisateur", 1);
}
echo "<select name=\"chooseLevel\" size=\"1\" id=\"chooseLevel\" onchange=\"changeParameters('$role','level')\">";
$levels = array("easy", "medium", "hard");
foreach ($levels as $level) {
echo "<option value=" . $level ;
if (strcmp($user->userlvl,$level) == 0) { echo " selected"; }
echo ">" . $lang['level_'.$level] . "</option>";
}
echo "</select>\n".
'<span class="info" id="info">'.$lang[$role."_".$user->userlvl].'</span>';
}
?>
......@@ -11,8 +11,7 @@ $lang_iso = new IsoLang();
<!-- cette formulaire sert à choisir la langue de jeu-->
<form id="select_lang">
<h2><?php echo $lang['learning'];?>
<!-- ICITE, gérer le choix du niveau (si possible avec message d'aide) -->
<select name="chooseLang" size="1" id="chooseLang" onchange="changeParameters('Oracle')">
<select name="chooseLang" size="1" id="chooseLang" onchange="changeParameters('Oracle','lang')">
<?php
foreach (explode(';',$user->spoken_lang) as $l) {
if (strlen($l) > 0) {
......@@ -23,8 +22,10 @@ $lang_iso = new IsoLang();
}
}
?>
</select>
<?php include_once("./views/level.menu.php");
print_level_choice('Oracle',$lang,$user);
?>
</h2>
</form>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment