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; }
public function filter($authrole) { return WorkerSchedule::filter($this->workerList, $authrole); }