protected function getJobByName($job_title, $branch_name = false) { if (!$this->jobNamesToIds) { $jobs = EfrontJob::getAllJobs(); foreach ($jobs as $job) { if (!isset($this->jobNamesToIds[$job['description']])) { $this->jobNamesToIds[$job['description']] = array(array("job_description_ID" => $job['job_description_ID'], "branches_name" => $job['name'])); } else { $this->jobNamesToIds[$job['description']][] = array("job_description_ID" => $job['job_description_ID'], "branches_name" => $job['name']); } } } $ids_to_return = array(); $jobs_with_this_description = $this->jobNamesToIds[$job_title]; foreach ($jobs_with_this_description as $jobInfo) { if (!$branch_name || $jobInfo['branches_name'] == $branch_name) { $ids_to_return[] = $jobInfo['job_description_ID']; } } return $ids_to_return; }
private function doUnenrollUsers() { $smarty = $this->getSmartyVar(); $currentUser = $this->getCurrentUser(); if ($_GET['type'] == 'job') { foreach (EfrontJob::getAllJobs() as $key => $value) { $entities[$value['job_description_ID']] = $value['description']; } if ($_GET['entry']) { $entity = new EfrontJob($_GET['entry']); $courses = $entity->getJobCourses(array('archive' => false)); $users = $entity->getEmployees(); } } elseif ($_GET['type'] == 'branch') { foreach (EfrontBranch::getAllBranches() as $key => $value) { $entities[$value['branch_ID']] = $value['name']; } if ($_GET['entry']) { $entity = new EfrontBranch($_GET['entry']); $courses = $entity->getBranchCourses(array('archive' => false)); $users = $entity->getEmployees(); } } elseif ($_GET['type'] == 'group') { foreach (EfrontGroup::getGroups() as $key => $value) { $entities[$value['id']] = $value['name']; } if ($_GET['entry']) { $entity = new EfrontGroup($_GET['entry']); $courses = $entity->getGroupCourses(array('archive' => false)); $users = $entity->getGroupUsers(); } } if ($_GET['ajax'] && $_GET['remove_users_from_courses']) { try { foreach ($courses as $course) { $course->removeUsers($users); } exit; } catch (Exception $e) { handleAjaxExceptions($e); } } $smarty->assign("T_ENTITIES_LIST", $entities); }