/**
 * Überprüft ob alle Unteraufgaben erfüllt sind.
 * @param type $id
 * @return boolean
 */
function AllSubTasksDone($id)
{
    require 'config.php';
    $sql = "SELECT * FROM tasks WHERE parent = " . $id;
    $result = mysqli_query($con, $sql);
    while ($row = mysqli_fetch_array($result)) {
        if ($row['taskstatus'] != 3) {
            return FALSE;
        }
        if (TaskHasChilds($row['taskid'])) {
            AllSubTasksDone($row['taskid']);
        }
    }
    return TRUE;
}
 $recuruntil_task = date_create_from_format('Y-m-d', $tasksrow['recuruntil']);
 $datenow = date_create_from_format('Y-m-d', DATE('Y-m-d'));
 if (!($recuruntil_task < $datenow) || $tasksrow['recuruntil']) {
     if (UserCanDisplayTask($tasksrow['taskid'])) {
         $datediff = (strtotime($tasksrow['enddate']) - strtotime(DATE('Y-m-d'))) / 60 / 60 / 24;
         if ($tasksrow['alarm'] != 0) {
             $alarmtime = $tasksrow['alarm'];
         } else {
             $alarmtime = 3;
         }
         if ($datediff <= $alarmtime && $tasksrow['taskstatus'] != 3 && $tasksrow['enddate'] != "0000-00-00" && $tasksrow['is_recurring'] != "1") {
             echo "<tr class=\"redrow\">";
         } else {
             echo "<tr>";
         }
         if (TaskHasChilds($tasksrow['taskid'])) {
             echo "<td><a class=\"bold\" href=\"viewtask.php?id=" . $tasksrow['taskid'] . "\">" . $tasksrow['taskname'] . "</a>";
             echo "</td>";
             echo "<td><a href=\"viewproject.php?id=" . $tasksrow['projectid'] . "\">" . getProjectInfoByID($tasksrow['projectid'], 'projectname') . "</a></td>";
             echo "<td>" . getTaskStatus($tasksrow['taskid'], $tasksrow['taskstatus']);
             if ($tasksrow['is_recurring'] === "1") {
                 echo "<img title=\"Wiederholende Aufgabe\" style=\"width:21px; margin-left: 5px;\" src=\"img/recur-small.png\">";
             }
             if ($tasksrow['is_private'] === "1") {
                 echo "<span class=\"glyphicon glyphicon-lock\" aria-hidden=\"true\"></span>";
             }
             echo "</td>";
             echo "<td>" . Datum($tasksrow['startdate']) . "</td>";
             echo "<td>" . Datum($tasksrow['enddate']) . "</td>";
             echo "<td>" . Datum($tasksrow['recuruntil']) . "</td>";
             echo "</tr>";
            <div class="panel panel-default">
            <div class="panel-heading"><?php 
echo $message['taskdetails'];
?>
</div>
                <div class="panel-body">
                    <?php 
echo getTaskInfobyID($_GET['id'], 'taskdetails');
if (IsChild($_GET['id'])) {
    echo "— " . $message['ispartof'] . " \"<a href=\"viewtask.php?id=" . getTaskInfobyID($_GET['id'], 'parent') . "\">" . getTaskInfobyID(getTaskInfobyID($_GET['id'], 'parent'), 'taskname') . "</a>\"";
}
?>
                </div>
            </div>
            <?php 
if (TaskHasChilds($_GET['id'])) {
    ?>
        <div class="panel panel-default">
            <div class="panel-heading"><?php 
    echo $message['subtasks'];
    ?>
</div>
            <div class="panel-body">
                <div class="table-responsive">
                    <table class="table table-striped">
                        <thead>
                            <tr>
                            <th><?php 
    echo $message['taskname'];
    ?>
</th>