예제 #1
0
    saveShift($shiftID, date("d/m/Y", $lastSunday));
    for ($day = 1; $day <= 7; $day++) {
        if ($_POST["day" . $day] > "") {
            $tmp2 = split(",", $_POST["day" . $day]);
            deleteStaff(date("Y", $lastSunday), date("m", $lastSunday), date("d", $lastSunday) + ($day - 1));
            for ($i = 0; $i < count($tmp2); $i++) {
                $tmp = split("-", $tmp2[$i]);
                saveStaff(date("Y", $lastSunday), date("m", $lastSunday), date("d", $lastSunday) + ($day - 1), $tmp[0], $tmp[1]);
            }
        }
    }
}
if ($shiftID > "0" && $_POST["procedure"] == "Generate") {
    $s = buildSchedule($shiftID);
    //load staff
    $staff = loadRandomEmployees();
    $workStaff = array();
    for ($day = 1; $day <= 7; $day++) {
        for ($job = 0; $job < count($jobs); $job++) {
            $j = $s->day[$day][$job];
            for ($n = 0; $n < $j->num; $n++) {
                $workStaff[$day][$jobs[$job]->id][$n] = findEmployee($staff, $j, $day);
            }
        }
    }
    //load colors
    $color = loadColors();
} else {
    //load scheduled shift
    $shiftID = loadScheduleShift(date("d/m/Y", $lastSunday));
    if ($shiftID > "0") {
예제 #2
0
    saveShift($shiftID, date("d/m/Y", $lastSunday));
    for ($day = 1; $day <= 7; $day++) {
        if ($_POST["day" . $day] > "") {
            $tmp2 = split(",", $_POST["day" . $day]);
            deleteStaff(date("Y", $lastSunday), date("m", $lastSunday), date("d", $lastSunday) + ($day - 1));
            for ($i = 0; $i < count($tmp2); $i++) {
                $tmp = split("-", $tmp2[$i]);
                saveStaff(date("Y", $lastSunday), date("m", $lastSunday), date("d", $lastSunday) + ($day - 1), $tmp[0], $tmp[1]);
            }
        }
    }
    $shiftSaved = true;
}
if ($shiftID > "0" && $_POST["procedure"] == "Generate") {
    $s = buildSchedule($shiftID);
    $employee = loadRandomEmployees();
    $requests = loadRequests();
    //echo "year = ".date("Y",$lastSunday);
    $empSchedule = scheduleEmployees($s, $lastSunday);
} else {
    //load scheduled shift
    $shiftID = loadScheduleShift(date("d/m/Y", $lastSunday));
    $s = buildSchedule($shiftID);
    if ($shiftID > "0") {
        $jobs = buildJobArray();
        $employee = loadSortedEmployees();
        $empSchedule = loadSchedule(date("Y", $lastSunday), date("m", $lastSunday), date("d", $lastSunday));
        $shiftSaved = true;
        //show empty dates
    } else {
        $showCalendar = true;