Esempio n. 1
0
 /**
  * Performs WebProfile data save from owning logged user
  * @param \App\UsersModule\Forms\PersonalWebProfileForm $form
  */
 public function webProfileFormSuccess(PersonalWebProfileForm $form)
 {
     $values = $form->getValues();
     $wp = new WebProfile((array) $values);
     $user = $this->getUser()->getIdentity();
     if (!$values->picture->isOk()) {
         $wp->setPicture($user->getWebProfile()->getPicture());
     } else {
         $wp->insertOldImgId($user->getWebProfile()->getPicture());
     }
     $wp->setStatus(WebProfileStatus::UPDATED);
     $wp->setUpdated(new \Nette\Utils\DateTime());
     $wp->setEditor($this->getUser()->getIdentity());
     $user->setWebProfile($wp);
     try {
         $this->userService->changeWebProfile($user);
     } catch (Exceptions\DataErrorException $e) {
         $this->handleDataSave($wp->getId(), "default", $e);
     }
     $this->redirect("this");
 }