/**
 *  Render breadcrumbs
 * @param int $id
 */
function breadcrumbs($id)
{
    $message = getLang();
    if (getCaller() == "viewtask.php") {
        echo "<ol class=\"breadcrumb\">";
        echo "<a style=\"cursor:pointer\" onclick=\"goBack()\"><span class=\"glyphicon glyphicon-chevron-left\" aria-hidden=\"true\"></span>" . $message['back'] . "    </a> | ";
        echo "<li><a href=\"index.php\">" . $message['dashboard'] . "</a></li>";
        if (!empty(getProjectInfoByID(getTaskInfobyID($id, 'projectid'), 'projectname'))) {
            echo "<li><a href=\"viewproject.php?id=" . getTaskInfobyID($id, 'projectid') . "\">" . $message['project'] . ": " . getProjectInfoByID(getTaskInfobyID($id, 'projectid'), 'projectname') . "</a></li>";
        }
        //echo "<li><a href=\"viewtask.php?id=" . getTaskInfobyID($id, 'taskid') . "\">". $message['task'] . ": " . getTaskInfobyID($id, 'taskname') ."</a></li>";
        if (IsChild($id)) {
            GetParents($id);
        }
        echo "</ol>";
    } elseif (getCaller() == "viewproject.php") {
        echo "<ol class=\"breadcrumb\">";
        echo "<a style=\"cursor:pointer\" onclick=\"goBack()\"><span class=\"glyphicon glyphicon-chevron-left\" aria-hidden=\"true\"></span>" . $message['back'] . "</a> | ";
        echo "<li><a href=\"index.php\">" . $message['dashboard'] . "</a></li>";
        echo "<li><a href=\"viewproject.php?id=" . $_GET['id'] . "\">" . $message['project'] . ": " . getProjectInfoByID($_GET['id'], 'projectname') . "</a></li>";
        echo "</ol>";
    } elseif (getCaller() == "index.php" || getCaller() == "") {
        echo "<ol class=\"breadcrumb\">";
        echo "<li><a href=\"index.php\">" . $message['dashboard'] . "</a></li>";
        echo "</ol>";
    } elseif (getCaller() == "projects.php") {
        echo "<ol class=\"breadcrumb\">";
        echo "<li><a href=\"index.php\">" . $message['dashboard'] . "</a></li>";
        echo "<li><a href=\"projects.php\">" . $message['projects'] . "</a></li>";
        echo "</ol>";
    } elseif (getCaller() == "tasks.php") {
        echo "<ol class=\"breadcrumb\">";
        echo "<a style=\"cursor:pointer\" onclick=\"goBack()\"><span class=\"glyphicon glyphicon-chevron-left\" aria-hidden=\"true\"></span>" . $message['back'] . "</a> | ";
        echo "<li><a href=\"index.php\">" . $message['dashboard'] . "</a></li>";
        echo "<li><a href=\"tasks.php\">" . $message['tasks'] . "</a></li>";
        echo "</ol>";
    } elseif (getCaller() == "users.php") {
        echo "<ol class=\"breadcrumb\">";
        echo "<a style=\"cursor:pointer\" onclick=\"goBack()\"><span class=\"glyphicon glyphicon-chevron-left\" aria-hidden=\"true\"></span>" . $message['back'] . "</a> | ";
        echo "<li><a href=\"index.php\">" . $message['dashboard'] . "</a></li>";
        echo "<li><a href=\"users.php\">" . $message['users'] . "</a></li>";
        echo "</ol>";
    } elseif (getCaller() == "groups.php") {
        echo "<ol class=\"breadcrumb\">";
        echo "<a style=\"cursor:pointer\" onclick=\"goBack()\"><span class=\"glyphicon glyphicon-chevron-left\" aria-hidden=\"true\"></span>" . $message['back'] . "</a> | ";
        echo "<li><a href=\"index.php\">" . $message['dashboard'] . "</a></li>";
        echo "<li><a href=\"groups.php\">" . $message['groups'] . "</a></li>";
        echo "</ol>";
    } elseif (getCaller() == "viewgroup.php") {
        echo "<ol class=\"breadcrumb\">";
        echo "<a style=\"cursor:pointer\" onclick=\"goBack()\"><span class=\"glyphicon glyphicon-chevron-left\" aria-hidden=\"true\"></span>" . $message['back'] . "</a> | ";
        echo "<li><a href=\"index.php\">" . $message['dashboard'] . "</a></li>";
        echo "<li><a href=\"groups.php\">" . $message['groups'] . "</a></li>";
        echo "<li><a href=\"viewgroup.php?id={$id}\">" . getGroupInfoByID($id, 'groupname') . "</a></li>";
        echo "</ol>";
    } elseif (getCaller() == "viewuser.php") {
        echo "<ol class=\"breadcrumb\">";
        echo "<a style=\"cursor:pointer\" onclick=\"goBack()\"><span class=\"glyphicon glyphicon-chevron-left\" aria-hidden=\"true\"></span>" . $message['back'] . "</a> | ";
        echo "<li><a href=\"index.php\">" . $message['dashboard'] . "</a></li>";
        echo "<li><a href=\"users.php\">" . $message['users'] . "</a></li>";
        echo "<li><a href=\"viewuser.php?id={$id}\">" . getUserFullName($id) . "</a></li>";
        echo "</ol>";
    }
}
    }
}
if (isset($_POST['edittask'])) {
    $statusid = mysqli_real_escape_string($con, $_POST['statusid']);
    $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']);
    ?>
                    </ul>
                </div>
            </div>
            <?php 
}
?>
            <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">