Ignore:
Timestamp:
Mar 6, 2023, 1:48:45 AM (22 months ago)
Author:
chronos
Message:
  • Fixed: Class types casting for better type checking.
  • Fixed: XML direct export.
  • Modified: User class instance moved from Core class to ModuleUser class.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Translation/TranslationList.php

    r888 r893  
    1313}
    1414
    15 
    1615class PageTranslationList extends Page
    1716{
    1817  function ShowFilter($GroupId = 0)
    1918  {
    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();
    2121
    2222    $Filter = array('SQL' => '');
     
    8585    $Output .= '</select></td>';
    8686
    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);
    8989    else
    9090      $Filter['Version'] = GetParameter('version', 0, true, true);
     
    176176    {
    177177        $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.
    179179          ' AND (`Sub`.`Entry` = `T`.`Entry`) AND (`Sub`.`ID` != `T`.`ID`) AND (`Sub`.`Complete` = 1) AND '.
    180180          '(`Sub`.`VersionStart` = `T`.`VersionStart`) AND (`Sub`.`VersionEnd` = `T`.`VersionEnd`) LIMIT 1 ) ';
     
    184184                           ' < ('.
    185185                                          '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 '.
    187187                                          '`Sub`.`VersionStart` = `T`.`VersionStart` AND `Sub`.`VersionEnd` = `T`.`VersionEnd` LIMIT 1 '.
    188188                              ')';
     
    192192      } else
    193193      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'].') '.
    195195          '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.
    197197          ' AND (`Sub`.`Entry` = `T`.`Entry`) AND (`Sub`.`Complete` = 1) AND '.
    198198          '(`Sub`.`VersionStart` = `T`.`VersionStart`) AND (`Sub`.`VersionEnd` = `T`.`VersionEnd`))';
     
    202202      } else
    203203      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'].
    205205      ') AND (`T`.`Complete` = 0)';
    206206      } else
    207207      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'].')';
    209209      } else
    210210      if ($Filter['State'] == CompletionState::NotFinishedNotTranslated) {
    211211        $Filter['SQL'] .= $UserFilter.$VersionFilter.$WithoutAlter.
    212       ' AND (`T`.`Language` != '.$this->System->Config['OriginalLanguage'].
     212      ' AND (`T`.`Language` != '.Core::Cast($this->System)->Config['OriginalLanguage'].
    213213      ') AND (`T`.`Complete` = 0)';
    214214      } else
    215215      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'];
    217217        $Filter['SQL'] .= ' AND ('.implode(' OR ', $ItemsVar).') ';
    218218      } else
    219219      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'];
    221221        $Filter['SQL'] .= ' '. $WithoutAlter;
    222222        $Filter['SQL'] .= ' AND ('.implode(' OR ', $ItemsVar).') ';
     
    333333  function ShowMenu()
    334334  {
     335    $User = ModuleUser::Cast($this->System->GetModule('User'))->User;
    335336    $TranslationTree = $this->System->ModuleManager->Modules['Translation']->GetTranslationTree();
    336337
     
    351352          '<td>'.T('Texts marked as unfinished').'</td></tr>';
    352353
    353       if ($this->System->User->Licence(LICENCE_USER))
     354      if ($User->Licence(LICENCE_USER))
    354355      {
    355         $Output .= '<tr><td><a title="'.T('Unfinished texts').'" href="?group='.$GroupId.'&amp;state=3&amp;user='.$this->System->User->Id.'">'.T('My unfinished').'</a></td>
     356        $Output .= '<tr><td><a title="'.T('Unfinished texts').'" href="?group='.$GroupId.'&amp;state=3&amp;user='.$User->Id.'">'.T('My unfinished').'</a></td>
    356357        <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.'&amp;state=2&amp;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.'&amp;state=2&amp;user='.$User->Id.'">'.T('My translated').'</a></td>
    358359        <td>'.T('Translated texts of logged-in user').'</td></tr>';
    359360      }
     
    395396  function ShowList()
    396397  {
     398    $User = ModuleUser::Cast($this->System->GetModule('User'))->User;
    397399    $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Group`');
    398400    $DbRow = $DbResult->fetch_row();
     
    408410      array('Name' => 'LastImport', 'Title' => T('Date of last import')),
    409411      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'].'&amp;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'].'&amp;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&amp;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&amp;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'].'&amp;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'].'&amp;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&amp;id='.
     433        GetVersionWOWId($Group['LastVersion'])).'">'.GetVersionWOW($Group['LastVersion']).'</a></td>';
     434      if ($User->Licence(LICENCE_ADMIN))
     435        $Output .= '<td><a href="?action=groupdelete&amp;id='.$Group['Id'].'">'.T('Remove').'</a></td>';
     436      $Output .= '</tr>';
    435437    }
    436438    $Output .= '</table>'.
    437439      '<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>';
    439441    return $Output;
    440442  }
     
    442444  function ShowGroupAdd()
    443445  {
    444     if ($this->System->User->Licence(LICENCE_ADMIN))
     446    $User = ModuleUser::Cast($this->System->GetModule('User'))->User;
     447    if ($User->Licence(LICENCE_ADMIN))
    445448    {
    446449      $Output = '<h3>Vložení nové překladové skupiny</h3>'.
     
    457460  function ShowGroupAddFinish()
    458461  {
    459     if ($this->System->User->Licence(LICENCE_ADMIN))
     462    $User = ModuleUser::Cast($this->System->GetModule('User'))->User;
     463    if ($User->Licence(LICENCE_ADMIN))
    460464    {
    461465      $TableName = 'Text'.$_POST['TablePrefix'];
     
    505509  function ShowGroupDelete()
    506510  {
    507     if ($this->System->User->Licence(LICENCE_ADMIN))
     511    $User = ModuleUser::Cast($this->System->GetModule('User'))->User;
     512    if ($User->Licence(LICENCE_ADMIN))
    508513    {
    509514      $DbResult = $this->System->Database->select('Group', '*', '`Id`='.$_GET['id']);
Note: See TracChangeset for help on using the changeset viewer.