Exemple #1
0
     break;
 case 'get_node':
     $node = isset($_GET['id']) && $_GET['id'] !== '#' ? (int) $_GET['id'] : 0;
     $temp = $fs->get_children($node);
     $rslt = array();
     foreach ($temp as $v) {
         $rslt[] = array('id' => $v['id'], 'text' => $v['nm'], 'children' => $v['rgt'] - $v['lft'] > 1);
     }
     break;
 case "get_content":
     $node = isset($_GET['id']) && $_GET['id'] !== '#' ? $_GET['id'] : 0;
     $node = explode(':', $node);
     if (count($node) > 1) {
         $rslt = array('content' => 'Multiple selected');
     } else {
         $temp = $fs->get_node((int) $node[0], array('with_path' => true));
         $rslt = array('content' => 'Selected: /' . implode('/', array_map(function ($v) {
             return $v['nm'];
         }, $temp['path'])) . '/' . $temp['nm']);
     }
     break;
 case 'create_node':
     $node = isset($_GET['id']) && $_GET['id'] !== '#' ? (int) $_GET['id'] : 0;
     $temp = $fs->mk($node, isset($_GET['position']) ? (int) $_GET['position'] : 0, array('nm' => isset($_GET['text']) ? $_GET['text'] : 'New node'));
     $rslt = array('id' => $temp);
     break;
 case 'rename_node':
     $node = isset($_GET['id']) && $_GET['id'] !== '#' ? (int) $_GET['id'] : 0;
     $rslt = $fs->rn($node, array('nm' => isset($_GET['text']) ? $_GET['text'] : 'Renamed node'));
     break;
 case 'delete_node':