1
|
<?php
|
2
|
require_once("config.php");
|
3
|
$jstree = new json_tree();
|
4
|
|
5
|
//$jstree->_create_default();
|
6
|
//die();
|
7
|
|
8
|
if(isset($_GET["reconstruct"])) {
|
9
|
$jstree->_reconstruct();
|
10
|
die();
|
11
|
}
|
12
|
if(isset($_GET["analyze"])) {
|
13
|
echo $jstree->_analyze();
|
14
|
die();
|
15
|
}
|
16
|
|
17
|
if($_REQUEST["operation"] && strpos("_", $_REQUEST["operation"]) !== 0 && method_exists($jstree, $_REQUEST["operation"])) {
|
18
|
header("HTTP/1.0 200 OK");
|
19
|
header('Content-type: text/json; charset=utf-8');
|
20
|
header("Cache-Control: no-cache, must-revalidate");
|
21
|
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
22
|
header("Pragma: no-cache");
|
23
|
echo $jstree->{$_REQUEST["operation"]}($_REQUEST);
|
24
|
die();
|
25
|
}
|
26
|
header("HTTP/1.0 404 Not Found");
|
27
|
?>
|
28
|
|
29
|
<?php
|
30
|
/*
|
31
|
$jstree->_drop();
|
32
|
$jstree->create_node(array("id"=>0,"position"=>0));
|
33
|
$jstree->create_node(array("id"=>1,"position"=>0));
|
34
|
$jstree->create_node(array("id"=>1,"position"=>0));
|
35
|
$jstree->create_node(array("id"=>3,"position"=>0,"name"=>"Pesho"));
|
36
|
$jstree->move(3,2,0,true);
|
37
|
$jstree->_dump(true);
|
38
|
$jstree->_reconstruct();
|
39
|
echo $jstree->_analyze();
|
40
|
die();
|
41
|
|
42
|
$tree = new _tree_struct;
|
43
|
$tree->drop();
|
44
|
$tree->create(0, 0);
|
45
|
$tree->create(0, 0);
|
46
|
$tree->create(1, 0);
|
47
|
$tree->create(0, 3);
|
48
|
$tree->create(2, 3);
|
49
|
$tree->create(2, 0);
|
50
|
$tree->dump(true);
|
51
|
$tree->move(6,4,0);
|
52
|
$tree->move(1,0,0);
|
53
|
$tree->move(3,2,99,true);
|
54
|
$tree->move(7,1,0,true);
|
55
|
$tree->move(1,7,0);
|
56
|
$tree->move(1,0,1,true);
|
57
|
$tree->move(2, 0, 0, true);
|
58
|
$tree->move(13, 12, 2, true);
|
59
|
$tree->dump(true);
|
60
|
$tree->move(15, 16, 2, true);
|
61
|
$tree->dump(true);
|
62
|
$tree->move(4, 0, 0);
|
63
|
$tree->dump(true);
|
64
|
$tree->move(4, 0, 2);
|
65
|
$tree->dump(true);
|
66
|
echo $tree->analyze();
|
67
|
$tree->drop();
|
68
|
*/
|
69
|
?>
|