public static function assignAsYouGo(Expo $expo, Worker $worker)
 {
     if ($expo->scheduleAssignAsYouGo) {
         $workerList = NULL;
         $stationList = NULL;
         $assignmentList = NULL;
         try {
             // needed for all
             $workerList = WorkerSchedule::selectExpo($expo->expoid);
             $stationList = JobSchedule::selectExpo($expo->expoid);
             $assignmentList = ShiftAssignment::selectExpo($expo->expoid);
         } catch (PDOException $ex) {
             logMessage("FirstComeFirstServed", "assignAsYouGo(" . $expo->titleString() . ", " . $worker->email . ") - " . $ex->getMessage());
             return;
         }
         foreach ($workerList as $w) {
             if ($w->workerid == $worker->workerid) {
                 $worker = $w;
                 break;
             }
         }
         // $w
         $aas = new FirstComeFirstServed($expo->expoid, $stationList, $workerList, $assignmentList, TRUE);
         $stationList = NULL;
         $assignmentList = NULL;
         $workerList = NULL;
         $d1 = new DateTime();
         logMessage("FirstComeFirstServed", "**** assignSchedule(" . $expoId . ") ****", $d1->format('H:i'), "\n");
         $aas->assignWorker($worker, $expoId);
         $d2 = new DateTime();
         logMessage("FirstComeFirstServed", "****assignSchedule(" . $expoId . ") ****", $d2->format('H:i'), "  elapsed: ", $d2->getTimestamp() - $d1->getTimestamp(), "\n");
         // $aas->logJobListState("FirstComeFirstServed", "jobs after assignment");
         // $aas->logWorkerListState("FirstComeFirstServed", "workers after assignment");
         AbstractScheduler::commitSchedule($expo->expoid, TRUE, $aas->getSchedule());
     }
     return;
 }
示例#2
0
    header('Location: WorkerLoginPage.php');
    include 'WorkerLoginPage.php';
    return;
}
$keepFlag = isset($_POST[PARAM_SCHEDULE_KEEP]);
$_SESSION[PARAM_SCHEDULE_ALGO] = $_POST[PARAM_SCHEDULE_ALGO];
$_SESSION[PARAM_SCHEDULE_KEEP] = $_POST[PARAM_SCHEDULE_KEEP];
$workerList = NULL;
$stationList = NULL;
$assignmentList = NULL;
try {
    // needed for all
    $workerList = WorkerSchedule::selectExpo($expo->expoid);
    // needed for all excepting PREFERENCEASSIGN
    $stationList = JobSchedule::selectExpo($expo->expoid);
    $assignmentList = ShiftAssignment::selectExpo($expo->expoid);
} catch (PDOException $ex) {
    $_POST[PARAM_PAGE_MESSAGE] = "Please try to schedule at a later time.";
    logMessage("ScheduleExpoAction", "Database screwup" . $ex->getMessage());
    header('Location: ScheduleExpoPage.php');
    include 'ScheduleExpoPage.php';
    return;
}
if (!is_null($algorithm)) {
    $aas = NULL;
    if (0 == strcmp(ASSIGNANDSUBTRACT, $algorithm)) {
        $aas = new AssignAndSubtract($expo->expoid, $stationList, $workerList, $assignmentList, $keepFlag);
    } else {
        if (0 == strcmp(FIRSTCOMEFIRSTSERVE, $algorithm)) {
            $aas = new FirstComeFirstServed($expo->expoid, $stationList, $workerList, $assignmentList, $keepFlag);
        } else {
示例#3
0
 public static function commitSchedule($expoId, $keepAssignmentsFlag, array $assignmentList)
 {
     // should probably combine these as single DB transaction
     if (!$keepAssignmentsFlag) {
         $oldAssignmentList = ShiftAssignment::selectExpo($expoId);
         // actively get rid of old list
         ShiftAssignment::deleteList($oldAssignmentList);
     }
     // create new list
     ShiftAssignment::insertList($assignmentList);
     return;
 }