source: trunk/img_statistic.php@ 577

Last change on this file since 577 was 577, checked in by chronos, 12 years ago
  • Modified: Moved some code from global to system file. System class is now serving as main application class. Now old files which still use ShowPage function need system initialization with $InitSystem = true; before global.php inclusion.
  • Modified: Get rid of some global reference to $System, $Config and $User variables.
  • Modified: Search result functionality moved to application module from action.php file.
File size: 2.3 KB
Line 
1<?php
2
3$InitSystem = true;
4include('includes/global.php');
5
6$Days = 14;
7$FontFile = 'images/FRIZQT__.ttf';
8$TranslationTree = GetTranslationTree();
9$GroupId = LoadGroupIdParameter();
10$Group = $TranslationTree[$GroupId];
11if(array_key_exists('team', $_GET))
12{
13 $team = ' AND `User` IN (SELECT `ID` FROM `User` WHERE `Team` = '.($_GET['team'] * 1).')';
14} else $team = '';
15
16if(array_key_exists('language', $_GET))
17{
18 $language = ' AND (`Language` = '.$_GET['language'].')';
19} else $language = '';
20
21
22$DbResult = $System->Database->query('SELECT MAX(`VersionEnd`) FROM '.$Group['TablePrefix']);
23$ID = $DbResult->fetch_row();
24$BuildNumber_max = $ID[0];
25if($BuildNumber_max == '') $BuildNumber_max = 0; // Empty result, no items in this group
26
27$where = '(`VersionEnd` = '.$BuildNumber_max.') AND (`Language` <> '.$Config['OriginalLanguage'].') AND (`Complete` = 1) '.$team.$language;
28$DbResult = $System->Database->query('SELECT COUNT(DISTINCT(`Entry`)) FROM `'.$Group['TablePrefix'].'` WHERE '.$where);
29$ID = $DbResult->fetch_row();
30$NumberTranslate = $ID[0];
31
32$DbResult = $System->Database->query('SELECT COUNT(DISTINCT(`Entry`)) FROM `'.$Group['TablePrefix'].'` WHERE (`VersionEnd` = '.$BuildNumber_max.') AND (`Language` = '.$Config['OriginalLanguage'].')');
33$ID = $DbResult->fetch_row();
34$NumberAJ = $ID[0];
35
36if($NumberAJ > 0) $Percent = ($NumberTranslate / $NumberAJ) * 100;
37 else $Percent = 0;
38$Percent = substr($Percent, 0, 5);
39
40$PercentBar = $Percent * 4;
41$NotTran = $NumberAJ - $NumberTranslate;
42
43$Image = ImageCreateTrueColor(400, 32);
44$Color1 = imagecolorallocate($Image, 214, 214, 214);
45$Color2 = imagecolorallocate($Image, 239, 131, 166);
46$Color3 = imagecolorallocate($Image, 225, 0, 0);
47imagefilledrectangle($Image, 0, 0, 400, 31, $Color1);
48imagefilledrectangle($Image, 0, 0, $PercentBar, 59, $Color2);
49$FontSize = 10;
50ImageTTFText($Image, $FontSize, 0, 140, 13, $Color3, $FontFile, $NumberTranslate.'/'.$NumberAJ);
51ImageTTFText($Image, $FontSize, 0, 240, 13, $Color3, $FontFile, $Group['Name']);
52ImageTTFText($Image, $FontSize, 0, 140, 29, $Color3, $FontFile, $Percent.'%');
53$FontSize = 6;
54ImageTTFText($Image, $FontSize, 0, 240, 28, $Color3, $FontFile, 'Aktualizace: '.date('m.d.y H:i'));
55
56Header('Content-type: image/png');
57ImagePNG($Image);
58ImageDestroy($Image);
Note: See TracBrowser for help on using the repository browser.