Guest User

Untitled

a guest
Aug 17th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. <?php
  2. public function profileAction() {
  3. $request = $this->getRequest();
  4. $user = new Stage5_Model_User();
  5. $user->loadByUserName($this->view->username);
  6. $profileForm = new Stage5_Form_Profile(array('user' => $user));
  7. $profileForm->setAction($this->view->url());
  8. //$profileForm->getElement('userid')->setValue($user->getId());
  9. //$profileForm->getElement('role')->setValue($user->getRole());
  10. $profileForm->getElement('inlognaam')->setValue($user->getUserName());
  11. $profileForm->getElement('paswoord1')->setValue('');
  12. $profileForm->getElement('voornaam')->setValue($user->getFirstName());
  13. $profileForm->getElement('achternaam')->setValue($user->getLastName());
  14. $profileForm->getElement('email')->setValue($user->getEmail());
  15. //$profileForm->getElement('pic')->setValue($user->getImage());
  16. $this->view->picture = $user->getImage();
  17. $this->view->form = $profileForm;
  18. if ($request->isPost()) {
  19. if ($profileForm->isValid($request->getPost())) {
  20. // do your handling here
  21. $userid = $user->getId();
  22. $role = $user->getRole();
  23. $inlognaam = $profileForm->getElement('inlognaam')->getValue();
  24. $paswoord = $profileForm->getElement('paswoord1')->getValue();
  25. $voornaam = $profileForm->getElement('voornaam')->getValue();
  26. $achternaam = $profileForm->getElement('achternaam')->getValue();
  27. $email = $profileForm->getElement('email')->getValue();
  28. $image = $profileForm->getElement('pic')->getValue();
  29. $user->setId($userid);
  30. $user->setUserName($inlognaam);
  31. if ($paswoord != '') $user->setPassword($paswoord, true);
  32. $user->setFirstName($voornaam);
  33. $user->setLastName($achternaam);
  34. $user->setEmail($email);
  35. $user->setRole($role);
  36. if ($image) $user->setImage($image);
  37. $user->save();
  38. $this->_forward('succes', 'user', 'default', array('page' => 'profile'));
  39. }
  40. }
  41. }
Add Comment
Please, Sign In to add comment