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); }
echo "</xml>"; } break; case 'group_users': if (isset($_GET['token']) && checkToken($_GET['token'])) { if (isset($_GET['group'])) { if (eF_checkParameter($_GET['group'], 'id') == false) { echo "<xml>"; echo "<status>error</status>"; echo "<message>Invalid group id</message>"; echo "</xml>"; exit; } try { $group = new EfrontGroup($_GET['group']); $usersList = $group->getGroupUsers(array('archive' => false, 'return_objects' => false)); echo "<xml>"; foreach ($usersList as $key => $user) { echo "<user>"; echo "<id>" . $user['id'] . "</id>"; echo "<login>" . $user['login'] . "</login>"; echo "<first_name>" . $user['name'] . "</first_name>"; echo "<last_name>" . $user['surname'] . "</last_name>"; echo "<email>" . $user['email'] . "</email>"; echo "<active>" . $user['active'] . "</active>"; echo "</user>"; } echo "</xml>"; } catch (Exception $e) { if ($e->getCode() == EfrontUserException::USER_NOT_EXISTS) { echo "<xml>";