/** * purpose: render a complete TABLE for a single game including all details but NO Action Buttons * params: event[],admin 0/1,$P=gameplayerrecords (2/4) * returns: HTML TABLE */ function _LS_renderSingleGameRow($event, $editmode, $matchdate, &$PH, &$PA) { # structure: P $gid,$gmkey,$gtype,$gstatus,4=$gpid,$gppid,$pfname,$plname,8=$tid if ($PH[0] != $PA[0]) { die('E:M10:GameIDWrong'); } $statvalH = 0; $statvalA = 0; $legswonH = 0; $legswonA = 0; $OUT = ''; #// generate statistics values based on the list NUM $statvalH = number_format(RetStatValForPlayerOnDate($PH[5], $event['evstatcode_id'], $matchdate), 2, '.', ''); $statvalA = number_format(RetStatValForPlayerOnDate($PA[5], $event['evstatcode_id'], $matchdate), 2, '.', ''); if ($editmode == 1) { $playerselectH = SelectPlayerFromTeam('ph' . $PH[0], $PH[8], $PH[5], $event['evpassfield']) . _input(0, 'th' . $PH[0], $PH[8]) . _input(0, 'gph' . $PH[0], $PH[4]); $playerselectA = SelectPlayerFromTeam('pa' . $PA[0], $PA[8], $PA[5], $event['evpassfield']) . _input(0, 'ta' . $PA[0], $PA[8]) . _input(0, 'gpa' . $PA[0], $PA[4]); } $legswonH = GetLegsWonThisGame($PH[0], $PH[5]); $legswonA = GetLegsWonThisGame($PA[0], $PA[5]); if ($editmode == 1) { $OUT = $OUT . '<table width="100%"><tr>'; # // open ROW and GAME DIV #$OUT=$OUT.'<td>S:'.$PH[0].'</td><td align="right">'.$playerselectH.'<br/>'.$statvalH.'</td>'; $OUT = $OUT . '<td align="right">' . $playerselectH . '<br/>' . $statvalH . '</td>'; } else { $OUT = $OUT . '<table width="100%"><tr><td></td><td width="30%" align="right">' . $PH[7] . ' ' . $PH[6] . '<br/>' . $statvalH . '</td>'; } $OUT = $OUT . '<td width="10%">'; if ($event['evsgldarts'] == 1) { $OUT = $OUT . LegTableDarts($event['evsgldist'], $PH[0], $PH[5]); } if ($event['evsglroundcheck'] == 1) { $OUT = $OUT . LegTableRounds($event['evsgldist'], $PH[0], $PH[5]); } $OUT = $OUT . '</td>'; if ($editmode == 1) { $OUT = $OUT . '<td align="right">' . _input(1, 'lh' . $PH[0], $legswonH, 2) . '</td>'; } else { $OUT = $OUT . '<td align="right">' . _input(2, 'lh' . $PH[0], $legswonH, 2) . '</td>'; } # # Player from AWAY team # if ($editmode == 1) { $OUT = $OUT . '<td >' . _input(1, 'la' . $PA[0], $legswonA, 2) . '</td>'; } else { $OUT = $OUT . '<td >' . _input(2, 'la' . $PA[0], $legswonA, 2) . '</td>'; } $OUT = $OUT . '<td width="10%">'; if ($event['evsgldarts'] == 1) { $OUT = $OUT . LegTableDarts($event['evsgldist'], $PA[0], $PA[5]); } if ($event['evsglroundcheck'] == 1) { $OUT = $OUT . LegTableRounds($event['evsgldist'], $PA[0], $PA[5]); } $OUT = $OUT . '</td>'; if ($editmode == 1) { $OUT = $OUT . '<td>' . $playerselectA . '<br/>' . $statvalA . '</td>'; } else { $OUT = $OUT . '<td width="30%">' . $PA[7] . ' ' . $PA[6] . '<br/>' . $statvalA . '</td>'; } $OUT = $OUT . '</tr></table>'; return $OUT; }
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ö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>'; }