redovalnica.php

Datoteka prikazuje ocene za izbrani razred in predmet ter omogoča vnos in izbris ocen za posameznega dijaka. Namenjena je profesorjem.

 

Slika 8 Redovalnica

 

<?php
if (isset($_POST["Btn_potrdi"]))
{
    $_SESSION["razred"] = $_POST["razred"];
    $_SESSION["id_predmeta"] = $_POST["predmet"];
}
?>
<h1 class="my-3 text-success">Redovalnica</h1>
<hr>
<form class="row" action="index.php?ukaz=redovalnica" method="post">
    <div class="col-2">
        <label class="mb-2 text-secondary form-label" for="razred">Razred:</label>
        <select name="razred" class="form-select">
            <option></option>
            <?php
            include "baza.php";
            $conn = new mysqli($server,$username,$password,$baza);
            $sql = "SELECT DISTINCT razred FROM dijaki";
            $result = $conn->query($sql);
            if ($result->num_rows > 0)
            {
                while ($row = mysqli_fetch_assoc($result))
                {
                    $razred = $row["razred"];
                    echo "<option value='".$razred."'>".$razred."</option>";
                }
            }
            $conn->close();
            ?>
        </select>
    </div>
    <div class="col-4">
        <label class="mb-2 text-secondary form-label" for="predmet">Predmet:</label>
        <select name="predmet" class="form-select">
            <option></option>
            <?php
            include "baza.php";
            $conn = new mysqli($server,$username,$password,$baza);
            $conn->set_charset("utf8");
            $sql = "SELECT id_predmeta, naziv FROM predmeti ORDER BY naziv";
            $result = $conn->query($sql);
            if ($result->num_rows > 0)
            {
                while ($row = mysqli_fetch_assoc($result))
                {
                    $id_predmeta = $row["id_predmeta"];
                    $naziv = $row["naziv"];
                    echo "<option value='".$id_predmeta."'>".$naziv."</option>";
                }
            }
            $conn->close();
            ?>
        </select>
    </div>
    <div class="col-2">
        <input type="submit" name="Btn_potrdi" value="Potrdi" class="mt-4 btn btn-success btn-lg">
    </div>
</form>
<?php
if ($_SESSION["razred"] != null && $_SESSION["id_predmeta"] != null)
{
    echo "<div class='alert alert-success alert-dismissible fade show mt-3' role='alert'>";
    echo "<p class='my-0 py-0'>Razred: <span class='lead' style='text-transform: uppercase;font-weight: bolder'>".$_SESSION["razred"]."</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Predmet: <span class='lead' style='text-transform: uppercase;font-weight: bolder'>".Get_podatek_predmeta($_SESSION['id_predmeta'],'naziv')."</span></p>";
    echo "<button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'></button>";
    echo "</div>";
    echo "<div class='row'>";
    echo "<div class='col-9'>";
    echo Izpis_redovalnice($_SESSION["razred"],$_SESSION["id_predmeta"]);
    echo "</div>"; //col-9
    echo "<div class='col-3'>";
    if ($_SESSION["id_dijaka"] != null)
    {
        echo "<p class='alert alert-dark bg-secondary text-center text-white display-1' style='font-size: x-large'>".Get_priimek_ime($_SESSION['id_dijaka'],'dijak')."</p>";
        if ($_SESSION["ocene_edit"] != null)
        {
            switch ($_SESSION["ocene_edit"])
            {
                case "insert":
                {
                    //vnos ocene
                    include "vnos_ocene.php";
                    break;
                }
                case "delete":
                {
                    //brisanje ocene
                    include "izbris_ocene.php";
                    break;
                }
            }
        }
    }
    echo "</div>"; // col-3
    echo "</div>"; // row
}



Created with an evaluation copy of HelpSmith.
To remove this notice, you should purchase the full version of the product.