source: trunk/comparison.php@ 85

Last change on this file since 85 was 83, checked in by maron, 16 years ago

užší levý panel

File size: 3.6 KB
Line 
1<?php
2
3include('includes/global.php');
4
5ShowPage();
6
7echo ('Text je porovnáván vždy ku předešlému (vlevo). Změny jsou zvýrazněny <span id="edit">barvou.</span><br><br>');
8
9 function CompareString($String1, $String2) {
10 //TODO: barevné porovnání
11 //strcasecmp($String1, $String2) == 0 je totožné
12 // echo $String1.'<br><br>';
13 $ArrStr1 = explode(' ',$String1);
14 $ArrStr2 = explode(' ',$String2);
15
16 for($i = 0;$i<count($ArrStr1);$i++) {
17 if (isset($ArrStr2[$i])) {
18 if ($ArrStr1[$i] == $ArrStr2[$i]) {
19 echo $ArrStr1[$i].' ';
20 } else {
21 $find = false;
22 for($j = 0;$j<count($ArrStr2);$j++) {
23 if (($ArrStr1[$i] == $ArrStr2[$j]) and ($find == false)) {
24 echo $ArrStr1[$i].' ';
25 $find = true;
26 }
27 }
28 if ($find == false)
29 echo '<span id="edit">'.$ArrStr1[$i].' </span>';
30 }
31 } else echo '<span id="edit">'.$ArrStr1[$i].' </span>';
32 }
33 // echo $ArrStr1[0];
34
35 }
36
37if(array_key_exists('group', $_GET)) $GroupId = $_GET['group']; else $GroupId = 1;
38$Table = $TranslationTree[$GroupId]['TablePrefix'];
39if(array_key_exists('action', $_GET)) $Action = $_GET['action']; else $Action = '';
40
41if(array_key_exists('entry', $_GET))
42{
43 $Textentry = $_GET['entry'];
44
45
46 if ((array_key_exists('ID1', $_GET)) and ($_GET['ID1'] <> -1)) { //porovnání pouze 2 textů
47 $TextID1 = $_GET['ID1'];
48 $TextID2 = $_GET['ID2'];
49 $WhereID = " AND (ID = $TextID1 OR ID = $TextID2 OR Language = 0)";
50 } else $WhereID = '';
51
52 $DataID = $Database->SQLCommand('SELECT * FROM '.$Table.' Where entry = '.$Textentry.$WhereID.' ORDER BY Language');
53 $i = 0;
54 while($Line = mysql_fetch_assoc($DataID)) {
55 $BuffLine[$i] = $Line;
56 $i = $i+1;
57 }
58 // if(!$Line) die('Překlad nenalezen.');
59 $Line = $BuffLine;
60 $i = $i-1;
61 echo('Počet porovnávaných textů: <b>'.$i.'</b><br> ');
62
63 echo('
64 <b>Číslo textu: <a href="http://www.wowhead.com/?quest='.$Textentry.'">'.$Textentry.'</a></b>
65
66 <table border="1" cellpadding="1" cellspacing="0">
67 <tr>');
68 echo (' <th>ID textu</th>');
69 foreach($Line as $Index => $LineItem) {
70 echo ('<td><a href="form.php?group='.$GroupId.'&amp;ID='.$LineItem['ID'].'">'.$LineItem['ID'].'</a></td>');
71 }
72 echo('</tr>');
73 echo (' <th>Převzato</th>');
74 foreach($Line as $Index => $LineItem) {
75 echo ('<td><a href="form.php?group='.$GroupId.'&amp;ID='.$LineItem['Take'].'">'.$LineItem['Take'].'</a></td>');
76 }
77 echo('</tr>');
78 echo (' <th>Přeložil</th>');
79 foreach($Line as $Index => $LineItem) {
80 $LineUser = mysql_fetch_array($Database->SQLCommand('SELECT * FROM user WHERE id = '.$LineItem['User']));
81 echo ('<th>'.$LineUser['user'].'</th>');
82 }
83 echo('</tr>');
84 echo (' <th>Jazyk</th>');
85 foreach($Line as $Index => $LineItem) {
86 echo ('<td>'); WriteLanguagesWithoutSel($LineItem['Language']); echo('</td>');
87 }
88 echo('</tr>');
89 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
90 {
91 if ($Line[0][$TextItem['Column']] <> '') {
92 echo('<tr>
93 <th>'.$TextItem['Name'].'</th>');
94 for ($i = 0; $i < count($Line); $i++) {
95 if ($i > 1) {
96 echo ('<td>');
97 CompareString($Line[$i][$TextItem['Column']],$Line[$i-1][$TextItem['Column']]);
98 echo ('</td>');
99 } else echo ('<td>'.$Line[$i][$TextItem['Column']].'</td>');
100 }
101 echo ('</tr>');
102 }
103 }
104 echo('</table></div>');
105
106
107
108} else
109{
110 // include 'ListQuests.php';
111 echo('Nebylo zadáno ID <a href="index.php">zpět</a>');
112}
113
114ShowFooter();
115
116?>
117
Note: See TracBrowser for help on using the repository browser.