Ignore:
Timestamp:
Apr 7, 2020, 10:15:48 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Improved code formatting.
File:
1 edited

Legend:

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

    r859 r880  
    4747    );
    4848    foreach ($StateTypes as $index => $StateType) {
    49       if($Filter['State'] == $index) $Selected = ' selected="selected"';
     49      if ($Filter['State'] == $index) $Selected = ' selected="selected"';
    5050      else $Selected = '';
    5151      $Output .= '<option value="'.$index.'"'.$Selected.'>'.$StateType.'</option>';
     
    5454
    5555    // Translation group
    56     if($GroupId == 0)
     56    if ($GroupId == 0)
    5757    {
    5858      $Filter['Group'] = GetParameter('group', 0, true, true);
    59       if($Filter['Group'] != 0)
     59      if ($Filter['Group'] != 0)
    6060      {
    61         if(isset($TranslationTree[$Filter['Group']]) == false)
     61        if (isset($TranslationTree[$Filter['Group']]) == false)
    6262          ErrorMessage('Překladová skupina dle zadaného Id neexistuje.');
    6363        $Table = $TranslationTree[$Filter['Group']]['TablePrefix'];
     
    7070
    7171    $Output .= '<td><select name="group" style="width: 80px">';
    72     if($Filter['Group'] == 0) $Selected = ' selected="selected"';
     72    if ($Filter['Group'] == 0) $Selected = ' selected="selected"';
    7373    else $Selected = '';
    7474    $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>';
    7575    $DbResult = $this->Database->query('SELECT `Id`,`Name` FROM `Group`');
    76     while($Group = $DbResult->fetch_assoc())
     76    while ($Group = $DbResult->fetch_assoc())
    7777      $Groups[T($Group['Name'])] = $Group;
    7878    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"';
    8282      else $Selected = '';
    8383      $Output .= '<option value="'.$Group['Id'].'"'.$Selected.'>'.T($Group['Name']).'</option>';
     
    8989    else
    9090      $Filter['Version'] = GetParameter('version', 0, true, true);
    91     if($Filter['Version'] != 0)
     91    if ($Filter['Version'] != 0)
    9292    {
    9393      $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)
    9595      {
    9696        $DbRow = $DbResult->fetch_assoc();
     
    9999    }
    100100    $Output .= '<td><select name="version">';
    101     if($Filter['Version'] == 0) $Selected = ' selected="selected"';
     101    if ($Filter['Version'] == 0) $Selected = ' selected="selected"';
    102102    else $Selected = '';
    103103    $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>';
    104104    $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"';
    108108      else $Selected = '';
    109109      $Output .= '<option value="'.$Version['Id'].'"'.$Selected.'>'.$Version['Version'].'</option>';
    110110    }
    111111    $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'].')';
    113113    else $VersionFilter = '';
    114114    //else $Filter['SQL'] .= ' AND '; DISTINCT(Entry)
     
    117117    $Filter['Language'] = GetParameter('lang', 0, true, true);
    118118    $Output .= '<td><select name="lang">';
    119     if($Filter['Language'] == 0) $Selected = ' selected="selected"';
     119    if ($Filter['Language'] == 0) $Selected = ' selected="selected"';
    120120    else $Selected = '';
    121121    $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>';
    122122    $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"';
    126126      else $Selected = '';
    127127      $Output .= '<option value="'.$Language['Id'].'"'.$Selected.'>'.T($Language['Name']).'</option>';
     
    130130    $LanguageFilter = '';
    131131    $LanguageFilterSub = '';
    132     if($Filter['Language'] != 0) {
     132    if ($Filter['Language'] != 0) {
    133133      $LanguageFilter = ' AND (`T`.`Language` = '.$Filter['Language'].')';
    134134      $LanguageFilterSub = ' AND (`Sub`.`Language` = '.$Filter['Language'].')';
     
    138138    $Filter['User'] = GetParameter('user', 0, true, true);
    139139    $Output .= '<td><select name="user" style="width: 80px">';
    140     if($Filter['User'] == 0) $Selected = ' selected="selected"';
     140    if ($Filter['User'] == 0) $Selected = ' selected="selected"';
    141141    else $Selected = '';
    142142    $Output .= '<option value="0"'.$Selected.'>'.T('All').'</option>';
    143143    $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"';
    147147      else $Selected = '';
    148148      $Output .= '<option value="'.$User['Id'].'"'.$Selected.'>'.$User['Name'].'</option>';
    149149    }
    150150    $Output .= '</select></td>';
    151     if($Filter['User'] != 0) $UserFilter = ' AND (`User` = '.$Filter['User'].')';
     151    if ($Filter['User'] != 0) $UserFilter = ' AND (`User` = '.$Filter['User'].')';
    152152    else $UserFilter = '';
    153153
     
    155155    $Filter['Text'] = GetParameter('text', '', false, true);
    156156    $Output .= '<td><input name="text" type="text" style="width: 60px;" value="'.htmlentities($Filter['Text']).'"></td>';
    157     if($Filter['Text'] != '')
     157    if ($Filter['Text'] != '')
    158158    {
    159159      $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)
    163163        $Items[] = '(`T`.`'.$GroupItem['Column'].'` LIKE "%'.$Filter['Text'].'%")';
    164164      $Filter['SQL'] .= ' AND ('.implode(' OR ', $Items).')';
     
    168168    $Filter['Entry'] = GetParameter('entry', '', false, true);
    169169    $Output .= '<td><input name="entry" type="text" style="width: 60px;" value="'.htmlentities($Filter['Entry']).'"></td>';
    170     if($Filter['Entry'] != '')
     170    if ($Filter['Entry'] != '')
    171171    {
    172172      $Filter['SQL'] .= ' AND (`Entry` = "'.$Filter['Entry'].'")';
    173173    }
    174174
    175     if($Filter['Group'] != 0)
     175    if ($Filter['Group'] != 0)
    176176    {
    177177        $WithoutAlter =       ' AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE '.
     
    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 ) ';
    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) {
    183183            $ItemsVar[] =    'LENGTH(`T`.`'.$GroupItem['Column'].'`) - LENGTH( REPLACE( `T`.`'.$GroupItem['Column'].'`,  \'$\',  \'\' ) ) '.
    184184                           ' < ('.
     
    188188                              ')';
    189189          }
    190       if($Filter['State'] == CompletionState::All) {
     190      if ($Filter['State'] == CompletionState::All) {
    191191        $Filter['SQL'] .= $UserFilter.$VersionFilter;
    192192      } else
    193       if($Filter['State'] == CompletionState::NotTranslated) {
     193      if ($Filter['State'] == CompletionState::NotTranslated) {
    194194        $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$this->System->Config['OriginalLanguage'].') '.
    195195          'AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE '.
     
    198198          '(`Sub`.`VersionStart` = `T`.`VersionStart`) AND (`Sub`.`VersionEnd` = `T`.`VersionEnd`))';
    199199      } else
    200       if($Filter['State'] == CompletionState::Translated) {
     200      if ($Filter['State'] == CompletionState::Translated) {
    201201        $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Complete` = 1)';
    202202      } else
    203       if($Filter['State'] == CompletionState::NotFinished) {
     203      if ($Filter['State'] == CompletionState::NotFinished) {
    204204        $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Language` != '.$this->System->Config['OriginalLanguage'].
    205205      ') AND (`T`.`Complete` = 0)';
    206206      } else
    207       if($Filter['State'] == CompletionState::Original) {
     207      if ($Filter['State'] == CompletionState::Original) {
    208208        $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$this->System->Config['OriginalLanguage'].')';
    209209      } else
    210       if($Filter['State'] == CompletionState::NotFinishedNotTranslated) {
     210      if ($Filter['State'] == CompletionState::NotFinishedNotTranslated) {
    211211        $Filter['SQL'] .= $UserFilter.$VersionFilter.$WithoutAlter.
    212212      ' AND (`T`.`Language` != '.$this->System->Config['OriginalLanguage'].
    213213      ') AND (`T`.`Complete` = 0)';
    214214      } else
    215       if($Filter['State'] == CompletionState::Missing1) {
     215      if ($Filter['State'] == CompletionState::Missing1) {
    216216        $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '.$this->System->Config['OriginalLanguage'];
    217217        $Filter['SQL'] .= ' AND ('.implode(' OR ', $ItemsVar).') ';
    218218      } else
    219       if($Filter['State'] == CompletionState::Missing2) {
     219      if ($Filter['State'] == CompletionState::Missing2) {
    220220        $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '.$this->System->Config['OriginalLanguage'];
    221221        $Filter['SQL'] .= ' '. $WithoutAlter;
     
    226226    /*
    227227     // 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'];
    229229    else $Filter['Owner'] = 0;
    230230    $Output .= ' <td><select name="owner">';
    231     if($Filter['Owner'] == 0) $Selected = ' selected="selected"';
     231    if ($Filter['Owner'] == 0) $Selected = ' selected="selected"';
    232232    else $Selected = '';
    233233    $Output .= '<option value="0"'.$Selected.'>Všech</option>';
    234     if($Filter['Owner'] == 1) $Selected = ' selected="selected"';
     234    if ($Filter['Owner'] == 1) $Selected = ' selected="selected"';
    235235    else $Selected = '';
    236236    $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"';
    238238    else $Selected = '';
    239239    $Output .= '<option value="2"'.$Selected.'>Překladatele</option>';
    240240    $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'].')';
    242242    */
    243243
     
    246246    $Output .= '</form><br/>';
    247247    $Filter['Output'] = $Output;
    248     return($Filter);
     248    return $Filter;
    249249  }
    250250
     
    289289
    290290    $DbResult = $this->Database->query($Query.' '.$Order['SQL'].' '.$PageList['SQLLimit']);
    291     while($Line = $DbResult->fetch_assoc())
     291    while ($Line = $DbResult->fetch_assoc())
    292292    {
    293293      $Output .= '<tr><td><a href="'.$this->System->Link('/form.php?group='.$Filter['Group'].'&amp;ID='.$Line['ID']).'">'.$Line['ID'].'</a></td>'.
     
    305305    $Output .= '</table>'.
    306306        $PageList['Output'];
    307     return($Output);
     307    return $Output;
    308308  }
    309309
     
    316316    $Output .= '<table class="BaseTable"><tr><th>'.T('Group').'</th><th>'.T('Count').'</th></tr>';
    317317    $Total = 0;
    318     foreach($TranslationTree as $Group)
    319       if($Group['TablePrefix'] != '')
     318    foreach ($TranslationTree as $Group)
     319      if ($Group['TablePrefix'] != '')
    320320      {
    321321        $Filter = $this->ShowFilter($Group['Id']);
     
    328328      $Output .= '<tr><td><strong>'.T('Total').'</strong></td><td><strong>'.$Total.'</strong></td></tr>'.
    329329          '</table>';
    330       return($Output);
     330      return $Output;
    331331  }
    332332
     
    336336
    337337    $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);
    339339    else {
    340340      $Table = $TranslationTree[$GroupId]['TablePrefix'];
     
    351351          '<td>'.T('Texts marked as unfinished').'</td></tr>';
    352352
    353       if($this->System->User->Licence(LICENCE_USER))
     353      if ($this->System->User->Licence(LICENCE_USER))
    354354      {
    355355        $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>
     
    373373      $Output .= '</table>';
    374374    }
    375     return($Output);
     375    return $Output;
    376376  }
    377377
     
    380380    $this->Title = T('Translation groups');
    381381    $Action = GetParameter('action', '');
    382     if($Action == 'filter') $Output = $this->ShowMenu();
     382    if ($Action == 'filter') $Output = $this->ShowMenu();
    383383    else
    384384    {
    385385      $Filter = $this->ShowFilter();
    386       if($Filter['Group'] > 0) $Output = $this->ShowTranslationList($Filter);
     386      if ($Filter['Group'] > 0) $Output = $this->ShowTranslationList($Filter);
    387387        else $Output = $this->ShowGroupList($Filter);
    388388    }
    389     return($Output);
     389    return $Output;
    390390  }
    391391}
     
    409409      array('Name' => 'LastVersion', 'Title' => T('Version of last import')),
    410410   );
    411    if($this->System->User->Licence(LICENCE_ADMIN))
     411   if ($this->System->User->Licence(LICENCE_ADMIN))
    412412   $TableColumns[] = array('Name' => '', 'Title' => T('Actions'));
    413413
     
    416416
    417417   $DbResult = $this->Database->query('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']);
    418    while($Group = $DbResult->fetch_assoc())
     418   while ($Group = $DbResult->fetch_assoc())
    419419   {
    420420     $Output .= '<tr><td><a href="'.$this->System->Link('/TranslationList.php?group='.$Group['Id'].'&amp;action=filter').'">'.T($Group['Name']).'</a></td>'.
    421421       '<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 ';
    425425     $Output .= '</td>';
    426      if($this->System->User->Licence(LICENCE_ADMIN))
     426     if ($this->System->User->Licence(LICENCE_ADMIN))
    427427       $Output .= '<td><a title="Změny po posledním importu u vybrané překladové skupiny" href="'.$this->System->Link('/log/?group='.
    428428     $Group['Id'].'&amp;type=11').'">'.HumanDate($Group['LastImport']).'</a></td>';
     
    430430     $Output .= '<td><a href="'.$this->System->Link('/client-version/?action=item&amp;id='.
    431431       GetVersionWOWId($Group['LastVersion'])).'">'.GetVersionWOW($Group['LastVersion']).'</a></td>';
    432      if($this->System->User->Licence(LICENCE_ADMIN))
     432     if ($this->System->User->Licence(LICENCE_ADMIN))
    433433       $Output .= '<td><a href="?action=groupdelete&amp;id='.$Group['Id'].'">'.T('Remove').'</a></td>';
    434434     $Output .= '</tr>';
     
    436436    $Output .= '</table>'.
    437437      '<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;
    440440  }
    441441
    442442  function ShowGroupAdd()
    443443  {
    444     if($this->System->User->Licence(LICENCE_ADMIN))
     444    if ($this->System->User->Licence(LICENCE_ADMIN))
    445445    {
    446446      $Output = '<h3>Vložení nové překladové skupiny</h3>'.
     
    452452          '</table></form>';
    453453    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    454     return($Output);
     454    return $Output;
    455455  }
    456456
    457457  function ShowGroupAddFinish()
    458458  {
    459     if($this->System->User->Licence(LICENCE_ADMIN))
     459    if ($this->System->User->Licence(LICENCE_ADMIN))
    460460    {
    461461      $TableName = 'Text'.$_POST['TablePrefix'];
    462462      $DbResult = $this->System->Database->select('Group', 'Id', 'TablePrefix="'.$TableName.'"');
    463       if($DbResult->num_rows == 0)
     463      if ($DbResult->num_rows == 0)
    464464      {
    465465
     
    500500      $Output .= $this->ShowList();
    501501    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    502     return($Output);
     502    return $Output;
    503503  }
    504504
    505505  function ShowGroupDelete()
    506506  {
    507     if($this->System->User->Licence(LICENCE_ADMIN))
     507    if ($this->System->User->Licence(LICENCE_ADMIN))
    508508    {
    509509      $DbResult = $this->System->Database->select('Group', '*', '`Id`='.$_GET['id']);
    510       if($DbResult->num_rows == 1)
     510      if ($DbResult->num_rows == 1)
    511511      {
    512512        $Group = $DbResult->fetch_assoc();
     
    518518    } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
    519519    $Output .= $this->ShowList();
    520     return($Output);
     520    return $Output;
    521521  }
    522522
     
    525525    $this->Title = T('Translation groups');
    526526    $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();
    530530    else $Output = $this->ShowList();
    531     return($Output);
     531    return $Output;
    532532  }
    533533}
Note: See TracChangeset for help on using the changeset viewer.