From 3b78513e620507d5c19d543933ee4ab1a66f6cbe Mon Sep 17 00:00:00 2001 From: Filip Komar Date: Wed, 29 May 2013 06:13:30 +0000 Subject: improved view of big table ;) --- langs/report.php | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'langs/report.php') diff --git a/langs/report.php b/langs/report.php index f26d15ecb..9d7ecde91 100644 --- a/langs/report.php +++ b/langs/report.php @@ -49,6 +49,7 @@ $report = array(); $stats = array(); $stats['en']['files'] = 0; + $num_of_col = 0; $diff_link = ''; @@ -199,7 +200,18 @@ $f, $l, $old_page ); } + $num_clmns_to_repeat = 9; + $num_of_col++; + if ($num_of_col % $num_clmns_to_repeat == 0 && $num_of_col <= count($enFiles) - ($num_clmns_to_repeat / 3)) { + if ($l == 'en') { + $cols .= $lang_coloumn = 'Language'; + } else { + $cols .= $lang_coloumn = sprintf('%s
%s', $langs[$l], $l); + } + } } + $cols .= $lang_coloumn; // last coloumn + $num_of_col = 0; // reset counter of coloumns $progress = floor($stats[$l]['strings'] / $stats['en']['strings'] * 100); // special case, en @@ -222,12 +234,24 @@ krsort($languages, SORT_NUMERIC); $enFiles = array_map(function ($e) { return str_replace('en/', '', $e); }, $enFiles); - $thfiles = '' . implode('', $enFiles) . '' . PHP_EOL; + // add language coloumn repeating + $lang_line = array(); + $num_of_h_col = 0; + foreach ($enFiles as $lang_chunk) { + $num_of_h_col++; + $lang_line[] = $lang_chunk; + if ($num_of_h_col % $num_clmns_to_repeat == 0 && $num_of_h_col <= count($enFiles) - ($num_clmns_to_repeat / 3)) { + $lang_line[] = ' '; + } + } + $lang_line[] = ' ';// last h coloumn + + $thfiles = '' . implode('', $lang_line) . '' . PHP_EOL; $count = count($otherLangs); - $chunks = array_chunk($languages, 8); + $chunks = array_chunk($languages, $num_lines_to_repeat = 8); // add header repeating $table_body = array(); foreach ($chunks as $chunk) { - $table_body = array_merge($table_body, $chunk, array(count($chunk) > 4 ? ' File' . $thfiles : '')); + $table_body = array_merge($table_body, $chunk, array(count($chunk) > ($num_lines_to_repeat / 2) ? ' File' . $thfiles : '')); } array_unshift($table_body, $en_language); // unshift English back $s = implode($table_body); -- cgit v1.2.1