Changeset 504 for trunk/comparison.php


Ignore:
Timestamp:
Feb 14, 2013, 7:51:59 PM (11 years ago)
Author:
chronos
Message:
  • Upraveno: Stránky jsou nyní generovány do výstupního řetězce, který je na konci skriptu funkci ShowPage jako parametr a ta zajistí zobrazení hlavičky i patičky. Nově tedy není výstup zobrazován přes echo na mnoha místech ale jen přes jedno místo. To umožnilo kontrolu či formátování výstupního HTML kódu před zasláním uživateli na výstup. Dále toto umožňuje vyhodnocení zobrazení hlavičky až po dokončení generování obsahu stránky. To se hodí např. při přihlašování a odhlašování, kdy změna přihlášeného uživatele se v hlavičce projeví ihned už při generování výsledné stránky.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        22aowow
        33nbproject
         4.settings
         5.project
         6.buildpath
  • trunk/comparison.php

    r466 r504  
    22
    33include('includes/global.php');   
    4 ShowPage();
    54
    6 echo('Text je porovnáván vždy ku předešlému (vlevo). Změny jsou zvýrazněny <span class="edit">barvou.</span><br /><br />');
     5$Output = 'Text je porovnáván vždy ku předešlému (vlevo). Změny jsou zvýrazněny <span class="edit">barvou.</span><br /><br />';
    76
    87function CompareString($String1, $String2)
     
    6564  $Line = $BuffLine;
    6665  $i = $i - 1;
    67   echo('Počet porovnávaných textů: <strong>'.$i.'</strong><br /> ');
     66  $Output .= 'Počet porovnávaných textů: <strong>'.$i.'</strong><br /> ';
    6867
    69   echo('<strong>Číslo textu: <a href="http://www.wowhead.com/?quest='.$Textentry.'">'.$Textentry.'</a></strong>'.
    70     '<table class="BaseTable">');
    71   echo('<tr><th>Přeložil</th>');
     68  $Output .= '<strong>Číslo textu: <a href="http://www.wowhead.com/?quest='.$Textentry.'">'.$Textentry.'</a></strong>'.
     69    '<table class="BaseTable">'.
     70    '<tr><th>Přeložil</th>';
    7271  foreach($Line as $Index => $LineItem)
    7372  {
    7473    $DbResult = $System->Database->query('SELECT * FROM `User` WHERE `ID` = '.$LineItem['User']);
    7574    $LineUser = $DbResult->fetch_array();
    76     echo('<th>'.$LineUser['Name'].'</th>');
     75    $Output .= '<th>'.$LineUser['Name'].'</th>';
    7776  }
    78   echo('</tr>');
    79   echo('<tr>');
    80   echo('<th>ID textu</th>');
     77  $Output .= '</tr>'.
     78    '<tr>'.
     79    '<th>ID textu</th>';
    8180  foreach($Line as $Index => $LineItem)
    8281  {
    83     echo('<td><a href="form.php?group='.$GroupId.'&amp;ID='.$LineItem['ID'].'">'.$LineItem['ID'].'</a></td>');
     82    $Output .= '<td><a href="form.php?group='.$GroupId.'&amp;ID='.$LineItem['ID'].'">'.$LineItem['ID'].'</a></td>';
    8483  }
    85   echo('</tr>');
    86   echo('<tr><th>Převzato</th>');
     84  $Output .= '</tr>'.
     85    '<tr><th>Převzato</th>';
    8786  foreach($Line as $Index => $LineItem)
    8887  {
    89     echo('<td><a href="form.php?group='.$GroupId.'&amp;ID='.$LineItem['Take'].'">'.$LineItem['Take'].'</a></td>');
     88    $Output .= '<td><a href="form.php?group='.$GroupId.'&amp;ID='.$LineItem['Take'].'">'.$LineItem['Take'].'</a></td>';
    9089  }
    91   echo('</tr>');
    92   echo('<tr><th>Jazyk</th>');
     90  $Output .= '</tr>'.
     91    '<tr><th>Jazyk</th>';
    9392  foreach($Line as $Index => $LineItem)
    9493  {
    95     echo('<td>');
    96     WriteLanguagesWithoutSel($LineItem['Language']);
    97     echo('</td>');
     94    $Output .= '<td>'.
     95    WriteLanguagesWithoutSel($LineItem['Language']).
     96    '</td>';
    9897  }
    99   echo('</tr>');
    100   echo('<tr><th>Verze</th>');
     98  $Output .= '</tr>'.
     99    '<tr><th>Verze</th>';
    101100  foreach($Line as $Index => $LineItem)
    102101  {
    103     echo('<td>');
    104     echo (GetVersionWOW($LineItem['VersionStart']).' - '.GetVersionWOW($LineItem['VersionEnd']));
    105     echo('</td>');
     102    $Output .= '<td>';
     103    $Output .= GetVersionWOW($LineItem['VersionStart']).' - '.GetVersionWOW($LineItem['VersionEnd']);
     104    $Output .= '</td>';
    106105  }
    107   echo('</tr>');
     106  $Output .= '</tr>';
    108107  foreach($TranslationTree[$GroupId]['Items'] as $Index => $TextItem)
    109108  {         
    110109    if($Line[0][$TextItem['Column']] <> '')
    111110    {
    112       echo('<tr><th>'.$TextItem['Name'].'</th>');
     111      $Output .= '<tr><th>'.$TextItem['Name'].'</th>';
    113112      for($i = 0; $i < count($Line); $i++)
    114113      {
    115114        if($i > 0)
    116115        {
    117           echo('<td>');
    118           echo(str_replace("\n", '<br/>', CompareString($Line[$i][$TextItem['Column']],$Line[$i - 1][$TextItem['Column']])));
    119           echo('</td>');
    120         } else echo('<td>'.$Line[$i][$TextItem['Column']].'</td>');
     116          $Output .= '<td>';
     117          $Output .= str_replace("\n", '<br/>', CompareString($Line[$i][$TextItem['Column']],$Line[$i - 1][$TextItem['Column']]));
     118          $Output .= '</td>';
     119        } else $Output .= '<td>'.$Line[$i][$TextItem['Column']].'</td>';
    121120      }
    122       echo ('</tr>');
     121      $Output .= '</tr>';
    123122    }
    124123  }
    125   echo('</table>')
    126 } else ShowMessage('Nebylo zadáno ID.', MESSAGE_CRITICAL);
     124  $Output .= '</table>'
     125} else $Output .= ShowMessage('Nebylo zadáno ID.', MESSAGE_CRITICAL);
    127126
    128 ShowFooter();
     127ShowPage($Output);
    129128
    130129?>   
Note: See TracChangeset for help on using the changeset viewer.