$numrows = mysqli_num_rows($result);
while ($row = mysqli_fetch_array($result)) {
    $week = (int) date('W', strtotime($row['timestamp']));
    $time = date('G:i', strtotime($row['timestamp']));
    $day = strftime("%A", strtotime($row['timestamp']));
    if ($calweek == $week) {
        echo "<p><a href=\"viewtask.php?id=" . $row['taskid'] . "\">" . getTaskInfobyID($row['taskid'], 'taskname') . "</a> wurde am <span style=\"text-decoration: underline;\">" . $day . "</span> um {$time} von " . getUserFullName($row['userid']) . " auf " . getTaskStatus('', $row['statusid']) . " geändert.<br></p>";
    } else {
        if (!$firstrun) {
            echo "</div>";
        }
        $firstrun = FALSE;
        $calweek = $week;
        echo "<div class=\"well\">";
        echo "<div class=\"calweek\">{$calweek}. Kalenderwoche</div>";
        echo "<p><a href=\"viewtask.php?id=" . $row['taskid'] . "\">" . getTaskInfobyID($row['taskid'], 'taskname') . "</a> wurde am <span style=\"text-decoration: underline;\">" . $day . "</span> um {$time} von " . getUserFullName($row['userid']) . " auf " . getTaskStatus('', $row['statusid']) . " geändert.<br></p>";
    }
}
if ($numrows != 0) {
    echo "</div>";
}
?>
        </div>
        
        <div class="tab-pane" id="userinfo">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><?php 
echo $message['userdetails'];
?>
</h3>
    $taskid = mysqli_real_escape_string($con, $_POST['taskid']);
    $projectid = getTaskInfobyID($taskid, 'projectid');
    $projectmanagermail = getUserInfo(getProjectInfoByID(getTaskInfobyID($taskid, 'projectid'), 'userid'), 'email');
    $projectmanagerid = getProjectInfoByID(getTaskInfobyID($taskid, 'projectid'), 'userid');
    $sql = "UPDATE `tasks` SET taskstatus = '" . $statusid . "', `lastchange`=CURRENT_TIMESTAMP WHERE taskid ='" . $taskid . "'";
    $history = "INSERT INTO `{$db_data}`.`statushistory` (`taskid`, `userid`, `statusid`, `timestamp`) VALUES ('" . $taskid . "', '" . $_SESSION['userid'] . "', '" . $statusid . "', CURRENT_TIMESTAMP);";
    mysqli_query($con, $history);
    if (mysqli_query($con, $sql)) {
        if (IsChild($taskid) && AllSubTasksDone($taskid) && $statusid == 3) {
            $updateparent = "UPDATE `tasks` SET taskstatus = '3' WHERE taskid ='" . getTaskInfobyID($taskid, 'parent') . "'";
            mysqli_query($con, $updateparent);
        } elseif (IsChild($taskid) && AllSubTasksDone($taskid) && $statusid != 3) {
            $updateparent = "UPDATE `tasks` SET taskstatus = '0' WHERE taskid ='" . getTaskInfobyID($taskid, 'parent') . "'";
            mysqli_query($con, $updateparent);
        }
        if (getProjectStatusInPercent(getTaskInfobyID($taskid, 'projectid')) == 100) {
            $body = "Hallo " . getUserFullName($projectmanagerid) . ",\n\n";
            $body .= "Dies ist eine automatische E-Mail um Ihnen mitzuteilen, dass die letzte Aufgabe in \"" . getProjectInfoByID($projectid, 'projectname') . "\" erledigt wurde.";
            smtpmailer($projectmanagermail, 'Projekt: ' . getProjectInfoByID($projectid, 'projectname'), $body);
        }
        if (getTaskInfobyID($taskid, 'creator') != getTaskInfobyID($taskid, 'userid') && $statusid == 3) {
            $creator = getTaskInfobyID($taskid, 'creator');
            $body = "Hallo " . getUserFullName($creator) . ",\n";
            $body .= "Die Aufgabe (" . getTaskInfobyID($taskid, 'taskname') . "), die du " . getUserFullName(getTaskInfobyID($taskid, 'userid')) . " zugewiesen hast wurde erledigt.";
            smtpmailer(getUserInfo($creator, 'email'), 'Aufgabe: ' . getTaskInfobyID($taskid, 'taskname'), $body);
        }
        header("Location: " . $_SERVER['HTTP_REFERER']);
    } else {
        die("Bearbeiten fehlgeschlagen");
    }
}
/**
 * Gibt zurück ob der Task angezeigt oder privat ist und der Nutzer kein Zugriff hat
 * @param int $id TaskID
 * @return boolean
 */
function UserCanDisplayTask($id)
{
    if (getTaskInfobyID($id, 'is_private') == 1 && getTaskInfobyID($id, 'userid') === $_SESSION['userid']) {
        return TRUE;
    } elseif (getTaskInfobyID($id, 'is_private') == "0") {
        return TRUE;
    } else {
        return FALSE;
    }
}
            <?php 
if (getCaller() === "viewproject.php") {
    ?>
            startDate: "<?php 
    echo Datum(getProjectInfoByID($_GET['id'], 'startdate'));
    ?>
",
            endDate: "<?php 
    echo Datum(getProjectInfoByID($_GET['id'], 'enddate'));
    ?>
"
                <?php 
}
if (getCaller() === "viewtask.php") {
    if (getTaskInfobyID($_GET['id'], 'projectid') != 0) {
        echo "endDate: \"" . Datum(getProjectInfoByID(getTaskInfobyID($_GET['id'], 'projectid'), 'enddate')) . "\"\n";
    }
}
?>
        });
    });
    </script>
   
    <script>
    function goBack() {
        window.history.back();
    }
    </script>
    
    <script type="text/javascript">
    $( document ).ready(function() {
                        <input type="text" class="input-sm form-control" name="startdate" placeholder="<?php 
    echo $message['startdate'];
    ?>
" value="<?php 
    echo Datum(getTaskInfobyID($_GET['id'], 'startdate'));
    ?>
"/>
                        <span class="input-group-addon"><?php 
    echo $message['to'];
    ?>
</span>
                        <input type="text" class="input-sm form-control" name="enddate" placeholder="<?php 
    echo $message['enddate'];
    ?>
" value="<?php 
    echo Datum(getTaskInfobyID($_GET['id'], 'enddate'));
    ?>
"/>
                    </div>
                </div>
                <br>
                <button type="submit" class="btn btn-default" name="addtask"><?php 
    echo $message['add'];
    ?>
</button>
            </form>
        </div>
        <?php 
}
?>
        <div class="tab-pane" id="history">