Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mathieu Loiseau
GameOfWords
Commits
ca0874d0
Commit
ca0874d0
authored
Sep 08, 2016
by
arnaudbey
Browse files
dirty fix on dirty code
parent
9e48facb
Changes
5
Hide whitespace changes
Inline
Side-by-side
languages/lang.fr.php
View file @
ca0874d0
...
...
@@ -28,6 +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
$lang
[
'cmd_submit'
]
=
'Valider'
;
$lang
[
'cmd_cancel'
]
=
'Annuler'
;
...
...
@@ -53,7 +54,7 @@ $lang['select_role'] = 'Selectionez un rôle';
$lang
[
'card_create'
]
=
'Création d\'une carte'
;
$lang
[
'card_description'
]
=
'Description d\'une carte'
;
$lang
[
'game_arbitrage'
]
=
'Arbitrage d\'une partie'
;
$lang
[
'card_lexinno'
]
=
'Carte liée à votre lexique'
;
$lang
[
'card_lexinno'
]
=
'Carte liée à votre lexique'
;
// Description d'une carte par un Oracle oracle.card.display.html
$lang
[
'warning'
]
=
'Attention, votre micro n\'a pas été activé.'
;
...
...
@@ -80,10 +81,10 @@ $lang['word_direction'] = 'Niveau du CECR de ce mot (indépendamment des mots in
$lang
[
'level_easy'
]
=
'Facile'
;
$lang
[
'level_medium'
]
=
'Moyen'
;
$lang
[
'level_hard'
]
=
'Difficile'
;
$lang
[
'level_beg'
]
=
"
Débutant
"
;
$lang
[
'level_int'
]
=
"
Intermédiaire
"
;
$lang
[
'level_adv'
]
=
"
Avancé
"
;
$lang
[
'level_nat'
]
=
"
Natif
"
;
$lang
[
'level_beg'
]
=
'
Débutant
'
;
$lang
[
'level_int'
]
=
'
Intermédiaire
'
;
$lang
[
'level_adv'
]
=
'
Avancé
'
;
$lang
[
'level_nat'
]
=
'
Natif
'
;
$lang
[
'validate'
]
=
'Valider'
;
$lang
[
'reset'
]
=
'Réinitialiser'
;
...
...
@@ -127,7 +128,7 @@ $lang['RecordCard'] = 'Si vous voulez proposer un enregistrement pour cette cart
$lang
[
'RecordArbitre'
]
=
'Si vous voulez arbitrer cet enregistrement cliquez ici : '
;
$lang
[
'restart'
]
=
'Rejouer une partie ? '
;
$lang
[
'start'
]
=
'Il est temps de jouer !'
;
$lang
[
'start_playback'
]
=
"Commencer l'écoute"
;
$lang
[
'start_playback'
]
=
"Commencer l'écoute"
;
$lang
[
'give_up'
]
=
'Abandonner'
;
$lang
[
'devin-nope'
]
=
'Pas ce mot…'
;
$lang
[
'game'
]
=
'Jouer'
;
...
...
@@ -149,7 +150,7 @@ $lang['score_diviner'] = 'Devin';
$lang
[
'score_global'
]
=
'Score global'
;
$lang
[
'userName'
]
=
'Joueur'
;
$lang
[
'global_score'
]
=
'Classement général'
;
$lang
[
'scores_by_language'
]
=
"
Scores par langue
"
;
$lang
[
'scores_by_language'
]
=
'
Scores par langue
'
;
// Timeout
$lang
[
'diviner_timeout'
]
=
'Tu n\'as pas fourni de réponse dans le temps imparti'
;
...
...
@@ -200,21 +201,20 @@ $lang['Oracle_medium'] = "Trois mots interdits et 1′ d'enregistrement (mise&nb
$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.
"
;
$lang
[
'Devin_hard'
]
=
'
Enregistrement + 8″ pour une mise de 30 points.
'
;
$lang
[
'Card_created'
]
=
"Merci d'avoir créé une carte : "
;
$lang
[
'Rec_verified'
]
=
"Merci d'avoir vérifié l'enregistrement de "
;
$lang
[
'Oracle_verif'
][
true
]
=
" a vérifié votre enregistrement et pense que vous n'avez pas utilisé de mot interdit"
;
$lang
[
'Oracle_verif'
][
false
]
=
" a vérifié votre enregistrement et pense que vous n'avez pas utilisé de mot interdit"
;
$lang
[
'Oracle_devin'
][
false
]
=
" a écouté votre enregistrement et n'a pas trouvé le mot…"
;
$lang
[
'Oracle_devin'
][
true
]
=
"
a écouté votre enregistrement et a trouvé !
"
;
$lang
[
'Devin_played'
]
=
"
Vous avez écouté un enregistrement de
"
;
$lang
[
'Devin_oracle'
][
true
]
=
"
Et vous avez trouvé !
"
;
$lang
[
'Oracle_devin'
][
true
]
=
'
a écouté votre enregistrement et a trouvé !
'
;
$lang
[
'Devin_played'
]
=
'
Vous avez écouté un enregistrement de
'
;
$lang
[
'Devin_oracle'
][
true
]
=
'
Et vous avez trouvé !
'
;
$lang
[
'Devin_oracle'
][
false
]
=
"Mais vous n'avez pas trouvé…"
;
$lang
[
'img_augur'
]
=
"./profil/diviner.jpg"
;
$lang
[
'img_druid'
]
=
"./profil/druide.jpg"
;
$lang
[
'img_oracle'
]
=
"./profil/oracle.jpg"
;
$lang
[
'img_augur'
]
=
'./profil/diviner.jpg'
;
$lang
[
'img_druid'
]
=
'./profil/druide.jpg'
;
$lang
[
'img_oracle'
]
=
'./profil/oracle.jpg'
;
//Erreur upload
$lang
[
'file_unupload'
]
=
'Attention le fichier a mal été uploadé.'
;
...
...
@@ -225,4 +225,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
"
;
$lang
[
'admin'
]
=
'
Administration : Cliquer sur la croix pour supprimer la carte
'
;
sys/load_iso.php
View file @
ca0874d0
<?php
require_once
(
'./sys/db.class.php'
);
//probably useless
class
IsoLang
{
private
$db
;
private
static
$common_languages
=
array
(
"en"
=>
"Anglais"
,
"fr"
=>
"Français"
,
"it"
=>
"Italien"
,
"es"
=>
"Espagnol"
,
"zh"
=>
"Chinois"
);
public
function
__construct
(){
$this
->
db
=
db
::
getInstance
();
}
public
function
language_code_for
(
$french
){
$code
=
array_search
(
$french
,
self
::
$common_languages
,
true
);
if
(
$code
===
false
){
$this
->
db
->
query
(
"SELECT `iso_code` FROM `langues` WHERE `french`='"
.
$french
.
"'"
);
if
(
$this
->
db
->
affected_rows
()
==
1
){
$code
=
$this
->
db
->
fetch_object
()
->
iso_code
;
}
else
{
$code
=
false
;
}
}
return
$code
;
}
public
function
any_to_iso
(
$any
){
$res
=
$this
->
language_code_for
(
$any
);
if
(
$res
===
false
){
if
(
$this
->
french_for
(
$any
)
!==
false
){
$res
=
$any
;
}
else
{
throw
new
Exception
(
"
$any
n'est ni une langue en français, ni un code iso."
);
}
}
return
$res
;
}
public
function
any_to_french
(
$any
){
$res
=
$this
->
french_for
(
$any
);
if
(
$res
===
false
){
if
(
$this
->
language_code_for
(
$any
)
!==
false
){
$res
=
$any
;
}
else
{
throw
new
Exception
(
"
$any
n'est ni une langue en français, ni un code iso."
);
}
}
return
$res
;
}
public
function
french_for
(
$isoCode
){
if
(
!
isset
(
self
::
$common_languages
[
$isoCode
])){
$this
->
db
->
query
(
"SELECT `french` FROM `langues` WHERE `iso_code`='"
.
$isoCode
.
"'"
);
if
(
$this
->
db
->
affected_rows
()
==
1
){
$french
=
$this
->
db
->
fetch_object
()
->
french
;
}
else
{
$french
=
false
;
}
}
else
{
$french
=
self
::
$common_languages
[
$isoCode
];
}
return
$french
;
}
public
function
get_all_codes
(
$language
=
"french"
){
$res
=
array
();
$this
->
db
->
query
(
"SELECT `iso_code`,`
$language
` FROM `langues`"
);
if
(
$this
->
db
->
affected_rows
()
>=
1
){
while
(
$tmpObj
=
$this
->
db
->
fetch_object
()){
$res
[
$tmpObj
->
iso_code
]
=
$tmpObj
->
{
$language
};
}
}
else
{
$res
=
false
;
}
return
$res
;
}
}
?>
<?php
require_once
'./sys/db.class.php'
;
//probably useless
class
IsoLang
{
private
$db
;
private
static
$common_languages
=
array
(
'en'
=>
'Anglais'
,
'fr'
=>
'Français'
,
'it'
=>
'Italien'
,
'es'
=>
'Espagnol'
,
'zh'
=>
'Chinois'
,
);
public
$commonlyUsed
=
[
'Allemand'
,
'Anglais'
,
'Arabe'
,
'Chinois'
,
'Espagnol'
,
'Français'
,
'Hindi'
,
'Russe'
];
public
function
__construct
()
{
$this
->
db
=
db
::
getInstance
();
}
public
function
language_code_for
(
$french
)
{
$code
=
array_search
(
$french
,
self
::
$common_languages
,
true
);
if
(
$code
===
false
)
{
$this
->
db
->
query
(
"SELECT `iso_code` FROM `langues` WHERE `french`='"
.
$french
.
"'"
);
if
(
$this
->
db
->
affected_rows
()
==
1
)
{
$code
=
$this
->
db
->
fetch_object
()
->
iso_code
;
}
else
{
$code
=
false
;
}
}
return
$code
;
}
public
function
any_to_iso
(
$any
)
{
$res
=
$this
->
language_code_for
(
$any
);
if
(
$res
===
false
)
{
if
(
$this
->
french_for
(
$any
)
!==
false
)
{
$res
=
$any
;
}
else
{
throw
new
Exception
(
"
$any
n'est ni une langue en français, ni un code iso."
);
}
}
return
$res
;
}
public
function
any_to_french
(
$any
)
{
$res
=
$this
->
french_for
(
$any
);
if
(
$res
===
false
)
{
if
(
$this
->
language_code_for
(
$any
)
!==
false
)
{
$res
=
$any
;
}
else
{
throw
new
Exception
(
"
$any
n'est ni une langue en français, ni un code iso."
);
}
}
return
$res
;
}
public
function
french_for
(
$isoCode
)
{
if
(
!
isset
(
self
::
$common_languages
[
$isoCode
]))
{
$this
->
db
->
query
(
"SELECT `french` FROM `langues` WHERE `iso_code`='"
.
$isoCode
.
"'"
);
if
(
$this
->
db
->
affected_rows
()
==
1
)
{
$french
=
$this
->
db
->
fetch_object
()
->
french
;
}
else
{
$french
=
false
;
}
}
else
{
$french
=
self
::
$common_languages
[
$isoCode
];
}
return
$french
;
}
public
function
get_all_codes
(
$language
=
'french'
)
{
$res
=
array
();
$this
->
db
->
query
(
"SELECT `iso_code`,`
$language
` FROM `langues`"
);
if
(
$this
->
db
->
affected_rows
()
>=
1
)
{
while
(
$tmpObj
=
$this
->
db
->
fetch_object
())
{
$res
[
$tmpObj
->
iso_code
]
=
$tmpObj
->
{
$language
};
}
}
else
{
$res
=
false
;
}
return
$res
;
}
}
views/edit.form.html
View file @
ca0874d0
...
...
@@ -4,7 +4,6 @@ include('./views/page.header.html');
require_once('./sys/load_iso.php');
$lang_iso = new IsoLang();
include('./controllersJS/display_lang.js');
?>
<div
id=
"main-container"
>
<div
id=
"jrForm"
>
...
...
@@ -60,6 +59,7 @@ include('./controllersJS/display_lang.js');
<?php
$i=1;
$languages = $lang_iso->get_all_codes();
$commonlyUsed = $lang_iso->commonlyUsed;
$levels = ["Débutant", "Intermédiaire", "Avancé", "Natif"];
$spoken_lang = explode(';',$this->spoken_lang);
...
...
@@ -72,24 +72,42 @@ include('./controllersJS/display_lang.js');
$l = $spoken_lang[$i];
$n = $niveaux[$i];
$i++;
if (strlen($l) > 0) {
echo "<tr><td align='center'>" .
"<select ".$languageid ." name='choix_langs_" . $i . "' required='required' onchange=\"updateRadio(this);\">";
foreach($languages as $language){
$selected = ($l === $language) ? "selected" : "";
echo "<option value='".$language."' ".$selected.">".$language."</option>";
}
echo "</select>" .
"</td>" .
"<td align='center'>".
"<select ".$levelid." name='choix_niveau_" . $i . "' required='required'>";
foreach($levels as $level){
$selected = ($n === $level) ? "selected" : "";
echo "<option value='".$level."' ".$selected.">".$level."</option>";
}
if (strlen($l) > 0) {
?>
<tr>
<td
align=
'center'
>
<select
<?
php
echo
$
languageid
;?
>
name='choix_langs_
<?php echo $i; ?>
' required='required' onchange='updateRadio(this);'>
<option
value=
''
>
--
</option>
<optgroup
label=
'Commonly Used'
>
<?php
foreach($commonlyUsed as $language){
echo "<option value='".$language."'>".$language."</option>";
}
?>
</optgroup>
<optgroup
label=
'All'
>
<?php
foreach($languages as $language){
$selected = ($l === $language) ? "selected" : "";
echo "<option value='".$language."' ".$selected.">".$language."</option>";
}
?>
</optgroup>
</select>
</td>
<td
align=
'center'
>
<select
<?
php
echo
$
levelid
;?
>
name='choix_niveau_
<?php echo $i; ?>
' required='required'>
<option
value=
''
>
--
</option>
<?php
foreach($levels as $level){
$selected = ($n === $level) ? "selected" : "";
echo "<option value='".$level."' ".$selected.">".$level."</option>";
}
?>
echo "</select></td>";
</select>
</td>
<?php
if (strcmp($l,$userlang_game) == 0) {
echo "<td align='center'><input type='radio' name='lang_game' required='required' checked value='" . $l . "'/></td></tr>";
} else {
...
...
views/page.header.html
View file @
ca0874d0
...
...
@@ -13,10 +13,9 @@ $notif->readNotif();
<head>
<title>
<?php echo $title; ?>
</title>
<meta
charset=
"UTF-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<script
type=
"text/javascript"
src=
"style/default.js/js/jquery-1.11.2.min.js"
></script>
<!-- Adaptation au Bootstrap -->
...
...
@@ -35,7 +34,7 @@ $notif->readNotif();
<!--Module de son : -->
<script
src=
"style/default.js/RecordRTC.js"
></script>
<script
src=
"style/default.js/RecordRTC.js"
></script>
<!-- ALL jQuery Tools. No jQuery library -->
<script
src=
"http://cdn.jquerytools.org/1.2.6/full/jquery.tools.min.js"
></script>
...
...
@@ -44,8 +43,6 @@ $notif->readNotif();
<script
src=
"controllersJS/Notification/modernizr.custom.js"
></script>
<script
src=
"controllersJS/sendSQL.js"
></script>
<script
src=
"controllersJS/notif.js"
></script>
</head>
<body>
<div
id=
"header-logo"
></div>
...
...
views/register.form.html
View file @
ca0874d0
...
...
@@ -6,6 +6,7 @@ $lang_iso = new IsoLang();
include('./controllersJS/display_lang.js');
?>
<div
id=
"main-container"
>
<div
id=
"jrForm"
>
<form
class=
"form-jr"
role=
"form"
id=
"register"
method=
"post"
action=
"./"
enctype=
"multipart/form-data"
>
...
...
@@ -58,23 +59,35 @@ include('./controllersJS/display_lang.js');
<td>
<select
id=
"languages"
name=
"choix_langs_1"
required=
"required"
onchange=
"updateRadio(this);"
>
<option
value=
""
>
--
</option>
<?php
$languages = $lang_iso->get_all_codes();
foreach($languages as $language){
echo "<option value='".$value."'>".$language."</option>";
}
?>
<?php
$languages = $lang_iso->get_all_codes();
$commonlyUsed = $lang_iso->commonlyUsed;
?>
<optgroup
label=
"Commonly used"
>
<?php
foreach($commonlyUsed as $language){
echo "<option value='".$language."'>".$language."</option>";
}
?>
</optgroup>
<optgroup
label=
"All"
>
<?php
foreach($languages as $language){
echo "<option value='".$language."'>".$language."</option>";
}
?>
</optgroup>
</select>
</td>
<td
align=
"center"
>
<select
id=
"levels"
name=
"choix_niveau_1"
required=
"required"
>
<option
value=
""
>
--
</option>
<?php
$levels = ["Débutant", "Intermédiaire", "Avancé", "Natif"];
foreach($levels as $level){
echo "<option value='".$level."'>".$level."</option>";
}
?>
<?php
$levels = ["Débutant", "Intermédiaire", "Avancé", "Natif"];
foreach($levels as $level){
echo "<option value='".$level."'>".$level."</option>";
}
?>
</select>
</td>
<td
align=
"center"
><input
type=
"radio"
name=
"lang_game"
required=
"required"
/></td>
...
...
@@ -106,7 +119,7 @@ include('./controllersJS/display_lang.js');
<dl>
<dt><label
for=
"userlang"
>
Choisissez une langue d'interface
</label></dt>
<!-- userlang= langue d'interface -->
<dd>
<select
id=
"userlang"
name=
"userlang"
>
<select
required
id=
"userlang"
name=
"userlang"
>
<option
value =
""
></option>
<option
value =
"fr"
>
Français
</option>
<option
value =
"en"
>
Anglais
</option>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment