コード例 #1
0
ファイル: ls_stats.php プロジェクト: robmat/samplebator
/** @_showlegstatDetails
 * shows breakdown detail results for the leg statistics in darts based games
 * called by activating a player rank from the legstats  leggroupstats page
 * displays a GRAPH(ajaxed) and the details below
 */
function _showlegstatDetails($eventid, $pid, $mode = 2)
{
    global $event, $dbi;
    /*
     * att: the eventid can be wrong since this could be triggered from the group page
     * make sure to get the correct event for a player of this group
     */
    $privEventID = DB_getEventForPlayer($dbi, $pid, $event['evtypecode_id']);
    #debug($privEventID);
    switch ($mode) {
        case 1:
            $strcomp = '=' . $event['evsgldist'];
            $head = 'Gewonnene Legs';
            break;
        case 0:
            $strcomp = '<' . $event['evsgldist'];
            $head = 'Verlorene Legs';
            break;
        case 2:
            $strcomp = '>0';
            $head = 'Alle Legs';
            break;
    }
    $aTH = array('Bewerb', 'Vorname', 'Nachname', 'Datum', 'Darts', 'Finish', 'Rest', 'Average');
    $RS = DB_listLegStatAverageBreakdown($dbi, 0, $privEventID, $strcomp, $event['evsgldist'], $pid);
    $fields = array(0, 2, 3, 4, 5, 6, 7, 8);
    $ROWS = RecordsetToDataTable($RS, $fields);
    /*
     * OUTPUT, we could change the header here to show a group header
     * if(!$eventid==$privEventID){
     * echo _MakeStatPageHeader($eventid,1);
     * }
     */
    echo _MakeStatPageHeader($eventid, 0);
    echo '<h3>Graphische Darstellung - ' . $head . '</h3>';
    echo '<script language="JavaScript" src="code/legdatagraph.js"></script>';
    echo '<div id="JG" style="position:relative;height:500px;width:700px"></div>';
    echo '<h3>Detailierte Auflistung - ' . $head . '</h3>';
    echo '<table width="100%">' . ArrayToTableHead($aTH) . $ROWS . '</table>';
    echo "<script>window.onLoad=playerhist({$eventid},{$mode},{$pid})</script>";
}
コード例 #2
0
$dbi = sql_connect($dbhost, $dbuname, $dbpass, $dbname);
$aEvent = reteventconfig($event_id);
if (sizeof($aEvent) < 3) {
    die('Err40:NoEventID');
}
#debug($aEvent);
switch ($score_comp) {
    case 0:
        $score_comp = '<' . $aEvent['evsgldist'];
        break;
    case 2:
        $score_comp = '>0';
        break;
    case 1:
        $score_comp = '=' . $aEvent['evsgldist'];
        break;
}
# raw listing of all games in this league
if ($t_id > 0) {
    $RS = DB_listLegStatDartsHistogramTeam($dbi, $event_group_id, $statcode_id, $event_id, $score_comp, $aEvent['evsgldist'], $t_id);
}
if ($p_id > 0) {
    #hack since this could come from a group page with non matching pid-eventid pairings
    $privEventID = DB_getEventForPlayer($dbi, $p_id, $aEvent['evtypecode_id']);
    $RS = DB_listLegStatAverageBreakdown($dbi, 0, $privEventID, $score_comp, $aEvent['evsgldist'], $p_id, $hist_mode);
}
#$fields=array(0,1);
#$ROWS=RecordsetToDataTable($RS,$fields);
$ROWS = RecordsetToCSV($RS);
header('Content-Type: application/text; charset=ISO-8859-1');
echo $ROWS;