Changeset 436 for trunk/TranslationList.php
- Timestamp:
- Apr 9, 2010, 11:16:24 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/TranslationList.php
r435 r436 3 3 include('includes/global.php'); 4 4 5 function WriteQuests($Query) 6 { 7 global $Database, $TranslationTree, $GroupId, $Table, $Action; 5 function ShowFilter($GroupId = 0) 6 { 7 global $System, $TranslationTree; 8 9 $Filter = array('SQL' => ''); 10 11 $Output = '<form action="?" method="post">'. 12 '<table class="BaseTable"><tr>'. 13 '<th>Zpracování</th>'. 14 '<th>Skupina</th>'. 15 '<th>Verze</th>'. 16 '<th>Jazyk</th>'. 17 '<th>Překladatel</th>'. 18 '<th>Slova</th>'. 19 '<th>Položka</th>'. 20 '<th></th></tr><tr>'; 21 22 // State 23 $Filter['State'] = GetParameter('state', 0, true, true); 24 $Output .= '<td><select name="state">'; 25 if($Filter['State'] == 0) $Selected = ' selected="selected"'; 26 else $Selected = ''; 27 $Output .= '<option value="0"'.$Selected.'>Všechny</option>'; 28 if($Filter['State'] == 1) $Selected = ' selected="selected"'; 29 else $Selected = ''; 30 $Output .= '<option value="1"'.$Selected.'>Nepřeložené</option>'; 31 if($Filter['State'] == 2) $Selected = ' selected="selected"'; 32 else $Selected = ''; 33 $Output .= '<option value="2"'.$Selected.'>Přeložené</option>'; 34 if($Filter['State'] == 3) $Selected = ' selected="selected"'; 35 else $Selected = ''; 36 $Output .= '<option value="3"'.$Selected.'>Rozpracované</option>'; 37 if($Filter['State'] == 4) $Selected = ' selected="selected"'; 38 else $Selected = ''; 39 $Output .= '<option value="4"'.$Selected.'>Anglické</option>'; 40 $Output .= '</select></td>'; 41 42 // Translation group 43 if($GroupId == 0) 44 { 45 $Filter['Group'] = GetParameter('group', 0, true, true); 46 if($Filter['Group'] != 0) 47 { 48 if(isset($TranslationTree[$Filter['Group']]) == false) ErrorMessage('Překladová skupina dle zadaného Id neexistuje.'); 49 $Table = $TranslationTree[$Filter['Group']]['TablePrefix']; 50 } 51 } else 52 { 53 $Filter['Group'] = $GroupId; 54 $Table = $TranslationTree[$Filter['Group']]['TablePrefix']; 55 } 56 57 $Output .= '<td><select name="group" style="width: 80px">'; 58 if($Filter['Group'] == 0) $Selected = ' selected="selected"'; 59 else $Selected = ''; 60 $Output .= '<option value="0"'.$Selected.'>Všechny</option>'; 61 $DbResult = $System->Database->query('SELECT `Id`,`Name` FROM `Group` ORDER BY `Name`'); 62 while($Group = $DbResult->fetch_assoc()) 63 { 64 if($Group['Id'] == $Filter['Group']) $Selected = ' selected="selected"'; 65 else $Selected = ''; 66 $Output .= '<option value="'.$Group['Id'].'"'.$Selected.'>'.$Group['Name'].'</option>'; 67 } 68 $Output .= '</select></td>'; 69 70 // Version 71 $Filter['Version'] = GetParameter('version', 0, true, true); 72 if($Filter['Version'] != 0) 73 { 74 $DbResult = $System->Database->query('SELECT `Id`, `BuildNumber`,`Version` FROM `ClientVersion` WHERE (`Imported` = 1) AND (`Id` ='.$Filter['Version'].')'); 75 if($DbResult->num_rows > 0) 76 { 77 $DbRow = $DbResult->fetch_assoc(); 78 $Filter['BuildNumber'] = $DbRow['BuildNumber']; 79 } else ErrorMessage('Zadaná verze klienta nenalezena'); 80 } 81 $Output .= '<td><select name="version">'; 82 if($Filter['Version'] == 0) $Selected = ' selected="selected"'; 83 else $Selected = ''; 84 $Output .= '<option value="0"'.$Selected.'>Všechny</option>'; 85 $DbResult = $System->Database->query('SELECT `Id`, `BuildNumber`,`Version` FROM `ClientVersion` WHERE `Imported` = 1 ORDER BY `BuildNumber` DESC'); 86 while($Version = $DbResult->fetch_assoc()) 87 { 88 if($Version['Id'] == $Filter['Version']) $Selected = ' selected="selected"'; 89 else $Selected = ''; 90 $Output .= '<option value="'.$Version['Id'].'"'.$Selected.'>'.$Version['Version'].'</option>'; 91 } 92 $Output .= '</select></td>'; 93 if($Filter['Version'] != 0) $VersionFilter = ' AND (`VersionStart` <= '.$Filter['BuildNumber'].') AND (`VersionEnd` >= '.$Filter['BuildNumber'].')'; 94 else $VersionFilter = ''; 95 //else $Filter['SQL'] .= ' AND '; DISTINCT(Entry) 96 97 // Language 98 $Filter['Language'] = GetParameter('lang', 0, true, true); 99 $Output .= '<td><select name="lang">'; 100 if($Filter['Language'] == 0) $Selected = ' selected="selected"'; 101 else $Selected = ''; 102 $Output .= '<option value="0"'.$Selected.'>Všechny</option>'; 103 $DbResult = $System->Database->query('SELECT `Id`, `Name` FROM `Language` WHERE `Enabled` = 1 ORDER BY `Name`'); 104 while($Language = $DbResult->fetch_assoc()) 105 { 106 if($Language['Id'] == $Filter['Language']) $Selected = ' selected="selected"'; 107 else $Selected = ''; 108 $Output .= '<option value="'.$Language['Id'].'"'.$Selected.'>'.$Language['Name'].'</option>'; 109 } 110 $Output .= '</select></td>'; 111 if($Filter['Language'] != 0) $LanguageFilter = ' AND (`Language` = '.$Filter['Language'].')'; 112 else $LanguageFilter = ''; 113 114 // User 115 $Filter['User'] = GetParameter('user', 0, true, true); 116 $Output .= '<td><select name="user" style="width: 80px">'; 117 if($Filter['User'] == 0) $Selected = ' selected="selected"'; 118 else $Selected = ''; 119 $Output .= '<option value="0"'.$Selected.'>Všichni</option>'; 120 $DbResult = $System->Database->query('SELECT `Id`, `Name` FROM `User` ORDER BY `Name`'); 121 while($User = $DbResult->fetch_assoc()) 122 { 123 if($User['Id'] == $Filter['User']) $Selected = ' selected="selected"'; 124 else $Selected = ''; 125 $Output .= '<option value="'.$User['Id'].'"'.$Selected.'>'.$User['Name'].'</option>'; 126 } 127 $Output .= '</select></td>'; 128 if($Filter['User'] != 0) $UserFilter = ' AND (`User` = '.$Filter['User'].')'; 129 else $UserFilter = ''; 130 131 // Words 132 $Filter['Text'] = GetParameter('text', '', false, true); 133 $Output .= '<td><input name="text" type="text" style="width: 60px;" value="'.$Filter['Text'].'"></td>'; 134 if($Filter['Text'] != '') 135 { 136 $Items = array('(`ID` LIKE "%'.$Filter['Text'].'%")', '(`Entry` LIKE "%'.$Filter['Text'].'%")'); 137 if($Filter['Group'] != 0) 138 foreach($TranslationTree[$Filter['Group']]['Items'] as $GroupItem) 139 if($GroupItem['Visible'] == 1) 140 $Items[] = '(`'.$GroupItem['Column'].'` LIKE "%'.$Filter['Text'].'%")'; 141 $Filter['SQL'] .= ' AND ('.implode(' OR ', $Items).')'; 142 } 143 144 // Entry 145 $Filter['Entry'] = GetParameter('entry', '', false, true); 146 $Output .= '<td><input name="entry" type="text" style="width: 60px;" value="'.$Filter['Entry'].'"></td>'; 147 if($Filter['Entry'] != '') 148 { 149 $Filter['SQL'] .= ' AND (`Entry` LIKE "%'.$Filter['Entry'].'%")'; 150 } 151 152 if($Filter['Group'] != 0) 153 { 154 if($Filter['State'] == 0) $Filter['SQL'] .= $UserFilter.$VersionFilter.''; 155 else if($Filter['State'] == 1) $Filter['SQL'] .= ' AND (`Language` = 0) AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE (`Sub`.`Language` <> 0)'.$LanguageFilter.$UserFilter.$VersionFilter.' AND (`Sub`.`Entry` = `T`.`Entry`) AND (`Sub`.`Complete` = 1) AND (`Sub`.`VersionStart` = `T`.`VersionStart`) AND (`Sub`.`VersionEnd` = `T`.`VersionEnd`))'; 156 else if($Filter['State'] == 2) $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`Complete` = 1)'; 157 else if($Filter['State'] == 3) $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`Language` != 0) AND (`Complete` = 0)'; 158 else if($Filter['State'] == 4) $Filter['SQL'] .= $VersionFilter.' AND (`Language` = 0)'; 159 } 160 161 /* 162 // Ownership 163 if(array_key_exists('owner', $_GET) and is_numeric($_GET['owner'])) $Filter['Owner'] = $_GET['owner']; 164 else $Filter['Owner'] = 0; 165 echo(' <td><select name="owner">'); 166 if($Filter['Owner'] == 0) $Selected = ' selected="selected"'; 167 else $Selected = ''; 168 echo('<option value="0"'.$Selected.'>Všech</option>'); 169 if($Filter['Owner'] == 1) $Selected = ' selected="selected"'; 170 else $Selected = ''; 171 echo('<option value="1"'.$Selected.'>Překladatelův tým</option>'); 172 if($Filter['Owner'] == 2) $Selected = ' selected="selected"'; 173 else $Selected = ''; 174 echo('<option value="2"'.$Selected.'>Překladatele</option>'); 175 echo('</select></td>'); 176 if(($Filter['Owner'] == 2) AND ($Filter['User'] != 0)) $Filter['SQL'] .= ' AND (`User` = '.$Filter['User'].')'; 177 */ 178 179 $Output .= '<td><input type="submit" value="Filtrovat"/></td>'; 180 $Output .= '</tr></table>'; 181 $Output .= '</form><br/>'; 182 $Filter['Output'] = $Output; 183 return($Filter); 184 } 185 186 function ShowTranslationList($Filter) 187 { 188 global $System, $TranslationTree; 8 189 190 echo($Filter['Output']); 191 $Table = $TranslationTree[$Filter['Group']]['TablePrefix']; 192 193 $Query = 'SELECT `T`.*, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `T`.`User`) AS `UserName` FROM `'.$Table.'` AS `T` WHERE 1 '.$Filter['SQL']; 194 //echo($Query); 195 9 196 // Get total item count 10 $DbResult = $ Database->SQLCommand('SELECT COUNT(*) FROM ('.$Query.') AS `T`');11 $DbRow = mysql_fetch_row($DbResult);197 $DbResult = $System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS `TT`'); 198 $DbRow = $DbResult->fetch_row(); 12 199 $PageList = GetPageList($DbRow[0]); 13 200 14 201 echo($PageList['Output']); 15 16 202 $TableColumns = array( 17 array('Name' => 'ID', 'Title' => ' Pořadové číslo'),18 array('Name' => 'Entry', 'Title' => ' Identifikační číslo'),19 array('Name' => $TranslationTree[$ GroupId]['Items'][0]['Column'], 'Title' => 'Název'),203 array('Name' => 'ID', 'Title' => 'Číslo'), 204 array('Name' => 'Entry', 'Title' => 'Položka'), 205 array('Name' => $TranslationTree[$Filter['Group']]['Items'][0]['Column'], 'Title' => 'Název'), 20 206 array('Name' => 'VersionStart', 'Title' => 'Verze'), 207 array('Name' => 'UserName', 'Title' => 'Překladatel'), 21 208 ); 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');25 209 26 210 $Order = GetOrderTableHeader($TableColumns, 'VersionStart', 1); … … 28 212 echo($Order['Output']); 29 213 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['UserName'].'</td>'); 214 $DbResult = $System->Database->query($Query.' '.$Order['SQL'].' '.$PageList['SQLLimit']); 215 while($Line = $DbResult->fetch_assoc()) 216 { 217 echo('<tr><td><a href="form.php?group='.$Filter['Group'].'&ID='.$Line['ID'].'">'.$Line['ID'].'</a></td><td>'.$Line['Entry'].'</td>'. 218 '<td>'.htmlspecialchars($Line[$TranslationTree[$Filter['Group']]['Items'][0]['Column']]).'</td>'. 219 '<td>'.GetVersionWOW($Line['VersionStart']).'-'.GetVersionWOW($Line['VersionEnd']).'</td>'. 220 '<td>'.$Line['UserName'].'</td>'); 38 221 echo('</tr>'); 39 222 } 40 223 echo('</table>'); 41 224 42 echo($PageList['Output']); 43 } 44 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 '<strong>Vypsání nepřeložených textů s limitem na stránku</strong><br /><br />'); 52 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`))'); 54 } 55 56 function Connexion() 57 { 58 global $GroupId, $Table, $BuildNumber_max, $Database; 59 60 if(array_key_exists('connexion_id', $_GET)) $_SESSION['connexion_id'] = $_GET['connexion_id']; 61 if(array_key_exists('connexion_id', $_SESSION) and is_numeric($_SESSION['connexion_id'])) 62 { 63 $DbResult = $Database->SQLCommand('SELECT `Name` FROM `connexion` WHERE `Id` = '.$_SESSION['connexion_id']); 64 if(mysql_num_rows($DbResult) > 0) 65 { 66 $Line = mysql_fetch_assoc($DbResult); 67 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&action=filter">Filtr textů</a> -> 68 <a title="Zde je seznam souvislostí" href="?group='.$GroupId.'&action=connexion">Souvislosti</a> - > 69 <strong>Vypsání souvislostí ze skupiny '.$Line['Name'].'</strong><br /><br />'); 70 71 WriteQuests('SELECT *, (SELECT `Sub`.`User` FROM `'.$Table.'` AS `Sub` WHERE (`Sub`.`Entry` = `'.$Table.'`.`Entry`) AND (`Language` <> 0) LIMIT 1) AS `UserID`, (SELECT `User`.`Name` 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.'")'); 72 } else echo('Chybné id'); 73 } else echo('Chybné id'); 74 } 75 76 function ConnexionList() 77 { 78 global $GroupId, $Table, $BuildNumber_max, $Database; 79 80 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&action=filter">Filtr textů</a> -> '. 81 '<a title="Zde je seznam souvislostí" href="?group='.$GroupId.'&action=connexion">Souvislosti</a> - > '. 82 '<strong>Vypsání souvislostí</strong><br /><br />'); 83 echo('<table class="BaseTable"><tr><th>Pořadové číslo</th><th>Název</th>'); 84 echo('</tr>'); 85 $ID = $Database->SQLCommand('SELECT * FROM `connexion` WHERE `Group` = '.$GroupId); 86 while($Line = mysql_fetch_assoc($ID)) 87 { 88 echo('<tr><td><a href="?group='.$GroupId.'&action=connexion&connexion_id='.$Line['Id'].'">'.$Line['Id'].'</a></td> 89 <td>'.$Line['Name'].'</td>'); 90 } 91 echo ('</table>'); 92 } 93 94 function Noncomplete() 95 { 96 global $GroupId, $Table, $BuildNumber_max, $Database; 97 98 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&action=filter">Filtr textů</a> -> 99 <a title="Zde můžete začít překládat" href="?group='.$GroupId.'&action=selection">nedokončené texty</a> - > 100 <strong>Vypsání nedokončených textů s limitem na stránku</strong><br /><br />'); 101 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)'); 133 } 134 135 function UserSelected() 136 { 137 global $GroupId, $Table; 138 139 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&action=filter">Filtr textů</a> -> 140 <strong>Vypsání textů od určitých uživatelů</strong><br /><br />'); 141 if(array_key_exists('users', $_POST)) $users = $_POST['users']; 142 else $users = array(); 143 144 $WhereUsers = ''; 145 foreach($users as $Index => $User) 146 { 147 if($WhereUsers <> '') $WhereUsers .= ' OR `User` = '.$User; 148 else $WhereUsers .= ' `User` = '.$User; 149 } 150 if($WhereUsers == '') $WhereUsers = '0'; 151 152 WriteQuests('SELECT *, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE '.$WhereUsers); 153 } 154 155 function UserAll() 156 { 157 global $Database, $TranslationTree; 158 159 $ID = $Database->SQLCommand('SELECT `Name` FROM `User` WHERE `ID` = '.$_GET['user']); 160 $Line = mysql_fetch_row($ID); 161 echo('<strong>Počty překladů uživatele '.$Line[0].': </strong><br /><br />'); 162 163 echo('<table class="BaseTable"><tr><th>Skupina</th><th>Rozpracované</th><th>Hotové</th></tr>'); 225 echo($PageList['Output']); 226 } 227 228 function ShowGroupList($Filter) 229 { 230 global $System, $TranslationTree; 231 232 echo($Filter['Output']); 233 234 echo('<table class="BaseTable"><tr><th>Skupina</th><th>Počet</th></tr>'); 164 235 $Total = 0; 165 $Total2 = 0;166 236 foreach($TranslationTree as $Group) 167 237 if($Group['TablePrefix'] != '') 168 238 { 169 $sql = 'SELECT COUNT(*) FROM `'.$Group['TablePrefix'].'` WHERE (`Complete` = 0) AND (`User`='.$_GET['user'].')'; 170 $ID = $Database->SQLCommand($sql); 171 $Line = mysql_fetch_row($ID); 172 $sql = 'SELECT COUNT(*) FROM `'.$Group['TablePrefix'].'` WHERE (`Complete` = 1) AND (`User`='.$_GET['user'].')'; 173 $ID = $Database->SQLCommand($sql); 174 $Line2 = mysql_fetch_row($ID); 175 $GroupId = $Group['Id']; 176 echo('<tr><td>'.$Group['Name'].'</td><td><a href="?group='.$GroupId.'&action=userid&not&user='.$_GET['user'].'">'.$Line[0].'</a></td><td><a href="?group='.$GroupId.'&action=userid&user='.$_GET['user'].'">'.$Line2[0].'</a></td></tr>'); 239 $Filter = ShowFilter($Group['Id']); 240 $ID = $System->Database->query('SELECT COUNT(*) FROM `'.$Group['TablePrefix'].'` AS `T` WHERE 1 '.$Filter['SQL']); 241 $Line = $ID->fetch_row(); 242 echo('<tr><td><a href="?group='.$Group['Id'].'">'.$Group['Name'].'</td><td>'.$Line[0].'</a></tr>'); 177 243 $Total += $Line[0]; 178 $Total2 += $Line2[0];179 244 } 180 echo('<tr><td><strong>Celkem</strong></td><td><strong>'.$Total.'</strong></td>< td><strong>'.$Total2.'</strong></td></tr>');245 echo('<tr><td><strong>Celkem</strong></td><td><strong>'.$Total.'</strong></td></tr>'); 181 246 echo('</table>'); 182 247 } 183 248 184 function GroupList()249 function ShowGroupTypeList() 185 250 { 186 251 global $Database; … … 214 279 } 215 280 216 function TranslatedByUserId() 217 { 218 global $Database, $Table, $GroupId; 219 220 if(array_key_exists('user', $_GET)) 221 { 222 $ID = $Database->SQLCommand('SELECT `Name` FROM `User` WHERE `ID` = '.($_GET['user'] * 1)); 223 if(mysql_num_rows($ID) > 0) 224 { 225 $Line = mysql_fetch_row($ID); 226 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&action=filter">Filtr textů</a> -> '. 227 '<strong>Vypis překladů uživatele '.$Line[0].': </strong><br /><br />'); 228 if(array_key_exists('not', $_GET)) 229 WriteQuests('SELECT *, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE (`Complete` = 0) AND (`User` = '.$_GET['user'].')'); 230 else WriteQuests('SELECT *, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE `User` = '.$_GET['user']); 231 } else echo('Nebyl nalezen uživatel se zadaným id'); 232 } else echo('Je nutno zadat id uživatele.'); 233 } 234 235 function TranslatedSearch() 236 { 237 global $Table, $GroupId, $TranslationTree; 238 239 if(array_key_exists('search', $_GET)) $Search = $_GET['search']; 240 else if(array_key_exists('search', $_POST)) $Search = $_POST['search']; 241 else ErrorMessage('Nebyl zadán text k vyhledání.'); 242 243 $sql = 'SELECT *, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE `ID` LIKE "%'.$Search.'%" 244 OR `Entry` LIKE "%'.$Search.'%" 245 OR `Language` LIKE "%'.$Search.'%" 246 OR `User` LIKE "%'.$Search.'%" 247 OR `Complete` LIKE "%'.$Search.'%"'; 248 foreach($TranslationTree[$GroupId]['Items'] as $Item) 249 { 250 if($Item['Column'] != '') $sql .= ' OR `'.$Item['Column'].'` LIKE "%'.$Search.'%"'; 251 } 252 253 WriteQuests($sql); 254 } 255 256 function SearchEntry() 257 { 258 global $Table, $System; 259 260 if(array_key_exists('ID', $_GET) and is_numeric($_GET['ID'])) $Search = $_GET['ID']; 261 else if(array_key_exists('ID', $_POST) and is_numeric($_POST['ID'])) $Search = $_POST['ID']; 262 else ErrorMessage('Nebylo zadáno ID položky'); 263 264 $DbResult = $System->Database->query('SELECT `Entry` FROM `'.$Table.'` WHERE `ID`='.$Search); 265 if($DbResult->num_rows > 0) 266 { 267 $DbRow = $DbResult->fetch_assoc(); 268 $sql = 'SELECT *, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE (`Entry` = '.$DbRow['Entry'].')'. 269 ' AND (`Complete` = 1) AND (`Language` != 0)'; // Do not show uncompleted user translation 270 271 WriteQuests($sql); 272 } else echo('Položka nenalezena'); 273 } 274 275 function TranslatedAll() 276 { 277 global $GroupId, $Table; 278 279 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&action=filter">Filtr textů</a> -> 280 <a title="Zde můžete začít překládat" href="?group='.$GroupId.'&action=selection">Nepřeložené texty</a> - > 281 <strong>Výpis všech textů s limitem na stránku</strong><br /><br />'); 282 283 WriteQuests('SELECT *, (SELECT `User`.`Name` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE (`'.$Table.'`.`Language` = 0)'); 284 } 285 286 function TranslatedFilter() 287 { 288 global $Table, $GroupId, $Database, $User; 289 290 echo('<a title="Zobrazit texty podle vlastního filtru" href="?group='.$GroupId.'&action=filter">Filtr textů</a><br /><br /><br />'. 281 function ShowMenu() 282 { 283 global $Database, $User, $TranslationTree; 284 285 $GroupId = GetParameter('group', 0, true); 286 if($GroupId == 0) ErrorMessage('Skupina nenalezena'); 287 $Table = $TranslationTree[$GroupId]['TablePrefix']; 288 289 echo('<h3>Základní filtrování textů</h3><br/>'. 291 290 '<table class="BaseTable"><tr><th>Odkaz</th><th>Popis</th></tr>'. 292 '<tr><td><a title="Všechny dostupné texty ve skupině" href="?group='.$GroupId.'& action=all">Všechny texty</a></td>'.293 '<td>Zobrazit všechny dostupné texty ve skupině.</td></tr>'.294 '<tr><td><a title="Přeložené texty, můžete zde hlasovat, nebo text opravovat" href="?group='.$GroupId.'& action=Translate">Přeložené texty</a></td>'.291 '<tr><td><a title="Všechny dostupné texty ve skupině" href="?group='.$GroupId.'&state=4">Všechny</a></td>'. 292 '<td>Zobrazit všechny dostupné anglické texty ve skupině.</td></tr>'. 293 '<tr><td><a title="Přeložené texty, můžete zde hlasovat, nebo text opravovat" href="?group='.$GroupId.'&state=2">Přeložené</a></td>'. 295 294 '<td>Zobrazit pouze již přeložené texty.</td></tr>'. 296 '<tr><td><a title="Nepřeložené texty" href="?group='.$GroupId.'& action=notran">Nepřeložené texty</a></td>'.295 '<tr><td><a title="Nepřeložené texty" href="?group='.$GroupId.'&state=1">Nepřeložené</a></td>'. 297 296 '<td>Dosud nepřeložené texty, které je potřeba přeložit.</td></tr>'. 298 '<tr><td><a title="Nedokončené texty" href="?group='.$GroupId.'& action=nocomplete">Nedokončené texty</a></td>'.297 '<tr><td><a title="Nedokončené texty" href="?group='.$GroupId.'&state=3">Nedokončené</a></td>'. 299 298 '<td>Texty označené jako rozpracované.</td></tr>'); 300 299 301 300 if($User->Licence(LICENCE_USER)) 302 301 { 303 echo('<tr><td><a title="Nedokončené texty" href="?group='.$GroupId.'&action=mydevelop">Rozepsané texty</a></td> 304 <td>Nedokončené texty přihlášeného uživatele</td></tr> 305 <tr><td><a title="Přeložené texty přihlášeného uživatele" href="?group='.$GroupId.'&action=my">Moje překlady</a></td> 306 <td>Přeložené texty přihlášeného uživatele</td></tr>'); 307 } 308 309 echo('<tr><td><form action="?group='.$GroupId.'&action=users" method="post"><div>'. 310 '<select name="users[]" size="10" multiple="multiple" class="UserList">'); 311 312 $ID = $Database->SQLCommand('SELECT `Name`, `ID` FROM `User` WHERE 313 EXISTS(SELECT 1 FROM `'.$Table.'` WHERE `User` = `User`.`ID`) ORDER BY `Name`'); 314 if($ID) 315 while($Line = mysql_fetch_assoc($ID)) 316 echo('<option value="'.$Line['ID'].'">'.$Line['Name'].'</option>'); 317 318 echo('</select><br /> 319 <input type="submit" value="Vypsat" /></div></form></td> 320 <td>Vypsat pouze od těchto uživatalů<br /> 321 Vybrat více uživatelů můžete pomocí CTRL+click</td></tr>'); 322 323 echo('<tr><td><form action="?group='.$GroupId.'&action=search" method="post"><div>'. 302 echo('<tr><td><a title="Nedokončené texty" href="?group='.$GroupId.'&state=3&user='.$User->Id.'">Moje nedokončené</a></td> 303 <td>Nedokončené texty přihlášeného uživatele</td></tr> 304 <tr><td><a title="Přeložené texty přihlášeného uživatele" href="?group='.$GroupId.'&state=2&user='.$User->Id.'">Moje přeložené</a></td> 305 <td>Přeložené texty přihlášeného uživatele</td></tr>'); 306 } 307 308 echo('<tr><td><form action="?group='.$GroupId.'" method="post"><div>'. 324 309 '<input type="text" name="search" size="8" />'. 325 310 '<input type="submit" value="Hledat" />'. … … 327 312 '</td><td>Vyhledat pomocí textu</td></tr>'); 328 313 329 echo('<tr><td><form action="?group='.$GroupId.'& ;action=searchentry" method="post"><div>'.330 '<input type="text" name=" ID" size="8" />'.314 echo('<tr><td><form action="?group='.$GroupId.'&" method="post"><div>'. 315 '<input type="text" name="Entry" size="8" />'. 331 316 '<input type="submit" value="Hledat" />'. 332 317 '</div></form>'. … … 336 321 } 337 322 338 339 323 ShowPage(); 340 324 341 $GroupId = LoadGroupIdParameter(); 342 $Table = $TranslationTree[$GroupId]['TablePrefix']; 343 if(array_key_exists('action', $_GET)) $Action = $_GET['action']; else $Action = ''; 344 345 $DbResult = $Database->SQLCommand('SELECT MAX(`VersionEnd`) FROM `'.$TranslationTree[$GroupId]['TablePrefix'].'`'); 346 $ID = mysql_fetch_row($DbResult); 347 $BuildNumber_max = $ID[0]; 348 349 if(($Action != 'userall') and ($Action != 'grouplist')) 350 echo('Skupina: <strong>'.$TranslationTree[$GroupId]['Name'].'</strong><br />'); 351 352 if($Action == 'notran') Nontranslated(); 353 else if($Action == 'connexion') Connexion(); 354 else if($Action == 'connexion_list') ConnexionList(); 355 else if($Action == 'nocomplete') Noncomplete(); 356 else if($Action == 'Translate') Translate(); 357 else if(($Action == 'my') and $User->Licence(LICENCE_USER)) UserTranslated(); 358 else if(($Action == 'mydevelop') and $User->Licence(LICENCE_USER)) UserUnfinished(); 359 else if($Action == 'users') UserSelected(); 360 else if($Action == 'userall') UserAll(); 361 else if($Action == 'grouplist') GroupList(); 362 else if($Action == 'userid') TranslatedByUserId(); 363 else if($Action == 'search') TranslatedSearch(); 364 else if($Action == 'searchentry') SearchEntry(); 365 else if($Action == 'all') TranslatedAll(); 366 else if($Action == 'filter') TranslatedFilter(); 367 else echo('Neznámá akce'); 368 325 $Action = GetParameter('action', ''); 326 if($Action == 'filter') ShowMenu(); 327 else if($Action == 'grouplist') ShowGroupTypeList(); 328 else 329 { 330 $Filter = ShowFilter(); 331 //print_r($Filter); 332 if($Filter['Group'] > 0) ShowTranslationList($Filter); 333 else ShowGroupList($Filter); 334 } 335 369 336 ShowFooter(); 370 337
Note:
See TracChangeset
for help on using the changeset viewer.