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