From e8cc9359e0330a4951224fbe1f2bc9bba02d7c7a Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Sat, 18 Mar 2017 11:33:07 +0100 Subject: [PATCH] more consistent tournaments names management --- web/briskin5/Obj/briskin5.phh | 13 +++++++++---- web/briskin5/Obj/rules.phh | 6 +++--- web/briskin5/stat-day.php | 17 ++--------------- 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/web/briskin5/Obj/briskin5.phh b/web/briskin5/Obj/briskin5.phh index 76e3c72..5e22966 100644 --- a/web/briskin5/Obj/briskin5.phh +++ b/web/briskin5/Obj/briskin5.phh @@ -83,9 +83,11 @@ function multoval($mult) function dom_select_rules() { + GLOBAL $G_lang; + $ret = "\n"; @@ -262,6 +264,7 @@ class Bin5_table extends Table { function spawn(&$from) { + GLOBAL $G_lang; if (($thiz =& new Bin5_table()) == FALSE) return (FALSE); @@ -603,6 +606,8 @@ class Bin5_table extends Table { function rules_change(&$bri, $user, $rules_id_s) { + GLOBAL $G_lang; + // // Rules: update version following loaded tcode // @@ -657,7 +662,7 @@ class Bin5_table extends Table { if ($i < BIN5_PLAYERS_N) { // FIXME_LANG $msg = sprintf("L'utente %s voleva già usare le %s.", - xcape($user_cur->name), xcape(rules_id2descr($user_cur->rules_get()))); + xcape($user_cur->name), xcape(rules_id2descr($user_cur->rules_get(), $G_lang))); break; } @@ -669,7 +674,7 @@ class Bin5_table extends Table { if ($rules_tot < BIN5_PLAYERS_N) { // FIXME_LANG $msg = sprintf("L'utente %s vorrebbe usare le %s.", - xcape($user->name), xcape(rules_id2descr($rules_id))); + xcape($user->name), xcape(rules_id2descr($rules_id, $G_lang))); break; } @@ -1796,7 +1801,7 @@ function show_table_info(&$bri, &$table, $table_pos) // TAG: POINTS_MANAGEMENT $pnt_min = $table->points_n - MAX_POINTS < 0 ? 0 : $table->points_n - MAX_POINTS; - $noty = sprintf('

%s.

\n', xcape(ucfirst(rules_id2descr($table->rules->id_get())))); + $noty = sprintf('

%s.

\n', xcape(ucfirst(rules_id2descr($table->rules->id_get(), $G_lang)))); $noty .= sprintf(''); // Names. diff --git a/web/briskin5/Obj/rules.phh b/web/briskin5/Obj/rules.phh index 37dbe58..48e540b 100644 --- a/web/briskin5/Obj/rules.phh +++ b/web/briskin5/Obj/rules.phh @@ -57,12 +57,12 @@ function rules_id2name($id) return 'Rules_unknown'; } -function rules_id2descr($id) +function rules_id2descr($id, $lang) { if ($id == 1) - return 'regole vecchie con pareggio'; + return 'regole vecchie (con pareggio)'; else if ($id == 2) - return 'regole nuove senza pareggio'; + return 'regole nuove (senza pareggio)'; else if ($id == 4) return 'regole del torneo "insieme per gioco"'; diff --git a/web/briskin5/stat-day.php b/web/briskin5/stat-day.php index 8afb371..f12b303 100644 --- a/web/briskin5/stat-day.php +++ b/web/briskin5/stat-day.php @@ -42,15 +42,6 @@ $G_base = "../"; // SYNC WITH bin5_tournaments table $mlang_stat_day = array( - 'old rules: with draw'=> array( 'it' => 'Partite vecchie (con il pareggio)', - 'en' => 'Old matches (with draw)' ), - - 'new rules: without draw' => array( 'it' => 'Partite nuove (senza pareggio)', - 'en' => 'New matches (without draw)'), - - 'special match' => array( 'it' => 'Partite speciali', - 'en' => 'Special matches'), - 'info_total'=> array( 'it' => 'totali', 'en' => 'En totali') ); @@ -129,12 +120,8 @@ SELECT m.code AS code, m.mazzo_next as minus_one_is_old if ($tmt_n == 0) continue; - if (!isset($mlang_stat_day[$trn_obj->name][$G_lang])) { - log_crit("stat-day: tournament name not found in array"); - break; - } - printf("[Tournament [%s]], number of matches: %d\n", $mlang_stat_day[$trn_obj->name][$G_lang], $tmt_n); - fprintf($fpexp, "

%s

", $mlang_stat_day[$trn_obj->name][$G_lang]); + printf("[Tournament [%s]], number of matches: %d\n", rules_id2descr($trn_obj->code, $G_lang), $tmt_n); + fprintf($fpexp, "

%s

", xcape(ucfirst(rules_id2descr($trn_obj->code, $G_lang)))); // loop on matches for ($m = 0 ; $m < $tmt_n ; $m++) { -- 2.17.1