Changeset 577 for trunk/Modules/Translation/Form.php
- Timestamp:
- Sep 11, 2013, 10:37:54 PM (11 years ago)
- File:
-
- 1 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);
Note:
See TracChangeset
for help on using the changeset viewer.