$db = new BD(); $sql = sprintf("select r2.campeonato campeonato from\n\t\t\t\t\t\t(select max(subtime(addtime(data, hora),'06:00:00')) datarod\n\t\t\t\t\t\t\t\tfrom cad_rodada r,\n\t\t\t\t\t\t\t\tcad_campeonato c\n\t\t\t\t\t\t\t\twhere date_add(now(),interval 1 hour) > subtime(addtime(data, hora),'06:00:00')\n\t\t\t\t\t\t\t\tand c.codigo = r.campeonato\n\t\t\t\t\t\t\t\tand c.`flandamento` = 'S'\n\t\t\t\t\t\t\t\thaving date_add(now(),interval 1 hour) > datarod) r,\n\t\t\t\t\t\t(select campeonato,max(subtime(addtime(data, hora),'06:00:00')) datarod\n\t\t\t\t\t\t\t\tfrom cad_rodada r,\n\t\t\t\t\t\t\t\tcad_campeonato c\n\t\t\t\t\t\t\t\twhere date_add(now(),interval 1 hour) > subtime(addtime(data, hora),'06:00:00')\n\t\t\t\t\t\t\t\tand c.codigo = r.campeonato\n\t\t\t\t\t\t\t\tand c.`flandamento` = 'S'\n\t\t\t\t\t\t\t\tgroup by r.campeonato\n\t\t\t\t\t\t\t\thaving date_add(now(),interval 1 hour) > datarod) r2\n\t\t\t\t\t\twhere r.datarod = r2.datarod"); $db->Query($sql); $db->Next(); $camp = $db->getValue('campeonato'); $cmp = new Campeonato($camp); $db->Close(); $cab = sprintf('<legend><span style="color:green;"><b>Rodada Atual</b></legend>'); echo $cab . "\n"; ?> <table id=menuadm frame=box bordercolor="white" border="1px" cellspacing="0" style="width:450px;" width="450px"> <tr class="cabec"> <td width="140px" align="right">Mandante</td><td width="40px" align="center">x</td><td width="140px">Visitante</td><td align="center">Data/Hora</td> </tr> <?php $sql = sprintf("select r.rodada,r.jogo,r.golsma,r.golsvi,r.manda cmanda, r.visita cvisita,\n\t\t\t\t\t\t\t\t\t\t\t\ttm.nome manda,tv.nome visita,\n\t\t\t\t\t\t\t\t\t\t\t\taddtime(r.data, r.hora) datahora\n\t\t\t\t\t\t\t\t\t\t\t\tfrom\n\t\t\t\t\t\t\t\t\t\t\t\tcad_times tm,\n\t\t\t\t\t\t\t\t\t\t\t\tcad_times tv,\n\t\t\t\t\t\t\t\t\t\t\t\tcad_rodada r\n\t\t\t\t\t\t\t\t\t\t\t\twhere\n\t\t\t\t\t\t\t\t\t\t\t\tr.campeonato = %d\n\t\t\t\t\t\t\t\t\t\t\t\tand r.rodada = %d\n\t\t\t\t\t\t\t\t\t\t\t\tand r.manda = tm.codigo\n\t\t\t\t\t\t\t\t\t\t\t\tand r.visita = tv.codigo", $cmp->getCodigo(), $cmp->getRodadaAtual()); $db = new BD(); $db->Query($sql); while ($db->Next()) { $tm = new Time($db->getValue('cmanda')); $tv = new Time($db->getValue('cvisita')); $linha = sprintf('<td align="right">%s</td>' . '<td align="center">%s x %s</td> ' . '<td>%s</td> ' . '<td>%s %s</td> ', $tm->getLink(), $db->getValue('golsma'), $db->getValue('golsvi'), $tv->getLink(), date("d/m/Y H:i", strtotime($db->getValue('datahora'))), $dw[date("w", strtotime($db->getValue('datahora')))]); echo '<tr class="dettab">' . $linha . '</tr>' . "\n"; } $db->Close(); ?> </fieldset> </table> </td></tr>
$camp = 0; $posant = 0; $pos = 0; if ($db->NumRows() == 0) { echo ' <tr> <td>Não existe campeonatos cadastrados ou em andamento no momento.<br></td> </tr>' . "\n"; } else { while ($db->Next()) { if ($camp != $db->getValue('campeonato')) { if ($camp != 0) { echo "<tr><td colspan=4><br></td></tr>\n"; } $pos = 0; $cmp = new Campeonato($db->getValue('campeonato')); echo "<tr style='background:rgb(250, 252, 188);color:rgb(0, 102, 0);'><td colspan=10 align=center><b>" . $cmp->getDescricaoAno() . "</td></tr>\n"; echo "<tr style='background:rgb(250, 252, 188);color:rgb(0, 102, 0);'><td colspan=3 align=center><b>Classificação do Bolão</td>\n\t\t\t\t\t\t\t</tr>\n"; $camp = $cmp->getCodigo(); echo "<tr class='cabec'><td align=center>Pos</td><td>Participante</td><td align=center>Pontos</td></tr>\n"; } $usr = new Usuario($db->getValue('userid')); $ins = new Inscricao($cmp->getCodigo(), $usr->getUserid()); if ($posant != $ins->getPosicao()) { $pos = $ins->getPosefetiva(); $posant = $ins->getPosicao(); } else { $pos = " "; } if ($pos == 999999) { $pos = " "; } $lu = $usr->getLinkUsuario(); if ($ins->getPago() == 'S') {
$db = new BD(); $sql = sprintf("select r2.campeonato campeonato from\n\t\t\t\t\t\t(select max(subtime(addtime(data, hora),'06:00:00')) datarod\n\t\t\t\t\t\t\t\tfrom cad_rodada r,\n\t\t\t\t\t\t\t\tcad_campeonato c\n\t\t\t\t\t\t\t\twhere date_add(now(),interval 1 hour) > subtime(addtime(data, hora),'06:00:00')\n\t\t\t\t\t\t\t\tand c.codigo = r.campeonato\n\t\t\t\t\t\t\t\tand c.`flandamento` = 'S'\n\t\t\t\t\t\t\t\thaving date_add(now(),interval 1 hour) > datarod) r,\n\t\t\t\t\t\t(select campeonato,max(subtime(addtime(data, hora),'06:00:00')) datarod\n\t\t\t\t\t\t\t\tfrom cad_rodada r,\n\t\t\t\t\t\t\t\tcad_campeonato c\n\t\t\t\t\t\t\t\twhere date_add(now(),interval 1 hour) > subtime(addtime(data, hora),'06:00:00')\n\t\t\t\t\t\t\t\tand c.codigo = r.campeonato\n\t\t\t\t\t\t\t\tand c.`flandamento` = 'S'\n\t\t\t\t\t\t\t\tgroup by r.campeonato\n\t\t\t\t\t\t\t\thaving date_add(now(),interval 1 hour) > datarod) r2\n\t\t\t\t\t\twhere r.datarod = r2.datarod"); $db->Query($sql); $db->Next(); $camp = $db->getValue('campeonato'); $cmp = new Campeonato($camp); $db->Close(); $cab = sprintf('<legend><span style="color:green;"><b>Rodada Atual</b></legend>'); echo $cab . "\n"; ?> <table id=menuadm frame=box bordercolor="white" border="1px" cellspacing="0" style="width:450px;" width="450px"> <tr class="cabec"><td width="105px" align="right">Mandante</td><td width="40px" align="center">x</td><td width="105px">Visitante</td><td align="center">Data/Hora</td> <td align="center">Palpite</td> <td align="center">Pts</td> </tr> <?php $sql = sprintf("select r.rodada,r.jogo,r.golsma,r.golsvi,r.manda cmanda, r.visita cvisita,\n\t\t\t\t\ttm.nome manda,tv.nome visita,\n\t\t\t\t\taddtime(r.data, r.hora) datahora,p.pmanda,p.pvisita,p.pontos\n\t\t\t\t\tfrom\n\t\t\t\t\tcad_times tm,\n\t\t\t\t\tcad_times tv,\n\t\t\t\t\tcad_rodada r\n\t\t\t\t\tleft join\n\t\t\t\t\tcad_palpite p\n\t\t\t\t\ton\n\t\t\t\t\tp.campeonato = r.campeonato\n\t\t\t\t\tand p.rodada = r.rodada\n\t\t\t\t\tand p.jogo = r.jogo\n\t\t\t\t\tand p.userid = %d\n\t\t\t\t\twhere\n\t\t\t\t\tr.campeonato = %d\n\t\t\t\t\tand r.rodada = %d\n\t\t\t\t\tand r.manda = tm.codigo\n\t\t\t\t\tand r.visita = tv.codigo", $_SESSION['userid'], $cmp->getCodigo(), $cmp->getRodadaAtual()); $db = new BD(); $db->Query($sql); while ($db->Next()) { $tm = new Time($db->getValue('cmanda')); $tv = new Time($db->getValue('cvisita')); $linha = sprintf('<td align="right">%s</td>' . '<td align="center">%s x %s</td> ' . '<td>%s</td> ' . '<td>%s %s</td> ' . '<td align="center">%s x %s</td> ' . '<td align="center">%s</td> ', $tm->getLink(), $db->getValue('golsma'), $db->getValue('golsvi'), $tv->getLink(), date("d/m/Y H:i", strtotime($db->getValue('datahora'))), $dw[date("w", strtotime($db->getValue('datahora')))], $db->getValue('pmanda'), $db->getValue('pvisita'), $db->getValue('pontos')); echo '<tr class="dettab">' . $linha . '</tr>' . "\n"; } $db->Close(); ?> </fieldset> </table> </td></tr>