Changeset 772 for trunk/Modules


Ignore:
Timestamp:
Jan 31, 2014, 8:55:12 AM (11 years ago)
Author:
chronos
Message:
  • Modified: Enumeration numbers changed to named constants in translation list filter.
File:
1 edited

Legend:

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

    r759 r772  
    11<?php
     2
     3class CompletionState
     4{
     5        const All = 0;
     6        const NotTranslated = 1;
     7        const Translated = 2;
     8        const NotFinished = 3;
     9        const Original = 4;
     10        const NotFinishedNotTranslated = 5;
     11        const Missing1 = 6;
     12        const Missing2 = 7;
     13}
     14
    215
    316class PageTranslationList extends Page
     
    2336                $Filter['State'] = GetParameter('state', 0, true, true);
    2437                $Output .= '<td><select name="state">';
    25                 $StateTypes = array('Všechny','Nepřeložené','Přeložené','Rozpracované','Anglické','Rozpracované-Nepřeložené','Chybějící $ ($N,$s..)','Chybějící $-Neopravený');
     38                $StateTypes = array(
     39                  CompletionState::All => 'Všechny',
     40      CompletionState::NotTranslated => 'Nepřeložené',
     41      CompletionState::Translated => 'Přeložené',
     42      CompletionState::NotFinished => 'Rozpracované',
     43      CompletionState::Original => 'Anglické',
     44      CompletionState::NotFinishedNotTranslated => 'Rozpracované-Nepřeložené',
     45      CompletionState::Missing1 => 'Chybějící $ ($N,$s..)',
     46      CompletionState::Missing2 => 'Chybějící $-Neopravený'
     47    );
    2648                foreach ($StateTypes as $index=>$StateType) {
    2749                if($Filter['State'] == $index) $Selected = ' selected="selected"';
     
    160182                              ')';
    161183                      }
    162                         if($Filter['State'] == 0) $Filter['SQL'] .= $UserFilter.$VersionFilter.'';
    163                         else if($Filter['State'] == 1) $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$this->System->Config['OriginalLanguage'].') '.
     184                        if($Filter['State'] == CompletionState::All) $Filter['SQL'] .= $UserFilter.$VersionFilter.'';
     185                        else if($Filter['State'] == CompletionState::NotTranslated) $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$this->System->Config['OriginalLanguage'].') '.
    164186                                        'AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE '.
    165187                                        '(`Sub`.`Language` <> '.$this->System->Config['OriginalLanguage'].') '.$LanguageFilterSub.$UserFilter.
    166188                                        ' AND (`Sub`.`Entry` = `T`.`Entry`) AND (`Sub`.`Complete` = 1) AND '.
    167189                                        '(`Sub`.`VersionStart` = `T`.`VersionStart`) AND (`Sub`.`VersionEnd` = `T`.`VersionEnd`))';
    168                         else if($Filter['State'] == 2) $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Complete` = 1)';
    169                         else if($Filter['State'] == 3) $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Language` != '.$this->System->Config['OriginalLanguage'].
     190                        else if($Filter['State'] == CompletionState::Translated) $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Complete` = 1)';
     191                        else if($Filter['State'] == CompletionState::NotFinished) $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Language` != '.$this->System->Config['OriginalLanguage'].
    170192                        ') AND (`T`.`Complete` = 0)';
    171                         else if($Filter['State'] == 4) $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$this->System->Config['OriginalLanguage'].')';
    172                         else if($Filter['State'] == 5) $Filter['SQL'] .= $UserFilter.$VersionFilter.$WithoutAlter.
     193                        else if($Filter['State'] == CompletionState::Original) $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$this->System->Config['OriginalLanguage'].')';
     194                        else if($Filter['State'] == CompletionState::NotFinishedNotTranslated) $Filter['SQL'] .= $UserFilter.$VersionFilter.$WithoutAlter.
    173195      ' AND (`T`.`Language` != '.$this->System->Config['OriginalLanguage'].
    174196                        ') AND (`T`.`Complete` = 0)'.
    175197          '';
    176                         else if($Filter['State'] == 6) {                       
     198                        else if($Filter['State'] == CompletionState::Missing1) {                       
    177199        $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '.$this->System->Config['OriginalLanguage'];
    178200        $Filter['SQL'] .= ' AND ('.implode(' OR ', $ItemsVar).') ';             
    179201                  }
    180                         else if($Filter['State'] == 7) {                       
     202                        else if($Filter['State'] == CompletionState::Missing2) {                       
    181203        $Filter['SQL'] .= $UserFilter.$VersionFilter.' AND (`T`.`Complete` = 1) AND `T`.`Language` != '.$this->System->Config['OriginalLanguage'];
    182204        $Filter['SQL'] .= ' '. $WithoutAlter;
Note: See TracChangeset for help on using the changeset viewer.