Changeset 393 for trunk/form.php


Ignore:
Timestamp:
Mar 17, 2010, 1:21:49 PM (14 years ago)
Author:
maron
Message:

Zvýrazňování názvů jmen a slov ze slovníčku u překladů

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/form.php

    r376 r393  
    22
    33include('includes/global.php');   
     4
     5function ColorNames($Text,$names) {
     6       
     7         // $buff[] = array($Line['ID'],GetIDbyName($Table),$Line[$Column],$Line['Tran']);
     8  foreach($names as $Line) {
     9         if ($Line[3] <> '') {
     10           $Text = str_replace($Line[2],'<span Title="Byl nalezen překlad: '.$Line[3].'" class="edit">'.$Line[2].'</span>',$Text);
     11           $Text = str_replace(strtolower($Line[2]),'<span Title="Byl nalezen překlad: '.$Line[3].'" class="edit">'.$Line[2].'</span>',$Text);
     12         } else {
     13       $Text = str_replace($Line[2],'<span Title="Jméno bylo nalezeno v názvech a můžete ho přeložit. Začnete kliknutím na: Vyhledat v názvech" class="edit">'.$Line[2].'</span>',$Text);
     14       $Text = str_replace(strtolower($Line[2]),'<span Title="Jméno bylo nalezeno v názvech a můžete ho přeložit. Začnete kliknutím na: Vyhledat v názvech" class="edit">'.$Line[2].'</span>',$Text);
     15     }
     16  }
     17        return $Text;
     18}
    419
    520ShowPage();
     
    110125  WriteLanguages($Language);
    111126  echo('</td></tr>');
     127
     128  //zvýrazňování jmen
     129    $Text = '';
     130    foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
     131      if($TextItem['Visible'] == 1)
     132        $Text = $Text.' '.$LineAJ[$TextItem['Column']];
     133
     134  if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) {
     135  //<span class="edit">barvou.</span>
     136    $names = GetTranslatNames($Text,0,array('Dictionary' => 'Text','TextCreature' => 'name'));
     137  } else {
     138    $names = GetTranslatNames($Text,0,array('Dictionary' => 'Text'));
     139  }
     140  //print_r($names);
     141
    112142  foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
    113143  if($TextItem['Visible'] == 1)
     
    117147      if ($TextItem['Name'] == 'Text' AND (($Table == 'global_strings') OR ($Table == 'glue_strings'))) echo('<tr><th>'.$LineAJ['ShortCut'].'</th>');
    118148        else echo('<tr><th>'.$TextItem['Name'].'</th>');
    119       echo('<td>'.str_replace("\n", '<br/>', htmlspecialchars($LineAJ[$TextItem['Column']])).'</td>
     149      echo('<td>'.str_replace("\n", '<br/>', ColorNames(htmlspecialchars($LineAJ[$TextItem['Column']]),$names)).'</td>
    120150      <td><textarea rows="8" cols="40" onkeydown="ResizeTextArea(this)" class="textedit" id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'">'.htmlspecialchars($Line[$TextItem['Column']]).'</textarea></td></tr>');
    121151    }
Note: See TracChangeset for help on using the changeset viewer.