Changeset 165
- Timestamp:
- Mar 19, 2009, 7:34:47 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dictionary.php
r161 r165 3 3 include('includes/global.php'); 4 4 5 function GetIDbyName($Table) { 6 global $TranslationTree; 7 foreach($TranslationTree as $TableID => $Value) { 8 //echo $Value['TablePrefix'].'='.$Table.'<br>'; 9 if ($Value['TablePrefix'] == $Table) return $TableID; 10 } 11 } 12 5 13 6 14 function GetTranslatNames($Text) { 7 global $Database ;15 global $Database,$mode; 8 16 9 echo('Přeložené názvy věci, postav, a herních objektů a další k tomuto překladu 10 <div style="overflow: auto; width: 100%; height: 345px;"><table width="98%" class="BaseTable">'); 17 echo('<div style="overflow: auto; width: 100%; height: 345px;"><table width="98%" class="BaseTable">'); 11 18 echo('<tr><th>Originál</th>'.'<th>Překlad</th>'); 12 $Tables = array('gameobject' => 'Name',19 $TablesColumn = array('gameobject' => 'Name', 13 20 'creature' => 'name', 14 21 'item' => 'Name', … … 16 23 'areatrigger_teleport' => 'Name', 17 24 'areatrigger_tavern' => 'Name',); 18 foreach($Tables as $Table => $Column) { 25 /* $TablesID = array('gameobject' => 5, 26 'creature' => 6, 27 'item' => 4, 28 'transports' => 'Name', 29 'areatrigger_teleport' => 'Name', 30 'areatrigger_tavern' => 'Name',); */ 19 31 20 $sql = 'SELECT '.$Column.',(SELECT Name FROM '.$Table.' as T WHERE O.entry = T.entry AND Language <> 0 LIMIT 1) as tran 32 33 34 foreach($TablesColumn as $Table => $Column) { 35 36 $sql = 'SELECT ID,'.$Column.',(SELECT Name FROM '.$Table.' as T WHERE O.entry = T.entry AND Language <> 0 LIMIT 1) as tran 21 37 FROM '.$Table.' as O WHERE '; 22 38 $groupby = ' GROUP BY '.$Column; 23 39 24 40 $ArrStr = explode(' ', $Text); 25 $where = 'Language = 0 AND 26 EXISTS(SELECT 1 FROM '.$Table.' AS sub WHERE (sub.Language <> 0) AND (sub.entry = O.entry)) 27 AND ('; 41 $where = 'Language = 0 '; 42 if ($mode == 1) $where .= ' AND EXISTS(SELECT 1 FROM '.$Table.' AS sub WHERE (sub.Language <> 0) AND (sub.entry = O.entry))'; 43 $where .= ' AND ('; 44 28 45 for($i = 0; $i < count($ArrStr); $i++) 29 46 { … … 38 55 $ID = $Database->SQLCommand($sql.$where.$groupby); 39 56 while($Line = mysql_fetch_assoc($ID)) { 40 echo('<tr> 41 <td>'.$Line[$Column].'</td> 42 <td>'.$Line['tran'].'</td> 43 '); 44 echo('</tr>'); 57 if ($mode == 0) { 58 if (in_array($Line[$Column],$ArrStr)) { 59 echo('<tr><td>'.$Line[$Column].'</td>'); 60 if ($Line['tran'] <> '') echo('<td>'.$Line['tran'].'</td></tr>'); 61 else echo('<td><a target="_NEW2" 62 href="form.php?group='.GetIDbyName($Table).'&ID='.$Line['ID'].'">Překládat</a></td></tr>'); 63 } 64 } else { 65 echo('<tr><td>'.$Line[$Column].'</td><td>'.$Line['tran'].'</td></tr>'); 66 } 45 67 } 46 68 } … … 66 88 67 89 if(array_key_exists('group', $_GET)) $GroupId = $_GET['group']; else $GroupId = 1; 90 if(array_key_exists('mode', $_GET)) $mode = $_GET['mode']; else $mode = 0; //0 = přesné názvy, 1=všechny názvy 68 91 $Table = $TranslationTree[$GroupId]['TablePrefix']; 69 if(array_key_exists('action', $_GET)) $Action = $_GET['action']; else $Action = '';70 92 71 93 if(array_key_exists('ID', $_GET)) { 72 94 $TextID = $_GET['ID']; 73 95 echo ('Přeložené názvy vztahující se k překladu: <a target="_NEW" href="form.php?group='.$GroupId.'&ID='.$TextID.'">'.$TextID.'</a><br />'. 96 '<a href="?mode=1&group='.$GroupId.'&ID='.$TextID.'" title="Zobrazit všechny podobné výsledky">Všechny výsledky</a> '. 97 '<a href="?mode=0&group='.$GroupId.'&ID='.$TextID.'" title="Zobrazit pouze přesné výsledky">Přesné výsledky</a> '); 74 98 $Line = mysql_fetch_assoc($Database->SQLCommand('SELECT * FROM '.$Table.' Where ID = '.$TextID)); 75 99 if(!$Line) die('Překlad nenalezen.');
Note:
See TracChangeset
for help on using the changeset viewer.