Guest User

Untitled

a guest
Dec 3rd, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. //This is the createAction
  2.  
  3. if ($userForm->isValid($_POST)) {
  4. $userModel = new Model_User();
  5. $userModel->createUser(
  6. $userForm->getValue('email'),
  7. $userForm->getValue('password'),
  8. $userForm->getValue('url'),
  9. $userForm->getValue('responsable'),
  10. $userForm->getValue('role')
  11. );
  12. $paises = $this->getRequest()->getParam('pais');
  13. $userId = //what should I have here??
  14.  
  15. return $this->_forward('list');
  16. }
  17.  
  18. //and this is the model
  19.  
  20. class Model_User extends Zend_Db_Table_Abstract {
  21. /**
  22. * The default table name
  23. */
  24. protected $_name = 'users';
  25.  
  26. public function createUser($email, $password, $url, $responsable, $role)
  27. {
  28. // create a new row
  29. $rowUser = $this->createRow();
  30. if($rowUser) {
  31. // update the row values
  32. $rowUser->email = $email;
  33. $rowUser->password = md5($password);
  34. $rowUser->url = $url;
  35. $rowUser->responsable = $responsable;
  36. $rowUser->role = $role;
  37. $rowUser->save();
  38. //return the new user
  39. return $rowUser;
  40. } else {
  41. throw new Zend_Exception("El usuario no se ha podido crear!");
  42. }
  43. }
  44. }
Add Comment
Please, Sign In to add comment