%PDF- %PDF-
Direktori : /mnt/tnb2/los/backend/ |
Current File : //mnt/tnb2/los/backend/urovne.php |
<!DOCTYPE html> <html lang="cs"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="apple-mobile-web-app-title" content="Správa závodů LOS" /> <meta name="application-name" content="Správa závodů LOS" /> <meta name="msapplication-TileColor" content="#da532c" /> <meta name="theme-color" content="#ffffff" /> <meta name="color-scheme" content="dark light" /> <title>Správa závodů LOS</title> <link rel="canonical" href="https://loslex.cz/backend/" /> <link rel="apple-touch-icon" sizes="180x180" href="../apple-touch-icon.png" /> <link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png" /> <link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png" /> <link rel="manifest" href="../site.webmanifest" /> <!-- css --> <link rel="stylesheet" href="css/bootstrap.min.css" /> <link rel="stylesheet" href="css/table-style.css" /> <link rel="stylesheet" href="css/dashboard.css" /> </head> <body> <?php ini_set( "session.gc_maxlifetime", 86400 ); session_start(); $admin=$_SESSION["admin"]; $poradatel_id=$_SESSION["poradatel_id"]; $poradatel=$_SESSION["poradatel"]; include('../sql.php'); $mysqli = new mysqli(pc,user,pass,data); $db=mysqli_connect(pc,user,pass,data) or die('Není spojení s databází!'); ?> <header> <nav class="navbar navbar-expand-md fixed-top bg-light border-bottom"> <div class="container-fluid"> <span class="navbar-brand fw-bold fs-6">SK LOS SEVER z. s.</span> <button type="button" class="navbar-toggler" data-bs-toggle="collapse" data-bs-target="#loslex"><span class="fas fa-bars"></span></button> <div class="collapse navbar-collapse" id="loslex"> <div class="navbar-nav mx-auto"> <ul class="navbar-nav mb-2 mb-lg-0"> <li class="nav-item"><a class="nav-link" href="main.php">Přehled závodů</a></li> <li class="nav-item"><a class="nav-link" href="novy.php">Nový závod</a></li> <li class="nav-item"><a class="nav-link" href="poradatel_nastaveni.php">Nastavení pořadatele</a></li> <?php if ($admin==1) { echo '<li class="nav-item"><a class="nav-link" href="zavodnici.php">Správa uživatelů</a></li>'; echo '<li class="nav-item"><a class="nav-link" href="soutez_nastaveni.php">Nastavení soutěže</a></li>'; } echo '</ul>'; echo '</div>'; if (isset($_SESSION["poradatel"])) { echo '<div class="navbar-nav ms-auto">'; echo '<li class="nav-item dropdown">'; echo '<a class="nav-link dropdown-toggle" href="login.php" role="button" data-bs-toggle="dropdown" aria-expanded="false">Pořadatel: '.$_SESSION["poradatel"].'</a>'; echo '<ul class="dropdown-menu rounded-0">'; echo '<li class="nav-item"><a class="nav-link dropdown-item" href="logout.php">Odhlásit</a></li>'; echo '</ul>'; echo '</li>'; echo '</div>'; } //else {echo '<li class="nav-item ms-auto"><a class="nav-link" href="index.php">Přihlásit</a></li>';} ?> </div> </div> </nav> </header> <!-- create table match *https://codepen.io/AllThingsSmitty/pen/MyqmdM* & *https://css-tricks.com/responsive-data-tables/* --> <div class="container"> <div class="row"> <div class="col-12 mb-3 mt-2"> <h4 class="text-center mt-3 mt-lg-0 mb-3">Přehled úrovní</h4> <div class="rg-container p-0 p-md-3 p-lg-4"> <table id="" class="rg-table mb-5"> <thead> <tr> <th>Název úrovně</th> <th>Aktivní</th> <th>Upravit</th> <th>Smazat</th> </tr> </thead> <tbody> <?php include('../sql.php'); $mysqli = new mysqli(pc,user,pass,data); $dotaz=mysqli_query($mysqli,"SELECT id,nazev,aktivni FROM uroven_zavodu order by nazev asc"); while($radek = mysqli_fetch_row($dotaz)) { echo '<tr><form name="form" method="GET">'; echo '<td><input class="form-control form-control-sm" type="text" name="nazev" value="'.$radek[1].'" /></td>'; if ($radek[2]==1) {$ano="checked";} else {$ano="";} echo '<td data-title="Aktivní:"><input name="aktivni" type="checkbox" '.$ano.' />'; echo '<input type="number" hidden name="id" value="'.$radek[0].'" /></td>'; echo '<td data-title="Změnit úroveň:"><input class="btn btn-sm btn-success" type="submit" name="upravit" value="Změnit" /></td>'; echo '<td data-title="Smazat úroveň:"><a href="smaz.php?id='.$radek[0].'&kde=uroven_zavodu" class="btn btn-sm btn-danger" onclick="return confirm(\'Opravdu smazat úroveň '.$radek[1].'? \');" title="Smazat úroveň"><i class="fas fa-trash"></i></a></td>'; echo '</form></tr>'; } ?> </tbody> </table> <form class="row row-cols-lg-auto g-3 align-items-center border px-3 pb-3 bg-white" method="POST"> <div class="col-auto"> <label for="nk" class="visually-hidden">Email</label> <input type="text" readonly class="form-control-plaintext" id="nk" value="Název nové úrovně:"> </div> <div class="col-auto"> <label class="visually-hidden" for="nazev">Název nové kategorie:</label> <input class="form-control form-control-sm" type="text" name="nazev" required /> </div> <div class="col-auto"> <div class="form-check"> <input class="form-check-input" type="checkbox" id="aktivni" name="aktivni" /> <label class="form-check-label" for="aktivni">Aktivní</label> </div> </div> <div class="col-auto"> <button type="submit" name="pridat" class="btn btn-sm btn-success">Přidat úroveň</button> </div> </form> <form class="row mt-3" method="POST"> <div class="col-auto mx-auto"> <button type="submit" name="zpet" class="btn btn-sm btn-dark">Zpět</button> </div> </form> </div> <?php if (isset($_POST['zpet'])){echo "<script>window.location.replace('soutez_nastaveni.php');</script>";} if (isset($_GET["upravit"])){ $id=$_GET["id"]; $nazev=$_GET["nazev"]; $aktivni=$_GET["aktivni"]; if ($aktivni=="on") {$aktivni=1;} else {$aktivni=0;} $dotaz="UPDATE uroven_zavodu SET nazev='".$nazev."',aktivni=".$aktivni." WHERE id=".$id; mysqli_query($db,$dotaz); echo '<script>window.location.replace("urovne.php");</script>'; } if (isset($_POST["pridat"])){ $nazev=$_POST["nazev"]; $aktivni=$_POST["aktivni"]; if ($aktivni) {$aktivok=1;} else {$aktivok=0;} $pridat='INSERT INTO uroven_zavodu (nazev,aktivni) VALUES ("'.$nazev.'",'.$aktivok.')'; mysqli_query($db,$pridat); echo "<meta http-equiv='refresh' content='1'>"; } ?> <!-- footer --> <footer class="footer mt-auto py-3"> <div class="container"> <p class="text-center copyright">2023 | mickey & strasidlo | created for defens shooting</p> </div> </footer> <!-- scripts --> <script src="js/bootstrap.bundle.min.js"></script> <script src="js/jquery.min.js"></script> <script src="js/main.js"></script> </body> </html>