1 | <?php
|
---|
2 |
|
---|
3 | include_once('../includes/global.php');
|
---|
4 | include_once('export_output.php');
|
---|
5 |
|
---|
6 | function ExportList()
|
---|
7 | {
|
---|
8 | global $Database;
|
---|
9 |
|
---|
10 | echo('<a href="?Action=ViewList">Všechny</a>');
|
---|
11 | if(Licence(LICENCE_USER))
|
---|
12 | {
|
---|
13 | echo(' <a href="?Action=ViewList&Filter=Others">Ostatních</a>');
|
---|
14 | echo(' <a href="?Action=ViewList&Filter=My">Moje</a>');
|
---|
15 | }
|
---|
16 |
|
---|
17 | $Filter = '';
|
---|
18 | if(array_key_exists('Filter', $_GET))
|
---|
19 | {
|
---|
20 | if($_GET['Filter'] == 'My') $Filter = ' WHERE `Export`.`User` = '.$_SESSION['UserID'];
|
---|
21 | if($_GET['Filter'] == 'Others') $Filter = ' WHERE `Export`.`User` != '.$_SESSION['UserID'];
|
---|
22 | }
|
---|
23 |
|
---|
24 | $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Export` '.$Filter);
|
---|
25 | $DbRow = mysql_fetch_row($DbResult);
|
---|
26 | $PageList = GetPageList($DbRow[0]);
|
---|
27 |
|
---|
28 | echo('<h3>Seznam exportů</h3>');
|
---|
29 | echo($PageList['Output']);
|
---|
30 |
|
---|
31 | $TableColumns = array(
|
---|
32 | array('Name' => 'TimeCreate', 'Title' => 'Čas vytvoření'),
|
---|
33 | array('Name' => 'UserName', 'Title' => 'Překladatel'),
|
---|
34 | array('Name' => 'Title', 'Title' => 'Označení'),
|
---|
35 | array('Name' => 'UsedCount', 'Title' => 'Prohlédnutí výstupu'),
|
---|
36 | array('Name' => 'UserCount', 'Title' => 'Vybraných překladatelů'),
|
---|
37 | array('Name' => 'GroupCount', 'Title' => 'Překladových skupin'),
|
---|
38 | array('Name' => '', 'Title' => 'Akce'),
|
---|
39 | );
|
---|
40 | $Order = GetOrderTableHeader($TableColumns, 'TimeCreate', 1);
|
---|
41 | echo('<table class="BaseTable">');
|
---|
42 | echo($Order['Output']);
|
---|
43 |
|
---|
44 | $DbResult = $Database->SQLCommand('SELECT `user`.`user` AS `UserName`, `Export`.*, (SELECT COUNT(*) FROM ExportGroup WHERE ExportGroup.Export=Export.Id) AS GroupCount, (SELECT COUNT(*) FROM ExportUser WHERE ExportUser.Export=Export.Id) AS UserCount FROM `Export` LEFT JOIN `user` ON `user`.`ID`=`Export`.`User` '.$Filter.$Order['SQL'].$PageList['SQLLimit']);
|
---|
45 | while($Export = mysql_fetch_assoc($DbResult))
|
---|
46 | {
|
---|
47 | $Action = '<a href="?Action=View&ExportId='.$Export['Id'].'">Zobrazit</a>';
|
---|
48 | if($Export['User'] == $_SESSION['UserID']) $Action .= ' <a href="?Action=Delete&ExportId='.$Export['Id'].'" onclick="return confirmAction(\'Opravdu smazat položku?\');">Smazat</a>';
|
---|
49 | echo('<tr><td>'.HumanDate($Export['TimeCreate']).'</td><td>'.$Export['UserName'].'</td><td>'.$Export['Title'].'</td><td>'.$Export['UsedCount'].'</td><td>'.$Export['UserCount'].'</td><td>'.$Export['GroupCount'].'</td><td>'.$Action.'</td></tr>');
|
---|
50 | }
|
---|
51 | echo('</table>');
|
---|
52 | echo($PageList['Output']);
|
---|
53 |
|
---|
54 | if(Licence(LICENCE_USER)) echo('<br/><div style="text-align: center;"><a href="?Action=Create">Vytvořit nový export</a></div>');
|
---|
55 | }
|
---|
56 |
|
---|
57 | function ExportCreate()
|
---|
58 | {
|
---|
59 | global $Database, $Config;
|
---|
60 |
|
---|
61 | if(Licence(LICENCE_USER))
|
---|
62 | {
|
---|
63 | $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM Export WHERE User='.$_SESSION['UserID']);
|
---|
64 | $DbRow = mysql_fetch_row($DbResult);
|
---|
65 | if($DbRow[0] < $Config['MaxExportPerUser'])
|
---|
66 | {
|
---|
67 | echo('<form action="?Action=CreateFinish" method="post">'.
|
---|
68 | '<fieldset><legend>Vytvoření nového exportu</legend>'.
|
---|
69 | '<table><tr><td>Označení:</td><td><input type="text" name="Title" /></td></tr>'.
|
---|
70 | '<tr><td>Popis:</td><td><textarea name="Description" cols="54" rows="10"></textarea></td></tr>'.
|
---|
71 | '<tr><td colspan="2"><input type="submit" value="Vytvořit" /></td></tr>'.
|
---|
72 | '</table></fieldset></form>');
|
---|
73 | } else echo('Nemůžete vytvářet další export. Max. počet na uživatele je '.$Config['MaxExportPerUser'].'.');
|
---|
74 | } else echo('Nemáte oprávnění');
|
---|
75 | }
|
---|
76 |
|
---|
77 | function ExportCreateFinish()
|
---|
78 | {
|
---|
79 | global $Database, $Config;
|
---|
80 |
|
---|
81 | if(Licence(LICENCE_USER))
|
---|
82 | {
|
---|
83 | if(array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST))
|
---|
84 | {
|
---|
85 | $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM `Export` WHERE `User`='.$_SESSION['UserID']);
|
---|
86 | $DbRow = mysql_fetch_row($DbResult);
|
---|
87 | if($DbRow[0] < $Config['MaxExportPerUser'])
|
---|
88 | {
|
---|
89 | $Database->SQLCommand('INSERT INTO `Export` (`Title`, `User`, `TimeCreate`, `WithDiacritic`, `Description`) VALUES ("'.$_POST['Title'].'", '.$_SESSION['UserID'].', NOW(), 1, "'.$_POST['Description'].'")');
|
---|
90 | $ExportId = mysql_insert_id();
|
---|
91 | echo('Nový export vytvořen.<br/>Přímý odkaz na tento export: <a href="?Action=View&ExportId='.$ExportId.'">zde</a><br/><br/>');
|
---|
92 | WriteLog('Vytvořen nový export <a href="'.$Config['Web']['BaseURL'].'export/?Action=View&ExportId='.$ExportId.'">'.$ExportId.'</a>.', 12);
|
---|
93 | $_GET['Filter'] = 'my';
|
---|
94 | ExportList();
|
---|
95 | } else echo('Nemůžete vytvářet další export. Max. počet na uživatele je '.$Config['MaxExportPerUser'].'.');
|
---|
96 | } else echo('Chybí údaje formuláře');
|
---|
97 | } else echo('Nemáte oprávnění');
|
---|
98 | }
|
---|
99 |
|
---|
100 | function ExportDelete()
|
---|
101 | {
|
---|
102 | global $Database;
|
---|
103 |
|
---|
104 | if(Licence(LICENCE_USER))
|
---|
105 | {
|
---|
106 | if(array_key_exists('ExportId', $_GET))
|
---|
107 | {
|
---|
108 | $DbResult = $Database->SQLCommand('SELECT * FROM Export WHERE Id='.$_GET['ExportId'].' AND User='.$_SESSION['UserID']);
|
---|
109 | if(mysql_num_rows($DbResult) > 0)
|
---|
110 | {
|
---|
111 | $Database->SQLCommand('DELETE FROM Export WHERE Id='.$_GET['ExportId']);
|
---|
112 | DeleteDirectory('../tmp/Export/'.$_GET['ExportId'].'/');
|
---|
113 | echo('Export smazán.<br/><br/>');
|
---|
114 | $_GET['Filter'] = 'my';
|
---|
115 | WriteLog('Smazán export '.$_GET['ExportId'], 12);
|
---|
116 | ExportList();
|
---|
117 | } else echo('Export '.$_GET['ExportId'].' nelze smazat.<br/>');
|
---|
118 | } else echo('Nebylo zadáno Id');
|
---|
119 | } else echo('Nemáte oprávnění');
|
---|
120 | }
|
---|
121 |
|
---|
122 | function ExportViewTranslators()
|
---|
123 | {
|
---|
124 | global $Database, $TranslationTree, $Config;
|
---|
125 |
|
---|
126 | $DisabledInput = array(false => ' disabled="disabled"', true => '');
|
---|
127 | if(array_key_exists('ExportId', $_GET))
|
---|
128 | {
|
---|
129 | $DbRows = $Database->SQLCommand('SELECT * FROM Export WHERE Id='.$_GET['ExportId']);
|
---|
130 | if(mysql_num_rows($DbRows) > 0)
|
---|
131 | {
|
---|
132 | $Export = mysql_fetch_assoc($DbRows);
|
---|
133 | if(Licence(LICENCE_USER) and ($_SESSION['UserID'] == $Export['User'])) $Editable = true;
|
---|
134 | else $Editable = false;
|
---|
135 |
|
---|
136 |
|
---|
137 | if(array_key_exists('Operation', $_GET))
|
---|
138 | {
|
---|
139 | if($_GET['Operation'] == 'Save')
|
---|
140 | {
|
---|
141 | //print_r($_POST);
|
---|
142 | // Update user selection page
|
---|
143 | foreach($_POST as $Index => $Value)
|
---|
144 | {
|
---|
145 | if(substr($Index, 0, 3) == 'seq')
|
---|
146 | {
|
---|
147 | $UserId = substr($Index, 3) * 1;
|
---|
148 | if(array_key_exists('sel'.$UserId, $_POST)) $Selected = true;
|
---|
149 | else $Selected = false;
|
---|
150 | $Condition = ' WHERE Export='.$_GET['ExportId'].' AND User='.$UserId;
|
---|
151 | $DbResult = $Database->SQLCommand('SELECT * FROM ExportUser '.$Condition);
|
---|
152 | if(mysql_num_rows($DbResult) > 0)
|
---|
153 | {
|
---|
154 | if(!$Selected) $Database->SQLCommand('DELETE FROM ExportUser '.$Condition);
|
---|
155 | else $Database->SQLCommand('UPDATE ExportUser SET Sequence='.$Value.$Condition);
|
---|
156 | } else
|
---|
157 | {
|
---|
158 | if($Selected) $Database->SQLCommand('INSERT INTO ExportUser (Export, User, Sequence) VALUES ('.$_GET['ExportId'].', '.$UserId.', '.$Value.')');
|
---|
159 | }
|
---|
160 | }
|
---|
161 | }
|
---|
162 |
|
---|
163 | // Recalculate sequence number
|
---|
164 | $Database->SQLCommand('SET @I = 0');
|
---|
165 | $Database->SQLCommand('UPDATE ExportUser SET Sequence = (@I := @I + 1) WHERE Export='.$_GET['ExportId'].' ORDER BY Sequence;');
|
---|
166 | }
|
---|
167 | }
|
---|
168 |
|
---|
169 | $TableColumns = array(
|
---|
170 | array('Name' => 'user', 'Title' => 'Jméno'),
|
---|
171 | array('Name' => 'TranslatedCount', 'Title' => 'Překladů'),
|
---|
172 | array('Name' => 'XP', 'Title' => 'Úroveň'),
|
---|
173 | array('Name' => '', 'Title' => 'Výběr'),
|
---|
174 | array('Name' => 'Sequence2', 'Title' => 'Pořadí'),
|
---|
175 | );
|
---|
176 | $Order = GetOrderTableHeader($TableColumns, 'TranslatedCount', 1);
|
---|
177 |
|
---|
178 | $Columns = '';
|
---|
179 | $Joins = '';
|
---|
180 | foreach($TranslationTree as $Group)
|
---|
181 | if($Group['TablePrefix'] != '')
|
---|
182 | {
|
---|
183 | $Columns .= 'COALESCE(T'.$Group['Id'].'.Count, 0) + ';
|
---|
184 | $Joins .= ' LEFT JOIN (SELECT User, COUNT(User) as Count FROM `'.$Group['TablePrefix'].'` WHERE (Complete = 1) AND (Language <> 0) GROUP BY User) as T'.$Group['Id'].' ON user.ID=T'.$Group['Id'].'.User';
|
---|
185 | }
|
---|
186 | $Query = 'SELECT (@I := @I + 1) AS Sequence2, TT.* FROM (SELECT ExportUser.Sequence, T.ID, T.TranslatedCount, T.user, T.XP FROM (SELECT user.ID, user.user, user.XP, ('.substr($Columns, 0, -3).') as TranslatedCount FROM `user`'.$Joins.') AS T';
|
---|
187 | $Query .=' LEFT JOIN ExportUser ON ExportUser.Export = '.$_GET['ExportId'].' AND ExportUser.User=T.ID';
|
---|
188 | $Query .=' WHERE T.TranslatedCount > 0 ORDER BY COALESCE(ExportUser.Sequence, 100000000), '.substr($Order['SQL'], 10).') AS TT';
|
---|
189 |
|
---|
190 | $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$Query.') AS X');
|
---|
191 | $DbRow = mysql_fetch_row($DbResult);
|
---|
192 | $PageList = GetPageList($DbRow[0]);
|
---|
193 |
|
---|
194 | echo('<form action="?Action=View&ExportId='.$_GET['ExportId'].'&Operation=Save" method="post">');
|
---|
195 | echo('<h3>Překladatelé</h3>');
|
---|
196 | echo('<input type="submit" value="Uložit" '.$DisabledInput[$Editable].'/><br />'.
|
---|
197 | 'Zvolte ze seznamu uživatele, od kterých chcete načítat překlady a upravte jejich pořadí.<br />'.
|
---|
198 | 'Pořadí řádků je dáno číselnou hodnotou, kterou lze změnit na požadované pořadí. Řádky se stejným pořadovým číslem budou přečíslovány vzestupně.');
|
---|
199 |
|
---|
200 | echo($PageList['Output']);
|
---|
201 | echo('<table class="BaseTable">');
|
---|
202 | echo($Order['Output']);
|
---|
203 |
|
---|
204 | $Query = 'SELECT * FROM ('.$Query.') AS TX '.$Order['SQL'].$PageList['SQLLimit'];
|
---|
205 | $Database->SQLCommand('SET @I = 0');
|
---|
206 | $DbResult = $Database->SQLCommand($Query);
|
---|
207 | while($User = mysql_fetch_assoc($DbResult))
|
---|
208 | {
|
---|
209 | $Checked = $User['Sequence'] != '';
|
---|
210 | $Selection = CheckBox('sel'.$User['ID'], $Checked, '', 'CheckBox', !$Editable);
|
---|
211 | $Sequence = '<input type="text" name="seq'.$User['ID'].'" style="text-align: center; width: 40px;" value="'.$User['Sequence2'].'"'.$DisabledInput[$Editable].'/>';
|
---|
212 | echo('<tr>
|
---|
213 | <td><a href="'.$Config['Web']['BaseURL'].'/TranslationList.php?user='.$User['ID'].'&action=userall" title="Zobrazit všechny jeho přeložené texty">'.$User['user'].'</a></td>
|
---|
214 | <td>'.$User['TranslatedCount'].'</td>
|
---|
215 | <td><img src="'.$Config['Web']['TempFolder'].'/user/'.$User['user'].'/level.png" alt="Úroveň uživatele" /></td>
|
---|
216 | <td>'.$Selection.'</td><td>'.$Sequence.'</td></tr>');
|
---|
217 | }
|
---|
218 | echo('</table>');
|
---|
219 | echo('</form>');
|
---|
220 | echo($PageList['Output']);
|
---|
221 | } else echo('Položka nenalezena');
|
---|
222 | } else echo('Nebylo zadáno Id');
|
---|
223 | }
|
---|
224 |
|
---|
225 | function ExportViewGeneral()
|
---|
226 | {
|
---|
227 | global $Database;
|
---|
228 |
|
---|
229 | $DisabledInput = array(false => ' disabled="disabled"', true => '');
|
---|
230 | $DisabledTextArea = array(false => ' readonly="yes"', true => '');
|
---|
231 | echo('<h3>Obecná nastavení</h3>');
|
---|
232 | if(array_key_exists('ExportId', $_GET))
|
---|
233 | {
|
---|
234 | $DbRows = $Database->SQLCommand('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
|
---|
235 | if(mysql_num_rows($DbRows) > 0)
|
---|
236 | {
|
---|
237 | $Export = mysql_fetch_assoc($DbRows);
|
---|
238 | if(Licence(LICENCE_USER) and ($_SESSION['UserID'] == $Export['User'])) $Editable = true;
|
---|
239 | else $Editable = false;
|
---|
240 | if($Editable and array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST))
|
---|
241 | {
|
---|
242 | if(array_key_exists('WithDiacritic', $_POST)) $WithDiacritic = 1;
|
---|
243 | else $WithDiacritic = 0;
|
---|
244 | $Database->SQLCommand('UPDATE `Export` SET `Title`="'.$_POST['Title'].'", `Description`="'.$_POST['Description'].'", `WithDiacritic`='.$WithDiacritic.' WHERE Id='.$Export['Id']);
|
---|
245 | $Export['Title'] = $_POST['Title'];
|
---|
246 | $Export['Description'] = $_POST['Description'];
|
---|
247 | $Export['WithDiacritic'] = $WithDiacritic;
|
---|
248 | }
|
---|
249 |
|
---|
250 | if($Export['WithDiacritic'] == 1) $WithDiacritic = ' checked="checked"'; else $WithDiacritic = '';
|
---|
251 | echo('<form action="?Action=View&Tab=0&ExportId='.$Export['Id'].'" method="post">'.
|
---|
252 | '<table>'.
|
---|
253 | '<tr><td colspan="2"><input type="submit" value="Uložit" '.$DisabledInput[$Editable].'/></td></tr>'.
|
---|
254 | '<tr><td>Označení:</td><td><input type="text" style="width: 400px" name="Title" value="'.$Export['Title'].'"'.$DisabledInput[$Editable].'/></td></tr>'.
|
---|
255 | '<tr><td>Popis:</td><td><textarea name="Description" cols="54" rows="10"'.$DisabledTextArea[$Editable].'>'.$Export['Description'].'</textarea></td></tr>'.
|
---|
256 | '<tr><td>Včetně háčků a čárek</td><td><input type="checkbox" name="WithDiacritic" '.$WithDiacritic.''.$DisabledInput[$Editable].'/></td></tr>'.
|
---|
257 | '</table></fieldset></form>');
|
---|
258 | } else echo('Položka nenalezena');
|
---|
259 | } else echo('Nebylo zadáno Id');
|
---|
260 | }
|
---|
261 |
|
---|
262 | function ExportViewLanguages()
|
---|
263 | {
|
---|
264 | global $Database, $TranslationTree, $Config;
|
---|
265 |
|
---|
266 | $DisabledInput = array(false => ' disabled="disabled"', true => '');
|
---|
267 | if(array_key_exists('ExportId', $_GET))
|
---|
268 | {
|
---|
269 | $DbRows = $Database->SQLCommand('SELECT * FROM Export WHERE Id='.$_GET['ExportId']);
|
---|
270 | if(mysql_num_rows($DbRows) > 0)
|
---|
271 | {
|
---|
272 | $Export = mysql_fetch_assoc($DbRows);
|
---|
273 | if(Licence(LICENCE_USER) and ($_SESSION['UserID'] == $Export['User'])) $Editable = true;
|
---|
274 | else $Editable = false;
|
---|
275 |
|
---|
276 | if(array_key_exists('Operation', $_GET))
|
---|
277 | {
|
---|
278 | if($_GET['Operation'] == 'Save')
|
---|
279 | {
|
---|
280 | //print_r($_POST);
|
---|
281 | // Update user selection page
|
---|
282 | foreach($_POST as $Index => $Value)
|
---|
283 | {
|
---|
284 | if(substr($Index, 0, 3) == 'seq')
|
---|
285 | {
|
---|
286 | $LanguageId = substr($Index, 3) * 1;
|
---|
287 | if(array_key_exists('sel'.$LanguageId, $_POST)) $Selected = true;
|
---|
288 | else $Selected = false;
|
---|
289 | $Condition = ' WHERE Export='.$_GET['ExportId'].' AND Language='.$LanguageId;
|
---|
290 | $DbResult = $Database->SQLCommand('SELECT * FROM ExportLanguage '.$Condition);
|
---|
291 | if(mysql_num_rows($DbResult) > 0)
|
---|
292 | {
|
---|
293 | if(!$Selected) $Database->SQLCommand('DELETE FROM ExportLanguage '.$Condition);
|
---|
294 | else $Database->SQLCommand('UPDATE ExportLanguage SET Sequence='.$Value.$Condition);
|
---|
295 | } else
|
---|
296 | {
|
---|
297 | if($Selected) $Database->SQLCommand('INSERT INTO ExportLanguage (Export, Language, Sequence) VALUES ('.$_GET['ExportId'].', '.$LanguageId.', '.$Value.')');
|
---|
298 | }
|
---|
299 | }
|
---|
300 | }
|
---|
301 |
|
---|
302 | // Recalculate sequence number
|
---|
303 | $Database->SQLCommand('SET @I = 0');
|
---|
304 | $Database->SQLCommand('UPDATE ExportLanguage SET Sequence = (@I := @I + 1) WHERE Export='.$_GET['ExportId'].' ORDER BY Sequence;');
|
---|
305 | }
|
---|
306 | }
|
---|
307 |
|
---|
308 | $Query = 'SELECT (@I := @I + 1) AS Sequence2, Sequence, language.Id, Name FROM language';
|
---|
309 | $Query .=' LEFT JOIN ExportLanguage ON ExportLanguage.Export = '.$_GET['ExportId'].' AND ExportLanguage.Language=language.Id';
|
---|
310 | $Query .=' WHERE language.Enabled = 1 ORDER BY COALESCE(Sequence, 100)';
|
---|
311 |
|
---|
312 | $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$Query.') AS X');
|
---|
313 | $DbRow = mysql_fetch_row($DbResult);
|
---|
314 | $PageList = GetPageList($DbRow[0]);
|
---|
315 |
|
---|
316 | $TableColumns = array(
|
---|
317 | array('Name' => 'Name', 'Title' => 'Název'),
|
---|
318 | array('Name' => '', 'Title' => 'Výběr'),
|
---|
319 | array('Name' => 'Sequence2', 'Title' => 'Pořadí'),
|
---|
320 | );
|
---|
321 | $Order = GetOrderTableHeader($TableColumns, 'Sequence2');
|
---|
322 | echo('<form action="?Action=View&ExportId='.$_GET['ExportId'].'&Operation=Save" method="post">');
|
---|
323 | echo('<h3>Jazyky</h3>');
|
---|
324 | echo('<input type="submit" value="Uložit" '.$DisabledInput[$Editable].'/><br />'.
|
---|
325 | 'Zvolte ze seznamu dostupných jazyků, ze kterých chcete sestavit překlady a upravte jejich pořadí.<br />'.
|
---|
326 | 'Pořadí řádků je dáno číselnou hodnotou, kterou lze změnit na požadované pořadí. Řádky se stejným pořadovým číslem budou přečíslovány vzestupně.');
|
---|
327 |
|
---|
328 | echo($PageList['Output']);
|
---|
329 | echo('<table class="BaseTable">');
|
---|
330 | echo($Order['Output']);
|
---|
331 |
|
---|
332 | $Query = 'SELECT * FROM ('.$Query.') AS TX '.$Order['SQL'].$PageList['SQLLimit'];
|
---|
333 | $Database->SQLCommand('SET @I = 0');
|
---|
334 | $DbResult = $Database->SQLCommand($Query);
|
---|
335 | while($Langugage = mysql_fetch_assoc($DbResult))
|
---|
336 | {
|
---|
337 | $Checked = $Langugage['Sequence'] != '';
|
---|
338 | $Selection = CheckBox('sel'.$Langugage['Id'], $Checked, '', 'CheckBox', !$Editable);
|
---|
339 | $Sequence = '<input type="text" name="seq'.$Langugage['Id'].'" style="text-align: center; width: 40px;" value="'.$Langugage['Sequence2'].'"'.$DisabledInput[$Editable].'/>';
|
---|
340 | echo('<tr>
|
---|
341 | <td>'.$Langugage['Name'].'</a></td>
|
---|
342 | <td>'.$Selection.'</td><td>'.$Sequence.'</td></tr>');
|
---|
343 | }
|
---|
344 | echo('</table>');
|
---|
345 | echo('</form>');
|
---|
346 | echo($PageList['Output']);
|
---|
347 | } else echo('Položka nenalezena');
|
---|
348 | } else echo('Nebylo zadáno Id');
|
---|
349 | }
|
---|
350 |
|
---|
351 | function ExportViewGroups()
|
---|
352 | {
|
---|
353 | global $Database, $TranslationTree, $Config;
|
---|
354 |
|
---|
355 | $DisabledInput = array(false => ' disabled="disabled"', true => '');
|
---|
356 | if(array_key_exists('ExportId', $_GET))
|
---|
357 | {
|
---|
358 | $DbRows = $Database->SQLCommand('SELECT * FROM Export WHERE Id='.$_GET['ExportId']);
|
---|
359 | if(mysql_num_rows($DbRows) > 0)
|
---|
360 | {
|
---|
361 | $Export = mysql_fetch_assoc($DbRows);
|
---|
362 | if(Licence(LICENCE_USER) and ($_SESSION['UserID'] == $Export['User'])) $Editable = true;
|
---|
363 | else $Editable = false;
|
---|
364 |
|
---|
365 | if(array_key_exists('Operation', $_GET))
|
---|
366 | {
|
---|
367 | if($_GET['Operation'] == 'Save')
|
---|
368 | {
|
---|
369 | //print_r($_POST);
|
---|
370 | // Update user selection page
|
---|
371 | foreach($_POST as $Index => $Value)
|
---|
372 | {
|
---|
373 | if(substr($Index, 0, 3) == 'seq')
|
---|
374 | {
|
---|
375 | $GroupId = substr($Index, 3) * 1;
|
---|
376 | if(array_key_exists('sel'.$GroupId, $_POST)) $Selected = true;
|
---|
377 | else $Selected = false;
|
---|
378 | $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `Group`='.$GroupId;
|
---|
379 | $DbResult = $Database->SQLCommand('SELECT * FROM `ExportGroup` '.$Condition);
|
---|
380 | if(mysql_num_rows($DbResult) > 0)
|
---|
381 | {
|
---|
382 | if(!$Selected) $Database->SQLCommand('DELETE FROM `ExportGroup` '.$Condition);
|
---|
383 | } else
|
---|
384 | {
|
---|
385 | if($Selected) $Database->SQLCommand('INSERT INTO `ExportGroup` (`Export`, `Group`) VALUES ('.$_GET['ExportId'].', '.$GroupId.')');
|
---|
386 | }
|
---|
387 | }
|
---|
388 | }
|
---|
389 | }
|
---|
390 | }
|
---|
391 |
|
---|
392 | $Query = 'SELECT `group`.*, `ExportGroup`.`Id` AS `ExportGroupId` FROM `group` LEFT JOIN `ExportGroup` ON `ExportGroup`.`Export`='.$_GET['ExportId'].' AND `Group`=`group`.`Id`';
|
---|
393 |
|
---|
394 | $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$Query.') AS X');
|
---|
395 | $DbRow = mysql_fetch_row($DbResult);
|
---|
396 | $PageList = GetPageList($DbRow[0]);
|
---|
397 |
|
---|
398 | $TableColumns = array(
|
---|
399 | array('Name' => 'Name', 'Title' => 'Jméno'),
|
---|
400 | array('Name' => 'MangosTable', 'Title' => 'Tabulka MaNGOSu'),
|
---|
401 | array('Name' => 'DBCFileName', 'Title' => 'DBC soubor'),
|
---|
402 | array('Name' => 'LuaFileName', 'Title' => 'Lua soubor'),
|
---|
403 | array('Name' => '', 'Title' => 'Výběr'),
|
---|
404 | );
|
---|
405 | $Order = GetOrderTableHeader($TableColumns, 'Name');
|
---|
406 | echo('<form action="?Action=View&ExportId='.$_GET['ExportId'].'&Operation=Save" method="post">');
|
---|
407 | echo('<h3>Překladové skupiny</h3>');
|
---|
408 | echo('<input type="submit" value="Uložit" '.$DisabledInput[$Editable].'/><br />'.
|
---|
409 | 'Zvolte ze překladových skupin, ze kterých chcete načítat překlady.<br />');
|
---|
410 |
|
---|
411 | echo($PageList['Output']);
|
---|
412 | echo('<table class="BaseTable">');
|
---|
413 | echo($Order['Output']);
|
---|
414 |
|
---|
415 | $Query = 'SELECT * FROM ('.$Query.') AS TX '.$Order['SQL'].$PageList['SQLLimit'];
|
---|
416 | $DbResult = $Database->SQLCommand($Query);
|
---|
417 | while($Group = mysql_fetch_assoc($DbResult))
|
---|
418 | {
|
---|
419 | $Checked = $Group['ExportGroupId'] != '';
|
---|
420 | $Selection = CheckBox('sel'.$Group['Id'], $Checked, '', 'CheckBox', !$Editable);
|
---|
421 | echo('<tr>'.
|
---|
422 | '<td>'.$Group['Name'].'</td>'.
|
---|
423 | '<td>'.$Group['MangosTable'].'</td>'.
|
---|
424 | '<td>'.$Group['DBCFileName'].'</td>'.
|
---|
425 | '<td>'.$Group['LuaFileName'].'</td>'.
|
---|
426 | '<td>'.$Selection.'<input type="hidden" name="seq'.$Group['Id'].'"/></td></tr>');
|
---|
427 | }
|
---|
428 | echo('</table>');
|
---|
429 | echo('</form>');
|
---|
430 | echo($PageList['Output']);
|
---|
431 | } else echo('Položka nenalezena');
|
---|
432 | } else echo('Nebylo zadáno Id');
|
---|
433 | }
|
---|
434 |
|
---|
435 | function ExportViewOutputFormat()
|
---|
436 | {
|
---|
437 | global $Database;
|
---|
438 |
|
---|
439 | $DisabledInput = array(false => ' disabled="disabled"', true => '');
|
---|
440 | if(array_key_exists('ExportId', $_GET))
|
---|
441 | {
|
---|
442 | $DbRows = $Database->SQLCommand('SELECT * FROM Export WHERE Id='.$_GET['ExportId']);
|
---|
443 | if(mysql_num_rows($DbRows) > 0)
|
---|
444 | {
|
---|
445 | $Export = mysql_fetch_assoc($DbRows);
|
---|
446 | if(Licence(LICENCE_USER) and ($_SESSION['UserID'] == $Export['User'])) $Editable = true;
|
---|
447 | else $Editable = false;
|
---|
448 |
|
---|
449 | if(array_key_exists('OutputType', $_POST))
|
---|
450 | {
|
---|
451 | $Database->SQLCommand('UPDATE Export SET OutputType='.$_POST['OutputType'].' WHERE Id='.$_GET['ExportId']);
|
---|
452 | }
|
---|
453 |
|
---|
454 | $DbResult = $Database->SQLCommand('SELECT * FROM Export WHERE Id='.$_GET['ExportId']);
|
---|
455 | $Export = mysql_fetch_assoc($DbResult);
|
---|
456 |
|
---|
457 | echo('<h3>Formát generovaného výstupu</h3>');
|
---|
458 | echo('<form action="?Action=View&ExportId='.$_GET['ExportId'].'&Operation=Save" method="post">');
|
---|
459 | echo('<input type="submit" value="Uložit" '.$DisabledInput[$Editable].'/><br/>');
|
---|
460 | $DbResult = $Database->SQLCommand('SELECT * FROM ExportOutputType ORDER BY Name');
|
---|
461 | while($ExportFormat = mysql_fetch_assoc($DbResult))
|
---|
462 | {
|
---|
463 | echo(RadioButton('OutputType', $ExportFormat['Id'], $Export['OutputType'] == $ExportFormat['Id'], '', !$Editable).' '.$ExportFormat['Name'].'<br/>');
|
---|
464 | }
|
---|
465 | echo('</form>');
|
---|
466 | } else echo('Položka nenalezena');
|
---|
467 | } else echo('Nebylo zadáno Id');
|
---|
468 | }
|
---|
469 |
|
---|
470 | function ExportViewVersion()
|
---|
471 | {
|
---|
472 | global $Database, $Config;
|
---|
473 |
|
---|
474 | $DisabledInput = array(false => ' disabled="disabled"', true => '');
|
---|
475 | if(array_key_exists('ExportId', $_GET))
|
---|
476 | {
|
---|
477 | $DbRows = $Database->SQLCommand('SELECT * FROM Export WHERE Id='.$_GET['ExportId']);
|
---|
478 | if(mysql_num_rows($DbRows) > 0)
|
---|
479 | {
|
---|
480 | $Export = mysql_fetch_assoc($DbRows);
|
---|
481 | if(Licence(LICENCE_USER) and ($_SESSION['UserID'] == $Export['User'])) $Editable = true;
|
---|
482 | else $Editable = false;
|
---|
483 |
|
---|
484 | if(array_key_exists('ClientVersion', $_POST))
|
---|
485 | {
|
---|
486 | $Database->SQLCommand('UPDATE Export SET ClientVersion='.$_POST['ClientVersion'].' WHERE Id='.$_GET['ExportId']);
|
---|
487 | }
|
---|
488 |
|
---|
489 | $DbResult = $Database->SQLCommand('SELECT * FROM Export WHERE Id='.$_GET['ExportId']);
|
---|
490 | $Export = mysql_fetch_assoc($DbResult);
|
---|
491 |
|
---|
492 | $Query = 'SELECT wow_client_version.* FROM ExportVersion LEFT JOIN wow_client_version ON wow_client_version.Id=ExportVersion.ClientVersion WHERE ExportType='.$Export['OutputType'];
|
---|
493 |
|
---|
494 | $DbResult = $Database->SQLCommand('SELECT COUNT(*) FROM ('.$Query.') AS X');
|
---|
495 | $DbRow = mysql_fetch_row($DbResult);
|
---|
496 | $PageList = GetPageList($DbRow[0]);
|
---|
497 |
|
---|
498 | $TableColumns = array(
|
---|
499 | array('Name' => 'Version', 'Title' => 'Verze'),
|
---|
500 | array('Name' => 'BuildNumber', 'Title' => 'Sestavení'),
|
---|
501 | array('Name' => 'ReleaseDate', 'Title' => 'Datum uvolnění'),
|
---|
502 | array('Name' => 'Title', 'Title' => 'Titutek'),
|
---|
503 | array('Name' => '', 'Title' => 'Výběr'),
|
---|
504 | );
|
---|
505 | $Order = GetOrderTableHeader($TableColumns, 'BuildNumber', 1);
|
---|
506 | echo('<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">');
|
---|
507 | echo('<h3>Verze klienta</h3>');
|
---|
508 |
|
---|
509 | echo('<input type="submit" value="Uložit" '.$DisabledInput[$Editable].'/><br />
|
---|
510 | Vyberte pro jakou verzi herního klienta se budou texty exportovat.<br />');
|
---|
511 | echo($PageList['Output']);
|
---|
512 | echo('<table class="BaseTable">');
|
---|
513 | echo($Order['Output']);
|
---|
514 |
|
---|
515 | $Query = 'SELECT * FROM ('.$Query.') AS TX '.$Order['SQL'].$PageList['SQLLimit'];
|
---|
516 | $DbResult = $Database->SQLCommand($Query);
|
---|
517 | while($Version = mysql_fetch_assoc($DbResult))
|
---|
518 | {
|
---|
519 | echo('<tr><td><a href="http://www.wowwiki.com/Patch_'.$Version['Version'].'">'.$Version['Version'].'</a></td><td>'.$Version['BuildNumber'].'</td><td>'.HumanDate($Version['ReleaseDate']).'</td><td>'.$Version['Title'].'</td><td>'.RadioButton('ClientVersion', $Version['Id'], $Export['ClientVersion'] == $Version['Id'], '', !$Editable
|
---|
520 | ).'</td></tr>');
|
---|
521 |
|
---|
522 | }
|
---|
523 | echo('</table>');
|
---|
524 | echo('</form>');
|
---|
525 | echo($PageList['Output']);
|
---|
526 | } else echo('Položka nenalezena');
|
---|
527 | } else echo('Nebylo zadáno Id');
|
---|
528 | }
|
---|
529 |
|
---|
530 | function ExportViewOutput()
|
---|
531 | {
|
---|
532 | global $Database;
|
---|
533 |
|
---|
534 | $DbResult = $Database->SQLCommand('SELECT * FROM Export WHERE Id='.$_GET['ExportId']);
|
---|
535 | $Export = mysql_fetch_assoc($DbResult);
|
---|
536 | $DbResult = $Database->SQLCommand('SELECT * FROM ExportOutputType WHERE Id='.$Export['OutputType']);
|
---|
537 | if(mysql_num_rows($DbResult) > 0)
|
---|
538 | {
|
---|
539 | $DbResult = $Database->SQLCommand('SELECT * FROM ExportVersion WHERE ExportType='.$Export[ 'OutputType'].' AND ClientVersion='.$Export['ClientVersion']);
|
---|
540 | if(mysql_num_rows($DbResult) > 0)
|
---|
541 | {
|
---|
542 | $Database->SQLCommand('UPDATE Export SET UsedCount = UsedCount + 1 WHERE Id='.$Export['Id']);
|
---|
543 | ExportOutput($Export['Id'], $Export['OutputType']);
|
---|
544 | } else echo('Nebyla vybrána požadovaná verze klienta');
|
---|
545 | } else echo('Nebyl vybrán formát výstupu.');
|
---|
546 | }
|
---|
547 |
|
---|
548 | function ExportView()
|
---|
549 | {
|
---|
550 | global $Database;
|
---|
551 |
|
---|
552 | $DbResult = $Database->SQLCommand('SELECT * FROM Export WHERE Id='.$_GET['ExportId']);
|
---|
553 | $Export = mysql_fetch_assoc($DbResult);
|
---|
554 | $DbResult = $Database->SQLCommand('SELECT * FROM user WHERE ID='.$Export['User']);
|
---|
555 | $User = mysql_fetch_assoc($DbResult);
|
---|
556 | echo('Export <strong><a href="?Action=View&Tab=6&ExportId='.$Export['Id'].'">'.$_GET['ExportId'].'</a></strong> překladatele <strong>'.$User['user'].'</strong> s označením <strong>'.$Export['Title'].'</strong>');
|
---|
557 | ShowTabs(array('Obecné', 'Překladatelé', 'Překlady', 'Jazyky', 'Formát', 'Verze', 'Výstup'));
|
---|
558 | echo('<div id="content">');
|
---|
559 | if($_SESSION['Tab'] == 0) ExportViewGeneral();
|
---|
560 | else if($_SESSION['Tab'] == 1) ExportViewTranslators();
|
---|
561 | else if($_SESSION['Tab'] == 2) ExportViewGroups();
|
---|
562 | else if($_SESSION['Tab'] == 3) ExportViewLanguages();
|
---|
563 | else if($_SESSION['Tab'] == 4) ExportViewOutputFormat();
|
---|
564 | else if($_SESSION['Tab'] == 5) ExportViewVersion();
|
---|
565 | else if($_SESSION['Tab'] == 6) ExportViewOutput();
|
---|
566 |
|
---|
567 | echo('</div>');
|
---|
568 | }
|
---|
569 |
|
---|
570 | ShowPage();
|
---|
571 |
|
---|
572 | if(array_key_exists('Action', $_GET))
|
---|
573 | {
|
---|
574 | if($_GET['Action'] == 'Create') ExportCreate();
|
---|
575 | else if($_GET['Action'] == 'CreateFinish') ExportCreateFinish();
|
---|
576 | else if($_GET['Action'] == 'View') ExportView();
|
---|
577 | else if($_GET['Action'] == 'Delete') ExportDelete();
|
---|
578 | else ExportList();
|
---|
579 | } else ExportList();
|
---|
580 |
|
---|
581 | ShowFooter();
|
---|
582 |
|
---|
583 | ?>
|
---|