Ejemplo n.º 1
0
function RetStatValForPlayerOnDate($P_ID, $vstatcode = 0, $matchdate = "")
{
    /*
     *  	returns the ranking points for a player on a given date.
     * 	default vstatcode=1, usually this is the evstatcode from event config
     * 	matchdate defaults to today()
     * 	TODO - replace by query lookup according to the evStatCode
     * 		- dont we have a proper DB_retSomething for this ???
     * 				- in the future statvals or else can be in different tables or static lists
     * 	ATT there may be no actual EVENT when we come here ...
     */
    global $event, $dbi;
    if (strlen($matchdate) == 0) {
        // default is TODAY ...
        $d = getdate();
        $matchdate = "{$d['year']}" . "-" . "{$d['mon']}" . "-" . "{$d['mday']}";
    }
    if (!$P_ID) {
        return 0;
    }
    // retrieve a valid ranking date for this statistics_code
    $vrankingdate = RetStatDateForStatCode($vstatcode, $matchdate);
    // get points for this date ...
    // $PID $vstatcode $vstatdate;
    #debug($vrankingdate);
    switch ($vstatcode) {
        case 9:
        case 16:
        case 17:
            // experimental value generated by dividing legpoints by matches ...
            $QRY = 'select sum(gplegswon)/count(gplegswon) statval,pid,plname,pfname from tblmatch,tblgame,tblgameplayer,tplayer' . ' WHERE mkey=gmkey and gid=gpgid and gppid=pid and mkey like "e' . $event['id'] . 'r%" and gtype=1 and pid=' . $P_ID . ' group by pid order by statval desc';
            $res = sql_query($QRY, $dbi);
            break;
        case 1:
        case 3:
        case 5:
        default:
            $res = sql_query("select statval from tblstat where statpid={$P_ID} and statcode={$vstatcode} and statdate='{$vrankingdate}'", $dbi);
            break;
    }
    $aRET = sql_fetch_array($res, $dbi);
    return $aRET['statval'];
}
Ejemplo n.º 2
0
# // v2.6 included legacy stuff from tbllegx into gesamt RANKINGS.
# // v2.7 included the iTEST flag on the FEDAIndex pages to change the checkindex count
#		FIX: Liga ranking
include "ls_main.php";
require "func_stat.php";
require 'ORM/fedastat.php';
# // security ... this is easy since here we are public ....
# // this is a GET only controller, no POST processing is done here ...
# // Beginn Funktionen ----------------
$tdbg = "#CCDDCC";
$tdWon = "#ccffcc";
$tdLost = "#ffcccc";
$d = getdate();
$rtdate = "{$d['year']}" . "-" . "{$d['mon']}" . "-" . "{$d['mday']}";
#// hardcoded to FEDA MIX ....
$fedadefaultdate = RetStatDateForStatCode(3, $rtdate);
/** @_MakeStatPageHeader
 * this creates the top and navigation rows on every statistic page ...
 * param: $evlistnum contains the eventGroupListNumber - indicates that we are viewing a consolidated eventLIST STAT from a group
 * TODO - depending on the event we can have different headers in here .... this is awfull right now
 * 		- should this be stat_num or group_num ????????
 * 		- how about just passing a costum header ??
 **/
