Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / examples / direct / php / api.php
1 <?php
2 require('config.php');
3 header('Content-Type: text/javascript');
4
5 // convert API config to Ext.Direct spec
6 $actions = array();
7 foreach($API as $aname=>&$a){
8         $methods = array();
9         foreach($a['methods'] as $mname=>&$m){
10             if (isset($m['len'])) {
11                     $md = array(
12                             'name'=>$mname,
13                             'len'=>$m['len']
14                     );
15                 } else {
16                     $md = array(
17                         'name'=>$mname,
18                         'params'=>$m['params']
19                     );
20                 }
21                 if(isset($m['formHandler']) && $m['formHandler']){
22                         $md['formHandler'] = true;
23                 }
24                 $methods[] = $md;
25         }
26         $actions[$aname] = $methods;
27 }
28
29 $cfg = array(
30     'url'=>'php/router.php',
31     'type'=>'remoting',
32         'actions'=>$actions
33 );
34
35 echo 'Ext.ns("Ext.app"); Ext.app.REMOTING_API = ';
36
37 echo json_encode($cfg);
38 echo ';';