Admin_DocumentController::seopanelTreeAction PHP Метод

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

public seopanelTreeAction ( )
    public function seopanelTreeAction()
    {
        $this->checkPermission("seo_document_editor");
        $document = Document::getById($this->getParam("node"));
        $documents = [];
        if ($document->hasChilds()) {
            $list = new Document\Listing();
            $list->setCondition("parentId = ?", $document->getId());
            $list->setOrderKey("index");
            $list->setOrder("asc");
            $childsList = $list->load();
            foreach ($childsList as $childDocument) {
                // only display document if listing is allowed for the current user
                if ($childDocument->isAllowed("list")) {
                    $list = new Document\Listing();
                    $list->setCondition("path LIKE ? and type = ?", [$childDocument->getRealFullPath() . "/%", "page"]);
                    if ($childDocument instanceof Document\Page || $list->getTotalCount() > 0) {
                        $documents[] = $this->getSeoNodeConfig($childDocument);
                    }
                }
            }
        }
        $this->_helper->json($documents);
    }