Changeset 315 for trunk/TranslationList.php
- Timestamp:
- Feb 1, 2010, 9:49:50 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/TranslationList.php
r311 r315 3 3 include('includes/global.php'); 4 4 5 ShowPage(); 6 7 $TranslationItemPerPage = 200; 8 $GroupId = LoadGroupIdParameter(); 9 if(array_key_exists('connexion_id', $_GET)) { 10 $_SESSION['connexion_id'] = $_GET['connexion_id']; 11 } 12 $Table = $TranslationTree[$GroupId]['TablePrefix']; 13 if(array_key_exists('action', $_GET)) $Action = $_GET['action']; else $Action = ''; 14 15 $ID = mysql_fetch_row($Database->SQLCommand('SELECT max(VersionEnd) FROM '.$TranslationTree[$GroupId]['TablePrefix'])); 16 $BuildNumber_max = $ID[0]; 17 18 if(($Action != 'userall') and ($Action != 'grouplist')) 19 echo('Skupina: <strong>'.$TranslationTree[$GroupId]['Name'].'</strong><br />'); 20 21 function WritePages($Address, $Where) 22 { 23 global $Database, $TranslationItemPerPage, $Table; 24 25 $Line = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM '.$Table.' '.$Where)); 26 $CountLists = $Line[0] / $TranslationItemPerPage; 27 28 echo('Počet položek: <strong>'.$Line[0].'</strong><br /> 29 Zobrazit stránku: '); 30 31 $limitx = 0; 32 for($i = 0; $i < $CountLists; ++$i) 33 { 34 $limity = $TranslationItemPerPage; 35 $limitx = $i * $limity; 36 $Page = $i + 1; 37 if($_SESSION['limitx'] == $limitx) echo('<strong>'.$Page.'</strong> '); 38 else echo('<a href="'.$Address.'&limitx='.$limitx.'&limity='.$limity.'">'.$Page.'</a> '); 39 } 40 41 if(!array_key_exists('limitx', $_SESSION)) $_SESSION['limitx'] = 0; 42 if($_SESSION['limitx'] > $limitx) $_SESSION['limitx'] = 0; 43 } 44 45 function WriteQuests($sql, $limit, $address) 46 { 47 global $Database, $order, $desc, $TranslationTree, $GroupId, $Table; 5 function WriteQuests($Query) 6 { 7 global $Database, $TranslationTree, $GroupId, $Table, $Action; 48 8 49 // Check if order column exists 50 $Items = $TranslationTree[$GroupId]['Items']; 51 $I = 0; 52 while(($I < count($Items)) and ($Items[$I]['MangosColumn'] != $order)) $I++; 53 if($I >= count($Items)) $order = 'ID'; 54 55 if($limit <> '') $limit = 'LIMIT '.$limit; 56 57 if($address <> 'selection') 58 { 59 if($order <> '') $order = 'ORDER BY '.$order; 60 if($desc <> 'desc') $desc = 'desc'; else $desc = ''; 61 } else 62 { 63 $order = ''; 64 $desc = ''; 65 } 66 9 // Get total item count 10 $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$Query.') AS T'); 11 $DbRow = mysql_fetch_row($DbResult); 12 $PageList = GetPageList($DbRow[0]); 13 14 echo($PageList['Output']); 15 67 16 $TableColumns = array( 68 17 array('Name' => 'ID', 'Title' => 'Pořadové číslo'), … … 71 20 array('Name' => 'VersionStart', 'Title' => 'Verze'), 72 21 ); 73 if($ address== 'selection') $TableColumns[] = array('Name' => 'CountQuests', 'Title' => 'Výskyt');74 else if($ address== 'connexion') $TableColumns[] = array('Name' => '', 'Title' => 'Již přeložil');75 else if($ address <> 'notran') $TableColumns[] = array('Name' => 'User', 'Title' => 'Překladatel');22 if($Action == 'selection') $TableColumns[] = array('Name' => 'CountQuests', 'Title' => 'Výskyt'); 23 else if($Action == 'connexion') $TableColumns[] = array('Name' => '', 'Title' => 'Již přeložil'); 24 else if($Action <> 'notran') $TableColumns[] = array('Name' => 'UserName', 'Title' => 'Překladatel'); 76 25 77 26 $Order = GetOrderTableHeader($TableColumns, 'VersionStart', 1); … … 79 28 echo($Order['Output']); 80 29 81 //print_r($TranslationTree[$GroupId]['Items']); 82 $ID = $Database->SQLCommand($sql.' '.$Order['SQL'].' '.$limit); 83 while($Line = mysql_fetch_assoc($ID)) 84 { 85 //print_r($Line); 86 echo('<tr><td><a href="form.php?group='.$GroupId.'&ID='.$Line['ID'].'">'.$Line['ID'].'</a></td> 87 <td>'.$Line['entry'].'</td> 88 <td>'.htmlspecialchars($Line[$TranslationTree[$GroupId]['Items'][0]['Column']]).'</td> 89 <td>'.GetVersionWOW($Line['VersionStart']).'-'.GetVersionWOW($Line['VersionEnd']).'</td>'); 90 if($address == 'selection') echo('<td>'.$Line['CountQuest'].'</td>'); 91 else if($address <> 'notran') echo('<td>'.$Line['User'].'</td>'); 30 $DbResult = $Database->SQLCommand($Query.' '.$Order['SQL'].' '.$PageList['SQLLimit']); 31 while($Line = mysql_fetch_assoc($DbResult)) 32 { 33 echo('<tr><td><a href="form.php?group='.$GroupId.'&ID='.$Line['ID'].'">'.$Line['ID'].'</a></td><td>'.$Line['entry'].'</td>'. 34 '<td>'.htmlspecialchars($Line[$TranslationTree[$GroupId]['Items'][0]['Column']]).'</td>'. 35 '<td>'.GetVersionWOW($Line['VersionStart']).'-'.GetVersionWOW($Line['VersionEnd']).'</td>'); 36 if($Action == 'selection') echo('<td>'.$Line['CountQuest'].'</td>'); 37 else if($Action <> 'notran') echo('<td>'.$Line['User'].'</td>'); 92 38 echo('</tr>'); 93 39 } 94 40 echo('</table>'); 41 42 echo($PageList['Output']); 95 43 } 96 44 … … 103 51 <strong>Vypsání nepřeložených textů s limitem na stránku</strong><br /><br />'); 104 52 105 WritePages('?group='.$GroupId.'&action=notran', 'AS items WHERE items.Language = 0 AND106 NOT EXISTS(SELECT 1 FROM '.$Table.' AS sub WHERE sub.Language <> 0 AND sub.entry = items.entry AND VersionEnd = "'.$BuildNumber_max.'" AND VersionEnd = "'.$BuildNumber_max.'")');107 108 53 WriteQuests('SELECT * FROM '.$Table.' AS items WHERE (items.Language = 0) AND 109 NOT EXISTS(SELECT 1 FROM '.$Table.' AS sub WHERE (sub.Language <> 0) AND (sub.entry = items.entry) AND VersionEnd = "'.$BuildNumber_max.'" AND VersionEnd = "'.$BuildNumber_max.'")', $_SESSION['limitx'].','.$_SESSION['limity'], 'notran');54 NOT EXISTS(SELECT 1 FROM '.$Table.' AS sub WHERE (sub.Language <> 0) AND (sub.entry = items.entry) AND VersionEnd = "'.$BuildNumber_max.'" AND VersionEnd = "'.$BuildNumber_max.'")'); 110 55 } 111 56 … … 114 59 global $GroupId, $Table, $BuildNumber_max, $Database; 115 60 61 if(array_key_exists('connexion_id', $_GET)) $_SESSION['connexion_id'] = $_GET['connexion_id']; 62 116 63 //SELECT * FROM spell WHERE entry IN(SELECT entry FROM connexion_item WHERE connexion = 1) 117 64 $Line = mysql_fetch_assoc($Database->SQLCommand('SELECT Name FROM connexion WHERE `Id` = '.$_SESSION['connexion_id'])); … … 120 67 <strong>Vypsání souvislostí ze skupiny '.$Line['Name'].'</strong><br /><br />'); 121 68 122 WritePages('?group='.$GroupId.'&action=connexion', ' WHERE Language = 0 AND entry IN(SELECT entry FROM connexion_item WHERE connexion = '.$_SESSION['connexion_id'].') AND VersionEnd = "'.$BuildNumber_max.'" AND VersionEnd = "'.$BuildNumber_max.'"'); 123 WriteQuests('SELECT *, (SELECT sub.User FROM '.$Table.' as sub WHERE sub.entry = '.$Table.'.entry AND Language <> 0 LIMIT 1) as UserID, (SELECT user.user FROM user WHERE user.id = UserID) as User FROM '.$Table.' WHERE Language = 0 AND entry IN(SELECT entry FROM connexion_item WHERE connexion = '.$_SESSION['connexion_id'].') AND VersionEnd = "'.$BuildNumber_max.'" AND VersionEnd = "'.$BuildNumber_max.'"', $_SESSION['limitx'].','.$_SESSION['limity'], 'connexion'); 69 WriteQuests('SELECT *, (SELECT sub.User FROM '.$Table.' as sub WHERE sub.entry = '.$Table.'.entry AND Language <> 0 LIMIT 1) as UserID, (SELECT user.user FROM user WHERE user.id = UserID) AS UserName FROM '.$Table.' WHERE Language = 0 AND entry IN(SELECT entry FROM connexion_item WHERE connexion = '.$_SESSION['connexion_id'].') AND VersionEnd = "'.$BuildNumber_max.'" AND VersionEnd = "'.$BuildNumber_max.'"'); 124 70 } 125 71 … … 151 97 <strong>Vypsání nedokončených textů s limitem na stránku</strong><br /><br />'); 152 98 153 WritePages('?group='.$GroupId.'&action=notran', 'AS items WHERE items.Language = 0 AND154 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.'") AND155 EXISTS(SELECT 1 FROM '.$Table.' AS sub WHERE sub.Language <> 0 AND sub.entry = items.entry AND (sub.Complete = 0) AND VersionEnd = "'.$BuildNumber_max.'") AND VersionEnd = "'.$BuildNumber_max.'"');156 157 99 WriteQuests('SELECT * FROM '.$Table.' AS items WHERE (items.Language = 0) AND 158 100 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 159 EXISTS(SELECT 1 FROM '.$Table.' AS sub WHERE (sub.Language <> 0) AND (sub.entry = items.entry) AND (sub.Complete = 0) AND VersionEnd = "'.$BuildNumber_max.'") AND VersionEnd = "'.$BuildNumber_max.'"' , $_SESSION['limitx'].','.$_SESSION['limity'], 'nocomplete');101 EXISTS(SELECT 1 FROM '.$Table.' AS sub WHERE (sub.Language <> 0) AND (sub.entry = items.entry) AND (sub.Complete = 0) AND VersionEnd = "'.$BuildNumber_max.'") AND VersionEnd = "'.$BuildNumber_max.'"'); 160 102 } 161 103 … … 167 109 <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 />'); 168 110 169 WritePages('?group='.$GroupId.'&action=Translate', 'WHERE '.$Table.'.Language <> 0 AND '.$Table.'.Complete = 1'); 170 171 WriteQuests('SELECT *, (SELECT user.user FROM user WHERE user.id = '.$Table.'.user) as User FROM 172 '.$Table.' WHERE '.$Table.'.Language <> 0 AND '.$Table.'.Complete = 1', $_SESSION['limitx'].','.$_SESSION['limity'], 'Translate');} 111 WriteQuests('SELECT `'.$Table.'`.*, `user`.`user` AS `UserName` FROM `'.$Table.'` JOIN `user` ON `user`.`id` = `'.$Table.'`.`User` WHERE (`'.$Table.'`.`Language` <> 0) AND (`'.$Table.'`.`Complete` = 1)'); 112 } 173 113 174 114 function UserTranslated() … … 178 118 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&action=filter">Filtr textů</a> -> 179 119 <a title="Přeložené questy přilášeného uživatele" href="?group='.$GroupId.'&action=my">Moje překlady</a><br /><br />'); 180 WriteQuests('SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = '.$Table.'.`user`) AS `User ` FROM `'.$Table.'` Where `user` = '.$_SESSION['UserID'], '', 'my');120 WriteQuests('SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = '.$Table.'.`user`) AS `UserName` FROM `'.$Table.'` Where `user` = '.$_SESSION['UserID']); 181 121 } 182 122 … … 187 127 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&action=filter">Filtr textů</a> -> 188 128 <a title="Nedokončené texty" href="?group='.$GroupId.'&action=mydevelop">Rozepsané překlady</a><br /><br />'); 189 WriteQuests('SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `User ` FROM `'.$Table.'` Where `user` = '.$_SESSION['UserID'].' AND `Complete` = 0', '', 'mydevelop');129 WriteQuests('SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `UserName` FROM `'.$Table.'` WHERE `user` = '.$_SESSION['UserID'].' AND `Complete` = 0'); 190 130 } 191 131 … … 207 147 if($WhereUsers == '') $WhereUsers = '0'; 208 148 209 WriteQuests('SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `User ` FROM `'.$Table.'` WHERE '.$WhereUsers, '', 'users');149 WriteQuests('SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `UserName` FROM `'.$Table.'` WHERE '.$WhereUsers); 210 150 } 211 151 … … 291 231 '<strong>Vypis překladů uživatele '.$Line[0].': </strong><br /><br />'); 292 232 if(array_key_exists('not', $_GET)) 293 WriteQuests('SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `User ` FROM `'.$Table.'` Where `Complete` = 0 AND `user` = '.$_GET['user'], '', 'userid');294 else WriteQuests('SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `User ` FROM `'.$Table.'` Where `user` = '.$_GET['user'], '', 'userid');233 WriteQuests('SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `UserName` FROM `'.$Table.'` Where `Complete` = 0 AND `user` = '.$_GET['user']); 234 else WriteQuests('SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `UserName` FROM `'.$Table.'` Where `user` = '.$_GET['user']); 295 235 } else echo('Nebyl nalezen uživatel se zadaným id'); 296 236 } else echo('Je nutno zadat id uživatele.'); … … 305 245 else ErrorMessage('Nebyl zadán text k vyhledání.'); 306 246 307 $sql = 'SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `User ` FROM `'.$Table.'` WHERE `ID` LIKE "%'.$Search.'%"247 $sql = 'SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `UserName` FROM `'.$Table.'` WHERE `ID` LIKE "%'.$Search.'%" 308 248 OR `entry` LIKE "%'.$Search.'%" 309 249 OR `Language` LIKE "%'.$Search.'%" … … 315 255 } 316 256 317 WriteQuests($sql , '', 'search='.$Search);257 WriteQuests($sql); 318 258 } 319 259 … … 326 266 else $Search = ''; 327 267 328 $sql = 'SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `User ` FROM `'.$Table.'` WHERE `entry` LIKE "'.$Search.'"';268 $sql = 'SELECT *, (SELECT `user`.`user` FROM `user` WHERE `user`.`id` = `'.$Table.'`.`user`) AS `UserName` FROM `'.$Table.'` WHERE `entry` LIKE "'.$Search.'"'; 329 269 330 WriteQuests($sql , '', 'searchentry='.$Search);270 WriteQuests($sql); 331 271 } 332 272 … … 339 279 <strong>Výpis všech textů s limitem na stránku</strong><br /><br />'); 340 280 341 WritePages('?group='.$GroupId.'&action=all', ' AS `items` WHERE (`items`.`Language` = 0)'); 342 343 WriteQuests('SELECT * FROM `'.$Table.'` AS `items` WHERE (`items`.`Language` = 0)', $_SESSION['limitx'].','.$_SESSION['limity'], 'all'); 281 WriteQuests('SELECT * FROM `'.$Table.'` AS `items` WHERE (`items`.`Language` = 0)'); 344 282 } 345 283 … … 396 334 // WriteQuests("SELECT * FROM quests Where user = ".$_SESSION['UserID']." AND Complete = '0'", '', 'mydevelop'); 397 335 } 336 337 338 ShowPage(); 339 340 $GroupId = LoadGroupIdParameter(); 341 $Table = $TranslationTree[$GroupId]['TablePrefix']; 342 if(array_key_exists('action', $_GET)) $Action = $_GET['action']; else $Action = ''; 343 344 $ID = mysql_fetch_row($Database->SQLCommand('SELECT max(VersionEnd) FROM '.$TranslationTree[$GroupId]['TablePrefix'])); 345 $BuildNumber_max = $ID[0]; 346 347 if(($Action != 'userall') and ($Action != 'grouplist')) 348 echo('Skupina: <strong>'.$TranslationTree[$GroupId]['Name'].'</strong><br />'); 398 349 399 350 if($Action == 'notran') Nontranslated();
Note:
See TracChangeset
for help on using the changeset viewer.