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