Changeset 8 for branches/2/frontend.php
- Timestamp:
- May 9, 2008, 10:39:00 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2/frontend.php
r7 r8 34 34 function Login() 35 35 { 36 $Output = $this->System->Modules['User']->Login($_POST['Username'], $_POST['Password']); 37 $this->System->Modules['User']->Check(); 38 return($Output); 39 } 40 41 function Logout() 42 { 43 $Output = $this->System->Modules['User']->Logout(); 44 $this->System->Modules['User']->Check(); 45 return($Output); 46 } 47 48 function ShowText($TranslationGroupId) 49 { 36 50 37 return($this->System->Modules['User']->Login($_POST['Username'], $_POST['Password'])); 38 } 39 40 function Logout() 41 { 42 43 return($this->System->Modules['User']->Logout()); 44 } 45 46 function TranslationGroupEdit($TranslationGroupId) 47 { 48 $Output = '<strong>Překlad textů:</strong><br /><table class="TranslationTable">'; 49 foreach($this->System->Modules['Translation']->GetTextList($TranslationGroupId) as $GroupItem) 50 { 51 $Output .= '<tr><th>'.$GroupItem['Name'].'</th><td>'.$GroupItem['Text'].'</td><td><div><textarea name="GroupItem'.$GroupItem['Id'].'">'.$GroupItem['Text'].'</textarea></div></td></tr>'; 52 } 53 $Output .= '</table>'; 51 $TextList = $this->System->Modules['Translation']->GetMultipleText($TranslationGroupId, $_GET['Index']); 52 if(count($TextList) == 0) 53 { 54 // Edit new text 55 $Output = '<strong>Překlad textů:</strong><table class="TranslationTable">'; 56 foreach($this->System->Modules['Translation']->GetTextList($TranslationGroupId) as $GroupItem) 57 { 58 $Output .= '<tr><th>'.$GroupItem['Name'].'</th><td>'.$GroupItem['Text'].'</td><td><div><textarea name="GroupItem'.$GroupItem['Id'].'">'.$GroupItem['Text'].'</textarea></div></td></tr>'; 59 } 60 $Output .= '</table>'; 61 } 62 else if(count($TextList) == 1) 63 { 64 // Show only one 65 $Output = '<strong>Zobrazení textu:</strong><table class="TranslationTable">'; 66 foreach($this->System->Modules['Translation']->GetTextList($TranslationGroupId) as $GroupItem) 67 { 68 $Output .= '<tr><th>'.$GroupItem['Name'].'</th><td>'.$GroupItem['Text'].'</td><td>'.$GroupItem['Text'].'</td></tr>'; 69 } 70 $Output .= '</table>'; 71 } else 72 { 73 // Show multiple possibilites 74 $Output = '<strong>Více překladů jednoho textu:</strong><table class="TranslationTable">'. 75 '<tr><th>ID</th><th>Titulek</th></tr>'; 76 foreach($TextList as $Text) 77 { 78 $Output .= '<tr><td>'.$Text['Index'].'</td><td><a href="?Action=ShowText&GroupId='.$Text['Id'].'">'.$Text['Text'].'</a></td></tr>'; 79 } 80 $Output .= '</table>'; 81 } 54 82 return($Output); 55 83 } … … 59 87 $ItemPerPage = 30; 60 88 if(array_key_exists('Page', $_GET)) $Page = $_GET['Page']; else $Page = 0; 61 $Output = '<strong>Seznam textů:</strong><br/>'; 89 $Output = '<strong>Seznam textů:</strong><table>'. 90 '<tr><th>ID</th><th>Titulek</th><th>Překladů</th></tr>'; 62 91 foreach($this->System->Modules['Translation']->GetTextGroupList($GroupId, 1, 1, $Page, $ItemPerPage) as $Translation) 63 92 { 64 93 if(strlen($Translation['Text']) > 30) $Translation['Text'] = substr($Translation['Text'], 0, 30).'...'; 65 $Output .= $Translation['Index'].'. <a href="?Action=TranslationGroupEdit&GroupId='.$Translation['Id'].'">'.$Translation['Text'].'</a><br />';66 } 67 $Output .= $this->System->PagesList('?Action=TextGroupList&GroupId='.$GroupId.'&Page=', $Page, $this->System->Modules['Translation']->GetTextGroupListCount($GroupId, 1, 1), $ItemPerPage);94 $Output .= '<tr><td>'.$Translation['Index'].'</td><td><a href="?Action=ShowText&GroupId='.$Translation['Id'].'&Index='.$Translation['Index'].'">'.$Translation['Text'].'</a></td><td>'.($Translation['TextCount'] - 1).'</td></tr>'; 95 } 96 $Output .= '</table>'.$this->System->PagesList('?Action=TextGroupList&GroupId='.$GroupId.'&Page=', $Page, $this->System->Modules['Translation']->GetTextGroupListCount($GroupId, 1, 1), $ItemPerPage); 68 97 return($Output); 69 98 } … … 71 100 function TranslationGroupList() 72 101 { 73 $Output = '<strong>Seznam skupin:</strong><br/>'; 102 $Output = '<strong>Seznam skupin:</strong><table>'. 103 '<tr><th>Skupina textů</th><th>Počet textů</th></tr>'; 74 104 foreach($this->System->Modules['Translation']->GetTranslationGroupList() as $Group) 75 105 { 76 $Output .= '< a href="?Action=TextGroupList&GroupId='.$Group['Id'].'">'.$Group['Name'].'</a><br />';106 $Output .= '<tr><td><a href="?Action=TextGroupList&GroupId='.$Group['Id'].'">'.$Group['Name'].'</a></td><td>'.$Group['TextCount'].'</td></tr>'; 77 107 } 78 108 return($Output); … … 84 114 '<a href="?">Uvodní stránka</a><br />'. 85 115 '<a href="?Action=TranslationGroupList">Seznam skupin</a><br />'. 86 '<a href="?Action=MangosImport">Import z MaNGOSu</a><br />'.87 116 '<br />'; 88 117 return($Output); … … 92 121 { 93 122 $Output = 'Uživatel: '.$this->System->Modules['User']->User['Name'].' '; 94 if($this->System->Modules['User']->User['Id'] == 0) $Output .= '<a href="?Action=LoginDialog">Přihlásit</a>';123 if($this->System->Modules['User']->User['Id'] == 1) $Output .= '<a href="?Action=LoginDialog">Přihlásit</a>'; 95 124 else $Output .= '<a href="?Action=Logout">Odhlásit</a>'; 96 125 97 126 return($Output.'<br />'); 98 127 } 99 128 129 function UserMenu() 130 { 131 $Output = '<strong>Uživatelské menu</strong><br />'; 132 $Permission = &$this->System->Modules['User']->User['Permission']; 133 if($Permission[9]['Read']) $Output .= '<a href="?Action=PermissionMatrix">Tabulka oprávnění</a><br />'; 134 if($Permission[4]['Read']) $Output .= '<a href="?Action=UserOptions">Nastavení účtu</a><br />'; 135 if($Permission[2]['Read']) $Output .= '<a href="?Action=UserTextList">Přeložené texty</a><br />'; 136 if($Permission[3]['Read']) $Output .= '<a href="?Action=UserNewText">Nový překlad</a><br />'; 137 if($Permission[5]['Read']) $Output .= '<a href="?Action=Import">Import</a><br />'; 138 return($Output.'<br />'); 139 } 140 141 function UserOptions() 142 { 143 $Output = ''; 144 return($Output); 145 } 146 147 function PermissionMatrix() 148 { 149 $Output = '<table>'; 150 $Matrix = $this->System->Modules['User']->PermissionMatrix(); 151 $ShowHeader = 1; 152 foreach($Matrix as $RowIndex => $Row) 153 { 154 if($ShowHeader == 1) 155 { 156 $Output .= '<tr><th> </th>'; 157 foreach($Row as $ColumnIndex => $Column) 158 $Output .= '<th>'.$ColumnIndex.'</th>'; 159 $Output .= '</tr>'; 160 $ShowHeader = 0; 161 } 162 $Output .= '<tr><th>'.$RowIndex.'</th>'; 163 foreach($Row as $ColumnIndex => $Column) 164 $Output .= '<td>'.$Column.'</td>'; 165 $Output .= '</tr>'; 166 } 167 $Output .= '</table>'; 168 return($Output); 169 } 170 171 function UserTextList($GroupId) 172 { 173 $ItemPerPage = 30; 174 if(array_key_exists('Page', $_GET)) $Page = $_GET['Page']; else $Page = 0; 175 $Output = '<strong>Seznam vašich textů:</strong><br/>'; 176 foreach($this->System->Modules['Translation']->GetTextGroupList($GroupId, $this->System->Modules['User']->User['Id'], 1, $Page, $ItemPerPage) as $Translation) 177 { 178 if(strlen($Translation['Text']) > 30) $Translation['Text'] = substr($Translation['Text'], 0, 30).'...'; 179 $Output .= $Translation['Index'].'. <a href="?Action=TranslationGroupEdit&GroupId='.$Translation['Id'].'">'.$Translation['Text'].'</a><br />'; 180 } 181 $Output .= $this->System->PagesList('?Action=TextGroupList&GroupId='.$GroupId.'&Page=', $Page, $this->System->Modules['Translation']->GetTextGroupListCount($GroupId, 1, 1), $ItemPerPage); 182 return($Output); 183 } 184 185 function Import() 186 { 187 return('<a href="?Action=ImportMangos">Import z Mangosu</a><br />'. 188 '<a href="?Action=ImportOldSystem">Import ze starého systému</a><br />'); 189 } 100 190 101 191 function Output() … … 114 204 $Output = $this->Logout(); 115 205 break; 116 case ' TranslationGroupEdit':117 $Output = $this-> TranslationGroupEdit($_GET['GroupId']);206 case 'ShowText': 207 $Output = $this->ShowText($_GET['GroupId']); 118 208 break; 119 209 case 'TextGroupList': … … 123 213 $Output = $this->TranslationGroupList(); 124 214 break; 125 case 'MangosImport': 126 $Output = $this->System->Modules['MangosImport']->FullImport(); 215 case 'PermissionMatrix': 216 $Output = $this->PermissionMatrix(); 217 break; 218 case 'UserOptions': 219 $Output = $this->UserOptions(); 220 break; 221 case 'UserTextList': 222 $Output = $this->UserTextList(); 223 break; 224 case 'Import': 225 $Output = $this->Import(); 226 break; 227 case 'ImportMangos': 228 $Output = $this->System->Modules['MangosImport']->ImportFromMangos(); 229 break; 230 case 'ImportOldSystem': 231 $Output = $this->System->Modules['MangosImport']->ImportOldMangos(); 127 232 break; 128 233 } 129 234 else $Output = ''; 130 return($this->Header().'<table class="MainLayout"><tr><td id="LeftPanel">'.$this->User().$this->Menu(). '</td><td>'.$Output.'</td></tr></table>'.$this->Footer());235 return($this->Header().'<table class="MainLayout"><tr><td id="LeftPanel">'.$this->User().$this->Menu().$this->UserMenu().'</td><td class="MainLayoutTd">'.$Output.'</td></tr></table>'.$this->Footer()); 131 236 } 132 237 }
Note:
See TracChangeset
for help on using the changeset viewer.