addUserDepartmentGroups() public static method

public static addUserDepartmentGroups ( $userData, $groupsIds )
Beispiel #1
0
    }
    $Errors = erLhcoreClassUserValidator::validateUserNew($UserData, $userParams);
    if (count($Errors) == 0) {
        try {
            $db = ezcDbInstance::get();
            $db->beginTransaction();
            erLhcoreClassUser::getSession()->save($UserData);
            if (count($userParams['global_departament']) > 0) {
                erLhcoreClassUserDep::addUserDepartaments($userParams['global_departament'], $UserData->id, $UserData);
            }
            $UserData->setUserGroups();
            $userPhotoErrors = erLhcoreClassUserValidator::validateUserPhoto($UserData);
            if ($userPhotoErrors !== false && count($userPhotoErrors) == 0) {
                $UserData->saveThis();
            }
            erLhcoreClassModelDepartamentGroupUser::addUserDepartmentGroups($UserData, erLhcoreClassUserValidator::validateDepartmentsGroup($UserData));
            erLhcoreClassModelUserSetting::setSetting('show_all_pending', $userParams['show_all_pending'], $UserData->id);
            erLhcoreClassChatEventDispatcher::getInstance()->dispatch('user.user_created', array('userData' => &$UserData, 'password' => $UserData->password_front));
            $db->commit();
            erLhcoreClassModule::redirect('user/userlist');
            exit;
        } catch (Exception $e) {
            $tpl->set('errors', array($e->getMessage()));
            $UserData->removeFile();
            $db->rollback();
        }
    } else {
        $tpl->set('errors', $Errors);
    }
}
$tpl->set('user', $UserData);