Exemple #1
0
        echo "<p>" . $AppUI->_('No data available') . "</p>";
    } else {
        foreach ($task_list as $task) {
            $task_start_date = new CDate($task->task_start_date);
            $task_end_date = new CDate($task->task_end_date);
            $day_difference = $task_end_date->dateDiff($task_start_date);
            $actual_date = $task_start_date;
            $users = $task->getAssignedUsers();
            if ($coarseness == 1) {
                userUsageDays();
            } elseif ($coarseness == 7) {
                userUsageWeeks();
            }
        }
        if ($coarseness == 1) {
            showDays();
        } elseif ($coarseness == 7) {
            showWeeks();
        }
        ?>
			<center><table class="list">
			<?php 
        echo $table_header . $table_rows;
        ?>
			</table>
			<table width="100%"><tr><td align="center">
		<?php 
        echo '<h4>' . $AppUI->_("Total capacity for shown users") . '</h4>';
        echo $AppUI->_("Allocated hours") . ": " . number_format($allocated_hours_sum, 2) . "<br />";
        echo $AppUI->_("Total capacity") . ": " . number_format($total_hours_capacity, 2) . "<br />";
        echo $AppUI->_("Percentage used") . ": " . ($total_hours_capacity > 0 ? number_format($allocated_hours_sum / $total_hours_capacity, 2) * 100 : 0) . "%<br />";
Exemple #2
0
$m = date("n");
# number of month (1-12)
$d = date("j");
# day of the month 1-31
$h = date("H");
$y = date("Y");
// 4 digit year valu;e
$j = date('z');
// the day of the year (0-365)
$cmas = 359;
$isLeap = checkLeap($y);
if ($isLeap == 1) {
    $cmas = 360;
}
$days_left = $cmas - $j - 1;
$hours_left = 24 - $h - 1;
$minutes_left = 60 - $h - 1;
$seconds_left = 60 - $s;
echo "<hr size = '1'>";
echo "There are <b>{$days_left}</b> days, " . "<b>{$hours_left}</b> hours," . "<b>{$minutes_left}</b> minutes," . "and <b>{$seconds_left}</b> seconds left to Christmas.";
echo "<hr size ='1'>";
echo showDays($y);
function checkLeap($y)
{
    return $y % 4 == 0 && ($y % 100 != 0 || $y % 400 == 0) ? 1 : 0;
}
function showDays($y)
{
    $n = cal_days_in_month(CAL_GREGORIAN, 2, $y);
    return "February of {$y} has <b>{$n}</b> days!<br>";
}