Changeset 577 for trunk/Modules/Translation
- Timestamp:
- Sep 11, 2013, 10:37:54 PM (11 years ago)
- Location:
- trunk/Modules/Translation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Translation/Form.php
r569 r577 30 30 function ShowForm() 31 31 { 32 global $ System, $Config, $User, $TranslationTree;32 global $TranslationTree; 33 33 34 34 $Output = ''; … … 43 43 $TextID = $_GET['ID'] * 1; 44 44 45 $DbResult = $ System->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID` = '.$TextID);45 $DbResult = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE `ID` = '.$TextID); 46 46 $Line = $DbResult->fetch_assoc(); 47 47 if(!$Line) … … 49 49 $Output .= ShowMessage('Překlad nenalezen.', MESSAGE_CRITICAL); 50 50 } else 51 { 52 53 $DbResult = $System->Database->query('SELECT * FROM `'.$Table.'` WHERE (`Language` = '.$Config['OriginalLanguage'].') AND (`Entry` = '.$Line['Entry'].') AND (`VersionEnd` = '.$Line['VersionEnd'].') LIMIT 1'); 51 { 52 $DbResult = $this->Database->query('SELECT * FROM `'.$Table.'` WHERE '. 53 '(`Language` = '.$this->System->Config['OriginalLanguage'].') AND '. 54 '(`Entry` = '.$Line['Entry'].') AND (`VersionEnd` = '.$Line['VersionEnd'].') LIMIT 1'); 54 55 $LineAJ = $DbResult->fetch_assoc(); 55 56 if(!$LineAJ) … … 61 62 if($Line['User'] != '') 62 63 { 63 $IDUser = $ System->Database->query('SELECT * FROM `User` WHERE `ID` = '.$Line['User']);64 $IDUser = $this->Database->query('SELECT * FROM `User` WHERE `ID` = '.$Line['User']); 64 65 $LineUser = $IDUser->fetch_array(); 65 66 } else … … 72 73 if(($Line['Take'] <> 0) and ($Line['Take'] <> $Line['ID'])) 73 74 { 74 $DbResult = $ System->Database->query('SELECT `Language`,`VersionStart`,`VersionEnd` FROM `'.$Table.'` WHERE `ID` = '.$Line['Take']);75 $DbResult = $this->Database->query('SELECT `Language`,`VersionStart`,`VersionEnd` FROM `'.$Table.'` WHERE `ID` = '.$Line['Take']); 75 76 $Language = $DbResult->fetch_assoc(); 76 77 // echo $Language['Language'].' '.$Line['Take']; 77 78 78 $DbResult = $ System->Database->query('SELECT `Name` FROM `Language` WHERE `Id` ='.$Language['Language']);79 $DbResult = $this->Database->query('SELECT `Name` FROM `Language` WHERE `Id` ='.$Language['Language']); 79 80 $Lang = $DbResult->fetch_assoc(); 80 81 81 82 $Output .= 'Původní text: <strong>'. 82 83 84 83 ' ID <a href="form.php?group='.$GroupId.'&ID='.$Line['Take'].'">'.$Line['Take'].'</a></strong>'. 84 ' ('.$Lang['Name'].')'. 85 ' <br />'; 85 86 } 86 87 $Output .= 'Text: '; … … 95 96 '<br />'; 96 97 97 $DbResult = $System->Database->query('SELECT COUNT(*) FROM `'.$Table.'` WHERE (`Entry` = '.$Line['Entry'].') AND (`Language` <> '.$Config['OriginalLanguage'].') AND (`Complete` = 1)'); 98 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `'.$Table.'` WHERE '. 99 '(`Entry` = '.$Line['Entry'].') AND (`Language` <> '.$this->System->Config['OriginalLanguage'].') AND (`Complete` = 1)'); 98 100 $Version = $DbResult->fetch_row(); 99 101 $Version = $Version[0]; 100 102 if($Version > 0) 101 103 { 102 $Output .= '<form action="comparison.php" method="get"><a href="TranslationList.php?group='.$GroupId.'&user=0&state=2&entry='.$Line['Entry'].'&text=">Počet verzí: <strong>'.$Version.'</strong></a> 104 $Output .= '<form action="comparison.php" method="get"><a href="TranslationList.php?group='. 105 $GroupId.'&user=0&state=2&entry='.$Line['Entry'].'&text=">Počet verzí: <strong>'.$Version.'</strong></a> 103 106 <input type="hidden" name="group" value="'.$GroupId.'" /> 104 107 <input type="hidden" name="entry" value="'.$Line['Entry'].'" /> … … 107 110 <option value="-1">Vyberte text k porovnání</option> 108 111 <option value="-1">Zobrazit/porovnat všechny</option>'; 109 $DataID = $ System->Database->query('SELECT *, (SELECT `User`.`Name` AS `UserName` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE (`Entry` = '.$Line['Entry'].') AND (`ID` <> '.$Line['ID'].') AND (`Complete` = 1)');112 $DataID = $this->Database->query('SELECT *, (SELECT `User`.`Name` AS `UserName` FROM `User` WHERE `User`.`ID` = `'.$Table.'`.`User`) AS `UserName` FROM `'.$Table.'` WHERE (`Entry` = '.$Line['Entry'].') AND (`ID` <> '.$Line['ID'].') AND (`Complete` = 1)'); 110 113 while($Version = $DataID->fetch_array()) 111 114 { 112 if($Version['ID'] == $Line['Take']) $Output .= '<option value="'.$Version['ID'].'">'.$Version['ID'].' - '.$Version['User'].' (převzato)</option>'; 115 if($Version['ID'] == $Line['Take']) $Output .= '<option value="'. 116 $Version['ID'].'">'.$Version['ID'].' - '.$Version['User'].' (převzato)</option>'; 113 117 else 114 118 { … … 122 126 } else 123 127 { 124 $Output .= '<a href="TranslationList.php?group='.$GroupId.'&user=0&state=2&entry='.$Line['Entry'].'&text=">Počet verzí: <strong>'.$Version.'</strong></a>'; 128 $Output .= '<a href="TranslationList.php?group='.$GroupId.'&user=0&state=2&entry='. 129 $Line['Entry'].'&text=">Počet verzí: <strong>'.$Version.'</strong></a>'; 125 130 } 126 131 127 132 // Special characters: $B - New line, $N - Name, $C - profession 128 if($ User->Licence(LICENCE_USER))133 if($this->System->User->Licence(LICENCE_USER)) 129 134 { 130 135 $Output .= '<form action="save.php?group='.$GroupId.'" method="post"><div>'; … … 143 148 144 149 $Output .= '<input type="hidden" name="entry" value="'.$LineAJ['Entry'].'" /> 145 <input type="hidden" name="user" value="'.$ User->Id.'" />150 <input type="hidden" name="user" value="'.$this->System->User->Id.'" /> 146 151 <input type="hidden" name="ID" value="'.$TextID.'" /> 147 152 <table class="BaseTable"> … … 156 161 <td>'; 157 162 if($Line['Language'] <> 0) $Language = $Line['Language']; 158 else if($ User->Id != 0)159 { 160 $Language = $ User->Language;163 else if($this->System->User->Id != 0) 164 { 165 $Language = $this->System->User->Language; 161 166 } else $Language = 0; 162 if($ User->Licence(LICENCE_USER)) $Output .= WriteLanguages($Language);167 if($this->System->User->Licence(LICENCE_USER)) $Output .= WriteLanguages($Language); 163 168 else { 164 $DbResult3 = $ System->Database->select('Language', '`Id`, `Name`', '`Enabled` = 1');169 $DbResult3 = $this->Database->select('Language', '`Id`, `Name`', '`Enabled` = 1'); 165 170 if($DbResult3->num_rows > 0) 166 171 { … … 180 185 if(($GroupId < 4) or ($GroupId == 10) or ($GroupId == 11)) { 181 186 //<span class="edit">barvou.</span> 182 $names = GetTranslatNames($Text, 0,array('Dictionary' => 'Text','TextCreature' => 'name'));187 $names = GetTranslatNames($Text, 0, array('Dictionary' => 'Text', 'TextCreature' => 'name')); 183 188 } else { 184 $names = GetTranslatNames($Text, 0,array('Dictionary' => 'Text'));189 $names = GetTranslatNames($Text, 0, array('Dictionary' => 'Text')); 185 190 } 186 191 … … 190 195 if(($LineAJ[$TextItem['Column']] <> '') or ($Line[$TextItem['Column']] <> '')) 191 196 { 192 if ($TextItem['Name'] == 'Text' AND (($Table == 'global_strings') OR($Table == 'glue_strings')))197 if(($TextItem['Name'] == 'Text') and (($Table == 'global_strings') or ($Table == 'glue_strings'))) 193 198 $Output .= '<tr><th>'.$LineAJ['ShortCut'].'</th>'; 194 199 else $Output .= '<tr><th>'.$TextItem['Name'].'</th>'; 195 200 $Output .= '<td>'.str_replace("\n", '<br/>', $this->ColorNames(htmlspecialchars($LineAJ[$TextItem['Column']]),$names)).'</td> 196 201 <td>'; 197 if($User->Licence(LICENCE_USER)) $Output .= '<textarea rows="8" cols="40" onkeydown="ResizeTextArea(this)" class="textedit" id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'">'; 202 if($this->System->User->Licence(LICENCE_USER)) 203 $Output .= '<textarea rows="8" cols="40" onkeydown="ResizeTextArea(this)" class="textedit" id="'.$TextItem['Column'].'" name="'.$TextItem['Column'].'">'; 198 204 $Output .= htmlspecialchars($Line[$TextItem['Column']]); 199 if($ User->Licence(LICENCE_USER)) $Output .= '</textarea></td></tr>';205 if($this->System->User->Licence(LICENCE_USER)) $Output .= '</textarea></td></tr>'; 200 206 } 201 207 } else … … 204 210 } 205 211 $Output .= '</table></div>'; 206 if($ User->Licence(LICENCE_USER)) $Output .= '</form>';212 if($this->System->User->Licence(LICENCE_USER)) $Output .= '</form>'; 207 213 } 208 214 } … … 213 219 function Delete() 214 220 { 215 global $System, $User, $Config; 216 217 if($User->Licence(LICENCE_MODERATOR)) 221 if($this->System->User->Licence(LICENCE_MODERATOR)) 218 222 { 219 223 $TextID = $_GET['ID']; 220 $ System->Database->query('DELETE FROM `'.$Table.'` WHERE `ID` = '.$TextID.' AND `Language` <> '.$Config['OriginalLanguage']);224 $this->Database->query('DELETE FROM `'.$Table.'` WHERE `ID` = '.$TextID.' AND `Language` <> '.$this->System->Config['OriginalLanguage']); 221 225 $Output = ShowMessage('Překlad byl smazán.'); 222 226 WriteLog('Překlad byl smazán! <a href="form.php?group='.$GroupID.'&ID='.$TextID.'">'.$TextID.'</a>', LOG_TYPE_MODERATOR); -
trunk/Modules/Translation/TranslationList.php
r561 r577 5 5 function ShowFilter($GroupId = 0) 6 6 { 7 global $ System, $TranslationTree, $Config;7 global $TranslationTree; 8 8 9 9 $Filter = array('SQL' => ''); … … 59 59 else $Selected = ''; 60 60 $Output .= '<option value="0"'.$Selected.'>Všechny</option>'; 61 $DbResult = $ System->Database->query('SELECT `Id`,`Name` FROM `Group` ORDER BY `Name`');61 $DbResult = $this->Database->query('SELECT `Id`,`Name` FROM `Group` ORDER BY `Name`'); 62 62 while($Group = $DbResult->fetch_assoc()) 63 63 { … … 72 72 if($Filter['Version'] != 0) 73 73 { 74 $DbResult = $ System->Database->query('SELECT `Id`, `BuildNumber`,`Version` FROM `ClientVersion` WHERE (`Imported` = 1) AND (`Id` ='.$Filter['Version'].')');74 $DbResult = $this->Database->query('SELECT `Id`, `BuildNumber`,`Version` FROM `ClientVersion` WHERE (`Imported` = 1) AND (`Id` ='.$Filter['Version'].')'); 75 75 if($DbResult->num_rows > 0) 76 76 { … … 83 83 else $Selected = ''; 84 84 $Output .= '<option value="0"'.$Selected.'>Všechny</option>'; 85 $DbResult = $ System->Database->query('SELECT `Id`, `BuildNumber`,`Version` FROM `ClientVersion` WHERE `Imported` = 1 ORDER BY `BuildNumber` DESC');85 $DbResult = $this->Database->query('SELECT `Id`, `BuildNumber`,`Version` FROM `ClientVersion` WHERE `Imported` = 1 ORDER BY `BuildNumber` DESC'); 86 86 while($Version = $DbResult->fetch_assoc()) 87 87 { … … 101 101 else $Selected = ''; 102 102 $Output .= '<option value="0"'.$Selected.'>Všechny</option>'; 103 $DbResult = $ System->Database->query('SELECT `Id`, `Name` FROM `Language` WHERE `Enabled` = 1 ORDER BY `Name`');103 $DbResult = $this->Database->query('SELECT `Id`, `Name` FROM `Language` WHERE `Enabled` = 1 ORDER BY `Name`'); 104 104 while($Language = $DbResult->fetch_assoc()) 105 105 { … … 118 118 else $Selected = ''; 119 119 $Output .= '<option value="0"'.$Selected.'>Všichni</option>'; 120 $DbResult = $ System->Database->query('SELECT `Id`, `Name` FROM `User` ORDER BY `Name`');120 $DbResult = $this->Database->query('SELECT `Id`, `Name` FROM `User` ORDER BY `Name`'); 121 121 while($User = $DbResult->fetch_assoc()) 122 122 { … … 153 153 { 154 154 if($Filter['State'] == 0) $Filter['SQL'] .= $UserFilter.$VersionFilter.''; 155 else if($Filter['State'] == 1) $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$ Config['OriginalLanguage'].') '.155 else if($Filter['State'] == 1) $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$this->System->Config['OriginalLanguage'].') '. 156 156 'AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE '. 157 '(`Sub`.`Language` <> '.$ Config['OriginalLanguage'].')'.$LanguageFilter.$UserFilter.157 '(`Sub`.`Language` <> '.$this->System->Config['OriginalLanguage'].')'.$LanguageFilter.$UserFilter. 158 158 ' AND (`Sub`.`Entry` = `T`.`Entry`) AND (`Sub`.`Complete` = 1) AND '. 159 159 '(`Sub`.`VersionStart` = `T`.`VersionStart`) AND (`Sub`.`VersionEnd` = `T`.`VersionEnd`))'; 160 160 else if($Filter['State'] == 2) $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Complete` = 1)'; 161 else if($Filter['State'] == 3) $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Language` != '.$ Config['OriginalLanguage'].161 else if($Filter['State'] == 3) $Filter['SQL'] .= $UserFilter.$LanguageFilter.$VersionFilter.' AND (`T`.`Language` != '.$this->System->Config['OriginalLanguage']. 162 162 ') AND (`T`.`Complete` = 0)'; 163 else if($Filter['State'] == 4) $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$ Config['OriginalLanguage'].')';163 else if($Filter['State'] == 4) $Filter['SQL'] .= $VersionFilter.' AND (`T`.`Language` = '.$this->System->Config['OriginalLanguage'].')'; 164 164 } 165 165 … … 191 191 function ShowTranslationList($Filter) 192 192 { 193 global $ System, $TranslationTree;193 global $TranslationTree; 194 194 195 195 $Output = $Filter['Output']; … … 208 208 209 209 // Get total item count 210 $DbResult = $ System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS `TT`');210 $DbResult = $this->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS `TT`'); 211 211 $DbRow = $DbResult->fetch_row(); 212 212 $PageList = GetPageList($DbRow[0]); … … 226 226 $Order['Output']; 227 227 228 $DbResult = $ System->Database->query($Query.' '.$Order['SQL'].' '.$PageList['SQLLimit']);228 $DbResult = $this->Database->query($Query.' '.$Order['SQL'].' '.$PageList['SQLLimit']); 229 229 while($Line = $DbResult->fetch_assoc()) 230 230 { … … 243 243 function ShowGroupList($Filter) 244 244 { 245 global $ System, $TranslationTree;245 global $TranslationTree; 246 246 247 247 $Output = $Filter['Output']; … … 253 253 { 254 254 $Filter = $this->ShowFilter($Group['Id']); 255 $ID = $ System->Database->query('SELECT COUNT(*) FROM `'.$Group['TablePrefix'].'` AS `T` WHERE 1 '.$Filter['SQL']);255 $ID = $this->Database->query('SELECT COUNT(*) FROM `'.$Group['TablePrefix'].'` AS `T` WHERE 1 '.$Filter['SQL']); 256 256 $Line = $ID->fetch_row(); 257 257 $Output .= '<tr><td><a href="?group='.$Group['Id'].'">'.$Group['Name'].'</td><td>'.$Line[0].'</a></tr>'; … … 265 265 function ShowGroupTypeList() 266 266 { 267 global $System, $User; 268 269 $DbResult = $System->Database->query('SELECT COUNT(*) FROM `Group`'); 267 $DbResult = $this->Database->query('SELECT COUNT(*) FROM `Group`'); 270 268 $DbRow = $DbResult->fetch_row(); 271 269 $PageList = GetPageList($DbRow[0]); … … 285 283 $Output .= $Order['Output']; 286 284 287 $DbResult = $ System->Database->query('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']);285 $DbResult = $this->Database->query('SELECT * FROM `Group`'.$Order['SQL'].$PageList['SQLLimit']); 288 286 while($Group = $DbResult->fetch_assoc()) 289 287 { … … 297 295 $Output .= '</table>'. 298 296 '<br /><a title="Záznam změn po importu" href="log.php?type=11">Záznam změn v textech při importu</a><br/>'; 299 if($ User->Licence(LICENCE_ADMIN)) $Output .= '<a href="?action=groupadd">Přidat překladovou skupinu</a>';297 if($this->System->User->Licence(LICENCE_ADMIN)) $Output .= '<a href="?action=groupadd">Přidat překladovou skupinu</a>'; 300 298 return($Output); 301 299 } … … 303 301 function ShowMenu() 304 302 { 305 global $ User, $TranslationTree;303 global $TranslationTree; 306 304 307 305 $GroupId = GetParameter('group', 0, true); … … 321 319 '<td>Texty označené jako rozpracované.</td></tr>'; 322 320 323 if($ User->Licence(LICENCE_USER))321 if($this->System->User->Licence(LICENCE_USER)) 324 322 { 325 $Output .= '<tr><td><a title="Nedokončené texty" href="?group='.$GroupId.'&state=3&user='.$ User->Id.'">Moje nedokončené</a></td>323 $Output .= '<tr><td><a title="Nedokončené texty" href="?group='.$GroupId.'&state=3&user='.$this->System->User->Id.'">Moje nedokončené</a></td> 326 324 <td>Nedokončené texty přihlášeného uživatele</td></tr> 327 <tr><td><a title="Přeložené texty přihlášeného uživatele" href="?group='.$GroupId.'&state=2&user='.$ User->Id.'">Moje přeložené</a></td>325 <tr><td><a title="Přeložené texty přihlášeného uživatele" href="?group='.$GroupId.'&state=2&user='.$this->System->User->Id.'">Moje přeložené</a></td> 328 326 <td>Přeložené texty přihlášeného uživatele</td></tr>'; 329 327 } … … 348 346 function ShowGroupAdd() 349 347 { 350 global $User; 351 352 if($User->Licence(LICENCE_ADMIN)) 348 if($this->System->User->Licence(LICENCE_ADMIN)) 353 349 { 354 350 $Output = '<h3>Vložení nové překladové skupiny</h3>'. … … 368 364 function ShowGroupAddFinish() 369 365 { 370 global $User; 371 372 if($User->Licence(LICENCE_ADMIN)) 366 if($this->System->User->Licence(LICENCE_ADMIN)) 373 367 { 374 368 // TODO: Add group items manipulation oprations
Note:
See TracChangeset
for help on using the changeset viewer.