Esempio n. 1
0
function _showlowstat($eventid)
{
    global $dbi, $tdbg, $event;
    echo _MakeStatPageHeader($eventid, 0);
    $sql = "";
    if ($event['evsgldarts'] == 1) {
        $legend = 'Die 20 besten gewonnenen Legs in den Singles (Darts)';
        $sql = "select pfname,plname,ldarts from tblleg,tblgame,tplayer where lpid=pid and lgid=gid and gmkey like 'e" . $eventid . "r%' and gtype=1 and lscore=" . $event['evsgldist'] . " order by ldarts asc limit 20";
    } elseif ($event['evsglroundcheck'] == 1) {
        $legend = 'Die 20 besten gewonnenen Legs in den Singles (Runden)';
        $sql = "select pfname,plname,lroundcheck from tbllegrounds,tblgame,tplayer where lpid=pid and lgid=gid and gmkey like 'e" . $eventid . "r%' and gtype=1 and lscore=" . $event['evsgldist'] . " order by lroundcheck asc limit 20";
    }
    OpenTable();
    echo '<tr><td width="50%" valign="top"><table width="100%">';
    if (strlen($sql) > 0) {
        $precord = sql_query($sql, $dbi);
        $RS = createRecordSet($precord, $dbi);
        $ROWS = RecordsetToDataTable($RS, array(0, 1, 2));
        echo '<tr><td colspan=3 class="thead">' . $legend . '</td></tr>' . $ROWS;
    }
    ####################################
    $sql = '';
    echo '</table></td><td width="50%" valign="top"><table width="100%">';
    if ($event['evsgldarts'] == 1) {
        $legend = 'Die 20 schlechtesten gewonnenen Legs in den Singles (Darts)';
        $sql = "select pfname,plname,ldarts from tblleg,tblgame,tplayer where lpid=pid and lgid=gid and gmkey like 'e" . $eventid . "r%' and gtype=1 and lscore=" . $event['evsgldist'] . " order by ldarts desc limit 20";
    }
    if ($event['evsglroundcheck'] == 1) {
        $legend = 'Die 20 schlechtesten gewonnenen Legs in den Singles (Runden)';
        $sql = "select pfname,plname,lroundcheck from tbllegrounds,tblgame,tplayer where lpid=pid and lgid=gid and gmkey like 'e" . $eventid . "r%' and gtype=1 and lscore=" . $event['evsgldist'] . " order by lroundcheck desc limit 20";
    }
    if (strlen($sql) > 0) {
        $precord = sql_query($sql, $dbi);
        $RS = createRecordSet($precord, $dbi);
        $ROWS = RecordsetToDataTable($RS, array(0, 1, 2));
        echo '<tr><td colspan=3 class="thead">' . $legend . '</td></tr>' . $ROWS;
    }
    #####################################
    $sql = "";
    $LIM = 20;
    echo '</table></td></tr>';
    echo '<tr><td width="50%"><table width="100%">';
    if ($event['evsgldarts'] == 1) {
        $legend = 'Die ' . $LIM . ' besten Sets in den Singles (Score per Dart)';
        $sql = "select pid,pfname,plname,mdate,sum(lscore)/sum(ldarts) AVG from tblmatch,tblgame,tblleg,tplayer where mkey=gmkey and gid=lgid and lpid=pid and mkey like 'e" . $eventid . "r%' and gtype=1 group by lpid,lgid order by AVG desc limit {$LIM}";
    }
    if ($event['evsglroundcheck'] == 1) {
        $legend = 'Die ' . $LIM . ' besten Sets in den Singles (Score per Round)';
        $sql = "select pid,pfname,plname,mdate,sum(lscore)/sum(lroundcheck) AVG from tblmatch,tblgame,tbllegrounds,tplayer where mkey=gmkey and gid=lgid and lpid=pid and mkey like 'e" . $eventid . "r%' and gtype=1 group by lpid,lgid order by AVG desc limit {$LIM}";
    }
    if (strlen($sql) > 0) {
        $precord = sql_query($sql, $dbi);
        $RS = createRecordSet($precord, $dbi);
        $ROWS = RecordsetToDataTable($RS, array(1, 2, 3, 4));
        echo '<tr><td colspan=4 class="thead">' . $legend . '</td></tr>' . $ROWS;
    }
    echo '</table></td><td width="50%"><table width="100%">';
    $sql = '';
    $LIM = 20;
    if ($event['evsgldarts'] == 1) {
        $legend = 'Die ' . $LIM . ' schlechtesten Sets in den Singles (Score per Dart)';
        $sql = "select pid,pfname,plname,mdate,sum(lscore)/sum(ldarts) AVG from tblmatch,tblgame,tblleg,tplayer where mkey=gmkey and gid=lgid and lpid=pid and mkey like 'e" . $eventid . "r%' and gtype=1 group by lpid,lgid order by AVG asc limit {$LIM}";
    }
    if ($event['evsglroundcheck'] == 1) {
        $legend = 'Die ' . $LIM . ' schlechtesten Sets in den Singles (Score per Round)';
        $sql = "select pid,pfname,plname,mdate,sum(lscore)/sum(lroundcheck) AVG from tblmatch,tblgame,tbllegrounds,tplayer where mkey=gmkey and gid=lgid and lpid=pid and mkey like 'e" . $eventid . "r%' and gtype=1 group by lpid,lgid order by AVG asc limit {$LIM}";
    }
    if (strlen($sql) > 0) {
        $precord = sql_query($sql, $dbi);
        $RS = createRecordSet($precord, $dbi);
        $ROWS = RecordsetToDataTable($RS, array(1, 2, 3, 4));
        echo '<tr><td colspan=4 class="thead">' . $legend . '</td></tr>' . $ROWS;
    }
    $sql = '';
    ################################
    echo '</table></td></tr>';
    echo '<tr><td width="50%" valign="top"><table width="100%">';
    # // do we have to show finishstats ???
    if ($event['evsglfinish'] == 1) {
        $legend = 'Die 20 h&ouml;chsten in den Singles erzielten Finishzahlen';
        $precord = sql_query("select lpid,pfname,plname,lfinish from tblleg,tblgame,tplayer where lpid=pid and lgid=gid and gmkey like 'e" . $eventid . "r%' and gtype=1 and lfinish>0 order by lfinish desc limit 20", $dbi);
        $RS = createRecordSet($precord, $dbi);
        $ROWS = RecordsetToDataTable($RS, array(1, 2, 3));
        echo '<tr><td colspan=4 class="thead">' . $legend . '</td></tr>' . $ROWS;
    }
    echo '</table></td></tr><tr><td width="50%" valign="top"><table width="100%">';
    if ($event['evsglhighscore171'] == 1) {
        $legend = 'Anzahl erzielter Highscores 171';
        $precord = sql_query("select lpid,pfname,plname,sum(lhighscore171) HS from tblleg,tblgame,tplayer where lpid=pid and lgid=gid and gmkey like 'e" . $eventid . "r%' and gtype=1 and lhighscore171>0 group by lpid order by HS desc", $dbi);
        $RS = createRecordSet($precord, $dbi);
        $ROWS = RecordsetToDataTable($RS, array(1, 2, 3));
        echo '<tr><td colspan=4 class="thead">' . $legend . '</td></tr>' . $ROWS . '</table>';
    }
    echo '<td width="50%" valign="top"><table width="100%">';
    # // how about the HIGHSCORES ???
    if ($event['evsglhighscore'] == 1) {
        $legend = 'Anzahl erzielter Highscores 180';
        $precord = sql_query("select lpid,pfname,plname,sum(lhighscore) HS from tblleg,tblgame,tplayer where lpid=pid and lgid=gid and gmkey like 'e" . $eventid . "r%' and gtype=1 and lhighscore>0 group by lpid order by HS desc", $dbi);
        $RS = createRecordSet($precord, $dbi);
        $ROWS = RecordsetToDataTable($RS, array(1, 2, 3));
        echo '<tr><td colspan=4 class="thead">' . $legend . '</td></tr>' . $ROWS;
    }
    echo '</table></td></tr>';
    CloseTable();
}
Esempio n. 2
0
/**
 * Return a recordset describing how many games a player has achieved with 3-2-1-0 legs ..
 * in a specific league or league=group
 *
 * @param pointer $DB,$event_id,$player_id
 */
