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;
 }
 public function __construct($expoId, array $jobList = NULL, array $workerList = NULL, array $assignmentList = NULL, $keepAssignmentsFlag = TRUE)
 {
     if (is_null($expoId)) {
         throw new Exception("must pass in an expoId to AbstractScheduler");
     }
     $this->expoid = $expoId;
     if (is_null($jobList)) {
         $jobList = JobSchedule::selectExpo($expoId);
     }
     $this->jobList = $jobList;
     $jobList = NULL;
     if (is_null($workerList)) {
         $workerList = WorkerSchedule::selectExpo($expoId);
     }
     $this->workerList = $workerList;
     $workerList = NULL;
     if (is_null($assignmentList)) {
         $assignmentList = ShiftAssignment::selectExpo($expoId);
     }
     $this->assignmentList = $assignmentList;
     $assignmentList = NULL;
     $this->setup($keepAssignmentsFlag, $expoId);
     // todo - pass in parameter
 }
try {
    $algorithm = swwat_parse_enum($algorithm, ScheduleEnum::$ENUM_ARRAY, FALSE);
} catch (ParseSWWATException $ex) {
    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 {