예제 #1
0
 private function replaceOverMaxWorkerTime($worker, $expoId)
 {
     $changed = FALSE;
     // birds of a feather
     $roleList = WorkerSchedule::filter($this->workerList, $worker->authrole());
     unset($roleList[$worker->workerid]);
     // remove $loopWorker
     $loopWorkerUnhappyJob = $worker->sortJobPreference($this->jobList, TRUE);
     foreach ($loopWorkerUnhappyJob as $loopJob) {
         $preferredSwapOrder = WorkerSchedule::sortTimeLeft($loopJob, $roleList, FALSE);
         foreach ($preferredSwapOrder as $swapWorker) {
             if ($loopJob->swapTime($loopWorker, $swapWorker, $expoId)) {
                 $changed = TRUE;
                 break;
                 // goto $loopJob loop
             }
         }
         // $swapWorker
         if (!$worker->overMaxHours()) {
             break;
         }
         // onto next worker
     }
     // $loopJob
     return $changed;
 }
예제 #2
0
 public function filter($authrole)
 {
     return WorkerSchedule::filter($this->workerList, $authrole);
 }