Profile.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. class Profile {
  3. /**
  4. * Handler for client side form sumbit
  5. * @param Array $formPacket Collection of form items along with direct data
  6. * @return Array response packet
  7. */
  8. function updateBasicInfo($formPacket){
  9. $response = array();
  10. $email = $formPacket['email'];
  11. if ($email == 'aaron@sencha.com') {
  12. $success = false;
  13. $response['errors'] = array(
  14. 'email'=>'already taken'
  15. );
  16. } else {
  17. $success = true;
  18. }
  19. $response['success'] = $success;
  20. // return form packet for demonstration/testing purposes
  21. $response['debug_formPacket'] = $formPacket;
  22. return $response;
  23. }
  24. /**
  25. * put your comment there...
  26. * This method configured with len=2, so 2 arguments will be sent
  27. * in the order according to the client side specified paramOrder
  28. * @param Number $userId
  29. * @param String $foo
  30. * @return Array response packet
  31. */
  32. function getBasicInfo($userId, $foo){
  33. return array(
  34. 'success'=>true,
  35. 'data'=>array(
  36. 'foo'=>$foo,
  37. 'name'=>'Aaron Conran',
  38. 'company'=>'Sencha Inc.',
  39. 'email'=>'aaron@sencha.com'
  40. )
  41. );
  42. }
  43. function getPhoneInfo($userId) {
  44. return array(
  45. 'success'=>true,
  46. 'data'=>array(
  47. 'cell'=>'443-555-1234',
  48. 'office'=>'1-800-CALLEXT',
  49. 'home'=>''
  50. )
  51. );
  52. }
  53. function getLocationInfo($userId) {
  54. return array(
  55. 'success'=>true,
  56. 'data'=>array(
  57. 'street'=>'1234 Red Dog Rd.',
  58. 'city'=>'Seminole',
  59. 'state'=>'FL',
  60. 'zip'=>33776
  61. )
  62. );
  63. }
  64. }