function DB_retPlayerWonLostNumbers($DB, $event_id, $player_id)
{
    $qry = 'SELECT P.pid,P.plname,P.pfname, GP.gplegswon ,count(*) C FROM tblmatch M,tblgame G,tblgameplayer GP,tplayer P' . ' WHERE M.mkey=G.gmkey and G.gid=GP.gpgid and GP.gppid=P.pid and M.mkey like "e' . $event_id . 'r%" and G.gtype=1 and P.pid=' . $player_id . ' group by GP.gplegswon ORDER by GP.gplegswon desc';
    #debug($qry);
    $presult = sql_query($qry, $DB);
    return createRecordSet($presult, $DB);
}
Esempio n. 3
0
                $this->SetFillColor(192, 192, 192);
            }
            if ($cellValue < 5) {
                $this->SetFillColor(204, 127, 50);
            }
            if ($cellValue < 2) {
                $this->SetFillColor(255, 255, 255);
            }
        }
    }
}
global $dbi;
$queryResult = sql_query("SELECT pl.pid AS playerid, pl.pfname AS name, pl.plname AS surname, pl.pfkey2 AS userkey, le.lstart, le.ldarts AS darts, le.lscore, le.lfinish, le.lhighscore, le.lhighscore171, COUNT(*) AS howmany, SUM(le.lhighscore) AS max180, SUM(le.lhighscore171) AS max171 FROM tplayer pl JOIN tblleg le ON le.lpid = pl.pid WHERE le.lscore = 501 AND pl.pfkey2 LIKE 'HE%' AND le.ldarts BETWEEN 9 AND 18 GROUP BY playerid, le.ldarts ORDER BY surname, playerid, darts", $dbi);
$resultArray = createRecordSet($queryResult, $dbi);
$maxesQueryResult = sql_query("SELECT playerid, name, surname, userkey, SUM(max180), SUM(max171) FROM (SELECT pl.pid AS playerid, pl.pfname AS name, pl.plname AS surname, pl.pfkey2 AS userkey, le.lstart, le.ldarts AS darts, le.lscore, le.lfinish, le.lhighscore, le.lhighscore171, COUNT(*) AS howmany, SUM(le.lhighscore) AS max180, SUM(le.lhighscore171) AS max171 FROM tplayer pl JOIN tblleg le ON le.lpid = pl.pid WHERE pl.pfkey2 LIKE 'HE%' GROUP BY playerid, le.ldarts ORDER BY surname, playerid, darts ) AS sub GROUP BY playerid", $dbi);
$maxesResultArray = createRecordSet($maxesQueryResult, $dbi);
$currentPlayerId = "";
$playerCount = 0;
$pdfDataTable = array();
$idsArray = array();
foreach ($resultArray as $index => $row) {
    $idsArray[] = $row[0];
}
foreach ($maxesResultArray as $maxesRow) {
    $idsArray[] = $maxesRow[0];
}
$idsArray = array_unique($idsArray);
foreach ($resultArray as $index => $row) {
    if ($currentPlayerId != $row[0]) {
        $currentPlayerId = $row[0];
        $pdfDataTable[$playerCount] = array();