Admin_MiscController::fileexplorerTreeAction PHP Метод

fileexplorerTreeAction() публичный Метод

* FILEEXPLORER
    public function fileexplorerTreeAction()
    {
        $this->checkPermission("fileexplorer");
        $referencePath = $this->getFileexplorerPath("node");
        $items = scandir($referencePath);
        $contents = [];
        foreach ($items as $item) {
            if ($item == "." || $item == "..") {
                continue;
            }
            $file = $referencePath . "/" . $item;
            $file = str_replace("//", "/", $file);
            if (is_dir($file) || is_file($file)) {
                $itemConfig = ["id" => "/fileexplorer" . str_replace(PIMCORE_DOCUMENT_ROOT, "", $file), "text" => $item, "leaf" => true, "writeable" => is_writable($file)];
                if (is_dir($file)) {
                    $itemConfig["leaf"] = false;
                    $itemConfig["type"] = "folder";
                    if (\Pimcore\Tool\Admin::isExtJS6() && is_dir_empty($file)) {
                        $itemConfig["loaded"] = true;
                    }
                    $itemConfig["expandable"] = true;
                } elseif (is_file($file)) {
                    $itemConfig["type"] = "file";
                }
                $contents[] = $itemConfig;
            }
        }
        $this->_helper->json($contents);
    }