コード例 #1
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 
if (UserCan('create_project')) {
コード例 #2
0
/**
 * 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);
    }
}