示例#1
0
    /**
     * Create new user
     * 
     * @param array $data, POST data
     * @return int $id, current id of created user
     */
    public function saveLoginDataTab(array $data){
        $userObj = new UserLogin();
        $userObj->setUsername($data['userFirstTab_username']);
        $userObj->setEmail($data['userFirstTab_email']);
        $userObj->setRoleId($data['userFirstTab_userrole']);
        $userObj->setPassword($data['userFirstTab_password']);
        $userObj->save();
        $id = $userObj->getId();

        $userData = new UserData();
        $userData->setUserId($id);
        $userData->setFirstname($data['userFirstTab_firstname']);
        $userData->setLastname($data['userFirstTab_lastname']);
        $userData->save();

        $userSetting= new UserSetting();
        $userSetting->setUserId($id);
        $userSetting->setEmailformat($data['userFirstTab_emailformat']);
        $userSetting->setEmailtype($data['userFirstTab_emailtype']);
        $userSetting->setLanguage($data['userFirstTab_language']);
        $userSetting->setFirstlogin(1);
        $userSetting->save();
        return $id;
    }