Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
            $aas = new FirstComeFirstServed($expo->expoid, $stationList, $workerList, $assignmentList, $keepFlag);
        } else {
            if (0 == strcmp(FIRSTCOMELOCATIONLOCKED, $algorithm)) {
                $aas = new FirstComeLocationLocked($expo->expoid, $stationList, $workerList, $assignmentList, $keepFlag);
            } else {
                if (0 == strcmp(FIRSTCOMESOFTLOCATIONLOCKED, $algorithm)) {
                    $aas = new FirstComeSoftLocationLocked($expo->expoid, $stationList, $workerList, $assignmentList, $keepFlag);
                } else {
                    $aas = new FirstComeFirstServed($expo->expoid, $stationList, $workerList, $assignmentList, $keepFlag);
                }
            }
        }
    }
    $workerList = NULL;
    $stationList = NULL;
    $assignmentList = NULL;
    $d1 = new DateTime();
    logMessage("ScheduleExpoAction", "**** {$algorithm} - assignSchedule(" . $expo->expoid . ") ****", $d1->format('H:i'), "\n");
    $aas->assignSchedule($expo->expoid);
    $d2 = new DateTime();
    logMessage("ScheduleExpoAction", "**** {$algorithm} - assignSchedule(" . $expo->expoid . ") ****", $d2->format('H:i'), "  elapsed: ", $d2->getTimestamp() - $d1->getTimestamp(), "\n");
    $aas->logJobListState($algorithm, "jobs after assignment");
    $aas->logWorkerListState($algorithm, "workers after assignment");
    // $_SESSION[PARAM_SCHEDULE_PUBLISH] = $aas; - this will not work due to the recursion
    // i.e. stations->workers->stations->.....
    $_SESSION[PARAM_SCHEDULE_PUBLISH] = $aas->getSchedule();
    $_SESSION[PARAM_PAGE_MESSAGE] = "{$algorithm} finished";
}
session_write_close();
header('Location: ScheduleExpoPage.php');
include 'ScheduleExpoPage.php';