Changeset 893 for trunk/Modules/Translation/TranslationList.php
- Timestamp:
- Mar 6, 2023, 1:48:45 AM (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Translation/TranslationList.php
r888 r893 13 13 } 14 14 15 16 15 class PageTranslationList extends Page 17 16 { 18 17 function ShowFilter($GroupId = 0) 19 18 { 20 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 19 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 20 $TranslationTree = ModuleTranslation::Cast($this->System->GetModule('Translation'))->GetTranslationTree(); 21 21 22 22 $Filter = array('SQL' => ''); … … 85 85 $Output .= '</select></td>'; 86 86 87 if ($ this->System->User->Licence(LICENCE_USER))88 $Filter['Version'] = GetParameter('version', $ this->System->User->PreferredVersion, true, true);87 if ($User->Licence(LICENCE_USER)) 88 $Filter['Version'] = GetParameter('version', $User->PreferredVersion, true, true); 89 89 else 90 90 $Filter['Version'] = GetParameter('version', 0, true, true); … … 176 176 { 177 177 $WithoutAlter = ' AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE '. 178 '(`Sub`.`Language` <> '. $this->System->Config['OriginalLanguage'].')'.$LanguageFilterSub.178 '(`Sub`.`Language` <> '.Core::Cast($this->System)->Config['OriginalLanguage'].')'.$LanguageFilterSub. 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 ) '; … … 184 184 ' < ('. 185 185 'SELECT LENGTH(`Sub`.`'.$GroupItem['Column'].'`) - LENGTH( REPLACE( `Sub`.`'.$GroupItem['Column'].'`, \'$\', \'\' ) ) FROM `'.$Table.'` AS `Sub` WHERE '. 186 ' `Sub`.`Entry` = `T`.`Entry` AND `Sub`.`Language` = '. $this->System->Config['OriginalLanguage'].' AND '.186 ' `Sub`.`Entry` = `T`.`Entry` AND `Sub`.`Language` = '.Core::Cast($this->System)->Config['OriginalLanguage'].' AND '. 187 187 '`Sub`.`VersionStart` = `T`.`VersionStart` AND `Sub`.`VersionEnd` = `T`.`VersionEnd` LIMIT 1 '. 188 188 ')'; … … 192 192 } else 193 193 if ($Filter['State'] == CompletionState::NotTranslated) { 194 $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '. $this->System->Config['OriginalLanguage'].') '.194 $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.Core::Cast($this->System)->Config['OriginalLanguage'].') '. 195 195 'AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE '. 196 '(`Sub`.`Language` <> '. $this->System->Config['OriginalLanguage'].') '.$LanguageFilterSub.$UserFilter.196 '(`Sub`.`Language` <> '.Core::Cast($this->System)->Config['OriginalLanguage'].') '.$LanguageFilterSub.$UserFilter. 197 197 ' AND (`Sub`.`Entry` = `T`.`Entry`) AND (`Sub`.`Complete` = 1) AND '. 198 198 '(`Sub`.`VersionStart` = `T`.`VersionStart`) AND (`Sub`.`VersionEnd` = `T`.`VersionEnd`))'; … … 202 202 } else 203 203 if ($Filter['State'] == CompletionState::NotFinished) { 204 $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Language` != '. $this->System->Config['OriginalLanguage'].204 $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Language` != '.Core::Cast($this->System)->Config['OriginalLanguage']. 205 205 ') AND (`T`.`Complete` = 0)'; 206 206 } else 207 207 if ($Filter['State'] == CompletionState::Original) { 208 $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '. $this->System->Config['OriginalLanguage'].')';208 $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.Core::Cast($this->System)->Config['OriginalLanguage'].')'; 209 209 } else 210 210 if ($Filter['State'] == CompletionState::NotFinishedNotTranslated) { 211 211 $Filter['SQL'] .= $UserFilter.$VersionFilter.$WithoutAlter. 212 ' AND (`T`.`Language` != '. $this->System->Config['OriginalLanguage'].212 ' AND (`T`.`Language` != '.Core::Cast($this->System)->Config['OriginalLanguage']. 213 213 ') AND (`T`.`Complete` = 0)'; 214 214 } else 215 215 if ($Filter['State'] == CompletionState::Missing1) { 216 $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '. $this->System->Config['OriginalLanguage'];216 $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '.Core::Cast($this->System)->Config['OriginalLanguage']; 217 217 $Filter['SQL'] .= ' AND ('.implode(' OR ', $ItemsVar).') '; 218 218 } else 219 219 if ($Filter['State'] == CompletionState::Missing2) { 220 $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '. $this->System->Config['OriginalLanguage'];220 $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '.Core::Cast($this->System)->Config['OriginalLanguage']; 221 221 $Filter['SQL'] .= ' '. $WithoutAlter; 222 222 $Filter['SQL'] .= ' AND ('.implode(' OR ', $ItemsVar).') '; … … 333 333 function ShowMenu() 334 334 { 335 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 335 336 $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree(); 336 337 … … 351 352 '<td>'.T('Texts marked as unfinished').'</td></tr>'; 352 353 353 if ($ this->System->User->Licence(LICENCE_USER))354 if ($User->Licence(LICENCE_USER)) 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>356 $Output .= '<tr><td><a title="'.T('Unfinished texts').'" href="?group='.$GroupId.'&state=3&user='.$User->Id.'">'.T('My unfinished').'</a></td> 356 357 <td>'.T('Unfinished texts of logged-in user').'</td></tr> 357 <tr><td><a title="'.T('Translated texts of logged-in user').'" href="?group='.$GroupId.'&state=2&user='.$ this->System->User->Id.'">'.T('My translated').'</a></td>358 <tr><td><a title="'.T('Translated texts of logged-in user').'" href="?group='.$GroupId.'&state=2&user='.$User->Id.'">'.T('My translated').'</a></td> 358 359 <td>'.T('Translated texts of logged-in user').'</td></tr>'; 359 360 } … … 395 396 function ShowList() 396 397 { 398 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 397 399 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Group`'); 398 400 $DbRow = $DbResult->fetch_row(); … … 408 410 array('Name' => 'LastImport', 'Title' => T('Date of last import')), 409 411 array('Name' => 'LastVersion', 'Title' => T('Version of last import')), 410 );411 if ($this->System->User->Licence(LICENCE_ADMIN))412 $TableColumns[] = array('Name' => '', 'Title' => T('Actions'));413 414 $Order = GetOrderTableHeader($TableColumns, 'Name', 0);415 $Output .= $Order['Output'];416 417 $DbResult = $this->Database->query('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']);418 while ($Group = $DbResult->fetch_assoc())419 {420 $Output .= '<tr><td><a href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&action=filter').'">'.T($Group['Name']).'</a></td>'.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 ';425 $Output .= '</td>';426 if ($this->System->User->Licence(LICENCE_ADMIN))427 $Output .= '<td><a title="Změny po posledním importu u vybrané překladové skupiny" href="'.$this->System->Link('/log/?group='.428 $Group['Id'].'&type=11').'">'.HumanDate($Group['LastImport']).'</a></td>';429 else $Output .= '<td>'.HumanDate($Group['LastImport']).'</td>';430 $Output .= '<td><a href="'.$this->System->Link('/client-version/?action=item&id='.431 GetVersionWOWId($Group['LastVersion'])).'">'.GetVersionWOW($Group['LastVersion']).'</a></td>';432 if ($this->System->User->Licence(LICENCE_ADMIN))433 $Output .= '<td><a href="?action=groupdelete&id='.$Group['Id'].'">'.T('Remove').'</a></td>';434 $Output .= '</tr>';412 ); 413 if ($User->Licence(LICENCE_ADMIN)) 414 $TableColumns[] = array('Name' => '', 'Title' => T('Actions')); 415 416 $Order = GetOrderTableHeader($TableColumns, 'Name', 0); 417 $Output .= $Order['Output']; 418 419 $DbResult = $this->Database->query('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']); 420 while ($Group = $DbResult->fetch_assoc()) 421 { 422 $Output .= '<tr><td><a href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&action=filter').'">'.T($Group['Name']).'</a></td>'. 423 '<td>'.$Group['SourceType'].'</td><td>'; 424 if ($Group['MangosTable'] != '') $Output .= $Group['MangosTable'].'.sql '; 425 if ($Group['DBCFileName'] != '') $Output .= $Group['DBCFileName'].'.dbc '; 426 if ($Group['LuaFileName'] != '') $Output .= $Group['LuaFileName'].'.lua '; 427 $Output .= '</td>'; 428 if ($User->Licence(LICENCE_ADMIN)) 429 $Output .= '<td><a title="Změny po posledním importu u vybrané překladové skupiny" href="'.$this->System->Link('/log/?group='. 430 $Group['Id'].'&type=11').'">'.HumanDate($Group['LastImport']).'</a></td>'; 431 else $Output .= '<td>'.HumanDate($Group['LastImport']).'</td>'; 432 $Output .= '<td><a href="'.$this->System->Link('/client-version/?action=item&id='. 433 GetVersionWOWId($Group['LastVersion'])).'">'.GetVersionWOW($Group['LastVersion']).'</a></td>'; 434 if ($User->Licence(LICENCE_ADMIN)) 435 $Output .= '<td><a href="?action=groupdelete&id='.$Group['Id'].'">'.T('Remove').'</a></td>'; 436 $Output .= '</tr>'; 435 437 } 436 438 $Output .= '</table>'. 437 439 '<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>';440 if ($User->Licence(LICENCE_ADMIN)) $Output .= '<a href="?action=groupadd">'.T('Add translation group').'</a>'; 439 441 return $Output; 440 442 } … … 442 444 function ShowGroupAdd() 443 445 { 444 if ($this->System->User->Licence(LICENCE_ADMIN)) 446 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 447 if ($User->Licence(LICENCE_ADMIN)) 445 448 { 446 449 $Output = '<h3>Vložení nové překladové skupiny</h3>'. … … 457 460 function ShowGroupAddFinish() 458 461 { 459 if ($this->System->User->Licence(LICENCE_ADMIN)) 462 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 463 if ($User->Licence(LICENCE_ADMIN)) 460 464 { 461 465 $TableName = 'Text'.$_POST['TablePrefix']; … … 505 509 function ShowGroupDelete() 506 510 { 507 if ($this->System->User->Licence(LICENCE_ADMIN)) 511 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 512 if ($User->Licence(LICENCE_ADMIN)) 508 513 { 509 514 $DbResult = $this->System->Database->select('Group', '*', '`Id`='.$_GET['id']);
Note:
See TracChangeset
for help on using the changeset viewer.