Exemplo n.º 1
0
switch ($userObj->getType()) {
    case AMA_TYPE_STUDENT:
    case AMA_TYPE_AUTHOR:
        $editUserObj =& $userObj;
        break;
    case AMA_TYPE_SWITCHER:
        $userId = DataValidator::is_uinteger($_POST['id_utente']);
        if ($userId !== false) {
            $editUserObj = MultiPort::findUser($userId);
        }
        break;
}
if (!is_null($editUserObj) && isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
    $form = new UserProfileForm($languages);
    $form->fillWithPostData();
    if ($form->isValid()) {
        $user_layout = $_POST['layout'];
        $editUserObj->fillWithArrayData($_POST);
        // save extra datas if it has been forced
        if (isset($_POST['forceSaveExtra']) && $editUserObj->hasExtra()) {
            $editUserObj->setExtras($_POST);
        }
        MultiPort::setUser($editUserObj, array(), true, ADAUser::getExtraTableName());
        /**
         * Set the session user to the saved one if it's not
         * a switcher, that is not saving its own profile
         */
        if ($userObj->getType() != AMA_TYPE_SWITCHER) {
            $_SESSION['sess_userObj'] = $editUserObj;
        }
        // if registration form is saved ok and userObj is not a switcher,