Allows requesting a view update on specific tree nodes.
Similar to {@link getsubtree()}, but doesn't enforce loading
all children with the node. Useful to refresh views after
state modifications, e.g. saving a form.

@return String JSON
772825
public function updatetreenodes($request) {
        $data=array();
        $ids=explode(',', $request->getVar('ids'));
        foreach($ids as $id) {
            if($id==Session::get('CodeBank.deletedSnippetID')) {
                Session::clear('CodeBank.deletedSnippetID');
                $this->response->addHeader('Content-Type', 'text/json');
                return '{"'.$id.'": false}';
            }
            $record=$this->getRecord($id);
            $recordController=singleton('CodeBank');
            
            //Find the next & previous nodes, for proper positioning (Sort isn't good enough - it's not a raw offset)
            $next=$prev=null;
            $className=$this->stat('tree_class');
            $next=Snippet::get()->filter('LanguageID', $record->LanguageID)->filter('FolderID', $record->FolderID)->filter('Title:GreaterThan', $record->Title)->first();
            if(!$next) {
                $prev=Snippet::get()->filter('LanguageID', $record->LanguageID)->filter('FolderID', $record->FolderID)->filter('Title:LessThan', $record->Title)->reverse()->first();
            }
            
            $link=Controller::join_links($recordController->Link("show"), $record->ID);
            $html=CodeBank_TreeNode::create($record, $link, $this->isCurrentPage($record))->forTemplate().'</li>';
            
            $folder=$record->Folder();
            $data[$id]=array(
                            'html'=>$html,
                            'ParentID'=>(!empty($folder) && $folder!==false && $folder->ID!=0 ? 'folder-'.$record->FolderID:'language-'.$record->LanguageID),
                            'NextID'=>($next ? $next->ID:null),
                            'PrevID'=>($prev ? $prev->ID:null)
                        );
        }
        
        $this->response->addHeader('Content-Type', 'text/json');
        return Convert::raw2json($data);
    }
173660
public function getsubtree($request) {
        if(strpos($request->getVar('ID'), 'folder-')!==false) {
            $folderID=(strpos($request->getVar('ID'), 'folder-')!==false ? intval(str_replace('folder-', '', $request->getVar('ID'))):null);
            $html=$this->getSiteTreeFor('SnippetFolder', $folderID, 'Children', null, array($this, 'hasSnippets'));
        }else {
            $languageID=(strpos($request->getVar('ID'), 'language-')!==false ? intval(str_replace('language-', '', $request->getVar('ID'))):null);
            $html=$this->getSiteTreeFor($this->stat('tree_class'), $languageID, 'Children', null, array($this, 'hasSnippets'));
        }

        // Trim off the outer tag
        $html=preg_replace('/^[\s\t\r\n]*<ul[^>]*>/','', $html);
        $html=preg_replace('/<\/ul[^>]*>[\s\t\r\n]*$/','', $html);
        
        return $html;
    }
834393
public function getJson()
    {
        if (!isset($this->json)) {
            $this->json = json_decode($this->getProp('dump-single-json'));
        }

        return $this->json;
    }
1160410
protected function _getJson()
    {
        if ($this->_json) {
            return $this->_json;
        }

        return $this->_json = json_decode($this->_getBody(), true);
    }
997155
public function getTree($id = null) {
        $parent = $this->getConfig('parentField');
        $left = $this->getConfig('leftField');
        $right = $this->getConfig('rightField');

        $query = $this->getRepository()->select()->orderBy($left, 'asc');

        if ($id) {
            if ($parentNode = $this->getNode($id)) {
                $query->where($left, 'between', [$parentNode[$left], $parentNode[$right]]);
            } else {
                return [];
            }
        }

        $nodes = $query->all();

        if ($nodes->isEmpty()) {
            return [];
        }

        $map = [];
        $stack = [];
        $pk = $this->getRepository()->getPrimaryKey();

        foreach ($nodes as $node) {
            if ($node[$parent] && $node[$pk] != $id) {
                $map[$node[$parent]][] = $node;
            } else {
                $stack[] = $node;
            }
        }

        $results = $this->mapTree($stack, $map);

        if ($id) {
            return $results[0];
        }

        return $results;
    }
660760
protected function getJson()
    {
        if ($this->str_request_body_json === null) {
            $this->str_request_body_json = json_decode($this->getBody());
        }
        return $this->str_request_body_json;
    }
63702
public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('asf_layout');

        $rootNode
            ->children()
                ->booleanNode('enable_flash_messages')
                    ->defaultTrue()
                ->end()
                ->arrayNode('assets')
                    ->addDefaultsIfNotSet()
                    ->children()
                       ->append($this->addJqueryParameterNode())
                       ->append($this->addTwitterBootstrapParameterNode())
                       ->append($this->addjQueryUIParameterNode())
                       ->append($this->addSelect2ParameterNode())
                       ->append($this->addBazingaJsTranslationParameterNode())
                       ->append($this->addSpeakingURLParameterNode())
                       ->append($this->addTinyMCEParameterNode())
                       ->append($this->addJqueryTagsInputParameterNode())
                       ->append($this->addPrismJSParameterNode())
                       ->booleanNode('fos_js_routing')->defaultFalse()->end()
                    ->end()
                ->end()
                ->scalarNode('components_dir')
                    ->defaultValue(self::COMPONENTS_DIR)
                ->end()
            ->end()
        ;

        return $treeBuilder;
    }
