$end = "\n\t\t</tbody>\n\t\t</table>\n\t\t"; echo $start . $rows . $end; } elseif ($tipo != 1) { echo '<a href="admin_gare.php?op=gen&torneo=' . $_GET[torneo] . '" class="btn btn-warning btn-sm">Genera gare</a> <br><br>Per questo torneo non sono state ancora generate gare e/o gironi.'; } else { echo 'Per questo torneo non sono state ancora generate gare e/o gironi.'; } # modulo di creazione gare per torneo libero if ($tipo == 1) { BSspacer(); if (!$isend) { echo '<a href="admin_gare.php?op=close&torneo=' . $_GET[torneo] . '" class="btn btn-warning btn-sm">Termina la creazione delle gare</a>'; } BSspacer(); BSheader("Inserisci gara"); BSformo(); hidden("new"); $data = ssql("select get_inizio(" . $_GET[torneo] . ")"); BSdate("data", "Data", $data); BSdropdown("gg1", "Giocatore 1", "select u.id as user, concat(u.nome,' ',u.cognome) as nome \n\t\t\t\t\t\t\t\t\t\t\tfrom utenti u\n\t\t\t\t\t\t\t\t\t\t\t\tjoin iscritto_a ia on u.id=ia.IDutente\n\t\t\t\t\t\t\t\t\t\t\twhere ia.IDtorneo='" . $_GET[torneo] . "'\n\t\t\t\t\t\t\t\t\t\t\t\tand u.id>2", "user", "nome", ""); BSdropdown("gg2", "Giocatore 2", "select u.id as user, concat(u.nome,' ',u.cognome) as nome \n\t\t\t\t\t\t\t\t\t\t\tfrom utenti u\n\t\t\t\t\t\t\t\t\t\t\t\tjoin iscritto_a ia on u.id=ia.IDutente\n\t\t\t\t\t\t\t\t\t\t\twhere ia.IDtorneo='" . $_GET[torneo] . "'\n\t\t\t\t\t\t\t\t\t\t\t\tand u.id>2", "user", "nome", ""); BSbutton("Inserisci"); BSformc(); $jq2footer .= ' var fine = ' . $isend . '; if(fine) { $("#data").prop("disabled", true); $("#gg1").prop("disabled", true); $("#gg2").prop("disabled", true); $("#formo button").prop("disabled", true);
</div>'; if ($count == 1) { $list .= "<div class=\"clearfix visible-md visible-lg\"></div>"; $count = 0; } else { $count++; } } if (!$list) { echo "Nessun torneo in corso."; } else { echo $list; } BSclearfix(); BSspacer(); BSheader("Tornei futuri"); $list = ""; # Ciclo i tornei futuri $res = sql("select distinct t.id as id,\n t.nome as nome,\n t.ed as ed,\n t.data_inizio as data_inizio,\n t.data_fine as data_fine,\n t.chiusura_iscr as chiusura_iscr,\n ty.nome as tipo,\n t.num_gironi as gironi,\n concat(u.nome,' ',u.cognome) as admin,\n " . $quota . " as quota,\n (select count(*) from iscritto_a\n where IDtorneo=t.id\n and IDutente>2) as iscritti,\n t.partecipanti as max\n from torneo t \n left join tipo_torneo ty on ty.id=t.tipo\n left join utenti u on u.id=t.admin\n left join iscritto_a ia on t.id=ia.IDtorneo\n " . $and . "\n where data_inizio>now() and (data_fine>=now() or data_fine is null)\n order by data_inizio asc"); $count = 0; while ($t = pg_fetch_array($res)) { $d = $closed_class = $iscr_class = $fine = $approved = $gironi = ""; if (isset($_COOKIE[user])) { $approvato = ssql("select is_iscr_approved(" . $_SESSION[User2decide][id] . "," . $t[id] . ")"); $iscritto = ssql("select is_iscritto(" . $_SESSION[User2decide][id] . "," . $t[id] . ")"); } if (ssql("select reached_iscr_date(" . $t[id] . ")")) { $closed_class = "red"; $d = "disabled"; } if ($t[iscritti] >= $t[max]) {
</div>'; if ($count == 1) { $list .= "<div class=\"clearfix visible-md visible-lg\"></div>"; $count = 0; } else { $count++; } } if (!$list) { echo "Non hai vinto nessun torneo"; } else { echo $list; } BSclearfix(); BSspacer(); BSheader("Partecipati"); $list = ""; # Ciclo i tornei partecipati $res = sql("select t.id as id,\n\t\t\t\t\tt.nome as nome,\n\t\t\t\t\tt.ed as ed,\n\t\t\t\t\tt.data_inizio as data_inizio,\n\t\t\t\t\tt.data_fine as data_fine,\n\t\t\t\t\tty.nome as tipo,\n\t\t\t\t\tt.num_gironi as gironi,\n\t\t\t\t\tconcat(u.nome,' ',u.cognome) as admin,\n\t\t\t\t\tconcat(u2.nome,' ',u2.cognome) as vincitore\n\t\t\t\tfrom torneo t \n\t\t\t\t\tleft join tipo_torneo ty on ty.id=t.tipo\n\t\t\t\t\tleft join utenti u on u.id=t.admin\n\t\t\t\t\tleft join iscritto_a ia on t.id=ia.IDtorneo\n\t\t\t\t\tleft join vince v on v.IDtorneo=t.id\n\t\t\t\t\tleft join utenti u2 on u2.id=v.IDutente\n\t\t\t\twhere ia.IDutente=" . $_SESSION[User2decide][id] . "\n\t\t\t\t\tand t.data_fine<now()\n\t\t\t\t\tand v.IDutente<>" . $_SESSION[User2decide][id] . ""); $count = 0; while ($t = pg_fetch_array($res)) { if (ssql("select get_tipo(" . $t[id] . ")") == 2) { $gironi = "(a " . $t[gironi] . " gironi)"; } else { $gironi = ""; } $list .= ' <div class="col-md col-sm-6"> <div class="portlet portlet-boxed"> <div class="portlet-header"> <h4 class="portlet-title"><u>' . $t[nome] . ' ed.' . $t[ed] . '</u></h4>