Changeset 40 for branches/2/frontend.php
- Timestamp:
- Jan 24, 2009, 5:55:02 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2/frontend.php
r9 r40 46 46 } 47 47 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&GroupId='.$TranslationGroupId.'&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&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&GroupId='.$TranslationGroupId.'&Index='.$_GET['Index'].'">Překládat</a>'; 97 else if(count($TextList) == 1) $Output = $this->ShowText($EnglishText['Id']); 60 98 else 61 99 { 62 // Show only one63 $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 {80 100 // Show multiple possibilites 81 101 $Output = '<strong>Více překladů jednoho textu:</strong><table>'. … … 176 196 } 177 197 178 function UserTextList( $GroupId)198 function UserTextList() 179 199 { 180 200 $ItemPerPage = 30; 181 201 if(array_key_exists('Page', $_GET)) $Page = $_GET['Page']; else $Page = 0; 182 202 $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('.'); 185 206 if(strlen($Translation['Text']) > 30) $Translation['Text'] = substr($Translation['Text'], 0, 30).'...'; 186 207 $Output .= $Translation['Index'].'. <a href="?Action=TranslationGroupEdit&GroupId='.$Translation['Id'].'">'.$Translation['Text'].'</a><br />'; 187 208 } 188 $Output .= $this->System->PagesList('?Action=TextGroupList&GroupId='.$GroupId.'&Page=', $Page, $this->System->Modules['Translation']->GetTextGroupListCount( $GroupId, 1, 1), $ItemPerPage);209 $Output .= $this->System->PagesList('?Action=TextGroupList&GroupId='.$GroupId.'&Page=', $Page, $this->System->Modules['Translation']->GetTextGroupListCount(0, $this->System->Modules['User']->User['Id'], 1), $ItemPerPage); 189 210 return($Output); 190 211 } … … 215 236 break; 216 237 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']); 218 248 break; 219 249 case 'TextGroupList':
Note:
See TracChangeset
for help on using the changeset viewer.