967389
public function treeAction(Request $request = null)
    {
        $this->admin->checkAccess('tree');

        $sites = $this->get('sonata.page.manager.site')->findBy([]);
        $pageManager = $this->get('sonata.page.manager.page');

        $currentSite = null;
        $siteId = (int) $request->get('site');
        foreach ($sites as $site) {
            if ($siteId && $site->getId() === $siteId) {
                $currentSite = $site;
            } elseif (!$siteId && $site->getIsDefault()) {
                $currentSite = $site;
            }
        }
        if (!$currentSite && 1 === \count($sites)) {
            $currentSite = $sites[0];
        }

        if ($currentSite) {
            $pages = $pageManager->loadPages($currentSite);
        } else {
            $pages = [];
        }

        $datagrid = $this->admin->getDatagrid();
        $formView = $datagrid->getForm()->createView();
        $theme = $this->admin->getFilterTheme();
        $this->setFormTheme($formView, $theme);

        return $this->render($this->admin->getTemplate('tree'), [
            'action' => 'tree',
            'sites' => $sites,
            'currentSite' => $currentSite,
            'pages' => $pages,
            'form' => $formView,
            'csrf_token' => $this->getCsrfToken('sonata.batch'),
        ]);
    }
11564
public function getParentNode()
    {
        if (!$this->parentNode) {
            throw new \RuntimeException(sprintf(
                'Trying to retrieve parent node when no parent node has been set. An event ' .
                'listener should have set the node when persisting document "%s"',
                DocumentHelper::getDebugTitle($this->document)
            ));
        }

        return $this->parentNode;
    }
24947
public function actionUpdate()
    {
        $result = ['error' => Yii::t('podium/view', 'Error')];

        if (Yii::$app->request->isPost) {
            $result = (new Update())->nextStep();
        }
        return Json::encode($result);
    }
1227062
public function getParent()
	{
		JLog::add('JTree::getParent() is deprecated.', JLog::WARNING, 'deprecated');

		$this->_current = &$this->_current->getParent();
	}
187203
private function getMenusSection()
    {
        $builder = new TreeBuilder();
        $node = $builder->root('menus');

        $node
            ->useAttributeAsKey('name')
            ->prototype('array')
                ->children()
                    ->scalarNode('label')->isRequired()->cannotBeEmpty()->end()
                    ->scalarNode('icon')->isRequired()->cannotBeEmpty()->end()
                    ->integerNode('position')->defaultValue(0)->end()
                    ->scalarNode('domain')->defaultValue('messages')->end()
                    ->scalarNode('route')->defaultNull()->end()
                    ->arrayNode('entries')
                        ->useAttributeAsKey('name')
                        ->prototype('array')
                            ->children()
                                ->scalarNode('route')->isRequired()->cannotBeEmpty()->end()
                                ->scalarNode('label')->isRequired()->cannotBeEmpty()->end()
                                ->scalarNode('resource')->isRequired()->cannotBeEmpty()->end()
                                ->integerNode('position')->defaultValue(0)->end()
                                ->scalarNode('domain')->defaultValue('messages')->end()
                            ->end()
                        ->end()
                    ->end()
                ->end()
            ->end()
        ;

        return $node;
    }
86035
public function getUpdated()
    {
        return $this->getCachedProperty(
            'updated',
            function () {
                $element = $this->query('atom:updated', Node::SINGLE | Node::REQUIRED);

                /** @var Element $this */
                return $this->getExtensions()->parseElement($this, $element);
            }
        );
    }
1356576
public function getCurrentRoot()
    {
        if (null !== $this->getCurrentPage()) {
            return $this->getCurrentPage()->getRoot();
        } elseif (null === $this->getCurrentSite()) {
            return;
        } else {
            return $this->application->getEntityManager()
                ->getRepository('BackBee\NestedNode\Page')
                ->getRoot($this->getCurrentSite())
            ;
        }
    }
127741
public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $treeBuilder->root('majora_oauth_server')
            ->children()
                ->scalarNode('secret')
                    ->isRequired()
                    ->cannotBeEmpty()
                ->end()
                ->append($this->createTokenNode(
                    'access_token',
                    AccessToken::class,
                    AccessTokenInterface::class,
                    AccessTokenInterface::DEFAULT_TTL
                ))
                ->append($this->createTokenNode(
                    'refresh_token',
                    RefreshToken::class,
                    RefreshTokenInterface::class,
                    RefreshTokenInterface::DEFAULT_TTL
                ))
                ->arrayNode('application')
                    ->isRequired()
                    ->children()
                        ->append($this->createDriverStrategyNode('loader'))
                        ->append($this->createDriverStrategyNode('repository'))
                    ->end()
                ->end()
                ->arrayNode('account')
                    ->isRequired()
                    ->children()
                        ->append($this->createDriverStrategyNode('loader'))
                        ->append($this->createDriverStrategyNode('repository'))
                    ->end()
                ->end()
            ->end()
        ;

        return $treeBuilder;
    }
1213989
@Override
    public DefaultMutableTreeNode getDataAsTree() {
        HelpSet hs = getHelpSet();
        Hashtable<?, ?> params = getParameters();
        URL url;

        if (params == null || !params.containsKey("data")) {
            return new DefaultMutableTreeNode();
        }

        try {
            url = new URL(hs.getHelpSetURL(), (String) params.get("data"));
        } catch (Exception ex) {
            throw new Error("Trouble getting URL to TOC data; " + ex);
        }

        return parse(url, hs, hs.getLocale(), new TreeItemFactoryImpl(), this);
    }
92026
public function to_xml(){
        $str= "<update ";
		$str .= 'status="'.$this->data['action_table_type'].'" ';
		$str .= 'id="'.$this->data['dataId'].'" ';
		$str .= 'parent="'.$this->get_parent_id().'"';
		$str .= '>';
		$str .= $this->child->to_xml();
		$str .= '</update>';
        return $str;
	}