- Timestamp:
- Apr 8, 2010, 7:58:16 AM (15 years ago)
- Location:
- branches/CombinedTextTables
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CombinedTextTables/TranslationList.php
r405 r425 3 3 include('includes/global.php'); 4 4 5 function WriteQuests($Query)6 { 7 global $Database, $T ranslationTree, $GroupId, $Table, $Action;5 function ShowTable($Group, $Condition = '') 6 { 7 global $Database, $Table, $Action; 8 8 9 $Query = 'SELECT `T`.*, `TranslationItem`.`Value`, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `T`.`User`) AS `UserName`'. 10 ' FROM `Translation` AS `T`'. 11 ' JOIN `TranslationItem` ON (`TranslationItem`.`Translation` = `T`.`Id`) AND (`TranslationItem`.`Sequence` = 1)'. 12 ' WHERE (`T`.`Group` = '.$Group['Id'].')'; 13 if($Condition != '') $Query .= ' AND '.$Condition; 14 9 15 // Get total item count 10 16 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$Query.') AS `T`'); … … 15 21 16 22 $TableColumns = array( 17 array('Name' => 'I D', 'Title' => 'Pořadové číslo'),23 array('Name' => 'Id', 'Title' => 'Pořadové číslo'), 18 24 array('Name' => 'Entry', 'Title' => 'Identifikační číslo'), 19 array('Name' => $TranslationTree[$GroupId]['Items'][0]['Column'], 'Title' => 'Název'),25 array('Name' => 'Value', 'Title' => 'Název'), 20 26 array('Name' => 'VersionStart', 'Title' => 'Verze'), 21 27 ); … … 31 37 while($Line = mysql_fetch_assoc($DbResult)) 32 38 { 33 echo('<tr><td><a href="form.php?group='.$Group Id.'&ID='.$Line['ID'].'">'.$Line['ID'].'</a></td><td>'.$Line['Entry'].'</td>'.34 '<td>'.htmlspecialchars($Line[ $TranslationTree[$GroupId]['Items'][0]['Column']]).'</td>'.39 echo('<tr><td><a href="form.php?group='.$Group['Id'].'&ID='.$Line['Id'].'">'.$Line['Id'].'</a></td><td>'.$Line['Entry'].'</td>'. 40 '<td>'.htmlspecialchars($Line['Value']).'</td>'. 35 41 '<td>'.GetVersionWOW($Line['VersionStart']).'-'.GetVersionWOW($Line['VersionEnd']).'</td>'); 36 42 if($Action == 'selection') echo('<td>'.$Line['CountQuest'].'</td>'); … … 43 49 } 44 50 45 function Nontranslated() 46 { 47 global $GroupId, $Table; 48 49 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&action=filter">Filtr textů</a> -> '. 50 '<a title="Zde můžete začít překládat" href="?group='.$GroupId.'&action=selection">Nepřeložené texty</a> - > '. 51 function NonTranslated($Group) 52 { 53 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$Group['Id'].'&action=filter">Filtr textů</a> -> '. 54 '<a title="Zde můžete začít překládat" href="?group='.$Group['Id'].'&action=selection">Nepřeložené texty</a> - > '. 51 55 '<strong>Vypsání nepřeložených textů s limitem na stránku</strong><br /><br />'); 52 56 53 WriteQuests('SELECT * FROM `'.$Table.'` AS `items` WHERE (`items`.`Language` = 0) AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `sub` WHERE (`sub`.`Language` <> 0) AND (`sub`.`Entry` = `items`.`Entry`) AND (`sub`.`Complete`=1) AND (`sub`.`VersionStart` = `items`.`VersionStart`) AND (`sub`.`VersionEnd` = `items`.`VersionEnd`))'); 57 ShowTable($Group, '(`Language` = 0)', ' AND `Id` NOT IN (SELECT `Id` FROM `Translation` AS `Sub`'. 58 ' WHERE (`Sub`.`Language` <> 0)'. 59 ' AND (`Sub`.`Entry` = `T`.`Entry`)'. 60 ' AND (`Sub`.`Complete` = 1)'. 61 ' AND (`Sub`.`VersionStart` = `T`.`VersionStart`) AND (`Sub`.`VersionEnd` = `T`.`VersionEnd`))'); 54 62 } 55 63 … … 92 100 } 93 101 94 function Non complete()95 { 96 global $ GroupId, $Table, $BuildNumber_max, $Database;97 98 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$Group Id.'&action=filter">Filtr textů</a> ->99 <a title="Zde můžete začít překládat" href="?group='.$Group Id.'&action=selection">nedokončené texty</a> - >102 function NonComplete($Group) 103 { 104 global $BuildNumber_max; 105 106 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$Group['Id'].'&action=filter">Filtr textů</a> -> 107 <a title="Zde můžete začít překládat" href="?group='.$Group['Id'].'&action=selection">nedokončené texty</a> - > 100 108 <strong>Vypsání nedokončených textů s limitem na stránku</strong><br /><br />'); 101 109 102 WriteQuests('SELECT `items`.*, `User`.`Name` AS `UserName` FROM `'.$Table.'` AS `items` JOIN `User` ON `User`.`ID` = `items`.`User` WHERE (`items`.`Language` = 0) AND 103 NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `sub` WHERE (`sub`.`Language` <> 0) AND (`sub`.`Entry` = `items`.`Entry`) AND (`sub`.`Complete` = 1) AND (`VersionEnd` = '.$BuildNumber_max.')) AND 104 EXISTS(SELECT 1 FROM `'.$Table.'` AS `sub2` WHERE (`sub2`.`Language` <> 0) AND (`sub2`.`Entry` = `items`.`Entry`) AND (`sub2`.`Complete` = 0) AND (`VersionEnd` = '.$BuildNumber_max.')) AND (`items`.`VersionEnd` = '.$BuildNumber_max.')'); 105 } 106 107 function Translate() 108 { 109 global $GroupId, $Table, $BuildNumber_max, $Database; 110 111 echo('<a title="Zobrazit překlady podle vlasního filtru" href="?group='.$GroupId.'&action=filter">Filtr překladů</a> -> 112 <a title="Přeložené texty, můžete zde hlasovat, nebo opravovat texty" href="?group='.$GroupId.'&action=Translate">Přeložené texty</a><br /><br />'); 113 114 WriteQuests('SELECT `'.$Table.'`.*, `User`.`Name` AS `UserName` FROM `'.$Table.'` JOIN `User` ON `User`.`ID` = `'.$Table.'`.`User` WHERE (`'.$Table.'`.`Language` <> 0) AND (`'.$Table.'`.`Complete` = 1)'); 115 } 116 117 function UserTranslated() 118 { 119 global $GroupId, $Table, $User; 120 121 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&action=filter">Filtr textů</a> -> 122 <a title="Přeložené questy přilášeného uživatele" href="?group='.$GroupId.'&action=my">Moje překlady</a><br /><br />'); 123 WriteQuests('SELECT `'.$Table.'`.*, `User`.`Name` AS `UserName` FROM `'.$Table.'` JOIN `User` ON `User`.`id` = `'.$Table.'`.`User` WHERE `'.$Table.'`.`User` = '.$User->Id); 124 } 125 126 function UserUnfinished() 127 { 128 global $GroupId, $Table, $User; 129 130 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&action=filter">Filtr textů</a> -> 131 <a title="Nedokončené texty" href="?group='.$GroupId.'&action=mydevelop">Rozepsané překlady</a><br /><br />'); 132 WriteQuests('SELECT *, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE `User` = '.$User->Id.' AND `Complete` = 0'); 110 ShowTable($Group, '(`T`.`Language` = 0)'. 111 ' AND NOT EXISTS (SELECT 1 FROM `Translation` AS `Sub` WHERE (`Sub`.`Language` <> 0) AND (`Sub`.`Entry` = `T`.`Entry`) AND (`Sub`.`Complete` = 1) AND (`VersionEnd` = '.$BuildNumber_max.'))'. 112 ' AND EXISTS (SELECT 1 FROM `Translation` AS `Sub2` WHERE (`Sub2`.`Language` <> 0) AND (`Sub2`.`Entry` = `T`.`Entry`) AND (`Sub2`.`Complete` = 0) AND (`VersionEnd` = '.$BuildNumber_max.')) AND (`T`.`VersionEnd` = '.$BuildNumber_max.')'); 113 } 114 115 function Translated($Group) 116 { 117 global $BuildNumber_max, $Database; 118 119 echo('<a title="Zobrazit překlady podle vlasního filtru" href="?group='.$Group['Id'].'&action=filter">Filtr překladů</a> -> <a title="Přeložené texty, můžete zde hlasovat, nebo opravovat texty" href="?group='.$Group['Id'].'&action=Translate">Přeložené texty</a><br /><br />'); 120 121 ShowTable($Group, '(`T`.`Language` <> 0) AND (`T`.`Complete` = 1)'); 122 } 123 124 function UserTranslated($Group) 125 { 126 global $User; 127 128 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$Group['Id'].'&action=filter">Filtr textů</a> -> 129 <a title="Přeložené questy přilášeného uživatele" href="?group='.$Group['Id'].'&action=my">Moje překlady</a><br /><br />'); 130 131 ShowTable($Group, '(`T`.`User` = '.$User->Id.')'); 132 } 133 134 function UserUnfinished($Group) 135 { 136 global $User; 137 138 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$Group['Id'].'&action=filter">Filtr textů</a> -> 139 <a title="Nedokončené texty" href="?group='.$Group['Id'].'&action=mydevelop">Rozepsané překlady</a><br /><br />'); 140 141 ShowTable($Group, '(`T`.`User` = '.$User->Id.') AND (`T`.`Complete` = 0)'); 133 142 } 134 143 … … 153 162 } 154 163 155 function UserAll() 156 { 157 global $Database, $Table, $GroupId, $TranslationTree; 158 164 function UserAll($Group) 165 { 166 global $Database, $TranslationTree; 167 168 if(!array_key_exists('user', $_GET) or !is_numeric($_GET['user'])) ErrorMessage('Nezadáno id překladatele'); 159 169 $ID = $Database->SQLCommand('SELECT `Name` FROM `User` WHERE `ID` = '.$_GET['user']); 160 170 $Line = mysql_fetch_row($ID); 161 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$Group Id.'&action=filter">Filtr textů</a>'.171 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$Group['Id'].'&action=filter">Filtr textů</a>'. 162 172 ' -> <strong>Počty překladů uživatele '.$Line[0].': </strong><br /><br />'); 163 173 … … 165 175 $Total = 0; 166 176 foreach($TranslationTree as $Group) 167 if($Group['TablePrefix'] != '') 168 { 177 { 169 178 if(array_key_exists('not', $_GET)) 170 179 { 171 $sql = 'SELECT COUNT(*) FROM ` '.$Group['TablePrefix'].'` WHERE `Complete` = 0 AND `User`='.$_GET['user'];180 $sql = 'SELECT COUNT(*) FROM `Translation` WHERE (`Complete` = 0) AND (`User`='.$_GET['user'].') AND (`Group` = '.$Group['Id'].')'; 172 181 $ID = $Database->SQLCommand($sql); 173 182 $Line = mysql_fetch_row($ID); 174 183 $GroupId = $Group['Id']; 175 echo('<tr><td><a href="?group='.$Group Id.'&action=userid&not&user='.$_GET['user'].'">'.$Group['Name'].'</a></td><td>'.$Line[0].'</td></tr>');184 echo('<tr><td><a href="?group='.$Group['Id'].'&action=userid&not&user='.$_GET['user'].'">'.$Group['Name'].'</a></td><td>'.$Line[0].'</td></tr>'); 176 185 $Total += $Line[0]; 177 186 } else 178 187 { 179 $sql = 'SELECT COUNT(*) FROM ` '.$Group['TablePrefix'].'` WHERE `User`='.$_GET['user'];188 $sql = 'SELECT COUNT(*) FROM `Translation` WHERE (`User`='.$_GET['user'].') AND (`Group` = '.$Group['Id'].')'; 180 189 $ID = $Database->SQLCommand($sql); 181 190 $Line = mysql_fetch_row($ID); 182 191 $GroupId = $Group['Id']; 183 echo('<tr><td><a href="?group='.$Group Id.'&action=userid&user='.$_GET['user'].'">'.$Group['Name'].'</a></td><td>'.$Line[0].'</td></tr>');192 echo('<tr><td><a href="?group='.$Group['Id'].'&action=userid&user='.$_GET['user'].'">'.$Group['Name'].'</a></td><td>'.$Line[0].'</td></tr>'); 184 193 $Total += $Line[0]; 185 194 } … … 221 230 } 222 231 223 function TranslatedByUserId( )224 { 225 global $Database , $Table, $GroupId;226 227 if(array_key_exists('user', $_GET) )232 function TranslatedByUserId($Group) 233 { 234 global $Database; 235 236 if(array_key_exists('user', $_GET) and is_numeric($_GET['user'])) 228 237 { 229 238 $ID = $Database->SQLCommand('SELECT `Name` FROM `User` WHERE `ID` = '.($_GET['user'] * 1)); … … 231 240 { 232 241 $Line = mysql_fetch_row($ID); 233 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$Group Id.'&action=filter">Filtr textů</a> -> '.242 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$Group['Id'].'&action=filter">Filtr textů</a> -> '. 234 243 '<strong>Vypis překladů uživatele '.$Line[0].': </strong><br /><br />'); 235 244 if(array_key_exists('not', $_GET)) 236 WriteQuests('SELECT *, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE (`Complete` = 0) AND (`User` = '.$_GET['user'].')');237 else WriteQuests('SELECT *, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE`User` = '.$_GET['user']);245 ShowTable($Group, '(`T`.`Complete` = 0) AND (`T`.`User` = '.$_GET['user'].')'); 246 else ShowTable($Group, '`T`.`User` = '.$_GET['user']); 238 247 } else echo('Nebyl nalezen uživatel se zadaným id'); 239 248 } else echo('Je nutno zadat id uživatele.'); 240 249 } 241 250 242 function TranslatedSearch( )243 { 244 global $T able, $GroupId, $TranslationTree;251 function TranslatedSearch($Group) 252 { 253 global $TranslationTree; 245 254 246 255 if(array_key_exists('search', $_GET)) $Search = $_GET['search']; … … 248 257 else ErrorMessage('Nebyl zadán text k vyhledání.'); 249 258 250 $sql = 'SELECT *, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE `ID` LIKE "%'.$Search.'%" 251 OR `Entry` LIKE "%'.$Search.'%" 252 OR `Language` LIKE "%'.$Search.'%" 253 OR `User` LIKE "%'.$Search.'%" 254 OR `Complete` LIKE "%'.$Search.'%"'; 255 foreach($TranslationTree[$GroupId]['Items'] as $Item) 256 { 257 if($Item['Column'] != '') $sql .= ' OR `'.$Item['Column'].'` LIKE "%'.$Search.'%"'; 258 } 259 260 WriteQuests($sql); 259 $Filter = '(`T`.`Id` LIKE "%'.$Search.'%")'. 260 ' OR (`T`.`Entry` LIKE "%'.$Search.'%")'. 261 ' OR (`T`.`Language` LIKE "%'.$Search.'%")'. 262 ' OR (`T`.`User` LIKE "%'.$Search.'%")'. 263 ' OR (`T`.`Complete` LIKE "%'.$Search.'%")'; 264 //' OR (`T`.`Id` IN (SELECT `Id` FROM `TranslationItem` WHERE (`TranslationItem`.`Translate` = `T`.`Id`) AND (`TranslationItem`.`Value` LIKE "%'.$Search.'%"))'; 265 266 ShowTable($Group, $Filter); 261 267 } 262 268 … … 274 280 } 275 281 276 function TranslatedAll() 277 { 278 global $GroupId, $Table; 279 280 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&action=filter">Filtr textů</a> -> 281 <a title="Zde můžete začít překládat" href="?group='.$GroupId.'&action=selection">Nepřeložené texty</a> - > 282 function TranslatedAll($Group) 283 { 284 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$Group['Id'].'&action=filter">Filtr textů</a> -> 285 <a title="Zde můžete začít překládat" href="?group='.$Group['Id'].'&action=selection">Nepřeložené texty</a> - > 282 286 <strong>Výpis všech textů s limitem na stránku</strong><br /><br />'); 283 287 284 WriteQuests('SELECT *, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE (`'.$Table.'`.`Language` = 0)');285 } 286 287 function TranslatedFilter( )288 { 289 global $ Table, $GroupId, $Database, $User;290 291 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$Group Id.'&action=filter">Filtr textů</a><br /><br /><br />'.288 ShowTable($Group, '(`T`.`Language` = 0)'); 289 } 290 291 function TranslatedFilter($Group) 292 { 293 global $Database, $User; 294 295 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$Group['Id'].'&action=filter">Filtr textů</a><br /><br /><br />'. 292 296 '<table class="BaseTable"><tr><th>Odkaz</th><th>Popis</th></tr>'. 293 '<tr><td><a title="Všechny dostupné texty ve skupině" href="?group='.$Group Id.'&action=all">Všechny texty</a></td>'.297 '<tr><td><a title="Všechny dostupné texty ve skupině" href="?group='.$Group['Id'].'&action=all">Všechny texty</a></td>'. 294 298 '<td>Zobrazit všechny dostupné texty ve skupině.</td></tr>'. 295 '<tr><td><a title="Přeložené texty, můžete zde hlasovat, nebo text opravovat" href="?group='.$Group Id.'&action=Translate">Přeložené texty</a></td>'.299 '<tr><td><a title="Přeložené texty, můžete zde hlasovat, nebo text opravovat" href="?group='.$Group['Id'].'&action=Translate">Přeložené texty</a></td>'. 296 300 '<td>Zobrazit pouze již přeložené texty.</td></tr>'. 297 '<tr><td><a title="Nepřeložené texty" href="?group='.$Group Id.'&action=notran">Nepřeložené texty</a></td>'.301 '<tr><td><a title="Nepřeložené texty" href="?group='.$Group['Id'].'&action=notran">Nepřeložené texty</a></td>'. 298 302 '<td>Dosud nepřeložené texty, které je potřeba přeložit.</td></tr>'. 299 '<tr><td><a title="Nedokončené texty" href="?group='.$Group Id.'&action=nocomplete">Nedokončené texty</a></td>'.303 '<tr><td><a title="Nedokončené texty" href="?group='.$Group['Id'].'&action=nocomplete">Nedokončené texty</a></td>'. 300 304 '<td>Texty označené jako rozpracované.</td></tr>'); 301 305 302 306 if($User->Licence(LICENCE_USER)) 303 307 { 304 echo('<tr><td><a title="Nedokončené texty" href="?group='.$Group Id.'&action=mydevelop">Rozepsané texty</a></td>308 echo('<tr><td><a title="Nedokončené texty" href="?group='.$Group['Id'].'&action=mydevelop">Rozepsané texty</a></td> 305 309 <td>Nedokončené texty přihlášeného uživatele</td></tr> 306 <tr><td><a title="Přeložené texty přihlášeného uživatele" href="?group='.$Group Id.'&action=my">Moje překlady</a></td>310 <tr><td><a title="Přeložené texty přihlášeného uživatele" href="?group='.$Group['Id'].'&action=my">Moje překlady</a></td> 307 311 <td>Přeložené texty přihlášeného uživatele</td></tr>'); 308 312 } 309 313 310 echo('<tr><td><form action="?group='.$Group Id.'&action=users" method="post"><div>'.314 echo('<tr><td><form action="?group='.$Group['Id'].'&action=users" method="post"><div>'. 311 315 '<select name="users[]" size="10" multiple="multiple" class="UserList">'); 312 316 313 317 $ID = $Database->SQLCommand('SELECT `Name`, `ID` FROM `User` WHERE 314 EXISTS(SELECT 1 FROM `'.$Table.'` WHERE `User` = `User`.`ID`) ORDER BY `Name`'); 318 EXISTS(SELECT 1 FROM `Translation` WHERE (`Translation`-`User` = `User`.`ID`) AND (`Translation`.`Group` = '.$Group['Id'].')) ORDER BY `Name`'); 319 echo(mysql_error()); 315 320 if($ID) 316 321 while($Line = mysql_fetch_assoc($ID)) … … 322 327 Vybrat více uživatelů můžete pomocí CTRL+click</td></tr>'); 323 328 324 echo('<tr><td><form action="?group='.$Group Id.'&action=search" method="post"><div>'.329 echo('<tr><td><form action="?group='.$Group['Id'].'&action=search" method="post"><div>'. 325 330 '<input type="text" name="search" size="8" />'. 326 331 '<input type="submit" value="Hledat" />'. … … 328 333 '</td><td>Vyhledat pomocí textu</td></tr>'); 329 334 330 echo('<tr><td><form action="?group='.$Group Id.'&action=searchentry" method="post"><div>'.335 echo('<tr><td><form action="?group='.$Group['Id'].'&action=searchentry" method="post"><div>'. 331 336 '<input type="text" name="ID" size="8" />'. 332 337 '<input type="submit" value="Hledat" />'. … … 341 346 342 347 $GroupId = LoadGroupIdParameter(); 343 $Table = $TranslationTree[$GroupId]['TablePrefix']; 344 if(array_key_exists('action', $_GET)) $Action = $_GET['action']; else $Action = ''; 345 346 $DbResult = $Database->SQLCommand('SELECT MAX(`VersionEnd`) FROM `'.$TranslationTree[$GroupId]['TablePrefix'].'`'); 348 $Group = $TranslationTree[$GroupId]; 349 if(array_key_exists('action', $_GET)) $Action = $_GET['action']; 350 else $Action = ''; 351 352 $DbResult = $Database->SQLCommand('SELECT MAX(`VersionEnd`) FROM `Translation`'); 347 353 $ID = mysql_fetch_row($DbResult); 348 354 $BuildNumber_max = $ID[0]; … … 351 357 echo('Skupina: <strong>'.$TranslationTree[$GroupId]['Name'].'</strong><br />'); 352 358 353 if($Action == 'notran') Non translated();359 if($Action == 'notran') NonTranslated($Group); 354 360 else if($Action == 'connexion') Connexion(); 355 361 else if($Action == 'connexion_list') ConnexionList(); 356 else if($Action == 'nocomplete') Non complete();357 else if($Action == 'Translate') Translate ();358 else if(($Action == 'my') and $User->Licence(LICENCE_USER)) UserTranslated( );359 else if(($Action == 'mydevelop') and $User->Licence(LICENCE_USER)) UserUnfinished( );362 else if($Action == 'nocomplete') NonComplete($Group); 363 else if($Action == 'Translate') Translated($Group); 364 else if(($Action == 'my') and $User->Licence(LICENCE_USER)) UserTranslated($Group); 365 else if(($Action == 'mydevelop') and $User->Licence(LICENCE_USER)) UserUnfinished($Group); 360 366 else if($Action == 'users') UserSelected(); 361 else if($Action == 'userall') UserAll( );367 else if($Action == 'userall') UserAll($Group); 362 368 else if($Action == 'grouplist') GroupList(); 363 else if($Action == 'userid') TranslatedByUserId( );364 else if($Action == 'search') TranslatedSearch( );369 else if($Action == 'userid') TranslatedByUserId($Group); 370 else if($Action == 'search') TranslatedSearch($Group); 365 371 else if($Action == 'searchentry') SearchEntry(); 366 else if($Action == 'all') TranslatedAll( );367 else if($Action == 'filter') TranslatedFilter( );372 else if($Action == 'all') TranslatedAll($Group); 373 else if($Action == 'filter') TranslatedFilter($Group); 368 374 else echo('Neznámá akce'); 369 375 -
branches/CombinedTextTables/action.php
r376 r425 12 12 echo('<table class="BaseTable"><tr><th>Skupina</th><th>Výsledků</th></tr>'); 13 13 foreach($TranslationTree as $Group) 14 { 15 $Table = $Group['TablePrefix']; 16 17 $sql = 'SELECT COUNT(*) FROM `'.$Table.'` WHERE `ID` LIKE "%'.$Search.'%" 18 OR `Entry` LIKE "%'.$Search.'%" 19 OR `User` LIKE "%'.$Search.'%" 20 OR `Complete` LIKE "%'.$Search.'%"'; 21 foreach($Group['Items'] as $Item) 22 { 23 if($Item['Column'] != '') $sql .= ' OR `'.$Item['Column'].'` LIKE "%'.$Search.'%"'; 24 } 14 { 15 $sql = 'SELECT COUNT(*) FROM `Translation` WHERE (`ID` LIKE "%'.$Search.'%")'. 16 ' OR (`Entry` LIKE "%'.$Search.'%")'. 17 ' OR (`User` LIKE "%'.$Search.'%")'. 18 ' OR (`Complete` LIKE "%'.$Search.'%")'; 25 19 $Line = mysql_fetch_row($Database->SQLCommand($sql)); 26 20 echo('<tr><td><a href="TranslationList.php?group='.$Group['Id'].'&action=search&search='.$Search.'">'.$Group['Name'].'</a></td><td>'.$Line[0].'</td></tr>'); … … 256 250 257 251 $GroupId = LoadGroupIdParameter(); 258 $ Table = $TranslationTree[$GroupId]['TablePrefix'];252 $Group = $TranslationTree[$GroupId]; 259 253 if(array_key_exists('action', $_GET)) $Action = $_GET['action']; 260 254 else $Action = ''; -
branches/CombinedTextTables/form.php
r420 r425 5 5 function ColorNames($Text, $names) 6 6 { 7 8 // $buff[] = array($Line['ID'],GetIDbyName($Table),$Line[$Column],$Line['Tran']); 9 foreach($names as $Line) { 10 if ($Line[3] <> '') { 11 $Text = str_replace($Line[2],'<span Title="Byl nalezen překlad: '.$Line[3].'" class="edit">'.$Line[2].'</span>',$Text); 12 $Text = str_replace(strtolower($Line[2]),'<span Title="Byl nalezen překlad: '.$Line[3].'" class="edit">'.$Line[2].'</span>',$Text); 13 } else { 14 $Text = str_replace($Line[2],'<span Title="Jméno bylo nalezeno v názvech a můžete ho přeložit. Začnete kliknutím na: Vyhledat v názvech" class="edit">'.$Line[2].'</span>',$Text); 15 $Text = str_replace(strtolower($Line[2]),'<span Title="Jméno bylo nalezeno v názvech a můžete ho přeložit. Začnete kliknutím na: Vyhledat v názvech" class="edit">'.$Line[2].'</span>',$Text); 16 } 7 // $buff[] = array($Line['ID'],GetIDbyName($Table),$Line[$Column],$Line['Tran']); 8 foreach($names as $Line) 9 { 10 if($Line[3] <> '') 11 { 12 $Text = str_replace($Line[2], '<span Title="Byl nalezen překlad: '.$Line[3].'" class="edit">'.$Line[2].'</span>',$Text); 13 $Text = str_replace(strtolower($Line[2]), '<span Title="Byl nalezen překlad: '.$Line[3].'" class="edit">'.$Line[2].'</span>', $Text); 14 } else 15 { 16 $Text = str_replace($Line[2], '<span Title="Jméno bylo nalezeno v názvech a můžete ho přeložit. Začnete kliknutím na: Vyhledat v názvech" class="edit">'.$Line[2].'</span>', $Text); 17 $Text = str_replace(strtolower($Line[2]), '<span Title="Jméno bylo nalezeno v názvech a můžete ho přeložit. Začnete kliknutím na: Vyhledat v názvech" class="edit">'.$Line[2].'</span>', $Text); 18 } 17 19 } 18 20 return $Text; … … 22 24 23 25 $GroupId = LoadGroupIdParameter(); 24 $ Table = $TranslationTree[$GroupId]['TablePrefix'];26 $Group = $TranslationTree[$GroupId]; 25 27 if(array_key_exists('action', $_GET)) $Action = $_GET['action']; 26 28 else $Action = ''; 27 29 28 if(array_key_exists('ID', $_GET) )30 if(array_key_exists('ID', $_GET) and is_numeric($_GET['ID'])) 29 31 { 30 $TextID = $_GET['ID'] * 1;32 $TextID = $_GET['ID']; 31 33 32 $DbResult = $Database->SQLCommand('SELECT * FROM ` '.$Table.'` WHERE `ID` = '.$TextID);34 $DbResult = $Database->SQLCommand('SELECT * FROM `Translation` WHERE `ID` = '.$TextID); 33 35 $Line = mysql_fetch_assoc($DbResult); 34 36 if(!$Line) ErrorMessage('Překlad nenalezen.'); 35 37 36 $DbResult = $Database->SQLCommand('SELECT * FROM ` '.$Table.'` WHERE `Language` = 0 AND `Entry` = '.$Line['Entry'].' AND `VersionEnd` = '.$Line['VersionEnd'].'LIMIT 1');38 $DbResult = $Database->SQLCommand('SELECT * FROM `Translation` WHERE (`Language` = 0) AND (`Entry` = '.$Line['Entry'].') AND (`VersionEnd` = '.$Line['VersionEnd'].') LIMIT 1'); 37 39 $LineAJ = mysql_fetch_assoc($DbResult); 38 40 if(!$Line) ErrorMessage('Anglický originál k překladu nenalezen.'); 41 $DbResult = $System->Database->query('SELECT * FROM `TranslationItem` WHERE `Translation`='.$LineAJ['Id']); 42 while($DbRow = $DbResult->fetch_assoc()) 43 $LineAJ['Item'.$DbRow['Sequence']] = $DbRow['Value']; 39 44 40 45 $IDUser = $Database->SQLCommand('SELECT * FROM `User` WHERE `ID` = '.$Line['User']); … … 45 50 if(($Line['Language'] <> 0) and ($LineUser['Name'] <> '')) 46 51 echo('Přeložil: <strong>'.$LineUser['Name'].'</strong> <br />'); 47 if(($Line[' Take'] <> 0) and ($Line['Take'] <> $Line['ID']))52 if(($Line['Original'] <> 0) and ($Line['Original'] <> $Line['Id'])) 48 53 { 49 $Language = mysql_fetch_assoc($Database->SQLCommand('SELECT `Language`,`VersionStart`,`VersionEnd` FROM ` '.$Table.'` WHERE `ID` = '.$Line['Take']));54 $Language = mysql_fetch_assoc($Database->SQLCommand('SELECT `Language`,`VersionStart`,`VersionEnd` FROM `Translation` WHERE `ID` = '.$Line['Original'])); 50 55 // echo $Language['Language'].' '.$Line['Take']; 51 56 if($Language['Language'] <> 0) 52 echo('Převzato z: <a href="form.php?group='.$GroupId.'&ID='.$Line[' Take'].'">'.$Line['Take'].'</a> <br />');57 echo('Převzato z: <a href="form.php?group='.$GroupId.'&ID='.$Line['Original'].'">'.$Line['Original'].'</a> <br />'); 53 58 } 54 59 echo('Text: '); … … 63 68 echo('<br />'); 64 69 65 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ` '.$Table.'` WHERE `Entry` = '.$Line['Entry'].' AND `Language` <> 0');70 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Translation` WHERE (`Entry` = '.$Line['Entry'].') AND (`Language` <> 0)'); 66 71 $Version = mysql_fetch_row($DbResult); 67 72 $Version = $Version[0]; … … 75 80 <option value="-1">Vyberte text k porovnání</option> 76 81 <option value="-1">Zobrazit/porovnat všechny</option>'); 77 $DataID = $Database->SQLCommand('SELECT *, (SELECT `User`.`Name` AS `UserName` FROM `User` WHERE `User`.`ID` = ` '.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE (`Entry` = '.$Line['Entry'].') AND (`ID` <> '.$Line['ID'].')');82 $DataID = $Database->SQLCommand('SELECT *, (SELECT `User`.`Name` AS `UserName` FROM `User` WHERE `User`.`ID` = `Translate`.`User`) AS `UserName` FROM `Translate` WHERE (`Entry` = '.$Line['Entry'].') AND (`Id` <> '.$Line['Id'].')'); 78 83 while($version = mysql_fetch_array($DataID)) 79 84 { 80 if ($version['I D'] == $Line['Take']) echo('<option value="'.$version['ID'].'">'.$version['ID'].' - '.$version['User'].' (převzato)</option>');85 if ($version['Id'] == $Line['Original']) echo('<option value="'.$version['Id'].'">'.$version['Id'].' - '.$version['User'].' (převzato)</option>'); 81 86 else 82 87 { 83 88 if($version['Language'] == 0) $version['UserName'] = 'Předloha'; 84 echo('<option value="'.$version['I D'].'">'.$version['ID'].' - '.$Version['UserName'].' ('.GetVersionWOW($version['VersionStart']).' - '.GetVersionWOW($version['VersionEnd']).')</option>');89 echo('<option value="'.$version['Id'].'">'.$version['Id'].' - '.$Version['UserName'].' ('.GetVersionWOW($version['VersionStart']).' - '.GetVersionWOW($version['VersionEnd']).')</option>'); 85 90 } 86 91 } … … 95 100 if($User->Licence(LICENCE_USER)) 96 101 { 97 if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) echo('<a href="dictionary.php?group='.$GroupId.'&ID='.$LineAJ['I D'].'" target="_blank" title="Zobrazit přeložené názvy věci, postav, a herních objektů k tomuto překladu">Vyhledat v názvech</a>');102 if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) echo('<a href="dictionary.php?group='.$GroupId.'&ID='.$LineAJ['Id'].'" target="_blank" title="Zobrazit přeložené názvy věci, postav, a herních objektů k tomuto překladu">Vyhledat v názvech</a>'); 98 103 echo(' <input type="submit" value="Uložit do rozepsaných" name="save" title="Klikněte na uložit pro pozdější dokončení překladu" /> 99 104 <input type="submit" value="Dokončeno" name="End" title="Klikněte na Dokončeno jesli jsou všechny texty hotové a chcete již publikovat" /> '); 100 FollowingTran($TextID, $Table, $GroupId, true);101 FollowingTran($TextID, $Table, $GroupId);105 //FollowingTran($TextID, $Table, $GroupId, true); 106 //FollowingTran($TextID, $Table, $GroupId); 102 107 } 103 108 … … 128 133 echo('</td></tr>'); 129 134 130 //zvýrazňování jmen 131 $Text = ''; 132 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 133 if($TextItem['Visible'] == 1) 134 $Text = $Text.' '.$LineAJ[$TextItem['Column']]; 135 /* 136 // zvýrazňování jmen 137 $Text = ''; 138 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 139 if($TextItem['Visible'] == 1) 140 if(array_key_exists('Item'.$TextItem['Sequence'], $LineAJ)) 141 $Text = $Text.' '.$LineAJ['Item'.$TextItem['Sequence']]; 135 142 136 if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) { 137 //<span class="edit">barvou.</span> 138 $names = GetTranslatNames($Text,0,array('Dictionary' => 'Text','TextCreature' => 'name')); 139 } else { 140 $names = GetTranslatNames($Text,0,array('Dictionary' => 'Text')); 143 if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) 144 { 145 //<span class="edit">barvou.</span> 146 $names = GetTranslatNames($Text, 0, array('Dictionary' => 'Text', 'TextCreature' => 'name')); 147 } else 148 { 149 $names = GetTranslatNames($Text, 0, array('Dictionary' => 'Text')); 141 150 } 142 151 //print_r($names); 143 144 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 145 if($TextItem['Visible'] == 1) 146 { 147 if(($LineAJ[$TextItem['Column']] <> '') or ($Line[$TextItem['Column']] <> '')) 152 */ 153 $names = array(); 154 155 $DbResult = $System->Database->query('SELECT * FROM TranslationItem WHERE Translation='.$TextID); 156 while($TranslationItem = $DbResult->fetch_assoc()) 157 { 158 $TextItem = $TranslationTree[$GroupId]['Items'][$TranslationItem['Sequence']]; 159 if($TextItem['Visible'] == 1) 160 { 161 if(($LineAJ['Item'.$TranslationItem['Sequence']] <> '') or ($TranslationItem['Value'] <> '')) 162 { 163 //if($TextItem['Name'] == 'Text' AND (($Table == 'global_strings') OR ($Table == 'glue_strings'))) echo('<tr><th>'.$LineAJ['ShortCut'].'</th>'); 164 //else 165 echo('<tr><th>'.$TextItem['Name'].'</th>'); 166 167 echo('<td>'.str_replace("\n", '<br/>', ColorNames(htmlspecialchars($LineAJ['Item'.$TranslationItem['Sequence']]),$names)).'</td>'. 168 '<td><textarea rows="8" cols="40" onkeydown="ResizeTextArea(this)" class="textedit" id="Item'.$TranslationItem['Sequence'].'" name="Item'.$TranslationItem['Sequence'].'">'.htmlspecialchars($TranslationItem['Value']).'</textarea></td></tr>'); 169 } 170 } else 148 171 { 149 if ($TextItem['Name'] == 'Text' AND (($Table == 'global_strings') OR ($Table == 'glue_strings'))) echo('<tr><th>'.$LineAJ['ShortCut'].'</th>'); 150 else echo('<tr><th>'.$TextItem['Name'].'</th>'); 151 echo('<td>'.str_replace("\n", '<br/>', ColorNames(htmlspecialchars($LineAJ[$TextItem['Column']]),$names)).'</td> 152 <td><textarea rows="8" cols="40" onkeydown="ResizeTextArea(this)" class="textedit" id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'">'.htmlspecialchars($Line[$TextItem['Column']]).'</textarea></td></tr>'); 172 echo('<input id="Item'.$TranslationItem['Sequence'].'" name="Item'.$TranslationItem['Sequence'].'" type="hidden" value="'.htmlspecialchars($TranslationItem['Value']).'" />'); 153 173 } 154 } else155 {156 echo('<input id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'" type="hidden" value="'.htmlspecialchars($Line[$TextItem['Column']]).'" />');157 174 } 158 175 echo('</table></div></form>'); -
branches/CombinedTextTables/includes/global_function.php
r417 r425 238 238 $Result[$DbRow['Id']] = $DbRow; 239 239 } 240 $DbResult = $Database->SQLCommand('SELECT * FROM `GroupItem` ORDER BY ` DBCColumnIndex`');240 $DbResult = $Database->SQLCommand('SELECT * FROM `GroupItem` ORDER BY `Sequence`'); 241 241 while($DbRow = mysql_fetch_assoc($DbResult)) 242 242 { 243 $Result[$DbRow['Group']]['Items'][ ] = $DbRow;243 $Result[$DbRow['Group']]['Items'][$DbRow['Sequence']] = $DbRow; 244 244 } 245 245 return($Result); … … 469 469 { 470 470 //echo $Value['TablePrefix'].'='.$Table.'<br>'; 471 if ($Value['TablePrefix'] == $Table) return $TableID;471 if($Value['TablePrefix'] == $Table) return($TableID); 472 472 } 473 473 } -
branches/CombinedTextTables/save.php
r420 r425 10 10 $GroupId = LoadGroupIdParameter(); 11 11 $Group = $TranslationTree[$GroupId]; 12 $Table = $Group['TablePrefix'];13 12 if($User->Licence(LICENCE_USER)) 14 13 { … … 22 21 23 22 // Get source text record from database by ID 24 $DbResult = $System->Database->query('SELECT * FROM ` '.$Table.'` WHERE `ID`='.$TextID);23 $DbResult = $System->Database->query('SELECT * FROM `Translation` WHERE (`Id`='.$TextID.') AND (`Group` = '.$Group['Id'].')'); 25 24 if($DbResult->num_rows > 0) 26 25 { … … 28 27 29 28 // Get data for english original 30 $DbResult = $System->Database->query('SELECT * FROM ` '.$Table.'` WHERE (`Entry`='.$SourceText['Entry'].') AND (`Language` = 0) AND (`VersionStart` = '.$SourceText['VersionStart'].') AND (`VersionEnd` = '.$SourceText['VersionEnd'].')');31 if($DbResult->num_rows > 0) 29 $DbResult = $System->Database->query('SELECT * FROM `Translation` WHERE (`Entry`='.$SourceText['Entry'].') AND (`Language` = 0) AND (`VersionStart` = '.$SourceText['VersionStart'].') AND (`VersionEnd` = '.$SourceText['VersionEnd'].') AND (`Group` = '.$Group['Id'].')'); 30 if($DbResult->num_rows > 0) 32 31 { 33 32 $EnglishText = $DbResult->fetch_assoc(); … … 39 38 $Filter .= ' AND (`'.$GroupItem['Column'].'` = "'.$EnglishText[$GroupItem['Column']].'")'; 40 39 41 $DbResult = $System->Database->query('SELECT * FROM ` '.$Table.'` WHERE (`Language` = 0)'.$Filter);40 $DbResult = $System->Database->query('SELECT * FROM `Translation` WHERE (`Language` = 0) AND (`Group` = '.$Group['Id'].')'.$Filter); 42 41 while($DbRow = $DbResult->fetch_assoc()) 43 42 { 44 43 // Get user translation paired to found english item entry 45 $DbResult2 = $System->Database->query('SELECT * FROM ` '.$Table.'` WHERE (`User` = '.$User->Id.') AND (`Entry` = '.$DbRow['Entry'].') AND (`VersionStart` = '.$SourceText['VersionStart'].') AND (`VersionEnd` = '.$SourceText['VersionEnd'].')');44 $DbResult2 = $System->Database->query('SELECT * FROM `Translation` WHERE (`User` = '.$User->Id.') AND (`Entry` = '.$DbRow['Entry'].') AND (`VersionStart` = '.$SourceText['VersionStart'].') AND (`VersionEnd` = '.$SourceText['VersionEnd'].') AND (`Group` = '.$Group['Id'].')'); 46 45 if($DbResult2->num_rows > 0) 47 46 { … … 56 55 57 56 // Update user translation 58 $System->Database->query('UPDATE ` '.$Table.'` SET '.$Values.' WHERE `ID` = '.$ExistedText['ID']);57 $System->Database->query('UPDATE `Translation` SET '.$Values.' WHERE `ID` = '.$ExistedText['ID']); 59 58 60 59 echo('Změny v překladu <a href="form.php?group='.$GroupId.'&ID='.$ExistedText['ID'].'">'.$ExistedText['ID'].'</a> ('.$ExistedText['Entry'].') uloženy!<br />'); … … 63 62 { 64 63 // Insert new user translation 65 $Columns = '` Entry`, `VersionStart`, `VersionEnd`, `Language`, `Complete`, `User`, `Take`';66 $Values = $DbRow[' Entry'].', '.$DbRow['VersionStart'].', '.$DbRow['VersionEnd'].', '.$Language.', '.$Complete.', '.$User->Id.', '.$SourceText['ID'];64 $Columns = '`Group`, `Entry`, `VersionStart`, `VersionEnd`, `Language`, `Complete`, `User`, `Take`'; 65 $Values = $DbRow['Group'].', '.$DbRow['Entry'].', '.$DbRow['VersionStart'].', '.$DbRow['VersionEnd'].', '.$Language.', '.$Complete.', '.$User->Id.', '.$SourceText['ID']; 67 66 foreach($Group['Items'] as $GroupItem) 68 67 { … … 82 81 } 83 82 } 84 $System->Database->query('INSERT INTO ` '.$Table.'` ('.$Columns.') VALUES ('.$Values.')');83 $System->Database->query('INSERT INTO `Translation` ('.$Columns.') VALUES ('.$Values.')'); 85 84 $LastID = $System->Database->insert_id; 86 85 -
branches/CombinedTextTables/statistic.php
r410 r425 16 16 { 17 17 $Query .= 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('. 18 ' SELECT `T`.* FROM ` '.$DbRow['TablePrefix'].'` AS `T`'.19 ' WHERE (` Complete` = 1) AND (`Language`='.$LanguageId.') AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'.18 ' SELECT `T`.* FROM `Translation` AS `T`'. 19 ' WHERE (`Group` = '.$DbRow['Id'].') AND (`Complete` = 1) AND (`Language`='.$LanguageId.') AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'. 20 20 ') AS `C1`) AS `Translated`, '. 21 21 '(SELECT COUNT(DISTINCT(`Entry`)) FROM ('. 22 ' SELECT `T`.* FROM ` '.$DbRow['TablePrefix'].'` AS `T`'.23 ' WHERE (` Language` = 0) AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'.22 ' SELECT `T`.* FROM `Translation` AS `T`'. 23 ' WHERE (`Group` = '.$DbRow['Id'].') AND (`Language` = 0) AND (`VersionStart` <= '.$BuildNumber.') AND (`VersionEnd` >= '.$BuildNumber.')'. 24 24 ') AS `C2`) AS `Total`, "'.$DbRow['Name'].'" AS `Name` UNION '; 25 25 }
Note:
See TracChangeset
for help on using the changeset viewer.