コード例 #1
0
ファイル: statistik.php プロジェクト: netzhuffle/mainchat
 $m = SPrintF("%02d", $m);
 $y = SPrintF("%04d", $y);
 $msg = "";
 $msg .= "<center>\n";
 $msg .= "<TABLE BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"0\">\n";
 $msg .= "<FORM name=form ACTION=\"{$PHP_SELF}\" METHOD=\"POST\">\n";
 $msg .= "<INPUT TYPE=\"HIDDEN\" NAME=\"type\" VALUE=\"{$type}\">\n";
 $msg .= "<INPUT TYPE=\"HIDDEN\" NAME=\"aktion\" VALUE=\"{$aktion}\">\n";
 $msg .= "<INPUT TYPE=\"HIDDEN\" NAME=\"http_host\" VALUE=\"{$http_host}\">\n";
 $msg .= "<INPUT TYPE=\"HIDDEN\" NAME=\"id\" VALUE=\"{$id}\">\n";
 $msg .= "<INPUT TYPE=\"HIDDEN\" NAME=\"page\" VALUE=\"chat-month\">\n";
 $msg .= "<TR>\n";
 $msg .= "<TD" . coreMakeBackground($STAT_TITLE_BACK1) . ">" . $STAT_TITLE_FONTBEG0 . "\n";
 $msg .= $STAT_TXT["0061"];
 $msg .= $STAT_TITLE_FONTEND0 . "</TD>\n";
 $msg .= "<TD" . coreMakeBackground($STAT_TITLE_BACK1) . ">" . $STAT_TITLE_FONTBEG0 . "\n";
 $msg .= "<SELECT NAME=\"m\" onchange='form.submit();'>\n";
 while (list($i, $n) = each($STAT_MONTH_TXT)) {
     if ($i == $m) {
         $msg .= "<OPTION VALUE=\"{$i}\" SELECTED>{$n}\n";
     } else {
         $msg .= "<OPTION VALUE=\"{$i}\">{$n}\n";
     }
 }
 $msg .= "</SELECT>\n";
 // Auswahlbox Jahr
 $msg .= "<SELECT NAME=\"y\">\n";
 $i = 0;
 while ($i < 2) {
     $n = date("Y", time()) - $i;
     if ($n == $y) {
コード例 #2
0
function statsPrintGraph($title, $text_l, $text_b)
{
    global $grapharray;
    global $STAT_TXT;
    global $STAT_BAR_HEIGHT;
    global $STAT_BAR_IMAGE_T;
    global $STAT_BAR_IMAGE_M;
    global $STAT_BAR_IMAGE_B;
    global $STAT_BAR_BACK0;
    global $STAT_BAR_BACK1;
    global $STAT_BAR_BACK2;
    global $STAT_BAR_FONTBEG0;
    global $STAT_BAR_FONTEND0;
    global $STAT_BAR_FONTBEG1;
    global $STAT_BAR_FONTEND1;
    global $STAT_BAR_FONTBEG2;
    global $STAT_BAR_FONTEND2;
    global $STAT_BAR_FONTBEG3;
    global $STAT_BAR_FONTEND3;
    $msg = "";
    if (isset($grapharray) && count($grapharray) > 0) {
        $img_w = trim(strtok($STAT_BAR_IMAGE_M, ","));
        $img_h = trim(strtok(","));
        $img_p = trim(strtok(","));
        /* Als erstes wird der größte Eintrag im Array und einige Werte	*/
        /* ermittelt.																										*/
        $b = 0;
        $h = 0;
        $c = 2;
        $d = 0;
        $t = 0;
        $u = 0;
        if ($title == "") {
            $title = $STAT_TXT["0080"];
        }
        reset($grapharray);
        while (list($i, $v) = each($grapharray)) {
            if ($v > $b) {
                $b = $v;
            }
            if ($v > 0) {
                $t += $v;
                $u += 1;
            }
            $c++;
        }
        if ($b > 0) {
            $h = $STAT_BAR_HEIGHT / $b;
        } else {
            $h = 0;
        }
        if ($u > 0) {
            $d = intval($t / $u);
        } else {
            $d = 0;
        }
        /* Linke Beschriftung und die Tabelle mit den Balken anzeigen	*/
        /* lassen.																										*/
        reset($grapharray);
        $msg .= "<DIV ALIGN=\"CENTER\">\n";
        $msg .= "<TABLE BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"0\">\n";
        if ($title != "") {
            $msg .= "<TR>\n";
            $msg .= "<TD" . coreMakeBackground($STAT_BAR_BACK2) . " COLSPAN=\"{$c}\" ALIGN=\"CENTER\">";
            $msg .= $STAT_BAR_FONTBEG3;
            $msg .= $title;
            $msg .= $STAT_BAR_FONTEND3;
            $msg .= "</TD>\n";
            $msg .= "</TR>\n";
        }
        $msg .= "<TR" . coreMakeBackground($STAT_BAR_BACK0) . ">\n";
        $msg .= "<TD" . coreMakeBackground($STAT_BAR_BACK1) . ">";
        $msg .= $STAT_BAR_FONTBEG2;
        $t0 = 0;
        $t1 = strlen($text_l);
        while ($t0 < $t1) {
            $msg .= substr($text_l, $t0, 1) . "<BR>";
            $t0++;
        }
        $msg .= $STAT_BAR_FONTEND2;
        $msg .= "</TD>\n";
        while (list($i, $v) = each($grapharray)) {
            if ($v > 0) {
                $s = intval($v * $h);
                $msg .= "<TD VALIGN=\"BOTTOM\" ALIGN=\"CENTER\">";
                $msg .= $STAT_BAR_FONTBEG0;
                $msg .= $v;
                $msg .= "<BR>";
                if (strlen($STAT_BAR_IMAGE_T) > 0) {
                    $msg .= "<IMG " . coreMakeImage($STAT_BAR_IMAGE_T) . "><BR>";
                }
                $msg .= "<IMG SRC=\"{$img_p}\" BORDER=\"0\" WIDTH=\"{$img_w}\" HEIGHT=\"{$s}\">";
                $msg .= "<BR>";
                if (strlen($STAT_BAR_IMAGE_B) > 0) {
                    $msg .= "<IMG " . coreMakeImage($STAT_BAR_IMAGE_B) . "><BR>";
                }
                $msg .= $STAT_BAR_FONTEND0;
                $msg .= "</TD>\n";
            } else {
                $msg .= "<TD VALIGN=\"BOTTOM\" ALIGN=\"CENTER\">";
                $msg .= $STAT_BAR_FONTBEG0;
                $msg .= $v;
                $msg .= $STAT_BAR_FONTEND0;
                $msg .= "</TD>\n";
            }
        }
        $msg .= "<TD>&nbsp;</TD>\n";
        $msg .= "</TR>\n";
        $msg .= "<TR" . coreMakeBackground($STAT_BAR_BACK1) . ">\n";
        $msg .= "<TD>&nbsp;</TD>\n";
        /* Unter Leiste mit den Beschriftungen der einzelnen Balken aus-	*/
        /* geben.																													*/
        reset($grapharray);
        while (list($i, $v) = each($grapharray)) {
            $msg .= "<TD>";
            $msg .= $STAT_BAR_FONTBEG1;
            $msg .= $i;
            $msg .= $STAT_BAR_FONREND1;
            $msg .= "</TD>\n";
        }
        $msg .= "<TD>";
        $msg .= $STAT_BAR_FONTBEG2;
        $msg .= $text_b;
        $msg .= $STAT_BAR_FONREND2;
        $msg .= "</TD>\n";
        $msg .= "</TR>\n";
        $msg .= "</TABLE>\n";
        /* Durchschnittliche Anzahl der Benutzer und höchste Anzahl der	*/
        /* Benutzer ausgeben. */
        $msg .= "<P ALIGN=\"CENTER\">";
        $msg .= $STAT_BAR_FONTBEG0;
        $msg .= $STAT_TXT["0100"] . " {$d} - " . $STAT_TXT["0101"] . " {$b}";
        $msg .= $STAT_BAR_FONTEND0;
        $msg .= "</P>\n";
        $msg .= "</DIV>\n";
    }
    unset($grapharray);
    return $msg;
}