function _MakeStatPageHeader($event_id, $evlistnum)
{
    global $event;
    $ret = "";
    switch ($evlistnum) {
        case "3":
            # FEDA MIXED
        # FEDA MIXED
Ejemplo n.º 3
0
function _browseteams($eventid)
{
    # zeigt einen Table mit einer Vereins / SpielerListe an
    # evtl Teil des ADMIN Backends ???
    # // bugfix 22.10.2006 changed $lasttname to $lastTID
    global $event, $dbi, $sctdcolor, $predpic, $pgreenpic, $TEAM_LEVEL, $teamcode;
    $editmode = 0;
    if ($TEAM_LEVEL > 2) {
        $editmode = 1;
    }
    echo setPageTitle('Mannschaften und ihre Aufstellungen, ' . $event['evname']);
    echo '<div id=\'maincontent\'>';
    echo '<p>Ranglistenwerte vom ' . RetStatDateForStatCode($event['evstatcode_id']) . '</p>';
    OpenTable();
    # query the LineUp - show current and recent players, omit non-oedv players - list all players with current STATISTC values ...
    # no left join used, player do not show up without ANY SSI Value !!!
    $precord = sql_query('select T.tevent_id,T.id,T.tname,TP.lplayerid,P.pfname,P.plname,P.' . $event['evpassfield'] . ',TP.ltype,TYP.text' . ' FROM tblteam T left join tblteamplayer TP on T.id=lteamid left join tplayer P on TP.lplayerid=P.pid left join ttypeplayer TYP on TP.ltype=TYP.id' . ' WHERE T.tevent_id=' . $event['id'] . ' order by T.id,TP.lid;', $dbi);
    $lastTID = 0;
    $tcount = 0;
    # teamcounter used to create new TR row after 2 teams
    $pcount = 0;
    # playercounter within a team pcount=1 => captain of team ....
    while (list($tevevid, $tid, $tname, $pid, $pfname, $plname, $ppassnr, $ltype, $ttext) = sql_fetch_row($precord, $dbi)) {
        $statval = 0;
        if ($lastTID != $tid) {
            $tcount = $tcount + 1;
            $pcount = 0;
            if ($tcount % 2 > 0) {
                # ok lets start a new row - there are 2 teams per row ....
                if ($tcount == 1) {
                    echo '<tr><td valign=top><table width=100%>';
                }
                if ($tcount > 1) {
                    echo '</table></td></tr><tr><td valign=top><table width=100%>';
                }
            } else {
                # second verein same row --> new cell
                echo '</table></td><td valign=top><table width=100%>';
            }
            echo '<tr><td valign=\'top\' class=\'thead\' colspan=\'4\'>' . $tname . '</td></tr>';
            if ($editmode) {
                echo '<tr><td colspan=\'4\' id=\'teamctl' . $tid . '\'><table width=100%><tr>' . '<td>' . _button('Edit', '', $teamcode . '?func=editteam&eventid=' . $tevevid . '&vtid=' . $tid) . '</td>' . '<td>' . _button('Copy', '', "{$teamcode}?func=team2team&vtid={$tid}&eventid={$tevevid}") . '</td>' . '<td>' . _button('L&ouml;schen', '', "{$teamcode}?func=delete&vtid={$tid}&eventid={$tevevid}") . '</td>' . '</tr></table></td></tr>';
            }
            echo '<tr><td width="50px"></td><td><b>PassNr</b></td><td><b>Name</b></td><td><b>Wert/Index/Kommentar</b></td></tr>';
        }
        $pcount = $pcount + 1;
        # // here comes the player number, switch on event config
        if ($ltype == 1) {
            echo '<tr><td width=\'50px\'></td><td>' . $ppassnr . '</td><td>' . $pfname . ' ' . $plname . '</td>';
        } elseif ($ltype > 4) {
            echo '<tr><td width=\'50px\'></td><td>' . $ppassnr . '</td><td style=\'color:red\'>' . $pfname . ' ' . $plname . ' (' . $ttext . ')</td>';
        } else {
            echo '<tr><td width=\'50px\'></td><td>' . $ppassnr . '</td><td>' . $pfname . ' ' . $plname . ' (' . $ttext . ')</td>';
        }
        # // fetch existing statval - this is hardwired to existing STATLIST Values
        $statval = number_format(RetStatValForPlayerOnDate($pid, $event['evstatcode_id']), 2, '.', '');
        echo '<td>' . $statval . '</td></tr>';
        $lastTID = $tid;
    }
    # // END WHILE LOOP
    # // END TEAM-PLAYER QUERY for this event
    # // close last verein table and cell construct, but only if there are teams else the layout is messed up
    if ($tcount > 0) {
        echo '</table></td></tr>';
    }
    CloseTable();
    # // admin stuff - NEW TEAM - convenience button ...
    echo '<br>';
    if ($TEAM_LEVEL > 2) {
        OpenTable();
        echo '<table><tr><td>' . _button('Neues Team erstellen', '', $teamcode . '?func=newteam&eventid=' . $event['id']) . '</td></tr></table>';
        CloseTable();
    }
    echo '</div>';
}