Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1 | espaco | 1 | <?php |
| 2 | $parent = $_REQUEST["parent"]; |
||
| 3 | |||
| 4 | $data = array(); |
||
| 5 | |||
| 6 | $states = array( |
||
| 7 | "success", |
||
| 8 | "info", |
||
| 9 | "danger", |
||
| 10 | "warning" |
||
| 11 | ); |
||
| 12 | |||
| 13 | if ($parent == "#") { |
||
| 14 | for($i = 1; $i < rand(4, 7); $i++) { |
||
| 15 | $data[] = array( |
||
| 16 | "id" => "node_" . time() . rand(1, 100000), |
||
| 17 | "text" => "Node #" . $i, |
||
| 18 | "icon" => "fa fa-folder icon-lg icon-state-" . ($states[rand(0, 3)]), |
||
| 19 | "children" => true, |
||
| 20 | "type" => "root" |
||
| 21 | ); |
||
| 22 | } |
||
| 23 | } else { |
||
| 24 | if (rand(1, 5) === 3) { |
||
| 25 | $data[] = array( |
||
| 26 | "id" => "node_" . time() . rand(1, 100000), |
||
| 27 | "icon" => "fa fa-file fa-large icon-state-default", |
||
| 28 | "text" => "No childs ", |
||
| 29 | "state" => array("disabled" => true), |
||
| 30 | "children" => false |
||
| 31 | ); |
||
| 32 | } else { |
||
| 33 | for($i = 1; $i < rand(2, 4); $i++) { |
||
| 34 | $data[] = array( |
||
| 35 | "id" => "node_" . time() . rand(1, 100000), |
||
| 36 | "icon" => ( rand(0, 3) == 2 ? "fa fa-file icon-lg" : "fa fa-folder icon-lg")." icon-state-" . ($states[rand(0, 3)]), |
||
| 37 | "text" => "Node " . time(), |
||
| 38 | "children" => ( rand(0, 3) == 2 ? false : true) |
||
| 39 | ); |
||
| 40 | } |
||
| 41 | } |
||
| 42 | } |
||
| 43 | |||
| 44 | header('Content-type: text/json'); |
||
| 45 | header('Content-type: application/json'); |
||
| 46 | echo json_encode($data); |
||
| 47 | ?> |