//Import the file to the database, so we can access it with view_file $editedUser->user['avatar'] = key($newList); } } EfrontEvent::triggerEvent(array("type" => EfrontEvent::AVATAR_CHANGE, "users_LOGIN" => $editedUser->user['login'], "users_name" => $editedUser->user['name'], "users_surname" => $editedUser->user['surname'], "lessons_ID" => 0, "lessons_name" => "", "entity_ID" => $editedUser->user['avatar'])); } $editedUser->persist(); if (G_VERSIONTYPE == 'enterprise') { #cpp#ifdef ENTERPRISE if (isset($_GET['add_user'])) { $editedEmployee = EfrontHcdUser::createUser(array('users_login' => $editedUser->user['login'])); if ($currentEmployee->isSupervisor() && !EfrontUser::isOptionVisible('show_unassigned_users_to_supervisors')) { //if supervisors can't see unassigned users, then attach this new user to the supervisor's firts branch and job $branch = new EfrontBranch(current($currentEmployee->getSupervisedBranchesRecursive())); $nospecific = false; foreach ($branch->getJobDescriptions() as $value) { if ($value['description'] == _NOSPECIFICJOB) { $nospecific = $value['job_description_ID']; } } if (!$nospecific) { $nospecific = EfrontJob::createJob(array('description' => _NOSPECIFICJOB, 'branch_ID' => $branch->branch['branch_ID'])); } $editedEmployee->addJob($editedUser, $nospecific, $branch->branch['branch_ID'], 0); } } } #cpp#endif if (isset($_SESSION['missing_fields'])) { unset($_SESSION['missing_fields']); loginRedirect($editedUser->user['user_type'], urlencode(_OPERATIONCOMPLETEDSUCCESSFULLY . $ldapMessage), 'success');
} //If in a branch url, remove unrelated courses if (G_VERSIONTYPE == 'enterprise' && defined("G_BRANCH_URL") && G_BRANCH_URL) { $branch = new EfrontBranch($_SESSION['s_current_branch']); $result = eF_getTableDataFlat("module_hcd_course_to_branch", "courses_ID", "branches_ID=" . $branch->branch['branch_ID']); foreach ($courses['id'] as $key => $value) { if (!in_array($value, $result['courses_ID'])) { unset($courses['id'][$key]); unset($courses['name'][$key]); } } } // If in a branch url, remove unrelated lessons if (G_VERSIONTYPE == 'enterprise' && defined("G_BRANCH_URL") && G_BRANCH_URL) { $branch = new EfrontBranch($_SESSION['s_current_branch']); $jobs_of_branch = $branch->getJobDescriptions(); foreach ($jobs_of_branch as $value) { $job_ids[] = $value['job_description_ID']; } if (!empty($job_ids)) { $result = eF_getTableDataFlat("module_hcd_lesson_to_job_description", "lessons_ID", "job_description_ID in (" . implode(",", $job_ids) . ")"); foreach ($lessons['id'] as $key => $value) { if (!in_array($value, $result['lessons_ID'])) { unset($lessons['id'][$key]); unset($lessons['name'][$key]); } } } } //This code is for excluding lessons that belong to inactive courses and they do not belong to any other active course $lessons_excluded = eF_getTableData("courses c,lessons l, lessons_to_courses lc", "l.id,l.name,SUM(c.active) as active", "l.id=lc.lessons_ID and c.id=lc.courses_ID AND l.course_only=1", "", "l.id");