Upgrade to ExtJS 3.2.0 - Released 03/30/2010
[extjs.git] / examples / direct / php / classes / TestAction.php
1 <?php
2 class TestAction {
3     function doEcho($data){
4         return $data;
5     }
6
7     function multiply($num){
8         if(!is_numeric($num)){
9             throw new Exception('Call to multiply with a value that is not a number');
10         }
11         return $num*8;
12     }
13
14     function getTree($id){
15         $out = array();
16         if($id == "root"){
17                 for($i = 1; $i <= 5; ++$i){
18                     array_push($out, array(
19                         'id'=>'n' . $i,
20                         'text'=>'Node ' . $i,
21                         'leaf'=>false
22                     ));
23                 }
24         }else if(strlen($id) == 2){
25                 $num = substr($id, 1);
26                 for($i = 1; $i <= 5; ++$i){
27                     array_push($out, array(
28                         'id'=>$id . $i,
29                         'text'=>'Node ' . $num . '.' . $i,
30                         'leaf'=>true
31                     ));
32                 }
33         }
34         return $out;
35     }
36 }