1 | <?php
|
---|
2 |
|
---|
3 | include_once('ExportOutput.php');
|
---|
4 |
|
---|
5 | define('TAB_GENERAL', 0);
|
---|
6 | define('TAB_TRANSLATORS', 1);
|
---|
7 | define('TAB_GROUPS', 2);
|
---|
8 | define('TAB_LANGUAGES', 3);
|
---|
9 | define('TAB_OUTPUT_FORMAT', 4);
|
---|
10 | define('TAB_VERSION', 5);
|
---|
11 | define('TAB_STAT', 6);
|
---|
12 | define('TAB_OUTPUT', 7);
|
---|
13 |
|
---|
14 | class PageExport extends Page
|
---|
15 | {
|
---|
16 | function ExportList()
|
---|
17 | {
|
---|
18 | $Output = '<a href="?Action=ViewList">Všechny</a>';
|
---|
19 | if($this->System->User->Licence(LICENCE_USER))
|
---|
20 | {
|
---|
21 | $Output .= ' <a href="?Action=ViewList&Filter=Others">Ostatních</a>'.
|
---|
22 | ' <a href="?Action=ViewList&Filter=My">Moje</a>';
|
---|
23 | }
|
---|
24 |
|
---|
25 | if($this->System->User->Licence(LICENCE_USER))
|
---|
26 | $Output .= '<br/><div style="text-align: center;"><a href="?Action=Create">Vytvořit nový export</a></div><br/>';
|
---|
27 |
|
---|
28 | $Filter = '';
|
---|
29 | if(array_key_exists('Filter', $_GET))
|
---|
30 | {
|
---|
31 | if($_GET['Filter'] == 'My') $Filter = ' WHERE `Export`.`User` = '.$this->System->User->Id;
|
---|
32 | if($_GET['Filter'] == 'Others') $Filter = ' WHERE `Export`.`User` != '.$this->System->User->Id;
|
---|
33 | }
|
---|
34 |
|
---|
35 | $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` '.$Filter);
|
---|
36 | $DbRow = $DbResult->fetch_row();
|
---|
37 | $PageList = GetPageList($DbRow[0]);
|
---|
38 |
|
---|
39 | $Output .= '<h3>Seznam exportů</h3>'.
|
---|
40 | $PageList['Output'];
|
---|
41 |
|
---|
42 | $TableColumns = array(
|
---|
43 | array('Name' => 'TimeCreate', 'Title' => 'Čas vytvoření'),
|
---|
44 | array('Name' => 'UserName', 'Title' => 'Překladatel'),
|
---|
45 | array('Name' => 'Title', 'Title' => 'Označení'),
|
---|
46 | // array('Name' => 'UserCount', 'Title' => 'Vybraných překladatelů'),
|
---|
47 | // array('Name' => 'GroupCount', 'Title' => 'Překladových skupin'),
|
---|
48 | array('Name' => 'OutputType', 'Title' => 'Typ výstupu'),
|
---|
49 | array('Name' => 'ClientVersion', 'Title' => 'Verze klienta'),
|
---|
50 | array('Name' => 'UsedCount', 'Title' => 'Prohlédnutí výstupu'),
|
---|
51 | array('Name' => '', 'Title' => 'Akce'),
|
---|
52 | );
|
---|
53 | $Order = GetOrderTableHeader($TableColumns, 'TimeCreate', 1);
|
---|
54 | $Output .= '<table class="BaseTable">'.
|
---|
55 | $Order['Output'];
|
---|
56 |
|
---|
57 | $DbResult = $this->System->Database->query('SELECT `User`.`Name` AS `UserName`, `Export`.`Id`, `Export`.`TimeCreate`, `Export`.`Title`, `Export`.`User`, `Export`.`UsedCount`, (SELECT Version FROM `ClientVersion` WHERE `ClientVersion`.`Id`=`Export`.`ClientVersion`) AS `ClientVersion`,(SELECT Name FROM `ExportOutputType` WHERE `ExportOutputType`.`Id`=`Export`.`OutputType`) AS `OutputType`, (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']);
|
---|
58 | while($Export = $DbResult->fetch_assoc())
|
---|
59 | {
|
---|
60 | $Action = '<a href="?Action=View&ExportId='.$Export['Id'].'&Tab=0">Zobrazit</a> '.
|
---|
61 | '<a href="?Action=View&ExportId='.$Export['Id'].'&Tab=7">Exportovat</a>';
|
---|
62 | if($Export['User'] == $this->System->User->Id) $Action .= ' <a href="?Action=Delete&ExportId='.$Export['Id'].'" onclick="return confirmAction(\'Opravdu smazat položku?\');">Smazat</a>';
|
---|
63 | if($this->System->User->Id != null) $Action .= ' <a href="?Action=Clone&ExportId='.$Export['Id'].'" onclick="return confirmAction(\'Opravdu klonovat položku?\');">Klonovat</a>';
|
---|
64 | $Output .= '<tr><td>'.HumanDate($Export['TimeCreate']).'</td>'.
|
---|
65 | '<td><a href="'.$this->System->Link('/user.php?user='.$Export['User']).'">'.$Export['UserName'].'</a></td>'.
|
---|
66 | '<td>'.$Export['Title'].'</td>'.
|
---|
67 | '<td>'.$Export['OutputType'].'</td>'.
|
---|
68 | '<td>'.$Export['ClientVersion'].'</td>'.
|
---|
69 | '<td>'.$Export['UsedCount'].'</td>'.
|
---|
70 | '<td>'.$Action.'</td></tr>';
|
---|
71 | }
|
---|
72 | $Output .= '</table>'.
|
---|
73 | $PageList['Output'];
|
---|
74 |
|
---|
75 | return($Output);
|
---|
76 | }
|
---|
77 |
|
---|
78 | function ExportCreate()
|
---|
79 | {
|
---|
80 | if($this->System->User->Licence(LICENCE_USER))
|
---|
81 | {
|
---|
82 | $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id);
|
---|
83 | $DbRow = $DbResult->fetch_row();
|
---|
84 | if($DbRow[0] < $this->System->Config['MaxExportPerUser'])
|
---|
85 | {
|
---|
86 | $Output = '<form action="?Action=CreateFinish" method="post">'.
|
---|
87 | '<fieldset><legend>Vytvoření nového exportu</legend>'.
|
---|
88 | '<table><tr><td>Označení:</td><td><input type="text" name="Title" /></td></tr>'.
|
---|
89 | '<tr><td>Popis:</td><td><textarea name="Description" cols="54" rows="10"></textarea></td></tr>'.
|
---|
90 | '<tr><td colspan="2"><input type="submit" value="Vytvořit" /></td></tr>'.
|
---|
91 | '</table></fieldset></form>';
|
---|
92 | } else $Output = ShowMessage('Nemůžete vytvářet další export. Max. počet na uživatele je '.$this->System->Config['MaxExportPerUser'].'.', MESSAGE_CRITICAL);
|
---|
93 | } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
|
---|
94 | return($Output);
|
---|
95 | }
|
---|
96 |
|
---|
97 | function ExportCreateFinish()
|
---|
98 | {
|
---|
99 | if($this->System->User->Licence(LICENCE_USER))
|
---|
100 | {
|
---|
101 | if(array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST))
|
---|
102 | {
|
---|
103 | $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id);
|
---|
104 | $DbRow = $DbResult->fetch_row();
|
---|
105 | if($DbRow[0] < $this->System->Config['MaxExportPerUser'])
|
---|
106 | {
|
---|
107 | $this->System->Database->query('INSERT INTO `Export` (`Title`, `User`, `TimeCreate`, `WithDiacritic`, `Description`) VALUES ("'.$_POST['Title'].'", '.$this->System->User->Id.', NOW(), 1, "'.$_POST['Description'].'")');
|
---|
108 | $ExportId = $this->System->Database->insert_id;
|
---|
109 | $Output = ShowMessage('Nový export vytvořen.<br/>Přímý odkaz na tento export: <a href="?Action=View&ExportId='.$ExportId.'">zde</a>');
|
---|
110 | $this->System->ModuleManager->Modules['Log']->WriteLog('Vytvořen nový export <a href="'.$this->System->Link('/export/?Action=View&ExportId='.$ExportId).'">'.$ExportId.'</a>.', LOG_TYPE_EXPORT);
|
---|
111 | $_GET['Filter'] = 'my';
|
---|
112 | $this->ExportList();
|
---|
113 | } else $Output = ShowMessage('Nemůžete vytvářet další export. Max. počet na uživatele je '.$this->System->Config['MaxExportPerUser'].'.', MESSAGE_CRITICAL);
|
---|
114 | } else $Output = ShowMessage('Chybí údaje formuláře.', MESSAGE_CRITICAL);
|
---|
115 | } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
|
---|
116 | return($Output);
|
---|
117 | }
|
---|
118 |
|
---|
119 | function ExportDelete()
|
---|
120 | {
|
---|
121 | if($this->System->User->Licence(LICENCE_USER))
|
---|
122 | {
|
---|
123 | $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE (`Id`='.($_GET['ExportId'] * 1).') AND (`User`='.$this->System->User->Id.')');
|
---|
124 | if($DbResult->num_rows > 0)
|
---|
125 | {
|
---|
126 | $this->System->Database->query('DELETE FROM `ExportGroup` WHERE `Export`='.$_GET['ExportId']);
|
---|
127 | $this->System->Database->query('DELETE FROM `ExportLanguage` WHERE `Export`='.$_GET['ExportId']);
|
---|
128 | $this->System->Database->query('DELETE FROM `ExportTask` WHERE `Export`='.$_GET['ExportId']);
|
---|
129 | $this->System->Database->query('DELETE FROM `ExportUser` WHERE `Export`='.$_GET['ExportId']);
|
---|
130 | $this->System->Database->query('DELETE FROM `Export` WHERE `Id`='.$_GET['ExportId']);
|
---|
131 | DeleteDirectory('../tmp/Export/'.$_GET['ExportId'].'/');
|
---|
132 | $Output = ShowMessage('Export smazán.');
|
---|
133 | $_GET['Filter'] = 'my';
|
---|
134 | $this->System->ModuleManager->Modules['Log']->WriteLog('Smazán export '.$_GET['ExportId'], LOG_TYPE_EXPORT);
|
---|
135 | $Output .= $this->ExportList();
|
---|
136 | } else $Output = ShowMessage('Export nenalezen.', MESSAGE_CRITICAL);
|
---|
137 | } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
|
---|
138 | return($Output);
|
---|
139 | }
|
---|
140 |
|
---|
141 | function SaveAllUsers()
|
---|
142 | {
|
---|
143 | global $System;
|
---|
144 | $Export = new Export($System);
|
---|
145 | $Export->Id = $_GET['ExportId'];
|
---|
146 | $Export->SaveAllUsers();
|
---|
147 |
|
---|
148 | }
|
---|
149 |
|
---|
150 | function ExportViewTranslators()
|
---|
151 | {
|
---|
152 | global $TranslationTree;
|
---|
153 |
|
---|
154 | $Output = '';
|
---|
155 | $DisabledInput = array(false => ' disabled="disabled"', true => '');
|
---|
156 | $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
|
---|
157 | $Export = $DbResult->fetch_assoc();
|
---|
158 | if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
|
---|
159 | else $Editable = false;
|
---|
160 |
|
---|
161 | if(array_key_exists('Operation', $_POST))
|
---|
162 | {
|
---|
163 | if($_POST['Operation'] == 'Save')
|
---|
164 | {
|
---|
165 | //print_r($_POST);
|
---|
166 | // Update user selection page
|
---|
167 | foreach($_POST as $Index => $Value)
|
---|
168 | {
|
---|
169 | if(substr($Index, 0, 3) == 'seq')
|
---|
170 | {
|
---|
171 | $UserId = substr($Index, 3) * 1;
|
---|
172 | if(array_key_exists('sel'.$UserId, $_POST)) $Selected = true;
|
---|
173 | else $Selected = false;
|
---|
174 | $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `User`='.$UserId;
|
---|
175 | $DbResult = $this->System->Database->query('SELECT * FROM `ExportUser` '.$Condition);
|
---|
176 | if($DbResult->num_rows > 0)
|
---|
177 | {
|
---|
178 | if(!$Selected) $this->System->Database->query('DELETE FROM `ExportUser` '.$Condition);
|
---|
179 | else $this->System->Database->query('UPDATE `ExportUser` SET `Sequence`='.$Value.$Condition);
|
---|
180 | } else
|
---|
181 | {
|
---|
182 | if($Selected) $this->System->Database->query('INSERT INTO `ExportUser` (`Export`, `User`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$UserId.', '.$Value.')');
|
---|
183 | }
|
---|
184 | }
|
---|
185 | }
|
---|
186 |
|
---|
187 | if (array_key_exists('AllUsers', $_POST)) {
|
---|
188 | //add allusers to export
|
---|
189 | $this->System->Database->query('UPDATE `Export` SET `AllUsers`=1 WHERE `Id`='.$_GET['ExportId']);
|
---|
190 |
|
---|
191 | //update export stat
|
---|
192 | $Export['AllUsers'] = 1;
|
---|
193 | $this->SaveAllUsers();
|
---|
194 | } else {
|
---|
195 | //update export stat
|
---|
196 | $Export['AllUsers'] = 0;
|
---|
197 | $this->System->Database->query('UPDATE `Export` SET `AllUsers`=0 WHERE `Id`='.$_GET['ExportId']);
|
---|
198 | }
|
---|
199 |
|
---|
200 | // Recalculate sequence number
|
---|
201 | $this->System->Database->query('SET @I = 0');
|
---|
202 | $this->System->Database->query('UPDATE `ExportUser` SET `Sequence` = (@I := @I + 1) WHERE `Export`='.$_GET['ExportId'].' ORDER BY `Sequence`;');
|
---|
203 | $Output .= ShowMessage('Výběr uložen.');
|
---|
204 | }
|
---|
205 | }
|
---|
206 |
|
---|
207 | $TableColumns = array(
|
---|
208 | array('Name' => 'Name', 'Title' => 'Jméno'),
|
---|
209 | array('Name' => 'TranslatedCount', 'Title' => 'Překladů'),
|
---|
210 | array('Name' => 'XP', 'Title' => 'Úroveň'),
|
---|
211 | array('Name' => 'XP', 'Title' => 'Zkušenost'),
|
---|
212 | array('Name' => '', 'Title' => 'Výběr'),
|
---|
213 | array('Name' => 'Sequence2', 'Title' => 'Pořadí'),
|
---|
214 | );
|
---|
215 | $Order = GetOrderTableHeader($TableColumns, 'TranslatedCount', 1);
|
---|
216 | if($Order['Column'] != 'Sequence2') $InitialOrder = ', '.substr($Order['SQL'], 10);
|
---|
217 | else $InitialOrder = '';
|
---|
218 |
|
---|
219 | $Query = 'SELECT (@I := @I + 1) AS `Sequence2`, `TT`.* FROM (SELECT `ExportUser`.`Sequence`, `T`.`ID`, `T`.`TranslatedCount`, `T`.`Name`, `T`.`XP` FROM (SELECT `User`.`ID`, `User`.`Name`, `User`.`XP`, `TranslatedCount` FROM `User`) AS T';
|
---|
220 | $Query .=' LEFT JOIN `ExportUser` ON `ExportUser`.`Export` = '.$_GET['ExportId'].' AND `ExportUser`.`User`=`T`.`ID`';
|
---|
221 | $Query .=' WHERE `T`.`TranslatedCount` > 0 ORDER BY COALESCE(`ExportUser`.`Sequence`, 100000000)'.$InitialOrder.') AS `TT`';
|
---|
222 |
|
---|
223 | $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS `X`');
|
---|
224 | $DbRow = $DbResult->fetch_row();
|
---|
225 | $PageList = GetPageList($DbRow[0]);
|
---|
226 |
|
---|
227 | $Output .= '<form name="Translators" action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'.
|
---|
228 | '<h3>Překladatelé</h3>';
|
---|
229 | if($Editable)
|
---|
230 | {
|
---|
231 | $Output .= '<input type="submit" value="Uložit" '.$DisabledInput[$Editable].'/>'.
|
---|
232 | '<input type="hidden" name="Operation" value="Save"/><br />'.
|
---|
233 | ' <span onclick="CheckAllCheckbox();">'.CheckBox('CheckAll', False, 'CheckAll').' Zatrhnout vše na stránce</span> <br />'.
|
---|
234 | ' <span>'.CheckBox('AllUsers', $Export['AllUsers']).' '.T('Export allways from all users').'</span> '.
|
---|
235 | '<br />'.
|
---|
236 | 'Zvolte ze seznamu uživatele, od kterých chcete načítat překlady a upravte jejich pořadí.<br />'.
|
---|
237 | '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ě.';
|
---|
238 | }
|
---|
239 |
|
---|
240 | $Output .= $PageList['Output'].
|
---|
241 | '<table class="BaseTable">'.
|
---|
242 | $Order['Output'];
|
---|
243 |
|
---|
244 | $Query = 'SELECT * FROM ('.$Query.') AS `TX` '.$Order['SQL'].$PageList['SQLLimit'];
|
---|
245 | $this->System->Database->query('SET @I = 0');
|
---|
246 | $DbResult = $this->System->Database->query($Query);
|
---|
247 | while($UserLine = $DbResult->fetch_assoc())
|
---|
248 | {
|
---|
249 | $XP = GetLevelMinMax($UserLine['XP']);
|
---|
250 | $Checked = $UserLine['Sequence'] != '';
|
---|
251 | $Selection = CheckBox('sel'.$UserLine['ID'], $Checked, '', 'CheckBox', ((!$Editable) or ($Export['AllUsers'])));
|
---|
252 | $Sequence = '<input type="text" name="seq'.$UserLine['ID'].'" style="text-align: center; width: 40px;" value="'.$UserLine['Sequence2'].'"'.$DisabledInput[$Editable].'/>';
|
---|
253 | $Output .= '<tr>'.
|
---|
254 | '<td><a href="'.$this->System->Link('/TranslationList.php?user='.$UserLine['ID'].'&state=2&group=0').'" title="Zobrazit všechny jeho přeložené texty">'.$UserLine['Name'].'</a></td>'.
|
---|
255 | '<td>'.$UserLine['TranslatedCount'].'</td>'.
|
---|
256 | '<td>'.$XP['Level'].'</td>'.
|
---|
257 | '<td>'.ProgressBar(150, round($XP['XP'] / $XP['MaxXP'] * 100, 2), $XP['XP'].' / '.$XP['MaxXP']).'</td>'.
|
---|
258 | '<td>'.$Selection.'</td><td>'.$Sequence.'</td></tr>';
|
---|
259 | }
|
---|
260 | $Output .= '</table>'.
|
---|
261 | '</form>'.
|
---|
262 | $PageList['Output'];
|
---|
263 | return($Output);
|
---|
264 | }
|
---|
265 |
|
---|
266 | function ExportViewGeneral()
|
---|
267 | {
|
---|
268 | $DisabledInput = array(false => ' disabled="disabled"', true => '');
|
---|
269 | $DisabledTextArea = array(false => ' readonly="yes"', true => '');
|
---|
270 | $Output = '<h3>Obecná nastavení</h3>';
|
---|
271 | $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
|
---|
272 | $Export = $DbRows->fetch_assoc();
|
---|
273 | if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
|
---|
274 | else $Editable = false;
|
---|
275 |
|
---|
276 | if(array_key_exists('Operation', $_POST))
|
---|
277 | if($_POST['Operation'] == 'Save') if($Editable and array_key_exists('Title', $_POST) and array_key_exists('Description', $_POST))
|
---|
278 | {
|
---|
279 | if(array_key_exists('WithDiacritic', $_POST)) $WithDiacritic = 1;
|
---|
280 | else $WithDiacritic = 0;
|
---|
281 | $this->System->Database->query('UPDATE `Export` SET `Title`="'.$_POST['Title'].'", `Description`="'.$_POST['Description'].'", `WithDiacritic`='.$WithDiacritic.' WHERE Id='.$Export['Id']);
|
---|
282 | $Export['Title'] = $_POST['Title'];
|
---|
283 | $Export['Description'] = $_POST['Description'];
|
---|
284 | $Export['WithDiacritic'] = $WithDiacritic;
|
---|
285 | $Output .= ShowMessage('Nastavení uloženo.');
|
---|
286 | }
|
---|
287 |
|
---|
288 | if($Export['WithDiacritic'] == 1) $WithDiacritic = ' checked="checked"';
|
---|
289 | else $WithDiacritic = '';
|
---|
290 | $Output .= '<form action="?Action=View&Tab=0&ExportId='.$Export['Id'].'" method="post">'.
|
---|
291 | '<table>';
|
---|
292 | if($Editable)
|
---|
293 | {
|
---|
294 | $Output .= '<input type="hidden" name="Operation" value="Save"/>'.
|
---|
295 | '<tr><td colspan="2"><input type="submit" value="Uložit" '.$DisabledInput[$Editable].'/></td></tr>';
|
---|
296 | }
|
---|
297 | $Output .= '<tr><td>Označení:</td><td><input type="text" style="width: 400px" name="Title" value="'.$Export['Title'].'"'.$DisabledInput[$Editable].'/></td></tr>'.
|
---|
298 | '<tr><td>Popis:</td><td><textarea name="Description" cols="54" rows="10"'.$DisabledTextArea[$Editable].'>'.$Export['Description'].'</textarea></td></tr>'.
|
---|
299 | '<tr><td>Včetně háčků a čárek</td><td><input type="checkbox" name="WithDiacritic" '.$WithDiacritic.''.$DisabledInput[$Editable].'/></td></tr>'.
|
---|
300 | '</table></form>';
|
---|
301 | return($Output);
|
---|
302 | }
|
---|
303 |
|
---|
304 | function ExportViewLanguages()
|
---|
305 | {
|
---|
306 | global $TranslationTree;
|
---|
307 |
|
---|
308 | $Output = '';
|
---|
309 | $DisabledInput = array(false => ' disabled="disabled"', true => '');
|
---|
310 | $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
|
---|
311 | $Export = $DbRows->fetch_assoc();
|
---|
312 | if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
|
---|
313 | else $Editable = false;
|
---|
314 |
|
---|
315 | if(array_key_exists('Operation', $_POST))
|
---|
316 | {
|
---|
317 | if($_POST['Operation'] == 'Save')
|
---|
318 | {
|
---|
319 | //print_r($_POST);
|
---|
320 | // Update user selection page
|
---|
321 | foreach($_POST as $Index => $Value)
|
---|
322 | {
|
---|
323 | if(substr($Index, 0, 3) == 'seq')
|
---|
324 | {
|
---|
325 | $LanguageId = substr($Index, 3) * 1;
|
---|
326 | if(array_key_exists('sel'.$LanguageId, $_POST)) $Selected = true;
|
---|
327 | else $Selected = false;
|
---|
328 | $Condition = ' WHERE Export='.$_GET['ExportId'].' AND `Language`='.$LanguageId;
|
---|
329 | $DbResult = $this->System->Database->query('SELECT * FROM `ExportLanguage` '.$Condition);
|
---|
330 | if($DbResult->num_rows > 0)
|
---|
331 | {
|
---|
332 | if(!$Selected) $this->System->Database->query('DELETE FROM `ExportLanguage` '.$Condition);
|
---|
333 | else $this->System->Database->query('UPDATE `ExportLanguage` SET `Sequence`='.$Value.$Condition);
|
---|
334 | } else
|
---|
335 | {
|
---|
336 | if($Selected) $this->System->Database->query('INSERT INTO `ExportLanguage` (`Export`, `Language`, `Sequence`) VALUES ('.$_GET['ExportId'].', '.$LanguageId.', '.$Value.')');
|
---|
337 | }
|
---|
338 | }
|
---|
339 | }
|
---|
340 |
|
---|
341 | // Recalculate sequence number
|
---|
342 | $this->System->Database->query('SET @I = 0');
|
---|
343 | $this->System->Database->query('UPDATE `ExportLanguage` SET `Sequence` = (@I := @I + 1) WHERE `Export`='.$_GET['ExportId'].' ORDER BY `Sequence`;');
|
---|
344 | $Output .= ShowMessage('Výběr uložen.');
|
---|
345 | }
|
---|
346 | }
|
---|
347 |
|
---|
348 | $Query = 'SELECT (@I := @I + 1) AS `Sequence2`, `Sequence`, `Language`.`Id`, `Name` FROM `Language`';
|
---|
349 | $Query .=' LEFT JOIN `ExportLanguage` ON `ExportLanguage`.`Export` = '.$_GET['ExportId'].' AND `ExportLanguage`.`Language`=`Language`.`Id`';
|
---|
350 | $Query .=' WHERE `Language`.`Enabled` = 1 ORDER BY COALESCE(`Sequence`, 100)';
|
---|
351 |
|
---|
352 | $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS X');
|
---|
353 | $DbRow = $DbResult->fetch_row();
|
---|
354 | $PageList = GetPageList($DbRow[0]);
|
---|
355 |
|
---|
356 | $TableColumns = array(
|
---|
357 | array('Name' => 'Name', 'Title' => 'Název'),
|
---|
358 | array('Name' => '', 'Title' => 'Výběr'),
|
---|
359 | array('Name' => 'Sequence2', 'Title' => 'Pořadí'),
|
---|
360 | );
|
---|
361 | $Order = GetOrderTableHeader($TableColumns, 'Sequence2');
|
---|
362 | $Output .= '<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'.
|
---|
363 | '<h3>Jazyky</h3>';
|
---|
364 | if($Editable)
|
---|
365 | {
|
---|
366 | $Output .= '<input type="submit" value="Uložit" '.$DisabledInput[$Editable].'/>'.
|
---|
367 | '<input type="hidden" name="Operation" value="Save"/>'.
|
---|
368 | '<br />'.
|
---|
369 | 'Zvolte ze seznamu dostupných jazyků, ze kterých chcete sestavit překlady a upravte jejich pořadí.<br />'.
|
---|
370 | '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ě.';
|
---|
371 | }
|
---|
372 |
|
---|
373 | $Output .= $PageList['Output'].
|
---|
374 | '<table class="BaseTable">'.
|
---|
375 | $Order['Output'];
|
---|
376 |
|
---|
377 | $Query = 'SELECT * FROM ('.$Query.') AS TX '.$Order['SQL'].$PageList['SQLLimit'];
|
---|
378 | $this->System->Database->query('SET @I = 0');
|
---|
379 | $DbResult = $this->System->Database->query($Query);
|
---|
380 | while($Langugage = $DbResult->fetch_assoc())
|
---|
381 | {
|
---|
382 | $Checked = $Langugage['Sequence'] != '';
|
---|
383 | $Selection = CheckBox('sel'.$Langugage['Id'], $Checked, '', 'CheckBox', !$Editable);
|
---|
384 | $Sequence = '<input type="text" name="seq'.$Langugage['Id'].'" style="text-align: center; width: 40px;" value="'.$Langugage['Sequence2'].'"'.$DisabledInput[$Editable].'/>';
|
---|
385 | $Output .= '<tr>
|
---|
386 | <td>'.$Langugage['Name'].'</a></td>
|
---|
387 | <td>'.$Selection.'</td><td>'.$Sequence.'</td></tr>';
|
---|
388 | }
|
---|
389 | $Output .= '</table>'.
|
---|
390 | '</form>'.
|
---|
391 | $PageList['Output'];
|
---|
392 | return($Output);
|
---|
393 | }
|
---|
394 |
|
---|
395 | function ExportViewGroups()
|
---|
396 | {
|
---|
397 | global $TranslationTree;
|
---|
398 |
|
---|
399 | $Output = '';
|
---|
400 | $DisabledInput = array(false => ' disabled="disabled"', true => '');
|
---|
401 | $DbRows = $this->System->Database->query('SELECT * FROM Export WHERE Id='.$_GET['ExportId']);
|
---|
402 | $Export = $DbRows->fetch_assoc();
|
---|
403 | if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
|
---|
404 | else $Editable = false;
|
---|
405 |
|
---|
406 | if(array_key_exists('Operation', $_POST))
|
---|
407 | {
|
---|
408 | if($_POST['Operation'] == 'Save')
|
---|
409 | {
|
---|
410 | //print_r($_POST);
|
---|
411 | // Update user selection page
|
---|
412 | foreach($_POST as $Index => $Value)
|
---|
413 | {
|
---|
414 | if(substr($Index, 0, 3) == 'seq')
|
---|
415 | {
|
---|
416 | $GroupId = substr($Index, 3) * 1;
|
---|
417 | if(array_key_exists('sel'.$GroupId, $_POST)) $Selected = true;
|
---|
418 | else $Selected = false;
|
---|
419 | $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `Group`='.$GroupId;
|
---|
420 | $DbResult = $this->System->Database->query('SELECT * FROM `ExportGroup` '.$Condition);
|
---|
421 | if($DbResult->num_rows > 0)
|
---|
422 | {
|
---|
423 | if(!$Selected) $this->System->Database->query('DELETE FROM `ExportGroup` '.$Condition);
|
---|
424 | } else
|
---|
425 | {
|
---|
426 | if($Selected) $this->System->Database->query('INSERT INTO `ExportGroup` (`Export`, `Group`) VALUES ('.$_GET['ExportId'].', '.$GroupId.')');
|
---|
427 | }
|
---|
428 | }
|
---|
429 | }
|
---|
430 | $Output .= ShowMessage('Výběr uložen.');
|
---|
431 | }
|
---|
432 | //items
|
---|
433 | foreach($TranslationTree as $Group)
|
---|
434 | {
|
---|
435 | // echo $Group['Id'].' ';
|
---|
436 | foreach($TranslationTree[$Group['Id']]['Items'] as $Column) {
|
---|
437 | if(array_key_exists('item'.$Column['Id'], $_POST)) $Selected = true;
|
---|
438 | else $Selected = false;
|
---|
439 | //we will save only forbitten collums and need to be visible
|
---|
440 | $Selected = !$Selected;
|
---|
441 | if (!$Column['Visible']) $Selected = false;
|
---|
442 |
|
---|
443 | $Condition = ' WHERE `Export`='.$_GET['ExportId'].' AND `GroupItem`='.$Column['Id'];
|
---|
444 | $DbResult = $this->System->Database->query('SELECT * FROM `ExportGroupItem` '.$Condition);
|
---|
445 | if($DbResult->num_rows > 0)
|
---|
446 | {
|
---|
447 | if(!$Selected) $this->System->Database->query('DELETE FROM `ExportGroupItem` '.$Condition);
|
---|
448 | } else
|
---|
449 | {
|
---|
450 | if($Selected) $this->System->Database->query('INSERT INTO `ExportGroupItem` (`Export`, `GroupItem`) VALUES ('.$_GET['ExportId'].', '.$Column['Id'].')');
|
---|
451 | }
|
---|
452 |
|
---|
453 | }
|
---|
454 | }
|
---|
455 | }
|
---|
456 |
|
---|
457 | $Query = 'SELECT `Group`.*, `ExportGroup`.`Id` AS `ExportGroupId` FROM `Group` LEFT JOIN `ExportGroup` ON `ExportGroup`.`Export`='.$_GET['ExportId'].' AND `Group`=`Group`.`Id`';
|
---|
458 |
|
---|
459 | $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS X');
|
---|
460 | $DbRow = $DbResult->fetch_row();
|
---|
461 | $PageList = GetPageList($DbRow[0]);
|
---|
462 |
|
---|
463 | $TableColumns = array(
|
---|
464 | array('Name' => '', 'Title' => 'Výběr'),
|
---|
465 | array('Name' => 'Name', 'Title' => 'Jméno'),
|
---|
466 | array('Name' => 'MangosTable', 'Title' => 'Mangos/DBC/Lua'),
|
---|
467 | // array('Name' => 'DBCFileName', 'Title' => 'DBC soubor'),
|
---|
468 | // array('Name' => 'LuaFileName', 'Title' => 'Lua soubor'),
|
---|
469 | array('Name' => '', 'Title' => 'Položky překladu'),
|
---|
470 | );
|
---|
471 | $Order = GetOrderTableHeader($TableColumns, 'Name');
|
---|
472 | $Output .= '<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'.
|
---|
473 | '<h3>Překladové skupiny</h3>';
|
---|
474 | if($Editable)
|
---|
475 | {
|
---|
476 | $Output .= '<input type="submit" value="Uložit" '.$DisabledInput[$Editable].'/>'.
|
---|
477 | '<input type="hidden" name="Operation" value="Save"/>'.
|
---|
478 | ' <span onclick="CheckAllCheckbox();">'.CheckBox('CheckAll', False, 'CheckAll').' Zatrhnout vše</span> '.
|
---|
479 | '<br />'.
|
---|
480 | 'Zvolte ze překladových skupin, ze kterých chcete načítat překlady.<br />';
|
---|
481 | }
|
---|
482 |
|
---|
483 | $Output .= $PageList['Output'].
|
---|
484 | '<table class="BaseTable">'.
|
---|
485 | $Order['Output'];
|
---|
486 |
|
---|
487 | $DbResultItem = $this->System->Database->query('SELECT * FROM `ExportGroupItem` WHERE `Export`='.$_GET['ExportId']);
|
---|
488 | while($GroupItem = $DbResultItem->fetch_assoc())
|
---|
489 | {
|
---|
490 | $GroupItems[$GroupItem['GroupItem']] = 1;
|
---|
491 | }
|
---|
492 |
|
---|
493 | $Query = 'SELECT * FROM ('.$Query.') AS TX '.$Order['SQL'].$PageList['SQLLimit'];
|
---|
494 | $DbResult = $this->System->Database->query($Query);
|
---|
495 | while($Group = $DbResult->fetch_assoc())
|
---|
496 | {
|
---|
497 | $Columns = '';
|
---|
498 | foreach($TranslationTree[$Group['Id']]['Items'] as $Column) {
|
---|
499 | if ($Column['Visible']) $Columns .= CheckBox('item'.$Column['Id'], !isset($GroupItems[$Column['Id']]), '', 'CheckBox', !$Editable).' '.$Column['Name'].' <br />';
|
---|
500 | }
|
---|
501 | $Checked = $Group['ExportGroupId'] != '';
|
---|
502 | $Selection = CheckBox('sel'.$Group['Id'], $Checked, '', 'CheckBox', !$Editable);
|
---|
503 | $Output .= '<tr>'.
|
---|
504 | '<td>'.$Selection.'<input type="hidden" name="seq'.$Group['Id'].'"/></td>'.
|
---|
505 | '<td>'.$Group['Name'].'</td><td>';
|
---|
506 | if ($Group['MangosTable'] <> '')
|
---|
507 | $Output .= $Group['MangosTable'].'.sql ';
|
---|
508 | if ($Group['LuaFileName'] <> '')
|
---|
509 | $Output .= $Group['LuaFileName'].'.lua ';
|
---|
510 | if ($Group['DBCFileName'] <> '')
|
---|
511 | $Output .= $Group['DBCFileName'].'.dbc ';
|
---|
512 |
|
---|
513 | $Output .= '</td><td>';
|
---|
514 | $Output .= $Columns. '</td>';
|
---|
515 | $Output .= '</tr>';
|
---|
516 | }
|
---|
517 | $Output .= '</table>'.
|
---|
518 | '</form>'.
|
---|
519 | $PageList['Output'];
|
---|
520 | return($Output);
|
---|
521 | }
|
---|
522 |
|
---|
523 | function ExportViewOutputFormat()
|
---|
524 | {
|
---|
525 | $Output = '';
|
---|
526 | $DisabledInput = array(false => ' disabled="disabled"', true => '');
|
---|
527 | if(array_key_exists('ExportId', $_GET))
|
---|
528 | {
|
---|
529 | $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
|
---|
530 | if($DbRows->num_rows > 0)
|
---|
531 | {
|
---|
532 | $Export = $DbRows->fetch_assoc();
|
---|
533 | if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
|
---|
534 | else $Editable = false;
|
---|
535 |
|
---|
536 | if(array_key_exists('Operation', $_POST))
|
---|
537 | if($_POST['Operation'] == 'Save')
|
---|
538 | {
|
---|
539 | if(array_key_exists('OutputType', $_POST) and ($_POST['OutputType'] * 1 > 0))
|
---|
540 | {
|
---|
541 | $this->System->Database->query('UPDATE Export SET OutputType='.$_POST['OutputType'].' WHERE Id='.$_GET['ExportId']);
|
---|
542 | $Output .= ShowMessage('Výběr uložen.');
|
---|
543 | } else $Output .= ShowMessage('Nevybrán žádný formát', MESSAGE_CRITICAL);
|
---|
544 | }
|
---|
545 |
|
---|
546 | $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
|
---|
547 | $Export = $DbResult->fetch_assoc();
|
---|
548 |
|
---|
549 | $Output .= '<h3>Formát generovaného výstupu</h3>'.
|
---|
550 | '<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">';
|
---|
551 | if($Editable)
|
---|
552 | {
|
---|
553 | $Output .= '<input type="submit" value="Uložit" '.$DisabledInput[$Editable].'/>'.
|
---|
554 | '<input type="hidden" name="Operation" value="Save"/>'.
|
---|
555 | '<br />';
|
---|
556 | }
|
---|
557 | $DbResult = $this->System->Database->query('SELECT * FROM `ExportOutputType` ORDER BY `Name`');
|
---|
558 | while($ExportFormat = $DbResult->fetch_assoc())
|
---|
559 | {
|
---|
560 | $Output .= RadioButton('OutputType', $ExportFormat['Id'], $Export['OutputType'] == $ExportFormat['Id'], '', !$Editable).' '.$ExportFormat['Name'].'<br/>';
|
---|
561 | }
|
---|
562 | $Output .= '</form>';
|
---|
563 | } else $Output .= ShowMessage('Položka nenalezena.', MESSAGE_CRITICAL);
|
---|
564 | } else $Output .= ShowMessage('Nebylo zadáno Id.', MESSAGE_CRITICAL);
|
---|
565 | return($Output);
|
---|
566 | }
|
---|
567 |
|
---|
568 | function ExportViewVersion()
|
---|
569 | {
|
---|
570 | $Output = '';
|
---|
571 | $DisabledInput = array(false => ' disabled="disabled"', true => '');
|
---|
572 | $DbRows = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
|
---|
573 | $Export = $DbRows->fetch_assoc();
|
---|
574 | if($this->System->User->Licence(LICENCE_USER) and ($this->System->User->Id == $Export['User'])) $Editable = true;
|
---|
575 | else $Editable = false;
|
---|
576 |
|
---|
577 | if(array_key_exists('Operation', $_POST))
|
---|
578 | if(($_POST['Operation'] == 'Save') and (array_key_exists('ClientVersion', $_POST)))
|
---|
579 | {
|
---|
580 | $this->System->Database->query('UPDATE `Export` SET `ClientVersion`='.$_POST['ClientVersion'].' WHERE `Id`='.$_GET['ExportId']);
|
---|
581 | $Output .= ShowMessage('Výběr uložen.');
|
---|
582 | }
|
---|
583 |
|
---|
584 | $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
|
---|
585 | $Export = $DbResult->fetch_assoc();
|
---|
586 |
|
---|
587 | if($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL);
|
---|
588 | else {
|
---|
589 | $Query = 'SELECT `ClientVersion`.* FROM `ExportVersion` LEFT JOIN `ClientVersion` ON `ClientVersion`.`Id`=`ExportVersion`.`ClientVersion` WHERE `ExportType`='.$Export['OutputType'];
|
---|
590 |
|
---|
591 | $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS `X`');
|
---|
592 | $DbRow = $DbResult->fetch_row();
|
---|
593 | $PageList = GetPageList($DbRow[0]);
|
---|
594 |
|
---|
595 | $TableColumns = array(
|
---|
596 | array('Name' => 'Version', 'Title' => 'Verze'),
|
---|
597 | array('Name' => 'BuildNumber', 'Title' => 'Sestavení'),
|
---|
598 | array('Name' => 'ReleaseDate', 'Title' => 'Datum uvolnění'),
|
---|
599 | array('Name' => 'Title', 'Title' => 'Titutek'),
|
---|
600 | array('Name' => '', 'Title' => 'Výběr'),
|
---|
601 | );
|
---|
602 | $Order = GetOrderTableHeader($TableColumns, 'BuildNumber', 1);
|
---|
603 | $Output .= '<form action="?Action=View&ExportId='.$_GET['ExportId'].'" method="post">'.
|
---|
604 | '<h3>Verze klienta</h3>';
|
---|
605 |
|
---|
606 | if($Editable)
|
---|
607 | {
|
---|
608 | $Output .= '<input type="submit" value="Uložit" '.$DisabledInput[$Editable].'/>'.
|
---|
609 | '<input type="hidden" name="Operation" value="Save"/>'.
|
---|
610 | '<br />'.
|
---|
611 | 'Vyberte pro jakou verzi herního klienta se budou texty exportovat.<br />';
|
---|
612 | }
|
---|
613 | $Output .= $PageList['Output'].
|
---|
614 | '<table class="BaseTable">'.
|
---|
615 | $Order['Output'];
|
---|
616 |
|
---|
617 | $Query = 'SELECT * FROM ('.$Query.') AS `TX` '.$Order['SQL'].$PageList['SQLLimit'];
|
---|
618 | $DbResult = $this->System->Database->query($Query);
|
---|
619 | while($Version = $DbResult->fetch_assoc())
|
---|
620 | {
|
---|
621 | $Output .= '<tr><td><a href="http://www.wowwiki.com/Patch_'.$Version['Version'].'">'.
|
---|
622 | $Version['Version'].'</a></td><td>'.$Version['BuildNumber'].'</td><td>'.
|
---|
623 | HumanDate($Version['ReleaseDate']).'</td><td>'.$Version['Title'].'</td><td>'.
|
---|
624 | RadioButton('ClientVersion', $Version['Id'], $Export['ClientVersion'] == $Version['Id'], '', !$Editable
|
---|
625 | ).'</td></tr>';
|
---|
626 |
|
---|
627 | }
|
---|
628 | $Output .= '</table>'.
|
---|
629 | '</form>'.
|
---|
630 | $PageList['Output'];
|
---|
631 | }
|
---|
632 | return($Output);
|
---|
633 | }
|
---|
634 |
|
---|
635 | function ExportViewOutput()
|
---|
636 | {
|
---|
637 | $Output = '';
|
---|
638 | $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
|
---|
639 | $Export = $DbResult->fetch_assoc();
|
---|
640 | if($Export['OutputType'] == '') $Output .= ShowMessage('Nevybrán typ exportu', MESSAGE_CRITICAL);
|
---|
641 | else if($Export['ClientVersion'] == '') $Output .= ShowMessage('Export nemá vybránu verzi klienta', MESSAGE_CRITICAL);
|
---|
642 | else {
|
---|
643 | $DbResult = $this->System->Database->query('SELECT * FROM `ExportOutputType` WHERE `Id`='.$Export['OutputType']);
|
---|
644 | if($DbResult->num_rows > 0)
|
---|
645 | {
|
---|
646 | $DbResult = $this->System->Database->query('SELECT * FROM `ExportVersion` WHERE (`ExportType`='.$Export['OutputType'].') AND (`ClientVersion`='.$Export['ClientVersion'].')');
|
---|
647 | if($DbResult->num_rows > 0)
|
---|
648 | {
|
---|
649 | if (array_key_exists('Auto', $_GET) == false)
|
---|
650 | $this->System->Database->query('UPDATE `Export` SET `UsedCount` = `UsedCount` + 1 WHERE `Id`='.$Export['Id']);
|
---|
651 | $Output = ExportOutput($Export['Id'], $Export['OutputType']);
|
---|
652 | } else $Output = ShowMessage('Nebyla vybrána požadovaná verze klienta.', MESSAGE_CRITICAL);
|
---|
653 | } else $Output = ShowMessage('Nebyl vybrán formát výstupu.', MESSAGE_CRITICAL);
|
---|
654 | }
|
---|
655 | return($Output);
|
---|
656 | }
|
---|
657 |
|
---|
658 | function ExportViewStat($Where = '')
|
---|
659 | {
|
---|
660 | $Export = new Export($this->System);
|
---|
661 | $Export->Id = $_GET['ExportId'];
|
---|
662 | $Export->Init();
|
---|
663 | $Export->LoadFilters();
|
---|
664 |
|
---|
665 | if(($Export->Export['ClientVersion'] == '') or ($Export->ClientVersion['BuildNumber'] == ''))
|
---|
666 | $Output = ShowMessage('Nebyla vybrána verze klienta', MESSAGE_CRITICAL);
|
---|
667 | else {
|
---|
668 | $GroupListQuery = 'SELECT `Group`.* FROM `Group` '.
|
---|
669 | ' JOIN `ExportGroup` ON (`ExportGroup`.`Export`='.$Export->Id.') AND (`ExportGroup`.`Group`=`Group`.`Id`)';
|
---|
670 | $Query = '';
|
---|
671 | $UnionItems = array();
|
---|
672 | $DbResult = $this->System->Database->query($GroupListQuery.$Where);
|
---|
673 | while($DbRow = $DbResult->fetch_assoc())
|
---|
674 | {
|
---|
675 | $UnionItems[] = 'SELECT (SELECT COUNT(DISTINCT(`Entry`)) FROM ('.
|
---|
676 | ' SELECT `T`.* FROM `'.$DbRow['TablePrefix'].'` AS `T`'.
|
---|
677 | ' JOIN `ExportUser` ON (`ExportUser`.`User`=`T`.`User`) AND (`ExportUser`.`Export`='.$Export->Id.') '.
|
---|
678 | ' JOIN `ExportLanguage` ON (`ExportLanguage`.`Export`='.$Export->Id.')'.
|
---|
679 | ' WHERE (`Complete` = 1) AND (`VersionStart` <= '.$Export->ClientVersion['BuildNumber'].') AND (`VersionEnd` >= '.$Export->ClientVersion['BuildNumber'].')'.
|
---|
680 | ') AS `C1`) AS `Translated`, '.
|
---|
681 | '(SELECT COUNT(DISTINCT(`Entry`)) FROM ('.
|
---|
682 | ' SELECT `T`.* FROM `'.$DbRow['TablePrefix'].'` AS `T`'.
|
---|
683 | ' WHERE (`Language` = '.$this->System->Config['OriginalLanguage'].') AND (`VersionStart` <= '.$Export->ClientVersion['BuildNumber'].') AND (`VersionEnd` >= '.$Export->ClientVersion['BuildNumber'].')'.
|
---|
684 | ') AS `C2`) AS `Total`, "'.$DbRow['Name'].'" AS `Name`';
|
---|
685 | }
|
---|
686 | $Query = substr($Query, 0, - 6);
|
---|
687 |
|
---|
688 | $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM ('.$GroupListQuery.') AS `T`');
|
---|
689 | $DbRow = $DbResult->fetch_row();
|
---|
690 | $PageList = GetPageList($DbRow[0]);
|
---|
691 | $Output = '<h3>Statistika dokončení vybraných skupin</h3>'.
|
---|
692 | $PageList['Output'];
|
---|
693 |
|
---|
694 | $Output .= '<table class="BaseTable">';
|
---|
695 | $TableColumns = array(
|
---|
696 | array('Name' => 'Name', 'Title' => 'Jméno'),
|
---|
697 | array('Name' => 'Translated', 'Title' => 'Přeložených'),
|
---|
698 | array('Name' => 'Total', 'Title' => 'Anglických'),
|
---|
699 | array('Name' => 'Percent', 'Title' => 'Procenta'),
|
---|
700 | );
|
---|
701 |
|
---|
702 | $Order = GetOrderTableHeader($TableColumns, 'Name', 0);
|
---|
703 | $Output .= $Order['Output'];
|
---|
704 |
|
---|
705 | $Translated = 0;
|
---|
706 | $Total = 0;
|
---|
707 | if(count($UnionItems) > 0)
|
---|
708 | {
|
---|
709 | $ID = $this->System->Database->query('SELECT *, ROUND(`Translated` / `Total` * 100, 2) AS `Percent` FROM ('.implode(' UNION ALL ', $UnionItems).') AS `C3` '.$Order['SQL'].$PageList['SQLLimit']);
|
---|
710 | while($Group = $ID->fetch_assoc())
|
---|
711 | {
|
---|
712 | $Output .= '<tr><td>'.$Group['Name'].'</td><td>'.$Group['Translated'].'</td><td>'.$Group['Total'].'</td><td>'.ProgressBar(150, $Group['Percent']).'</td></tr>';
|
---|
713 | $Translated += $Group['Translated'];
|
---|
714 | $Total += $Group['Total'];
|
---|
715 | }
|
---|
716 | }
|
---|
717 | if($Total > 0) $Percent = $Translated / $Total * 100;
|
---|
718 | else $Percent = 100;
|
---|
719 |
|
---|
720 | $Output .= '<tr><td><strong>Celkem</strong></td><td><strong>'.$Translated.'</strong></td><td><strong>'.$Total.'</strong></td><td><strong>'.ProgressBar(150, round($Percent, 2)).'</strong></td></tr>';
|
---|
721 | $Output .= '</table>';
|
---|
722 | }
|
---|
723 | return($Output);
|
---|
724 | }
|
---|
725 |
|
---|
726 | function ExportView()
|
---|
727 | {
|
---|
728 | $Output = '';
|
---|
729 | if(array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId']))
|
---|
730 | {
|
---|
731 | $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
|
---|
732 | if($DbResult->num_rows > 0)
|
---|
733 | {
|
---|
734 | $Export = $DbResult->fetch_assoc();
|
---|
735 |
|
---|
736 | $DbResult = $this->System->Database->query('SELECT * FROM `User` WHERE `ID`='.$Export['User']);
|
---|
737 | $UserLine = $DbResult->fetch_assoc();
|
---|
738 | $Output .= 'Export <strong><a href="?Action=View&Tab=6&ExportId='.$Export['Id'].'">'.$_GET['ExportId'].'</a></strong> překladatele <strong>'.$UserLine['Name'].'</strong> s označením <strong>'.$Export['Title'].'</strong>';
|
---|
739 | $Output .= ShowTabs(array('Obecné', 'Překladatelé', 'Překlady', 'Jazyky', 'Formát', 'Verze', 'Statistika', 'Výstup'));
|
---|
740 | $Output .= '<div id="content">';
|
---|
741 | if($_SESSION['Tab'] == TAB_GENERAL) $Output .= $this->ExportViewGeneral();
|
---|
742 | else if($_SESSION['Tab'] == TAB_TRANSLATORS) $Output .= $this->ExportViewTranslators();
|
---|
743 | else if($_SESSION['Tab'] == TAB_GROUPS) $Output .= $this->ExportViewGroups();
|
---|
744 | else if($_SESSION['Tab'] == TAB_LANGUAGES) $Output .= $this->ExportViewLanguages();
|
---|
745 | else if($_SESSION['Tab'] == TAB_OUTPUT_FORMAT) $Output .= $this->ExportViewOutputFormat();
|
---|
746 | else if($_SESSION['Tab'] == TAB_VERSION) $Output .= $this->ExportViewVersion();
|
---|
747 | else if($_SESSION['Tab'] == TAB_STAT) $Output .= $this->ExportViewStat();
|
---|
748 | else if($_SESSION['Tab'] == TAB_OUTPUT) $Output .= $this->ExportViewOutput();
|
---|
749 | else $Output .= $this->ExportViewGeneral();
|
---|
750 |
|
---|
751 | $Output .= '</div>';
|
---|
752 | } else $Output .= ShowMessage('Export nenalezen.', MESSAGE_CRITICAL);
|
---|
753 | } else $Output .= ShowMessage('Nebylo zadáno Id.', MESSAGE_CRITICAL);
|
---|
754 | return($Output);
|
---|
755 | }
|
---|
756 |
|
---|
757 | function ExportClone()
|
---|
758 | {
|
---|
759 | if($this->System->User->Licence(LICENCE_USER))
|
---|
760 | {
|
---|
761 | if(array_key_exists('ExportId', $_GET) and is_numeric($_GET['ExportId']))
|
---|
762 | {
|
---|
763 | $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `Export` WHERE `User`='.$this->System->User->Id);
|
---|
764 | $DbRow = $DbResult->fetch_row();
|
---|
765 | if($DbRow[0] < $this->System->Config['MaxExportPerUser'])
|
---|
766 | {
|
---|
767 | $DbResult = $this->System->Database->query('SELECT * FROM `Export` WHERE `Id`='.$_GET['ExportId']);
|
---|
768 | if($DbResult->num_rows > 0)
|
---|
769 | {
|
---|
770 | $DbRow = $DbResult->fetch_assoc();
|
---|
771 | unset($DbRow['Id']);
|
---|
772 | $DbRow['UsedCount'] = '0';
|
---|
773 | $DbRow['User'] = $this->System->User->Id;
|
---|
774 | $DbRow['TimeCreate'] = 'NOW()';
|
---|
775 | $DbRow['Title'] .= ' - kopie';
|
---|
776 | $this->System->Database->insert('Export', $DbRow);
|
---|
777 | $ExportId = $this->System->Database->insert_id;
|
---|
778 | $this->System->Database->query('INSERT INTO `ExportGroup` (SELECT NULL AS `Id`, '.$ExportId.' AS `Export`, `Group` FROM `ExportGroup` WHERE `Export`='.$_GET['ExportId'].')');
|
---|
779 | $this->System->Database->query('INSERT INTO `ExportLanguage` (SELECT NULL AS `Id`, '.$ExportId.' AS `Export`, `Language`, `Sequence` FROM `ExportLanguage` WHERE `Export`='.$_GET['ExportId'].')');
|
---|
780 | $this->System->Database->query('INSERT INTO `ExportUser` (SELECT NULL AS `Id`, '.$ExportId.' AS `Export`, `User`, `Sequence` FROM `ExportUser` WHERE `Export`='.$_GET['ExportId'].')');
|
---|
781 | $Output = ShowMessage('Kopie exportu vytvořena.<br/>Přímý odkaz na tento export: <a href="?Action=View&ExportId='.$ExportId.'">zde</a>');
|
---|
782 | $this->System->ModuleManager->Modules['Log']->WriteLog('Vytvořena kopie exportu <a href="'.$this->System->Link('/export/?Action=View&ExportId='.$ExportId).'">'.$ExportId.'</a>.', LOG_TYPE_EXPORT);
|
---|
783 | $_GET['Filter'] = 'my';
|
---|
784 | $this->ExportList();
|
---|
785 | } else $Output = ShowMessage('Zdrojový export nenalezen', MESSAGE_CRITICAL);
|
---|
786 | } else $Output = ShowMessage('Nemůžete vytvářet další export. Max. počet na uživatele je '.
|
---|
787 | $this->System->Config['MaxExportPerUser'].'.', MESSAGE_CRITICAL);
|
---|
788 | } else $Output = ShowMessage('Export nenalezen.', MESSAGE_CRITICAL);
|
---|
789 | } else $Output = ShowMessage(T('Access denied'), MESSAGE_CRITICAL);
|
---|
790 | return($Output);
|
---|
791 | }
|
---|
792 |
|
---|
793 | function Show()
|
---|
794 | {
|
---|
795 | $this->Title = T('Export');
|
---|
796 | if(array_key_exists('Action', $_GET))
|
---|
797 | {
|
---|
798 | if($_GET['Action'] == 'Create') $Output = $this->ExportCreate();
|
---|
799 | else if($_GET['Action'] == 'CreateFinish') $Output = $this->ExportCreateFinish();
|
---|
800 | else if($_GET['Action'] == 'View') $Output = $this->ExportView();
|
---|
801 | else if($_GET['Action'] == 'Delete') $Output = $this->ExportDelete();
|
---|
802 | else if($_GET['Action'] == 'Clone') $Output = $this->ExportClone();
|
---|
803 | else $Output = $this->ExportList();
|
---|
804 | } else $Output = $this->ExportList();
|
---|
805 | return($Output);
|
---|
806 | }
|
---|
807 | }
|
---|