/**
 * Gibt den Status des Projektes in Prozent zurück
 * @param int $id ID des Projekts
 */
function getProjectStatusInPercent($id)
{
    $status = 0.0;
    $closedtasks = getNumberOfClosedTasksinProject($id);
    $alltasks = getNumberOfOpenTasksinProject($id) + getNumberOfClosedTasksinProject($id);
    if ($closedtasks == 0 && $alltasks == 0) {
        return 0;
    } else {
        $status = $closedtasks / $alltasks * 100;
        return round($status, 0);
    }
}
?>
</th>
                                <th><?php 
echo $message['enddate'];
?>
</th>
                            </tr>
                        </thead>
                        <tbody>
                        <?php 
$result = mysqli_query($con, "SELECT * FROM projects");
while ($row = mysqli_fetch_array($result)) {
    if (UserIsOwnerOfProject($row['projectid']) || UserCan('show_projects')) {
        echo "<tr>";
        echo "<td><a href=\"viewproject.php?id=" . $row['projectid'] . "\">" . $row['projectname'] . "</a></td>";
        echo "<td>" . getNumberOfOpenTasksinProject($row['projectid']) . "</td>";
        echo "<td>" . getNumberOfClosedTasksinProject($row['projectid']) . "</td>";
        echo "<td>" . getUserFullName($row['userid'], 'userid') . "</td>";
        echo "<td>" . getProjectStatusInPercent($row['projectid']) . "%</td>";
        echo "<td>" . getProjectStatus($row['projectid']) . "</td>";
        echo "<td>" . Datum($row['startdate']) . "</td>";
        echo "<td>" . Datum($row['enddate']) . "</td>";
        echo "</tr>";
    }
}
?>
                        </tbody>
                    </table>
                </div>
            </div>
            <?php 
<div id="delete" class="modal fade" role="dialog">
    <div class="modal-dialog">
        <!-- Modal content-->
        <div class="modal-content">
            <form method="POST">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">&times;</button>
                    <h4 class="modal-title"><?php 
echo $message['deleteproject'];
?>
</h4>
                </div>
                <div class="modal-body">
                    <p>Wollen Sie wirklich das Projekt löschen?</p>
                    <?php 
if (getNumberOfOpenTasksinProject($_GET['id']) > 0) {
    echo "<p>Es sind immer noch offene Aufgaben im Projekt. Diese werden ebenfalls gelöscht.</p>";
}
?>
                </div>
                <div class="modal-footer">
                    <input type="hidden" name="deleteid" value="<?php 
echo $_GET['id'];
?>
">
                    <button type="submit" name="delete" class="btn btn-danger"><?php 
echo $message['delete'];
?>
</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal"><?php 
echo $message['cancel'];