Changeset 880 for trunk/Modules/Translation/TranslationList.php
- Timestamp:
- Apr 7, 2020, 10:15:48 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Translation/TranslationList.php
r859 r880 47 47 ); 48 48 foreach ($StateTypes as $index => $StateType) { 49 if ($Filter['State'] == $index) $Selected = ' selected="selected"';49 if ($Filter['State'] == $index) $Selected = ' selected="selected"'; 50 50 else $Selected = ''; 51 51 $Output .= '<option value="'.$index.'"'.$Selected.'>'.$StateType.'</option>'; … … 54 54 55 55 // Translation group 56 if ($GroupId == 0)56 if ($GroupId == 0) 57 57 { 58 58 $Filter['Group'] = GetParameter('group', 0, true, true); 59 if ($Filter['Group'] != 0)59 if ($Filter['Group'] != 0) 60 60 { 61 if (isset($TranslationTree[$Filter['Group']]) == false)61 if (isset($TranslationTree[$Filter['Group']]) == false) 62 62 ErrorMessage('Překladová skupina dle zadaného Id neexistuje.'); 63 63 $Table = $TranslationTree[$Filter['Group']]['TablePrefix']; … … 70 70 71 71 $Output .= '<td><select name="group" style="width: 80px">'; 72 if ($Filter['Group'] == 0) $Selected = ' selected="selected"';72 if ($Filter['Group'] == 0) $Selected = ' selected="selected"'; 73 73 else $Selected = ''; 74 74 $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>'; 75 75 $DbResult = $this->Database->query('SELECT `Id`,`Name` FROM `Group`'); 76 while ($Group = $DbResult->fetch_assoc())76 while ($Group = $DbResult->fetch_assoc()) 77 77 $Groups[T($Group['Name'])] = $Group; 78 78 ksort($Groups); 79 foreach ($Groups as $Group)80 { 81 if ($Group['Id'] == $Filter['Group']) $Selected = ' selected="selected"';79 foreach ($Groups as $Group) 80 { 81 if ($Group['Id'] == $Filter['Group']) $Selected = ' selected="selected"'; 82 82 else $Selected = ''; 83 83 $Output .= '<option value="'.$Group['Id'].'"'.$Selected.'>'.T($Group['Name']).'</option>'; … … 89 89 else 90 90 $Filter['Version'] = GetParameter('version', 0, true, true); 91 if ($Filter['Version'] != 0)91 if ($Filter['Version'] != 0) 92 92 { 93 93 $DbResult = $this->Database->query('SELECT `Id`, `BuildNumber`,`Version` FROM `ClientVersion` WHERE (`Imported` = 1) AND (`Id` ='.$Filter['Version'].')'); 94 if ($DbResult->num_rows > 0)94 if ($DbResult->num_rows > 0) 95 95 { 96 96 $DbRow = $DbResult->fetch_assoc(); … … 99 99 } 100 100 $Output .= '<td><select name="version">'; 101 if ($Filter['Version'] == 0) $Selected = ' selected="selected"';101 if ($Filter['Version'] == 0) $Selected = ' selected="selected"'; 102 102 else $Selected = ''; 103 103 $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>'; 104 104 $DbResult = $this->Database->query('SELECT `Id`, `BuildNumber`,`Version` FROM `ClientVersion` WHERE `Imported` = 1 ORDER BY `BuildNumber` DESC'); 105 while ($Version = $DbResult->fetch_assoc())106 { 107 if ($Version['Id'] == $Filter['Version']) $Selected = ' selected="selected"';105 while ($Version = $DbResult->fetch_assoc()) 106 { 107 if ($Version['Id'] == $Filter['Version']) $Selected = ' selected="selected"'; 108 108 else $Selected = ''; 109 109 $Output .= '<option value="'.$Version['Id'].'"'.$Selected.'>'.$Version['Version'].'</option>'; 110 110 } 111 111 $Output .= '</select></td>'; 112 if ($Filter['Version'] != 0) $VersionFilter = ' AND (`VersionStart` <= '.$Filter['BuildNumber'].') AND (`VersionEnd` >= '.$Filter['BuildNumber'].')';112 if ($Filter['Version'] != 0) $VersionFilter = ' AND (`VersionStart` <= '.$Filter['BuildNumber'].') AND (`VersionEnd` >= '.$Filter['BuildNumber'].')'; 113 113 else $VersionFilter = ''; 114 114 //else $Filter['SQL'] .= ' AND '; DISTINCT(Entry) … … 117 117 $Filter['Language'] = GetParameter('lang', 0, true, true); 118 118 $Output .= '<td><select name="lang">'; 119 if ($Filter['Language'] == 0) $Selected = ' selected="selected"';119 if ($Filter['Language'] == 0) $Selected = ' selected="selected"'; 120 120 else $Selected = ''; 121 121 $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>'; 122 122 $DbResult = $this->Database->query('SELECT `Id`, `Name` FROM `Language` WHERE `Enabled` = 1 ORDER BY `Name`'); 123 while ($Language = $DbResult->fetch_assoc())124 { 125 if ($Language['Id'] == $Filter['Language']) $Selected = ' selected="selected"';123 while ($Language = $DbResult->fetch_assoc()) 124 { 125 if ($Language['Id'] == $Filter['Language']) $Selected = ' selected="selected"'; 126 126 else $Selected = ''; 127 127 $Output .= '<option value="'.$Language['Id'].'"'.$Selected.'>'.T($Language['Name']).'</option>'; … … 130 130 $LanguageFilter = ''; 131 131 $LanguageFilterSub = ''; 132 if ($Filter['Language'] != 0) {132 if ($Filter['Language'] != 0) { 133 133 $LanguageFilter = ' AND (`T`.`Language` = '.$Filter['Language'].')'; 134 134 $LanguageFilterSub = ' AND (`Sub`.`Language` = '.$Filter['Language'].')'; … … 138 138 $Filter['User'] = GetParameter('user', 0, true, true); 139 139 $Output .= '<td><select name="user" style="width: 80px">'; 140 if ($Filter['User'] == 0) $Selected = ' selected="selected"';140 if ($Filter['User'] == 0) $Selected = ' selected="selected"'; 141 141 else $Selected = ''; 142 142 $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>'; 143 143 $DbResult = $this->Database->query('SELECT `Id`, `Name` FROM `User` ORDER BY `Name`'); 144 while ($User = $DbResult->fetch_assoc())145 { 146 if ($User['Id'] == $Filter['User']) $Selected = ' selected="selected"';144 while ($User = $DbResult->fetch_assoc()) 145 { 146 if ($User['Id'] == $Filter['User']) $Selected = ' selected="selected"'; 147 147 else $Selected = ''; 148 148 $Output .= '<option value="'.$User['Id'].'"'.$Selected.'>'.$User['Name'].'</option>'; 149 149 } 150 150 $Output .= '</select></td>'; 151 if ($Filter['User'] != 0) $UserFilter = ' AND (`User` = '.$Filter['User'].')';151 if ($Filter['User'] != 0) $UserFilter = ' AND (`User` = '.$Filter['User'].')'; 152 152 else $UserFilter = ''; 153 153 … … 155 155 $Filter['Text'] = GetParameter('text', '', false, true); 156 156 $Output .= '<td><input name="text" type="text" style="width: 60px;" value="'.htmlentities($Filter['Text']).'"></td>'; 157 if ($Filter['Text'] != '')157 if ($Filter['Text'] != '') 158 158 { 159 159 $Items = array('(`T`.`ID` LIKE "%'.$Filter['Text'].'%")', '(`T`.`Entry` LIKE "%'.$Filter['Text'].'%")'); 160 if ($Filter['Group'] != 0)161 foreach ($TranslationTree[$Filter['Group']]['Items'] as $GroupItem)162 if ($GroupItem['Visible'] == 1)160 if ($Filter['Group'] != 0) 161 foreach ($TranslationTree[$Filter['Group']]['Items'] as $GroupItem) 162 if ($GroupItem['Visible'] == 1) 163 163 $Items[] = '(`T`.`'.$GroupItem['Column'].'` LIKE "%'.$Filter['Text'].'%")'; 164 164 $Filter['SQL'] .= ' AND ('.implode(' OR ', $Items).')'; … … 168 168 $Filter['Entry'] = GetParameter('entry', '', false, true); 169 169 $Output .= '<td><input name="entry" type="text" style="width: 60px;" value="'.htmlentities($Filter['Entry']).'"></td>'; 170 if ($Filter['Entry'] != '')170 if ($Filter['Entry'] != '') 171 171 { 172 172 $Filter['SQL'] .= ' AND (`Entry` = "'.$Filter['Entry'].'")'; 173 173 } 174 174 175 if ($Filter['Group'] != 0)175 if ($Filter['Group'] != 0) 176 176 { 177 177 $WithoutAlter = ' AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE '. … … 179 179 ' AND (`Sub`.`Entry` = `T`.`Entry`) AND (`Sub`.`ID` != `T`.`ID`) AND (`Sub`.`Complete` = 1) AND '. 180 180 '(`Sub`.`VersionStart` = `T`.`VersionStart`) AND (`Sub`.`VersionEnd` = `T`.`VersionEnd`) LIMIT 1 ) '; 181 foreach ($TranslationTree[$Filter['Group']]['Items'] as $GroupItem)182 if ($GroupItem['Visible'] == 1) {181 foreach ($TranslationTree[$Filter['Group']]['Items'] as $GroupItem) 182 if ($GroupItem['Visible'] == 1) { 183 183 $ItemsVar[] = 'LENGTH(`T`.`'.$GroupItem['Column'].'`) - LENGTH( REPLACE( `T`.`'.$GroupItem['Column'].'`, \'$\', \'\' ) ) '. 184 184 ' < ('. … … 188 188 ')'; 189 189 } 190 if ($Filter['State'] == CompletionState::All) {190 if ($Filter['State'] == CompletionState::All) { 191 191 $Filter['SQL'] .= $UserFilter.$VersionFilter; 192 192 } else 193 if ($Filter['State'] == CompletionState::NotTranslated) {193 if ($Filter['State'] == CompletionState::NotTranslated) { 194 194 $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$this->System->Config['OriginalLanguage'].') '. 195 195 'AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE '. … … 198 198 '(`Sub`.`VersionStart` = `T`.`VersionStart`) AND (`Sub`.`VersionEnd` = `T`.`VersionEnd`))'; 199 199 } else 200 if ($Filter['State'] == CompletionState::Translated) {200 if ($Filter['State'] == CompletionState::Translated) { 201 201 $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Complete` = 1)'; 202 202 } else 203 if ($Filter['State'] == CompletionState::NotFinished) {203 if ($Filter['State'] == CompletionState::NotFinished) { 204 204 $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Language` != '.$this->System->Config['OriginalLanguage']. 205 205 ') AND (`T`.`Complete` = 0)'; 206 206 } else 207 if ($Filter['State'] == CompletionState::Original) {207 if ($Filter['State'] == CompletionState::Original) { 208 208 $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$this->System->Config['OriginalLanguage'].')'; 209 209 } else 210 if ($Filter['State'] == CompletionState::NotFinishedNotTranslated) {210 if ($Filter['State'] == CompletionState::NotFinishedNotTranslated) { 211 211 $Filter['SQL'] .= $UserFilter.$VersionFilter.$WithoutAlter. 212 212 ' AND (`T`.`Language` != '.$this->System->Config['OriginalLanguage']. 213 213 ') AND (`T`.`Complete` = 0)'; 214 214 } else 215 if ($Filter['State'] == CompletionState::Missing1) {215 if ($Filter['State'] == CompletionState::Missing1) { 216 216 $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '.$this->System->Config['OriginalLanguage']; 217 217 $Filter['SQL'] .= ' AND ('.implode(' OR ', $ItemsVar).') '; 218 218 } else 219 if ($Filter['State'] == CompletionState::Missing2) {219 if ($Filter['State'] == CompletionState::Missing2) { 220 220 $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '.$this->System->Config['OriginalLanguage']; 221 221 $Filter['SQL'] .= ' '. $WithoutAlter; … … 226 226 /* 227 227 // Ownership 228 if (array_key_exists('owner', $_GET) and is_numeric($_GET['owner'])) $Filter['Owner'] = $_GET['owner'];228 if (array_key_exists('owner', $_GET) and is_numeric($_GET['owner'])) $Filter['Owner'] = $_GET['owner']; 229 229 else $Filter['Owner'] = 0; 230 230 $Output .= ' <td><select name="owner">'; 231 if ($Filter['Owner'] == 0) $Selected = ' selected="selected"';231 if ($Filter['Owner'] == 0) $Selected = ' selected="selected"'; 232 232 else $Selected = ''; 233 233 $Output .= '<option value="0"'.$Selected.'>Všech</option>'; 234 if ($Filter['Owner'] == 1) $Selected = ' selected="selected"';234 if ($Filter['Owner'] == 1) $Selected = ' selected="selected"'; 235 235 else $Selected = ''; 236 236 $Output .= '<option value="1"'.$Selected.'>Překladatelův tým</option>'; 237 if ($Filter['Owner'] == 2) $Selected = ' selected="selected"';237 if ($Filter['Owner'] == 2) $Selected = ' selected="selected"'; 238 238 else $Selected = ''; 239 239 $Output .= '<option value="2"'.$Selected.'>Překladatele</option>'; 240 240 $Output .= '</select></td>'; 241 if (($Filter['Owner'] == 2) AND ($Filter['User'] != 0)) $Filter['SQL'] .= ' AND (`User` = '.$Filter['User'].')';241 if (($Filter['Owner'] == 2) AND ($Filter['User'] != 0)) $Filter['SQL'] .= ' AND (`User` = '.$Filter['User'].')'; 242 242 */ 243 243 … … 246 246 $Output .= '</form><br/>'; 247 247 $Filter['Output'] = $Output; 248 return ($Filter);248 return $Filter; 249 249 } 250 250 … … 289 289 290 290 $DbResult = $this->Database->query($Query.' '.$Order['SQL'].' '.$PageList['SQLLimit']); 291 while ($Line = $DbResult->fetch_assoc())291 while ($Line = $DbResult->fetch_assoc()) 292 292 { 293 293 $Output .= '<tr><td><a href="'.$this->System->Link('/form.php?group='.$Filter['Group'].'&ID='.$Line['ID']).'">'.$Line['ID'].'</a></td>'. … … 305 305 $Output .= '</table>'. 306 306 $PageList['Output']; 307 return ($Output);307 return $Output; 308 308 } 309 309 … … 316 316 $Output .= '<table class="BaseTable"><tr><th>'.T('Group').'</th><th>'.T('Count').'</th></tr>'; 317 317 $Total = 0; 318 foreach ($TranslationTree as $Group)319 if ($Group['TablePrefix'] != '')318 foreach ($TranslationTree as $Group) 319 if ($Group['TablePrefix'] != '') 320 320 { 321 321 $Filter = $this->ShowFilter($Group['Id']); … … 328 328 $Output .= '<tr><td><strong>'.T('Total').'</strong></td><td><strong>'.$Total.'</strong></td></tr>'. 329 329 '</table>'; 330 return ($Output);330 return $Output; 331 331 } 332 332 … … 336 336 337 337 $GroupId = GetParameter('group', 0, true); 338 if ($GroupId == 0) $Output = ShowMessage('Skupina nenalezena', MESSAGE_CRITICAL);338 if ($GroupId == 0) $Output = ShowMessage('Skupina nenalezena', MESSAGE_CRITICAL); 339 339 else { 340 340 $Table = $TranslationTree[$GroupId]['TablePrefix']; … … 351 351 '<td>'.T('Texts marked as unfinished').'</td></tr>'; 352 352 353 if ($this->System->User->Licence(LICENCE_USER))353 if ($this->System->User->Licence(LICENCE_USER)) 354 354 { 355 355 $Output .= '<tr><td><a title="'.T('Unfinished texts').'" href="?group='.$GroupId.'&state=3&user='.$this->System->User->Id.'">'.T('My unfinished').'</a></td> … … 373 373 $Output .= '</table>'; 374 374 } 375 return ($Output);375 return $Output; 376 376 } 377 377 … … 380 380 $this->Title = T('Translation groups'); 381 381 $Action = GetParameter('action', ''); 382 if ($Action == 'filter') $Output = $this->ShowMenu();382 if ($Action == 'filter') $Output = $this->ShowMenu(); 383 383 else 384 384 { 385 385 $Filter = $this->ShowFilter(); 386 if ($Filter['Group'] > 0) $Output = $this->ShowTranslationList($Filter);386 if ($Filter['Group'] > 0) $Output = $this->ShowTranslationList($Filter); 387 387 else $Output = $this->ShowGroupList($Filter); 388 388 } 389 return ($Output);389 return $Output; 390 390 } 391 391 } … … 409 409 array('Name' => 'LastVersion', 'Title' => T('Version of last import')), 410 410 ); 411 if ($this->System->User->Licence(LICENCE_ADMIN))411 if ($this->System->User->Licence(LICENCE_ADMIN)) 412 412 $TableColumns[] = array('Name' => '', 'Title' => T('Actions')); 413 413 … … 416 416 417 417 $DbResult = $this->Database->query('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']); 418 while ($Group = $DbResult->fetch_assoc())418 while ($Group = $DbResult->fetch_assoc()) 419 419 { 420 420 $Output .= '<tr><td><a href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&action=filter').'">'.T($Group['Name']).'</a></td>'. 421 421 '<td>'.$Group['SourceType'].'</td><td>'; 422 if ($Group['MangosTable'] != '') $Output .= $Group['MangosTable'].'.sql ';423 if ($Group['DBCFileName'] != '') $Output .= $Group['DBCFileName'].'.dbc ';424 if ($Group['LuaFileName'] != '') $Output .= $Group['LuaFileName'].'.lua ';422 if ($Group['MangosTable'] != '') $Output .= $Group['MangosTable'].'.sql '; 423 if ($Group['DBCFileName'] != '') $Output .= $Group['DBCFileName'].'.dbc '; 424 if ($Group['LuaFileName'] != '') $Output .= $Group['LuaFileName'].'.lua '; 425 425 $Output .= '</td>'; 426 if ($this->System->User->Licence(LICENCE_ADMIN))426 if ($this->System->User->Licence(LICENCE_ADMIN)) 427 427 $Output .= '<td><a title="Změny po posledním importu u vybrané překladové skupiny" href="'.$this->System->Link('/log/?group='. 428 428 $Group['Id'].'&type=11').'">'.HumanDate($Group['LastImport']).'</a></td>'; … … 430 430 $Output .= '<td><a href="'.$this->System->Link('/client-version/?action=item&id='. 431 431 GetVersionWOWId($Group['LastVersion'])).'">'.GetVersionWOW($Group['LastVersion']).'</a></td>'; 432 if ($this->System->User->Licence(LICENCE_ADMIN))432 if ($this->System->User->Licence(LICENCE_ADMIN)) 433 433 $Output .= '<td><a href="?action=groupdelete&id='.$Group['Id'].'">'.T('Remove').'</a></td>'; 434 434 $Output .= '</tr>'; … … 436 436 $Output .= '</table>'. 437 437 '<br /><a title="'.T('Changelog of changes after import').'" href="'.$this->System->Link('/log/?type=11').'">'.T('Changelog of text modification during import').'</a><br/>'; 438 if ($this->System->User->Licence(LICENCE_ADMIN)) $Output .= '<a href="?action=groupadd">'.T('Add translation group').'</a>';439 return ($Output);438 if ($this->System->User->Licence(LICENCE_ADMIN)) $Output .= '<a href="?action=groupadd">'.T('Add translation group').'</a>'; 439 return $Output; 440 440 } 441 441 442 442 function ShowGroupAdd() 443 443 { 444 if ($this->System->User->Licence(LICENCE_ADMIN))444 if ($this->System->User->Licence(LICENCE_ADMIN)) 445 445 { 446 446 $Output = '<h3>Vložení nové překladové skupiny</h3>'. … … 452 452 '</table></form>'; 453 453 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 454 return ($Output);454 return $Output; 455 455 } 456 456 457 457 function ShowGroupAddFinish() 458 458 { 459 if ($this->System->User->Licence(LICENCE_ADMIN))459 if ($this->System->User->Licence(LICENCE_ADMIN)) 460 460 { 461 461 $TableName = 'Text'.$_POST['TablePrefix']; 462 462 $DbResult = $this->System->Database->select('Group', 'Id', 'TablePrefix="'.$TableName.'"'); 463 if ($DbResult->num_rows == 0)463 if ($DbResult->num_rows == 0) 464 464 { 465 465 … … 500 500 $Output .= $this->ShowList(); 501 501 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 502 return ($Output);502 return $Output; 503 503 } 504 504 505 505 function ShowGroupDelete() 506 506 { 507 if ($this->System->User->Licence(LICENCE_ADMIN))507 if ($this->System->User->Licence(LICENCE_ADMIN)) 508 508 { 509 509 $DbResult = $this->System->Database->select('Group', '*', '`Id`='.$_GET['id']); 510 if ($DbResult->num_rows == 1)510 if ($DbResult->num_rows == 1) 511 511 { 512 512 $Group = $DbResult->fetch_assoc(); … … 518 518 } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 519 519 $Output .= $this->ShowList(); 520 return ($Output);520 return $Output; 521 521 } 522 522 … … 525 525 $this->Title = T('Translation groups'); 526 526 $Action = GetParameter('action', ''); 527 if ($Action == 'groupadd') $Output = $this->ShowGroupAdd();528 else if ($Action == 'groupdelete') $Output = $this->ShowGroupDelete();529 else if ($Action == 'groupaddfinish') $Output = $this->ShowGroupAddFinish();527 if ($Action == 'groupadd') $Output = $this->ShowGroupAdd(); 528 else if ($Action == 'groupdelete') $Output = $this->ShowGroupDelete(); 529 else if ($Action == 'groupaddfinish') $Output = $this->ShowGroupAddFinish(); 530 530 else $Output = $this->ShowList(); 531 return ($Output);531 return $Output; 532 532 } 533 533 }
Note:
See TracChangeset
for help on using the changeset viewer.