source: trunk/web/addons/job_monarch/lib/extjs-30/examples/direct/php/classes/TestAction.php @ 625

Last change on this file since 625 was 625, checked in by ramonb, 15 years ago

lib/extjs-30:

  • new ExtJS 3.0
File size: 894 bytes
Line 
1<?php
2class 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}
Note: See TracBrowser for help on using the repository browser.