
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jstree/3.0.9/themes/default/style.min.css" />
<script src="//cdnjs.cloudflare.com/ajax/libs/jstree/3.0.9/jstree.min.js"></script>


<div id="container"></div>
<script>
$(function() {
  $('#container').jstree({
    'core' : {
      'data' : [
        { "text" : "Root node", "children" : [
            { "text" : "Child node 1" },
            { "text" : "Child node 2" }
          ]
        }
      ]
    }
  });
});
</script> 




<div id="arbre02"></div>
<script>
$(function() {
  $('#arbre02').jstree({
    'core' : {
      'data' : {
        "url" : "build.php",
        "dataType" : "json" // needed only if you do not supply JSON headers
      }
    }
  });
});
</script> 




</script>

<script>

 // Create jstree instance
    $('#arbre').jstree({
        "plugins": ["wholerow"],
        'check_callback' : true,
        "core": {
        "themes": {
            "variant": "large"
        },
            'data': {
            'url': "tree03.php?route=tree",
                'type': 'POST',
                'dataType': 'JSON',
                'data': function (node) {
                    // Set default top folder (/image)
                    var directory = '';

                    // If filepath set, remove its brackets
                    if (typeof node != "undefined") {
                        if (node.id != '#') {
                            directory = node.id;
                        }
                    }

                    return {
                        'directory': directory
                    };
                }
            }
        }
    });
	
</script>	

<?php    

    // Get children folders within a target directory folder and respond with json array and elements for jstree
     function directory() {
        $json = array();

        if (isset($this->request->post['directory'])) {

            $directories = glob(rtrim(DIR_IMAGE . str_replace('../', '', $this->request->post['directory']), '/') . '/*', GLOB_ONLYDIR);

            if ($directories) {
                $i = 0;

                foreach ($directories as $directory) {
                    $json[$i]['id'] = $this->request->post['directory'] . '/' . basename($directory);
                    $json[$i]['text'] = basename($directory);

                    $children = glob(rtrim($directory, '/') . '/*', GLOB_ONLYDIR);

                    if ($children)  {
                        $json[$i]['children'] = true;
                    }

                    $i++;
                }
            }
        }

        $this->response->setOutput(json_encode($json));
    }
	
	
	
     $drive = "../Utilisateurs";
     echo round((disk_free_space($drive) / 1048576), 2);

?>


<div id="arbre">
   
</div>