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 
if (UserCan('create_project')) {
    ?>
            <div class="tab-pane" id="newproject">
/**
 * Gibt den Status des Projects als html string zurück
 * @param int $id
 * @return string
 */
function getProjectStatus($id)
{
    $message = getLang();
    $startDate = getProjectInfoByID($id, 'startdate');
    $endDate = getProjectInfoByID($id, 'enddate');
    $datenow = DATE('Y-m-d');
    if (getProjectStatusInPercent($id) == 100) {
        return "<span class=\"label label-success\">" . $message['done'] . "</span>";
    }
    if ($datenow > $endDate) {
        return "<span class=\"label label-danger\">" . $message['overdue'] . "</span>";
    } elseif ($startDate >= $datenow && $endDate > $datenow) {
        return "<span class=\"label label-default\">" . $message['notstartet'] . "</span>";
    } elseif ($datenow > $startDate && $datenow < $endDate) {
        if (getProjectStatusInPercent($id) == 100) {
            return "<span class=\"label label-success\">" . $message['done'] . "</span>";
        } else {
            return "<span class=\"label label-info\">" . $message['inprogress'] . "</span>";
        }
    }
}
Ejemplo n.º 3
0
    $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");
    }
}
echo $message['createtask'];
?>
</a></li>
    </ul>
    <div class="tab-content" id="tabs">
        <div class="tab-pane active" id="overview">
            <div class="progress">
                <div class="progress-bar" role="progressbar" aria-valuenow="<?php 
echo getProjectStatusInPercent($_GET['id']);
?>
" aria-valuemin="0" aria-valuemax="100" style="min-width: 2em; width: <?php 
echo getProjectStatusInPercent($_GET['id']);
?>
%;">
                    <?php 
echo getProjectStatusInPercent($_GET['id']);
?>
%
                </div>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading"><?php 
echo $message['projectsummary'];
?>
</div>
                <div class="panel-body">
                    <?php 
echo getProjectInfoByID($_GET['id'], 'projectsummary');
?>
                </div>
            </div>