Changeset 56 for trunk/img_statistic.php


Ignore:
Timestamp:
Feb 2, 2009, 10:53:29 PM (16 years ago)
Author:
george
Message:
  • Přidáno: Fonty z WoW.
  • Upraveno: Zobrazování obrázků stavu dokončení ve statistice pomocí ttf fontů.
  • Přidáno: Adresování odlišných databází zdrojů textů.
  • Přidáno: Texty skriptů a EventAI ScriptDev2.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/img_statistic.php

    r49 r56  
    11<?php
     2
    23session_start();
    34include('includes/config.php');
    45include('includes/databaseconection.php');
     6include('includes/global_function.php');
    57
    68// SQL injection hack protection
     
    810foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]);
    911
    10 //připojení do databáze
     12// Open database connection
    1113$Database = new Database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password']);
    1214$Database->SQLCommand('SET NAMES '.$Config['Database']['Charset']);
    1315$Database->SelectDatabase($Config['Database']['Database']);   
    1416
    15   $TypeTexts = $_GET['TypeText'];
     17$FontFile = 'images/FRIZQT__.ttf';
     18$TranslationTree = GetTranslationTree();
     19$Group = $TranslationTree[$_GET['group']];
    1620
    17 //  echo  "SELECT count(distinct(entry)) FROM $TypeTexts WHERE Language <> '0' AND Complete = '1'";
    18   $ID = mysql_fetch_row($Database->SQLCommand("SELECT count(distinct(entry)) FROM ".$TypeTexts." WHERE Language <> '0' AND Complete = '1'"));
    19   $NumberTranslate = $ID[0];
     21$ID = mysql_fetch_row($Database->SQLCommand("SELECT count(distinct(entry)) FROM ".$Group['TablePrefix']." WHERE Language <> '0' AND Complete = '1'"));
     22$NumberTranslate = $ID[0];
    2023 
    21   $ID = mysql_fetch_row($Database->SQLCommand("SELECT count(*) FROM ".$TypeTexts." WHERE Language = '0'"));
    22   $NumberAJ = $ID[0];
     24$ID = mysql_fetch_row($Database->SQLCommand("SELECT count(*) FROM ".$Group['TablePrefix']." WHERE Language = '0'"));
     25$NumberAJ = $ID[0];
    2326
    24   $Percent = ($NumberTranslate / $NumberAJ) * 100;
    25   $Percent = substr($Percent, 0, 5);
     27if($NumberAJ > 0) $Percent = ($NumberTranslate / $NumberAJ) * 100; else $Percent = 0;
     28$Percent = substr($Percent, 0, 5);
    2629
    27   $PercentBar = $Percent * 4;
    28   $obrazek = imagecreatetruecolor(400, 40);
    29   $Color1 = imagecolorallocate($obrazek, 225, 246, 247);
    30   $Color2 = imagecolorallocate($obrazek, 77, 225, 251);
    31   $Color3 = imagecolorallocate($obrazek, 2, 9, 199);
    32   imagefilledrectangle($obrazek, 0, 0, 400, 39, $Color1);
    33   imagefilledrectangle($obrazek, 0, 0, $PercentBar, 59, $Color2);
    34   imagestring($obrazek, 10, 120, 5, $NumberTranslate.'/'.$NumberAJ, $Color3);
    35   imagestring($obrazek, 3, 300, 5, $TypeTexts, $Color3);
    36   imagestring($obrazek, 10, 120, 20, $Percent.' %', $Color3);
    37   imagestring($obrazek, 1, 240, 30, 'Aktualizace: '.date("m.d.y  H:i"), $Color3);
    38  
    39   header('Content-Type: image/png');
    40   imagepng($obrazek);
    41   imagedestroy($obrazek);
    42  
    43  // echo '<img src="statistic.png">';
    44          
     30$PercentBar = $Percent * 4;
     31$Image = ImageCreateTrueColor(400, 32);
     32$Color1 = imagecolorallocate($Image, 225, 246, 247);
     33$Color2 = imagecolorallocate($Image, 77, 225, 251);
     34$Color3 = imagecolorallocate($Image, 2, 9, 199);
     35imagefilledrectangle($Image, 0, 0, 400, 31, $Color1);
     36imagefilledrectangle($Image, 0, 0, $PercentBar, 59, $Color2);
     37$FontSize = 10;
     38ImageTTFText($Image, $FontSize, 0, 120, 13, $Color3, $FontFile, $NumberTranslate.'/'.$NumberAJ);
     39ImageTTFText($Image, $FontSize, 0, 240, 13, $Color3, $FontFile, $Group['Name']);
     40ImageTTFText($Image, $FontSize, 0, 120, 29, $Color3, $FontFile, $Percent.'%');
     41$FontSize = 6;
     42ImageTTFText($Image, $FontSize, 0, 240, 28, $Color3, $FontFile, 'Aktualizace: '.date("m.d.y  H:i"));
     43
     44Header("Content-type: image/png");
     45ImagePNG($Image);
     46ImageDestroy($Image);
     47           
    4548?>
Note: See TracChangeset for help on using the changeset viewer.