protected function getBranchByName($branch_name) { if (!$this->branchNamesToIds) { $branches = EfrontBranch::getAllBranches(); foreach ($branches as $branch) { if (!isset($this->branchNamesToIds[$branch['name']])) { $this->branchNamesToIds[$branch['name']] = array($branch['branch_ID']); } else { $this->branchNamesToIds[$branch['name']][] = $branch['branch_ID']; } } } return $this->branchNamesToIds[$branch_name]; }
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); }