/** * purpose: generate performance graph for a team * params: team_id * returns: complete table with Google API graphics */ function getTeamAvgHist($vtid) { # changed to google API and using the api_rs layer #TODO here we still are hardcoded to 501 playing ... global $dbi; $OUT = ""; $RS = DB_listTeamLineUp($dbi, $vtid); # TP.lid,T.id,T.tname,P.pid,P.pfname,P.plname,P.pfkey1,P.pfkey2,TY.TEXT,TP.leventid # foreach ($RS as $row) { $PlayerDat = DB_listLegStatAverageBreakdown($dbi, 0, $row[9], '>0', 501, $row[3]); # E.evname,P.pid,P.pfname,P.plname,M.mdate,L.ldarts,L.lfinish,(501-L.lscore),round((L.lscore/L.ldarts),2) AVG if (sizeof($PlayerDat) > 0) { $arAVG = array(); foreach ($PlayerDat as $rowleg) { $arAVG[] = round($rowleg[8]) * 2; } $imgURL = '<img src="' . _googleAVGChart('l', $arAVG) . '"/><br/>'; # to tu kurwa $OUT = $OUT . '<tr><td>' . mb_convert_encoding($rowleg[2], 'UTF-8') . ' ' . mb_convert_encoding($rowleg[3], 'UTF-8') . '</td><td>' . $imgURL . '</td></tr>'; } } $RET = OpenTable('teamdata', 1); $RET = $RET . $OUT; $RET = $RET . CloseTable(1); return $RET; }
/** @_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>"; }
$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;