1 | <?php
|
---|
2 |
|
---|
3 | include('includes/global.php');
|
---|
4 |
|
---|
5 | $Days = 14;
|
---|
6 | $FontFile = 'images/FRIZQT__.ttf';
|
---|
7 | $TranslationTree = GetTranslationTree();
|
---|
8 | $GroupId = LoadGroupIdParameter();
|
---|
9 | $Group = $TranslationTree[$GroupId];
|
---|
10 | if(array_key_exists('team', $_GET))
|
---|
11 | {
|
---|
12 | $team = ' AND `User` IN (SELECT `ID` FROM `user` WHERE `team` = '.$_GET['team'].')';
|
---|
13 | } else $team = '';
|
---|
14 | if(array_key_exists('language', $_GET))
|
---|
15 | {
|
---|
16 | $language = ' AND `Language` = '.$_GET['language'].'';
|
---|
17 | } else $language = '';
|
---|
18 | if(array_key_exists('user', $_GET))
|
---|
19 | {
|
---|
20 | $DbResult = $Database->SQLCommand('SELECT `user`,`ExportSetting` FROM `user` WHERE ID='.$_GET['user']);
|
---|
21 | $User = mysql_fetch_assoc($DbResult);
|
---|
22 | $ExportSetting = unserialize($User['ExportSetting']);
|
---|
23 | $SelectedUsers = '';
|
---|
24 | foreach($ExportSetting['users-selection'] as $Item)
|
---|
25 | $SelectedUsers .= ','.$Item;
|
---|
26 | $SelectedUsers = substr($SelectedUsers, 1);
|
---|
27 | $user_sql = ' AND `User` IN ('.$SelectedUsers.')';
|
---|
28 | } else $user_sql = '';
|
---|
29 |
|
---|
30 | $ID = mysql_fetch_row($Database->SQLCommand('SELECT MAX(`VersionEnd`) FROM '.$Group['TablePrefix']));
|
---|
31 | $BuildNumber_max = $ID[0];
|
---|
32 |
|
---|
33 | $where = 'VersionEnd = '.$BuildNumber_max.' AND (`Language` <> 0) AND (`Complete` = 1) '.$team.$language.$user_sql;
|
---|
34 | $ID = mysql_fetch_row($Database->SQLCommand('SELECT count(distinct(`entry`)) FROM '.$Group['TablePrefix'].' WHERE '.$where));
|
---|
35 | $NumberTranslate = $ID[0];
|
---|
36 |
|
---|
37 | $ID = mysql_fetch_row($Database->SQLCommand('SELECT count(distinct(`entry`)) FROM '.$Group['TablePrefix'].' WHERE `VersionEnd` = '.$BuildNumber_max.' AND (`Language` = 0)'));
|
---|
38 | $NumberAJ = $ID[0];
|
---|
39 |
|
---|
40 | $ID = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM `log` WHERE `Type` = 1 AND `date` >= CURRENT_DATE - INTERVAL '.$Days.' DAY
|
---|
41 | AND `text` LIKE "%'.$Group['Name'].'%"'));
|
---|
42 | $NumberPerDay = $ID[0]; //date ("Y-m-d H:i:s")
|
---|
43 |
|
---|
44 | if($NumberAJ > 0) $Percent = ($NumberTranslate / $NumberAJ) * 100;
|
---|
45 | else $Percent = 0;
|
---|
46 | $Percent = substr($Percent, 0, 5);
|
---|
47 |
|
---|
48 | $PercentBar = $Percent * 4;
|
---|
49 | $NotTran = $NumberAJ - $NumberTranslate;
|
---|
50 |
|
---|
51 | $Image = ImageCreateTrueColor(400, 32);
|
---|
52 | $Color1 = imagecolorallocate($Image, 214, 214, 214);
|
---|
53 | $Color2 = imagecolorallocate($Image, 239, 131, 166);
|
---|
54 | $Color3 = imagecolorallocate($Image, 225, 0, 0);
|
---|
55 | imagefilledrectangle($Image, 0, 0, 400, 31, $Color1);
|
---|
56 | imagefilledrectangle($Image, 0, 0, $PercentBar, 59, $Color2);
|
---|
57 | $FontSize = 10;
|
---|
58 | if(($NumberPerDay > 0) and ($team == '') and ($language == '') and ($user_sql == '') and ($NotTran > 0))
|
---|
59 | {
|
---|
60 | $TimeToTranslate = ($NotTran / $NumberPerDay) * $Days;
|
---|
61 | ImageTTFText($Image, $FontSize, 0, 5, 13, $Color3, $FontFile, 'Čas do dokončení');
|
---|
62 | ImageTTFText($Image, $FontSize, 0, 5, 29, $Color3, $FontFile, getmonthyears($TimeToTranslate));
|
---|
63 | }
|
---|
64 | if($user_sql <> '')
|
---|
65 | {
|
---|
66 | ImageTTFText($Image, $FontSize, 0, 5, 13, $Color3, $FontFile, 'Statistika výběru');
|
---|
67 | ImageTTFText($Image, $FontSize, 0, 5, 29, $Color3, $FontFile, 'uživatele: '.$User['user'] );
|
---|
68 | }
|
---|
69 | ImageTTFText($Image, $FontSize, 0, 140, 13, $Color3, $FontFile, $NumberTranslate.'/'.$NumberAJ);
|
---|
70 | ImageTTFText($Image, $FontSize, 0, 240, 13, $Color3, $FontFile, $Group['Name']);
|
---|
71 | ImageTTFText($Image, $FontSize, 0, 140, 29, $Color3, $FontFile, $Percent.'%');
|
---|
72 | $FontSize = 6;
|
---|
73 | ImageTTFText($Image, $FontSize, 0, 240, 28, $Color3, $FontFile, 'Aktualizace: '.date('m.d.y H:i'));
|
---|
74 |
|
---|
75 | Header('Content-type: image/png');
|
---|
76 | ImagePNG($Image);
|
---|
77 | ImageDestroy($Image);
|
---|
78 |
|
---|
79 | ?>
|
---|