Changeset 286 for trunk/img_statistic.php
- Timestamp:
- Dec 22, 2009, 10:22:38 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/img_statistic.php
r256 r286 6 6 $FontFile = 'images/FRIZQT__.ttf'; 7 7 $TranslationTree = GetTranslationTree(); 8 $Group = $TranslationTree[$_GET['group']]; 9 if (array_key_exists('team', $_GET)) { 10 $team = ' AND User IN (SELECT ID FROM user WHERE team = '.$_GET['team'].')'; 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'].')'; 11 13 } else $team = ''; 12 if (array_key_exists('language', $_GET)) { 13 $language = ' AND Language = '.$_GET['language'].''; 14 if(array_key_exists('language', $_GET)) 15 { 16 $language = ' AND `Language` = '.$_GET['language'].''; 14 17 } else $language = ''; 15 if (array_key_exists('user', $_GET)) { 16 $DbResult = $Database->SQLCommand('SELECT user,ExportSetting FROM `user` WHERE ID='.$_GET['user']); 17 $User = mysql_fetch_assoc($DbResult); 18 $ExportSetting = unserialize($User['ExportSetting']); 19 $SelectedUsers = ''; 20 foreach($ExportSetting['users-selection'] as $Item) 21 $SelectedUsers .= ','.$Item; 22 $SelectedUsers = substr($SelectedUsers, 1); 23 $user_sql = ' AND User IN ('.$SelectedUsers.')'; 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.')'; 24 28 } else $user_sql = ''; 25 29 26 $ID = mysql_fetch_row($Database->SQLCommand('SELECT max(VersionEnd) FROM '.$Group['TablePrefix']));30 $ID = mysql_fetch_row($Database->SQLCommand('SELECT MAX(`VersionEnd`) FROM '.$Group['TablePrefix'])); 27 31 $BuildNumber_max = $ID[0]; 28 32 29 $where = 'VersionEnd = '.$BuildNumber_max.' AND ( Language <> 0) AND (Complete= 1) '.$team.$language.$user_sql;30 $ID = mysql_fetch_row($Database->SQLCommand('SELECT count(distinct( entry)) FROM '.$Group['TablePrefix'].' WHERE '.$where));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)); 31 35 $NumberTranslate = $ID[0]; 32 36 33 $ID = mysql_fetch_row($Database->SQLCommand('SELECT count(distinct( entry)) FROM '.$Group['TablePrefix'].' WHERE VersionEnd = '.$BuildNumber_max.' AND (Language= 0)'));37 $ID = mysql_fetch_row($Database->SQLCommand('SELECT count(distinct(`entry`)) FROM '.$Group['TablePrefix'].' WHERE `VersionEnd` = '.$BuildNumber_max.' AND (`Language` = 0)')); 34 38 $NumberAJ = $ID[0]; 35 39 36 $ID = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM log WHERE Type = 1 AND date>= CURRENT_DATE - INTERVAL '.$Days.' DAY37 AND textLIKE "%'.$Group['Name'].'%"'));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'].'%"')); 38 42 $NumberPerDay = $ID[0]; //date ("Y-m-d H:i:s") 39 43 40 if($NumberAJ > 0) $Percent = ($NumberTranslate / $NumberAJ) * 100; else $Percent = 0; 44 if($NumberAJ > 0) $Percent = ($NumberTranslate / $NumberAJ) * 100; 45 else $Percent = 0; 41 46 $Percent = substr($Percent, 0, 5); 42 47 … … 51 56 imagefilledrectangle($Image, 0, 0, $PercentBar, 59, $Color2); 52 57 $FontSize = 10; 53 if (($NumberPerDay > 0) and ($team == '') and ($language == '') and ($user_sql == '') and ($NotTran>0)) { 54 $TimeToTranslate = ($NotTran / $NumberPerDay)* $Days; 55 ImageTTFText($Image, $FontSize, 0, 5, 13, $Color3, $FontFile, 'Čas do dokončení'); 56 ImageTTFText($Image, $FontSize, 0, 5, 29, $Color3, $FontFile, getmonthyears($TimeToTranslate) ); 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)); 57 63 } 58 if ($user_sql <> '') { 59 ImageTTFText($Image, $FontSize, 0, 5, 13, $Color3, $FontFile, 'Statistika výběru'); 60 ImageTTFText($Image, $FontSize, 0, 5, 29, $Color3, $FontFile, 'uživatele: '.$User['user'] ); 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'] ); 61 68 } 62 69 ImageTTFText($Image, $FontSize, 0, 140, 13, $Color3, $FontFile, $NumberTranslate.'/'.$NumberAJ); … … 64 71 ImageTTFText($Image, $FontSize, 0, 140, 29, $Color3, $FontFile, $Percent.'%'); 65 72 $FontSize = 6; 66 ImageTTFText($Image, $FontSize, 0, 240, 28, $Color3, $FontFile, 'Aktualizace: '.date( "m.d.y H:i"));73 ImageTTFText($Image, $FontSize, 0, 240, 28, $Color3, $FontFile, 'Aktualizace: '.date('m.d.y H:i')); 67 74 68 Header( "Content-type: image/png");75 Header('Content-type: image/png'); 69 76 ImagePNG($Image); 70 77 ImageDestroy($Image);
Note:
See TracChangeset
for help on using the changeset viewer.