Exemple #1
0
function history($mysqli)
{
    if (empty($_REQUEST['order'])) {
        $order = 'null';
    } else {
        $order = $_REQUEST["order"];
    }
    $direction = @$_GET['direction'];
    if (empty($_REQUEST['direction'])) {
        $direction = 'ASC';
    }
    if ($direction !== "DESC") {
        $direction = "ASC";
    }
    if ($direction == "ASC") {
        $direction_link = "DESC";
    }
    if (empty($direction_link)) {
        $direction_link = 'ASC';
    }
    $userid = $_SESSION['user_id'];
    $result = mysqli_query($mysqli, "SELECT work_on.date, project_name, category, hours, work_on_id, projekt.project_id\n                                    FROM work_on, projekt \n                                    WHERE work_on.project_id = projekt.project_id AND work_on.user_id = {$userid}\n                                    ORDER BY {$order} {$direction}");
    echo "<table class='pure-table pure-table-striped'>\n    <thead>\n    <tr>\n    <th><a href = 'history.php?order=work_on.date&direction={$direction_link}'> Dato</a></th>\n    <th><a href = 'history.php?order=project_name&direction={$direction_link}'>Projekt navn</a></th>\n    <th><a href = 'history.php?order=category&direction={$direction_link}'>Kategori</a></th>\n    <th><a href = 'history.php?order=hours&direction={$direction_link}'>Timer</a></th>\n    <th>Rediger tid</th>\n    </tr>\n    </thead>";
    while ($row = mysqli_fetch_array($result)) {
        echo "<tr>";
        echo "<td>" . $row[0] . "</td>";
        echo "<td><a href = 'project_info.php?pid={$row['5']}'> {$row['1']}</a> </td>";
        echo "<td>" . $row[2] . "</td>";
        echo "<td>" . $row[3] . "</td>";
        if (check_afsluttet($mysqli, $row[5]) == true) {
            echo "<td><a href = 'change_history.php?wid={$row['4']}'>Rediger</a> </td>";
        } else {
            echo "<td> Afsluttet </td>";
        }
        echo "</tr>";
    }
    echo "</table>";
}
Exemple #2
0
            ?>
                        Afslut projekt: 
                        <form>
                            <button type="submit" name="Afslut" value="Afslut">Afslut</button>
                            <input type="hidden" name="pid" value="<?php 
            echo $pid;
            ?>
">
                        </form>

                    <?php 
        }
        ?>

                    <?php 
        if (check_afsluttet($mysqli, $pid) == false) {
            ?>
                        Åben projektet igen: 
                        <form>
                            <button type="submit" name="Åben" value="Åben">Åben</button>
                            <input type="hidden" name="pid" value="<?php 
            echo $pid;
            ?>
">
                        </form>

                    <?php 
        }
        ?>
                <?php 
    }