function _showmatch($vmkey, $eventid) { #//select gid,ggameid,gmatchid,gvereinid,vname,gplayerid,pfname,plname from tblgame,tverein,tplayer where gvereinid=vid and gplayerid=pid # // display a typical matchcard # // adminmode = selectboxes and input fields # // usermode = readonly controls # // v1 bh 1.2006 initial version read only # // v2 using the matchkey and eventID # // v3 corrected gamewon counter to respect event - sgllegs/dbllegs # // v4 corrected bug in sending eventid to purge proc # // v4.1 changed code to use the input sub # // v4.2 added the vereins-access layer # // v43 complete rework: changed to codesharing with the lsdb backend , added POSTback buttons global $dbi, $event, $redpic, $greenpic, $LS_LEVEL; $editmode = 0; $thismatcheditmode = 0; $hometeam = 0; $awayteam = 0; # // v4.2 team-access-layer ... # we dont give full access in here just make sure the DETAIL links are in place ... and the MatchSave does work $thismatcheditmode = retAccessThisMatchKey($vmkey); if ($LS_LEVEL > 1 || $thismatcheditmode == 1) { $editmode = 1; # (can be 2,3,4) echo '<script type="text/javascript" src="code/MatchCode.js"></script>'; } echo setPageTitle('Resultat der Begegnung'); echo '<div id="maincontent">'; $precord = sql_query('select mid,mkey,mround,mdate,mlocation,mthome,mstatus,mcomment,T.id,T.tname' . ' FROM tblmatch M,tblmatchteam MT,tblteam T' . ' WHERE M.MKEY=MT.MTMKEY and MT.MTTID=T.ID and M.MKEY="' . $vmkey . '" order by MT.MTHOME desc', $dbi); $lastmid = 0; $matchdate = ''; while (list($mid, $mkey, $mround, $mdate, $mlocation, $mthome, $mstatus, $mcomment, $tid, $tname) = sql_fetch_row($precord, $dbi)) { if ($lastmid != $mid) { $hometeam = $tid; $hometeamName = $tname; } else { $awayteam = $tid; $awayteamName = $tname; } $lastmid = $mid; $matchdate = $mdate; $match_round = $mround; $match_comment = $mcomment; } /* * OUTPUT HEADER Section,make header box with 40:10:10:40 */ OpenTable('mhead'); echo '<tr><td colspan="4" align="center">' . $event['evname'] . 'Saison ' . $event['evyear'] . ' Runde ' . $match_round . '</td></tr><tr><td width="40%"><h3>' . $hometeamName . '</h3></td><td width="10%"></td>'; echo '<td width="10%"></td><td width="40%"><h3>' . $awayteamName . '</h3></td></tr>'; CloseTable(); echo _input(0, 'mkey', $vmkey) . _input(0, 'eid', $eventid) . '<br/>'; /* * SECTION Explanations, legend, and Quicklinks ... */ if ($editmode == 1) { // this is accessible by LigaAdmins + Vereinsaccounts ... OpenTable('mcontrol'); echo '<table><tr><td>-- Player unknown/missing -- </td><td>Dieser Eintrag ist zu wählen wenn das Spiel stattgefunden hat, der betreffende Spieler jedoch nicht in der Teamliste oder im System aufscheint.</td></tr>'; echo '<tr><td>-- #WO (nicht angetreten) --</td><td>Dieser Eintrag ist zu wählen wenn kein Spieler anwesend war (zB Unterzahl). Das Spiel wird dann automatisch mit zu null für den anwesenden Gegner gewertet. Sind beide Spieler nicht anwesend, so sind beide mit WO zu markieren, dieses Spiel wird dann überhaupt nicht gewertet.</td></tr>'; echo '<tr><td colspan="2"><table width="100%"><tr>' . '<td width="50%" align="center">'; echo renderWOMatchForm($eventid, $vmkey, $hometeam, $awayteam, $hometeamName); echo '</td><td width="50%" align="center"><form action="ls_system.php" method="post">'; echo renderWOMatchForm($eventid, $vmkey, $awayteam, $hometeam, $awayteamName); echo '</td></tr></table></td></tr></table>'; CloseTable(); echo '<br/>'; } /* * REPLACE in v5 by reading the event.config.blocks */ OpenTable('mbody'); # // =============================================== # // ========= SINGLES ====================== # // =============================================== $precord = sql_query('select gid,gmkey,gtype,gstatus,gpid,gppid,pfname,plname' . ' FROM tblgame G,tblgameplayer GP left join tplayer P on GP.gppid=P.pid' . ' WHERE G.gid=GP.gpgid and G.gmkey="' . $vmkey . '" and gtype=1 order by gid,gpid', $dbi); $lastgameid = 0; while (list($gid, $gmkey, $gtype, $gstatus, $gpid, $gppid, $pfname, $plname) = sql_fetch_row($precord, $dbi)) { if ($lastgameid != $gid) { $PH = array($gid, $gmkey, $gtype, $gstatus, $gpid, $gppid, $pfname, $plname, $hometeam); } else { $PA = array($gid, $gmkey, $gtype, $gstatus, $gpid, $gppid, $pfname, $plname, $awayteam); echo '<tr><td><div id="trg' . $gid . '">'; echo _LS_renderSingleGameRow($event, $editmode, $matchdate, $PH, $PA); echo '</div><div id="trged' . $gid . '"></div></td><td valign="top">'; if ($editmode == 1) { echo '<table cellpadding=0><tr><td>' . _imgButton('save', 'saveGame(' . $gid . ')') . '</td>'; echo '<td>' . _imgButton('edit', 'editGame(' . $gid . ')') . '</td>'; echo '<td>' . _imgButton('detail', 'getGame(' . $gid . ')') . '</td>' . '<td>' . _imgButton('cancel', 'resetGame(' . $gid . ')') . '</td></tr></table>'; } echo '</td></tr><tr><td align="right"><div id="msg' . $gid . '"></div></td></tr>'; // close the game Table + Game DIV and the Tablerow } $lastgameid = $gid; } // END WHILE singles ... # // =============================================== # // ========= PAIRS ======================== # // =============================================== # # $precord = sql_query('select G.gid,G.gmkey,G.gtype,G.gstatus,GP.gpid,GP.gppid,P.pfname,P.plname' . ' FROM tblgame G,tblgameplayer GP left JOIN tplayer P on GP.gppid=P.pid' . ' WHERE G.gid=GP.gpgid AND G.gmkey="' . $vmkey . '" and G.gtype=2 order by G.gid,GP.gpid', $dbi); $aAllGames = array(); while (list($gid, $gmkey, $gtype, $gstatus, $gpid, $gppid, $pfname, $plname) = sql_fetch_row($precord, $dbi)) { $aAllGames[] = array($gid, $gmkey, $gtype, $gstatus, $gpid, $gppid, $pfname, $plname); } /* * since we have pairs - we split Recordset into chunks of 4 */ $aAllGames = array_chunk($aAllGames, 4); foreach ($aAllGames as $aThisGame) { /* * for every chunk we have this should be a pairs game * assign the team ID and => lets render */ $aThisGame[0][8] = $hometeam; $aThisGame[1][8] = $hometeam; $aThisGame[2][8] = $awayteam; $aThisGame[3][8] = $awayteam; $gid = $aThisGame[0][0]; echo '<tr><td><div id="trg' . $gid . '">'; echo _LS_renderPairsGameRow($event, $editmode, $matchdate, $aThisGame); echo '</div><br/><div id="trged' . $gid . '"></div></td><td valign="top">'; if ($editmode == 1) { echo '<table><tr><td>' . _imgButton('save', 'saveGameD(' . $gid . ')') . '</td>'; #echo '<td>'._imgButton('edit','editGame('.$gid.')').'</td>'; echo '<td>' . _imgButton('detail', 'getGame(' . $gid . ')') . '</td>'; echo '<td>' . _imgButton('cancel', 'resetGame(' . $gid . ')') . '</td></tr></table>'; } echo '</td></tr><tr><td align="right"><div id="msg' . $gid . '"></div></td></tr>'; // close the game Table + Game DIV and the Tablerow } /* * Can we somehow have a summary ROW ??? with generated values ??? */ $setshometeam = 0; $setsawayteam = 0; $legshometeam = 0; $legsawayteam = 0; #echo '<tr><td align="center"><h3>'.$setshometeam.':'.$setsawayteam.'<br/>('.$legshometeam.'):('.$legsawayteam.')</h3></td></tr>'; CloseTable(); /** * =========== END of the Match Sheet Body =========== **/ /** * =========== START Admin Section =========== * a) create this match -->generates the empty tblgameplayer entries ... * b) save this match --> updates the tblmatchteam with results and sets status according to the userType */ echo '<br/>'; if ($LS_LEVEL > 1 || $editmode == 1) { // now this is for ADMINS only ..... OpenTable('madmin'); echo '<table><tr><td colspan=3>'; echo '<div id="mcomment">'; echo '<table><tr><td valign="top"><image src="images/detail.png" align="left">Speichere einen Kommentar</br>zu diesem Match (max 200)</td>'; echo '<td valign="top">' . _input(1, 'f23', $match_comment, 90) . '</td>'; echo '<td valign="top">' . _button('Speichern', 'savemcomment()') . '<div id="resp4"></div>'; echo '</td></tr></table></div></td></tr><tr>'; // render save section here in RW mode echo '<td valign="top" width="250px"><div id="msum">'; echo _LS_renderSaveMatchBox($LS_LEVEL, $setshometeam, $setsawayteam, $legshometeam, $legsawayteam, 0); echo '</div><div>' . _button('1. Addieren', 'calcResult()') . _button('2. Resultat Speichern', 'saveMatchA()') . '</div>'; echo '</td>'; if ($LS_LEVEL > 1) { // history button echo '<td valign="top" width="33%"><div id="mhist">'; echo '<image src="images/detail.png" align="left">Lade die Bearbeitungs Historie für dieses Match. Die Anzeige erfolgt unterhalb.<br/>' . _button('Show History', 'historymatch()'); echo '</div>'; echo '</td>'; } if ($LS_LEVEL > 2) { // delete button $STROUT = '<td valign="top" width="33%"><div id="mdel"><form action="ls_system.php" method="post">' . _input(0, 'func', 'purgematch') . _input(0, 'vmkey', $vmkey) . _input(0, 'eventid', $eventid) . '<table><tr><td><image src="images/stop.gif" align="left"><b>Achtung</b> Mit dem Button LÖSCHEN kannst du dieses Spiel neu anlegen, dabei werden sämtliche Spieldaten und Resultate <b>gelöscht</b>. Diese Aktion ist unwiederbringlich ...</td></tr>' . '<tr><td>' . _button('Löschen') . '</td></tr></table></form></div></td>'; echo $STROUT; } echo '</tr></table>'; CloseTable(); echo '<br/><div id="hmatch"></div>'; } /** * =========== END of the Match ADMIN Section =========== **/ echo '</div>'; # close maincontent-div }
/** * return a horizontal leg row according to the values passed and the event-config * this is a legrow for individual leg data * currently SINGLE only .. **/ function _LS_legrow($objEvent, $data = array()) { // data structure from api_rs: // G.gid,G.gtype,GP.gpid,GP.gpsetwon,GP.gplegswon,GP.gptid,P.pid,P.pfname,P.plname // [L.lid,L.lstart,L.ldarts,(501-L.lscore),L.lfinish,L.lhighscore] // [L.lid,L.lstart,L.lroundscore,L.lroundcheck,(501-L.lscore),L.lfinish,L.lhighscore] #if (sizeof($data)<10){$idname="RES";} else {$idname="L".$data[8];} if (sizeof($data) > 9) { $legID = $data[9]; } else { $legID = 0; } $strret = '<tr id="' . $legID . '"><td>' . _imgButton('remove', 'remLeg(' . $legID . ',' . $data[0] . ')') . '</td>'; if ($objEvent['evsgldarts'] == 1) { if ($objEvent['evsglstart'] == 1) { $strret = $strret . '<td>' . _checkbox('B', $data[10]) . '</td>'; } if ($objEvent['evsgldarts'] == 1) { $strret = $strret . '<td>' . _input(1, 'D', $data[11], 3, 3) . '</td>'; } if ($objEvent['evsglrest'] == 1) { $strret = $strret . '<td>' . _input(1, 'R', $data[12], 3, 3) . '</td>'; } if ($objEvent['evsglfinish'] == 1) { $strret = $strret . '<td>' . _input(1, 'F', $data[13], 3, 3) . '</td>'; } if ($objEvent['evsglhighscore'] == 1) { $strret = $strret . '<td>' . _input(1, 'M', $data[14], 3, 3) . '</td>'; } if ($objEvent['evsglhighscore171'] == 1) { $strret = $strret . '<td>' . _input(1, 'M171', $data[15], 3, 3) . '</td>'; } } elseif ($objEvent['evsglroundcheck'] == 1) { if ($objEvent['evsglstart'] == 1) { $strret = $strret . '<td>' . _checkbox('B', $data[10]) . '</td>'; } if ($objEvent['evsglroundscore'] == 1) { $strret = $strret . '<td>' . _input(1, 'S', $data[11], 3, 3) . '</td>'; } if ($objEvent['evsglrest'] == 1) { $strret = $strret . '<td>' . _input(1, 'R', $data[13], 3, 3) . '</td>'; } if ($objEvent['evsglroundcheck'] == 1) { $strret = $strret . '<td>' . _input(1, 'C', $data[12], 3, 3) . '</td>'; } if ($objEvent['evsglfinish'] == 1) { $strret = $strret . '<td>' . _input(1, 'F', $data[14], 3, 3) . '</td>'; } if ($objEvent['evsglhighscore']) { $strret = $strret . '<td>' . _input(1, 'M', $data[15], 3, 3) . '</td>'; } } else { $strret = $strret . '<td>Keine Leg Statistik konfiguriert</td>'; } return $strret . '</tr>'; }
function _showform_membership($membership_id, $player_id) { /* * depending on passed in id -> either fetch existing or show new * output is loaded into hosting DIV */ global $dbi, $usertoken; $aMEM = array(); $d = ls_getdate(); if ($membership_id > 0) { if (!($precord = sql_query('select * from tmembership where mid=' . $membership_id, $dbi))) { die('<font color="red">E127:Record not found</font>'); } if (!($aMEM = sql_fetch_array($precord, $dbi))) { die('<font color="red">E128:DB engine Error</font>'); } } else { $aMEM['mpassnr'] = ''; $aMEM['mtype'] = 0; $aMEM['mvereinid'] = $usertoken['verein_id']; // just in case we come here as the vereins account $aMEM['mcre_user'] = $usertoken['uname']; $aMEM['mcre_date'] = $d; $aMEM['mid'] = 0; $aMEM['mpid'] = $player_id; $aMEM['mstart'] = substr($d, 0, 4) . '-01-01'; $aMEM['mend'] = substr($d, 0, 4) . '-12-31'; } /* * OUTPUT ... */ $OUT = ''; $OUT = $OUT . (include '../forms/membership.php'); $OUT = $OUT . '<table><tr><td>' . _imgButton('save', 'membersave(' . $membership_id . ',' . $player_id . ')') . '</td><td><div id="savemsg"></div></td></tr></table>'; return $OUT; }