Esempio n. 1
0
function write_table()
{
    $shifts = get_shifts();
    // Laufvariablenarray fuer die Rowspan-Berechnung
    $rowspan_counter = array(0, 0, 0, 0, 0);
    $table = '<table id="shifttable" border="0" cellspacing="0px" >' . "\n";
    $table .= '<tr class="shiftrow days">' . "\n";
    $table .= "<td class=\"shiftcell day\"></td>\n";
    $table .= "<td class=\"shiftcell day\">Montag</td>\n";
    $table .= "<td class=\"shiftcell day\">Dienstag</td>\n";
    $table .= "<td class=\"shiftcell day\">Mittwoch</td>\n";
    $table .= "<td class=\"shiftcell day\">Donnerstag</td>\n";
    $table .= "<td class=\"shiftcell day\">Freitag</td>\n";
    $table .= "</tr>\n";
    for ($h = 8; $h < 22; $h++) {
        for ($m = 0; $m < 60; $m += 15) {
            $table .= '<tr class="shiftrow h' . $h . ' m' . $m . '">' . "\n";
            $table .= '<td class="shiftcell time">';
            $table .= sprintf('%02u:%02u', $h, $m) . "</td>\n";
            for ($d = 0; $d < 5; $d++) {
                $matches = 0;
                foreach ($shifts as $shift) {
                    if ($shift->is_now(sprintf('%u,%02u:%02u', $d, $h, $m))) {
                        $matches++;
                        $match = $shift;
                    }
                }
                if ($matches == 0) {
                    $table .= '<td class="shiftcell closed d' . $d . '" >&nbsp;</td>' . "\n";
                } else {
                    if ($rowspan_counter[$d] <= 1) {
                        $diff = get_time_difference($match->start, $match->end);
                        $rows = $diff['hours'] * 4 + $diff['minutes'] / 15;
                        $rowspan_counter[$d] = $rows;
                        $table .= sprintf('<td title="%s" rowspan="%s" ' . 'class="shift%s shiftcell open d%u">%s</td>' . "\n", $match->user->name, $rows, $match->sid, $d, $match->user->name);
                    } else {
                        $rowspan_counter[$d]--;
                    }
                }
                if ($matches > 1) {
                    error(sprintf('mehr als ein match: d:%s h:%s m:%s', $d, $h, $m));
                }
            }
            $table .= "</tr>\n";
        }
    }
    $table .= "</table>\n";
    print $table;
}
Esempio n. 2
0
    ?>
		<?php 
    while ($i <= 31) {
        ?>
 
			<div class="day">
				<?php 
        $day = $i++;
        if ($day < 10) {
            $day = "0" . $day;
        } else {
        }
        $date = $curMonth . $day . $curYear;
        echo $day;
        echo "<br/>";
        get_shifts($date);
        ?>
			</div>
		<?php 
    }
    ?>
	</div>
</div>
<?php 
}
if (level() == 2) {
    ?>
<div class="calendar">
	<div class="daysofweek">
		<?php 
    foreach ($dow as $day) {
Esempio n. 3
0
<?php

include "functions/functions.php";
if (isset($_POST['shift'])) {
    add_available(user(), 1, $_POST['date'], $_POST['shift'], 1);
    echo "no problem";
}
if (isset($_POST['start'])) {
    add_shift($_POST['date'], $_POST['start'], $_POST['end']);
    echo "no problem";
}
?>
<link rel="stylesheet" href="functions/styles/style.css" type="text/css"/>
<?php 
echo pretty_date("1012012");
get_page("calendar");
get_shifts("01012013");
get_shifts("01022013");
get_shifts("1232013");
?>
    <form method="post" action="index.php">
    start
            <input type="text" name="start"/>
            end
            <input type="text" name="end"/>
            date
            <input type="text" name="date"/>
            <input type="submit"/>
    </form>