Ignore:
Timestamp:
Dec 22, 2009, 10:22:38 AM (15 years ago)
Author:
george
Message:
  • Opraveno: Kontrola správného zadání Id překladové skupiny.
  • Opraveno: Kontrola správného zadání Id překladového jazyka.
  • Upraveno: Zobrazovat PageFooter pouze pokud již byl zobrazen PageHeader.
  • Opraveno: Chyba určení počtu stránek pro zobrazení stránkování.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/img_statistic.php

    r256 r286  
    66$FontFile = 'images/FRIZQT__.ttf';
    77$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];
     10if(array_key_exists('team', $_GET))
     11{
     12  $team = ' AND `User` IN (SELECT `ID` FROM `user` WHERE `team` = '.$_GET['team'].')';
    1113} else $team = '';
    12 if (array_key_exists('language', $_GET)) {
    13         $language = ' AND Language = '.$_GET['language'].'';
     14if(array_key_exists('language', $_GET))
     15{
     16  $language = ' AND `Language` = '.$_GET['language'].'';
    1417} 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.')';
     18if(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.')';
    2428} else $user_sql = '';
    2529
    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']));
    2731$BuildNumber_max = $ID[0];
    2832
    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));
    3135$NumberTranslate = $ID[0];
    3236 
    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)'));
    3438$NumberAJ = $ID[0];
    3539
    36 $ID = mysql_fetch_row($Database->SQLCommand('SELECT count(*) FROM log WHERE Type = 1 AND date >= CURRENT_DATE - INTERVAL '.$Days.' DAY
    37  AND text LIKE "%'.$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'].'%"'));
    3842$NumberPerDay = $ID[0]; //date ("Y-m-d H:i:s")
    3943
    40 if($NumberAJ > 0) $Percent = ($NumberTranslate / $NumberAJ) * 100; else $Percent = 0;
     44if($NumberAJ > 0) $Percent = ($NumberTranslate / $NumberAJ) * 100;
     45  else $Percent = 0;
    4146$Percent = substr($Percent, 0, 5);
    4247
     
    5156imagefilledrectangle($Image, 0, 0, $PercentBar, 59, $Color2);
    5257$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) );
     58if(($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));
    5763}
    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'] );
     64if($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'] );
    6168}
    6269ImageTTFText($Image, $FontSize, 0, 140, 13, $Color3, $FontFile, $NumberTranslate.'/'.$NumberAJ);
     
    6471ImageTTFText($Image, $FontSize, 0, 140, 29, $Color3, $FontFile, $Percent.'%');
    6572$FontSize = 6;
    66 ImageTTFText($Image, $FontSize, 0, 240, 28, $Color3, $FontFile, 'Aktualizace: '.date("m.d.y  H:i"));
     73ImageTTFText($Image, $FontSize, 0, 240, 28, $Color3, $FontFile, 'Aktualizace: '.date('m.d.y  H:i'));
    6774
    68 Header("Content-type: image/png");
     75Header('Content-type: image/png');
    6976ImagePNG($Image);
    7077ImageDestroy($Image);
Note: See TracChangeset for help on using the changeset viewer.