Changeset 40 for branches/2/frontend.php


Ignore:
Timestamp:
Jan 24, 2009, 5:55:02 PM (15 years ago)
Author:
george
Message:
  • Upraveno: Změna kódování znaků souborů na UTF-8.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2/frontend.php

    r9 r40  
    4646  }
    4747
    48   function ShowText($TranslationGroupId, $Edit)
    49   {
    50     if($Edit)
    51     {
    52       // Edit new text
    53       $Output = '<strong>Překlad textů:</strong><table class="TranslationTable">';
    54       foreach($this->System->Modules['Translation']->GetTextList($TranslationGroupId) as $GroupItem)
    55       {
    56         $Output .= '<tr><th>'.$GroupItem['Name'].'</th><td>'.$GroupItem['Text'].'</td><td><div><textarea name="GroupItem'.$GroupItem['Id'].'">'.$GroupItem['Text'].'</textarea></div></td></tr>';
    57       }
    58       $Output .= '</table>';
    59     }
     48  function NewText($TranslationGroupId)
     49  {
     50    $Output = '<form action="?Action=AddText&amp;GroupId='.$TranslationGroupId.'&amp;Index='.$Index.'" method="post"><strong>Překlad textů:</strong><table class="TranslationTable">';
     51    foreach($this->System->Modules['Translation']->GetTextList($TranslationGroupId) as $GroupItem)
     52    {
     53      $Output .= '<tr><th>'.$GroupItem['Name'].'</th><td>'.$GroupItem['Text'].'</td><td><div><textarea name="GroupItem'.$GroupItem['Id'].'">'.$GroupItem['Text'].'</textarea></div></td></tr>';
     54    }
     55    $Output .= '</table><input type="submit" value="Přidat"></from>';
     56    return($Output);
     57  }
     58
     59  function EditText($TranslationGroupId)
     60  {
     61    $Output = '<form action="?Action=SaveText&amp;GroupId='.$TranslationGroupId.'" method="post"><strong>Překlad textů:</strong><table class="TranslationTable">';
     62    foreach($this->System->Modules['Translation']->GetTextList($TranslationGroupId) as $GroupItem)
     63    {
     64      $Output .= '<tr><th>'.$GroupItem['Name'].'</th><td>'.$GroupItem['Text'].'</td><td><div><textarea name="GroupItem'.$GroupItem['Id'].'">'.$GroupItem['Text'].'</textarea></div></td></tr>';
     65    }
     66    $Output .= '</table><input type="submit" value="Uložit"></from>';
     67    return($Output);
     68  }
     69
     70  function ShowText($TranslationGroupId)
     71  {
     72    $Output = '<strong>Zobrazení textu:</strong><table class="TranslationTable">';
     73    foreach($this->System->Modules['Translation']->GetTextList($TranslationGroupId) as $GroupItem)
     74    {
     75      $Output .= '<tr><th>'.$GroupItem['Name'].'</th><td>'.$GroupItem['Text'].'</td><td>'.$GroupItem['Text'].'</td></tr>';
     76    }
     77    $Output .= '</table>';
     78    $Output .= '<a href="?Action=NewText">Překládat</a>';
     79    return($Output);
     80  }
     81
     82  function AddText($TranslationGroupId, $Index)
     83  {
     84     $Values = array();
     85     foreach($this->System->Modules['Translation']->GetTextList($TranslationGroupId) as $GroupItem)
     86     {
     87       $Values[] = array($GroupItem['Id'] => $_POST['GroupItem'.$GroupItem['Id']]);
     88     }
     89     $this->System->Modules['Translation']->AddTranslation($TranslationGroupId, $Index, $Values);
     90  }
     91 
     92  function ShowMultipleText($TranslationGroupId, $Index)
     93  {
     94    $TextList = $this->System->Modules['Translation']->GetMultipleText($TranslationGroupId, $Index);
     95    $EnglishText = array_shift($TextList);
     96    if(count($TextList) == 0) $Output = 'Tento text zatím nebyl přeložen! <a href="?Action=NewText&amp;GroupId='.$TranslationGroupId.'&amp;Index='.$_GET['Index'].'">Překládat</a>';
     97    else if(count($TextList) == 1) $Output = $this->ShowText($EnglishText['Id']);
    6098    else
    6199    {
    62       // Show only one
    63       $Output = '<strong>Zobrazení textu:</strong><table class="TranslationTable">';
    64       foreach($this->System->Modules['Translation']->GetTextList($TranslationGroupId) as $GroupItem)
    65       {
    66         $Output .= '<tr><th>'.$GroupItem['Name'].'</th><td>'.$GroupItem['Text'].'</td><td>'.$GroupItem['Text'].'</td></tr>';
    67       }
    68       $Output .= '</table>';
    69     }
    70     return($Output);
    71   }
    72  
    73   function ShowMultipleText($TranslationGroupId)
    74   {
    75     $TextList = $this->System->Modules['Translation']->GetMultipleText($TranslationGroupId, $_GET['Index']);
    76     $EnglishText = array_shift($TextList);
    77     if(count($TextList) == 0) $Output = $this->ShowText($EnglishText['Id'], 1);
    78     else if(count($TextList) == 1) $Output = $this->ShowText($EnglishText['Id'], 0);
    79     else {
    80100      // Show multiple possibilites
    81101      $Output = '<strong>Více překladů jednoho textu:</strong><table>'.
     
    176196  }
    177197
    178   function UserTextList($GroupId)
     198  function UserTextList()
    179199  {
    180200    $ItemPerPage = 30;
    181201    if(array_key_exists('Page', $_GET)) $Page = $_GET['Page']; else $Page = 0;
    182202    $Output = '<strong>Seznam vašich textů:</strong><br/>';
    183     foreach($this->System->Modules['Translation']->GetTextGroupList($GroupId, $this->System->Modules['User']->User['Id'], 1, $Page, $ItemPerPage) as $Translation)
    184     {
     203    foreach($this->System->Modules['Translation']->GetTextGroupList(0, $this->System->Modules['User']->User['Id'], 1, $Page, $ItemPerPage) as $Translation)
     204    {
     205      echo('.');
    185206      if(strlen($Translation['Text']) > 30) $Translation['Text'] = substr($Translation['Text'], 0, 30).'...';
    186207      $Output .= $Translation['Index'].'. <a href="?Action=TranslationGroupEdit&amp;GroupId='.$Translation['Id'].'">'.$Translation['Text'].'</a><br />';
    187208    }
    188     $Output .= $this->System->PagesList('?Action=TextGroupList&amp;GroupId='.$GroupId.'&amp;Page=', $Page, $this->System->Modules['Translation']->GetTextGroupListCount($GroupId, 1, 1), $ItemPerPage);
     209    $Output .= $this->System->PagesList('?Action=TextGroupList&amp;GroupId='.$GroupId.'&amp;Page=', $Page, $this->System->Modules['Translation']->GetTextGroupListCount(0, $this->System->Modules['User']->User['Id'], 1), $ItemPerPage);
    189210    return($Output);
    190211  }
     
    215236        break;
    216237      case 'ShowMultipleText':
    217         $Output = $this->ShowMultipleText($_GET['GroupId']);
     238        $Output = $this->ShowMultipleText($_GET['GroupId'], $_GET['Index']);
     239        break;
     240      case 'NewText':
     241        $Output = $this->NewText($_GET['GroupId'], $_GET['Index']);
     242        break;
     243      case 'AddText':
     244        $Output = $this->AddText($_GET['GroupId'], $_GET['Index']);
     245        break;
     246      case 'SaveText':
     247        $Output = $this->SaveText($_GET['GroupId'], $_GET['Edit']);
    218248        break;
    219249      case 'TextGroupList':
Note: See TracChangeset for help on using the changeset viewer.