Changeset 284 for trunk/dictionary.php
- Timestamp:
- Dec 11, 2009, 11:41:03 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dictionary.php
r199 r284 5 5 function GetIDbyName($Table) 6 6 { 7 8 9 10 { 11 12 13 7 global $TranslationTree; 8 9 foreach($TranslationTree as $TableID => $Value) 10 { 11 //echo $Value['TablePrefix'].'='.$Table.'<br>'; 12 if ($Value['TablePrefix'] == $Table) return $TableID; 13 } 14 14 } 15 15 … … 18 18 global $Database, $mode; 19 19 20 21 22 23 24 20 if ($mode == 0) echo ('..Přesné'); 21 if ($mode == 1) echo ('..Všechny přeložené'); 22 if ($mode == 2) echo ('..Nepřeložené'); 23 echo('<div style="overflow: auto; width: 100%; height: 345px;"><table width="98%" class="BaseTable">'); 24 echo('<tr><th>Originál</th>'.'<th>Překlad</th>'); 25 25 $TablesColumn = array 26 26 ( … … 52 52 for($i = 0; $i < count($ArrStr); $i++) 53 53 { 54 55 56 57 58 59 60 61 54 if (strpos($ArrStr[$i],'\'s') > 0) $ArrStr[$i] = substr($ArrStr[$i],0,strlen($ArrStr[$i])-4); 55 if (strpos($ArrStr[$i],',') > 0) $ArrStr[$i] = substr($ArrStr[$i],0,strlen($ArrStr[$i])-1); 56 if (strpos($ArrStr[$i],'.') > 0) $ArrStr[$i] = substr($ArrStr[$i],0,strlen($ArrStr[$i])-1); 57 if (strpos($ArrStr[$i],'!') > 0) $ArrStr[$i] = substr($ArrStr[$i],0,strlen($ArrStr[$i])-1); 58 if (strpos($ArrStr[$i],'?') > 0) $ArrStr[$i] = substr($ArrStr[$i],0,strlen($ArrStr[$i])-1); 59 60 if (strlen($ArrStr[$i]) > 4) 61 $where .= 'O.'.$Column.' LIKE "%'.addslashes($ArrStr[$i]).'%" OR '; 62 62 } 63 63 $where = substr($where,0,strlen($where)-4); 64 64 $where .= ')'; 65 66 67 68 69 { 70 71 { 72 65 echo ('</tr>'); 66 67 $ID = $Database->SQLCommand($sql.$where.$groupby); 68 while($Line = mysql_fetch_assoc($ID)) 69 { 70 if ($mode == 0) 71 { 72 if (strpos(strtolower($Text),strtolower($Line[$Column])) > 0) 73 73 { 74 75 76 77 78 79 { 80 81 82 83 84 85 } 86 74 echo('<tr><td>'.$Line[$Column].'</td>'); 75 if ($Line['tran'] <> '') echo('<td>'.$Line['tran'].'</td></tr>'); 76 else echo('<td><a target="_NEW2" href="form.php?group='.GetIDbyName($Table).'&ID='.$Line['ID'].'">Překládat</a></td></tr>'); 77 } 78 } else 79 { 80 echo('<tr><td>'.$Line[$Column].'</td>'); 81 if ($Line['tran'] <> '') echo('<td>'.$Line['tran'].'</td></tr>'); 82 else echo('<td><a target="_NEW2" href="form.php?group='.GetIDbyName($Table).'&ID='.$Line['ID'].'">Překládat</a></td></tr>'); 83 } 84 } 85 } 86 echo('</table></div>'); 87 87 } 88 88 … … 107 107 if(array_key_exists('group', $_GET)) 108 108 { 109 110 111 112 113 109 if(array_key_exists('group', $_GET)) $GroupId = $_GET['group']; else $GroupId = 1; 110 if(array_key_exists('mode', $_GET)) $mode = $_GET['mode']; else $mode = 0; //0 = přesné názvy, 1=všechny názvy, 2=nepřeložené 111 $Table = $TranslationTree[$GroupId]['TablePrefix']; 112 113 if(array_key_exists('ID', $_GET)) 114 114 { 115 115 $TextID = $_GET['ID']; 116 117 118 119 116 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 />'. 117 '<a href="?mode=1&group='.$GroupId.'&ID='.$TextID.'" title="Zobrazit všechny podobné výsledky">Všechny</a> '. 118 '<a href="?mode=0&group='.$GroupId.'&ID='.$TextID.'" title="Zobrazit pouze přesné výsledky">Přesné</a> '. 119 '<a href="?mode=2&group='.$GroupId.'&ID='.$TextID.'" title="Zobrazit všechny nepřeložené">Nepřeložené</a> '); 120 120 $Line = mysql_fetch_assoc($Database->SQLCommand('SELECT * FROM '.$Table.' Where ID = '.$TextID)); 121 121 if(!$Line) die('Překlad nenalezen.'); 122 123 124 125 126 127 122 123 $Text = ''; 124 foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem) 125 $Text .= ' '.$Line[$TextItem['Column']]; 126 GetTranslatNames($Text); 127 } 128 128 } else 129 129 { … … 218 218 $sql = 'SELECT `user`.`user` AS `UserName`, `user`. `ID` AS `UserID`, `T3`.`Entry`, `T3`.`Original`, `T3`.`Translated`, `T3`.`Description` FROM (SELECT T2.User, `T1`.Language, `T1`.`Text` AS Original, `T2`.`Text` AS `Translated`, `T2`.`Description`, `T1`.`Entry` AS `Entry` FROM `dictionary` AS `T1` JOIN `dictionary` AS `T2` ON `T2`.`Entry` = `T1`.`Entry` AND `T2`.`Language` = '.$_SESSION['language'].' WHERE LOWER(T1.Text) LIKE LOWER("%'.$Search.'%") OR LOWER(T1.Description) LIKE LOWER("%'.$Search.'%") ) AS T3 JOIN `user` ON `user`.`ID` = `T3`.`User` WHERE `T3`.`Language` = 0'; 219 219 } else $sql = 'SELECT `user`.`user` AS `UserName`, `ID` AS `UserID`, `T3`.`Entry`, `T3`.`Original`, `T3`.`Translated`, `T3`.`Description` FROM (SELECT T2.User, `T1`.Language, `T1`.`Text` AS Original, `T2`.`Text` AS `Translated`, `T2`.`Description`, `T1`.`Entry` AS `Entry` FROM `dictionary` AS `T1` JOIN `dictionary` AS `T2` ON `T2`.`Entry` = `T1`.`Entry` AND `T2`.`Language` = '.$_SESSION['language'].') AS T3 JOIN `user` ON `user`.`ID` = `T3`.`User` WHERE `T3`.`Language` = 0'; 220 $sql_page = $sql.' LIMIT '.($_SESSION['Page'] - 1) * $Config['Web']['ItemsPerPage'].','.$Config['Web']['ItemsPerPage']; 221 222 ListPaging('?Page=', '('.$sql.') AS T1', '', $Config['Web']['ItemsPerPage'], $_SESSION['Page']); 220 221 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$sql.') AS T1'); 222 $DbRow = mysql_fetch_row($DbResult); 223 $PageList = GetPageList($DbRow[0]); 224 225 $sql_page = $sql.' '.$PageList['SQLLimit']; 226 227 echo($PageList['Output']); 223 228 echo('<table width="98%" class="BaseTable"> 224 229 <tr><th>'.$LanguageList[0]['Name'].'</th> … … 244 249 } 245 250 echo('</table>'); 246 ListPaging('?Page=', '('.$sql.') AS T1', '', $Config['Web']['ItemsPerPage'], $_SESSION['Page']);251 echo($PageList['Output']); 247 252 echo('</td></tr>'); 248 253 echo('</table></form>');
Note:
See TracChangeset
for help on using the changeset viewer.