Ignore:
Timestamp:
Feb 22, 2015, 11:20:50 PM (9 years ago)
Author:
chronos
Message:
  • Modified: Tabs converted to spaces.
  • Modified: Remove spaces from end of lines.
  • Added: Code format script.
File:
1 edited

Legend:

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

    r806 r816  
    33class PageLoadNames extends Page
    44{
    5   function ReplaceTranslated($orig,$tran,$Text,$ID,$Group) 
     5  function ReplaceTranslated($orig,$tran,$Text,$ID,$Group)
    66  {
    77    $tran_replace = str_replace(' ',' ',htmlspecialchars($tran));
     
    99
    1010    //  if (strlen($orig) < strlen($Text)-1) {
    11     if ($Group <> '') 
     11    if ($Group <> '')
    1212    {
    1313      $Text = str_replace(' '.$orig,' <span Title="Přelož jako:&nbsp;'.$tran_replace.
    1414        '" class="edit"><a class="edit" target="_NEW2" href="'.$this->System->Link('/form.php?group='.$Group.'&amp;ID='.$ID).'">'.$orig_replace.'</a></span>',$Text);
    15     } else { 
     15    } else {
    1616      $Text = str_replace(' '.$orig,' <span Title="Přelož jako:&nbsp;'.$tran_replace.
    1717        '" class="edit"><a class="edit" target="_NEW2" href="'.$this->System->Link('/dictionary/?search='.$tran).'">'.$orig_replace.'</a></span>',$Text);
    1818    }
    19         //      }
     19  //  }
    2020    return ($Text);
    2121  }
    22   function ReplaceNotTranslated($orig,$tran,$Text,$ID,$Group) 
     22  function ReplaceNotTranslated($orig,$tran,$Text,$ID,$Group)
    2323  {
    2424    $orig_replace = str_replace(' ','&nbsp;',htmlspecialchars($orig));
    25        
     25
    2626    $Text = str_replace(' '.$orig,' <span title="Kliknutím přeložíš" class="needtran"><a class="needtran" target="_NEW2" href="'.
    2727      $this->System->Link('/form.php?group='.$Group.'&amp;ID='.$ID).'">'.$orig_replace.'</a></span>',$Text);
    2828    return ($Text);
    2929  }
    30  
    31         function ColorNames($Text, $names)
    32         {
     30
     31  function ColorNames($Text, $names)
     32  {
    3333    $Text = ' '.$Text;
    3434    $Text = str_replace('$B$B','$B$B ',$Text);
    35    
    36           $Text = str_replace('$B','<span Title="Znamená odřádkování, překladu zachovej na stejné pozici." class="edit">$B</span>',$Text);
    37           $Text = str_replace('$N','<span Title="Znamená jméno hráče, překladu zachovej na stejné pozici." class="edit">$N</span>',$Text);
    38           $Text = str_replace('$R','<span Title="Znamená rasu hráče, překladu zachovej na stejné pozici." class="edit">$R</span>',$Text);
    39           $Text = str_replace('$C','<span Title="Znamená povolání hráče, překladu zachovej na stejné pozici." class="edit">$C</span>',$Text);
    40           $Text = str_replace('$G','<span Title="Vybere oslovení podle pohlaví hráče, překladu zachovej na stejné pozici." class="edit">$G</span>',$Text);
    41           $Text = str_replace('$b','<span Title="Znamená odřádkování, překladu zachovej na stejné pozici." class="edit">$B</span>',$Text);
    42           $Text = str_replace('$n','<span Title="Znamená jméno hráče, překladu zachovej na stejné pozici." class="edit">$N</span>',$Text);
    43           $Text = str_replace('$c','<span Title="Znamená povolání hráče, překladu zachovej na stejné pozici." class="edit">$c</span>',$Text);
    44           $Text = str_replace('$r','<span Title="Znamená rasu hráče, překladu zachovej na stejné pozici." class="edit">$R</span>',$Text);
    45           $Text = str_replace('$g','<span Title="Vybere oslovení podle pohlaví hráče, překladu zachovej na stejné pozici." class="edit">$G</span>',$Text);
    46                 foreach($names as $Line) {
    47                  if (($_GET['ID'] <> $Line[0]) or ($Line[1] <> $_GET['GroupId']))       
     35
     36    $Text = str_replace('$B','<span Title="Znamená odřádkování, překladu zachovej na stejné pozici." class="edit">$B</span>',$Text);
     37    $Text = str_replace('$N','<span Title="Znamená jméno hráče, překladu zachovej na stejné pozici." class="edit">$N</span>',$Text);
     38    $Text = str_replace('$R','<span Title="Znamená rasu hráče, překladu zachovej na stejné pozici." class="edit">$R</span>',$Text);
     39    $Text = str_replace('$C','<span Title="Znamená povolání hráče, překladu zachovej na stejné pozici." class="edit">$C</span>',$Text);
     40    $Text = str_replace('$G','<span Title="Vybere oslovení podle pohlaví hráče, překladu zachovej na stejné pozici." class="edit">$G</span>',$Text);
     41    $Text = str_replace('$b','<span Title="Znamená odřádkování, překladu zachovej na stejné pozici." class="edit">$B</span>',$Text);
     42    $Text = str_replace('$n','<span Title="Znamená jméno hráče, překladu zachovej na stejné pozici." class="edit">$N</span>',$Text);
     43    $Text = str_replace('$c','<span Title="Znamená povolání hráče, překladu zachovej na stejné pozici." class="edit">$c</span>',$Text);
     44    $Text = str_replace('$r','<span Title="Znamená rasu hráče, překladu zachovej na stejné pozici." class="edit">$R</span>',$Text);
     45    $Text = str_replace('$g','<span Title="Vybere oslovení podle pohlaví hráče, překladu zachovej na stejné pozici." class="edit">$G</span>',$Text);
     46    foreach($names as $Line) {
     47     if (($_GET['ID'] <> $Line[0]) or ($Line[1] <> $_GET['GroupId']))
    4848      if ($Line[3] <> '')  {
    4949        $Text = $this->ReplaceTranslated($Line[2],$Line[3],$Text,$Line[0],$Line[1]);
    50        
    51                         } else {
     50
     51      } else {
    5252        $Text = $this->ReplaceNotTranslated($Line[2],$Line[3],$Text,$Line[0],$Line[1]);
    53                         }
    54                 }
    55                 return $Text;
    56         }               
     53      }
     54    }
     55    return $Text;
     56  }
    5757
    58   function LoadNames() 
     58  function LoadNames()
    5959  {
    6060    global $TranslationTree;
    61                
     61
    6262    $Output = '';
    6363    if(array_key_exists('GroupId', $_GET)) $GroupId = $_GET['GroupId'];
     
    7171    //$Text = $LineAJ[$TranslationTree[$GroupId]['Items'][$_GET['Item']]];
    7272          $Text = $LineAJ[$Column];
    73                 $names = array();
    74                 if ($this->System->User->Licence(LICENCE_USER))
    75                                         if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11))
     73          $names = array();
     74          if ($this->System->User->Licence(LICENCE_USER))
     75          if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11))
    7676          {
    77                                                 //<span class="edit">barvou.</span>
    78                                                 $names = GetTranslatNames($Text, 0, GetTranslatNamesArray());
    79                                         } else {
    80                                         if(($GroupId == 13)) {
    81                                                 $names = GetTranslatNames($Text, 0, array('Dictionary' => 'Text', 'TextGlobalString' => 'Text', 'TextArea' => 'Name', 'TextItemSubClass' => 'Name', 'TextCharacterRace' => 'Name1',),false);
     77            //<span class="edit">barvou.</span>
     78            $names = GetTranslatNames($Text, 0, GetTranslatNamesArray());
     79          } else {
     80            if(($GroupId == 13)) {
     81              $names = GetTranslatNames($Text, 0, array('Dictionary' => 'Text', 'TextGlobalString' => 'Text', 'TextArea' => 'Name', 'TextItemSubClass' => 'Name', 'TextCharacterRace' => 'Name1',),false);
    8282            } else {
    83                                                 $names = GetTranslatNames($Text, 0, GetTranslatNamesArray());
    84                                         }
    85                                         }
    86                                          //$LineAJ[$Column]
    87                                         return ($this->ColorNames(htmlspecialchars($Text),$names));
     83              $names = GetTranslatNames($Text, 0, GetTranslatNamesArray());
     84            }
     85          }
     86                                   //$LineAJ[$Column]
     87          return ($this->ColorNames(htmlspecialchars($Text),$names));
    8888    }
    8989
    9090  function Show()
    9191  {
    92         $this->RawPage = true;
     92    $this->RawPage = true;
    9393    return(str_replace("\n", '<br/>', $this->LoadNames()));
    9494  }
Note: See TracChangeset for help on using the changeset viewer.