Gets the root page when showing the tree of pages in rights tool
so that all pages are displayed and not only the one you have access to

@return Ambigous <\Zend\View\Model\ViewModel, \Zend\View\Model\JsonModel>
358117
public function getTreePagesForRightsManagementAction()
	{
		$idPage = $this->params()->fromQuery('nodeId', -1);

		if ($idPage == MelisCmsRightsService::MELISCMS_PREFIX_PAGES . '_root')
			$idPage = -1;
		else
			$idPage = str_replace(MelisCmsRightsService::MELISCMS_PREFIX_PAGES . '_', '', $idPage);

		$rootPages = array($idPage);
		$final = $this->getPagesDatas($rootPages);

		return $this->formatTreeResponse($final, true);
	}
1253804
public function getRootDirectory()
    {
        if(isset($this->rootDirectory) == false) {
            $this->rootDirectory = $this->locateRootDirectory();
        }
        return $this->rootDirectory;
    }
1180828
public function getRootPath()
    {
        if (null === $this->rootPath) {
            if (method_exists($this, 'setRootPath')) {
                $this->rootPath = realpath($this->setRootPath());
            } else {
                $this->rootPath = realpath(__DIR__.'/../../../../..');
            }
        }
        //$this->rootPath = '../';

        return $this->rootPath;
    }
566305
public function get_tree(){
		if(DEBUG_MODE){
			BLog::addToLog('[SoftModules]: get_tree()');
			}
		$brouter=BRouter::getInstance();
		$pages=$brouter->getsoftmodules();
		if(DEBUG_MODE){
			BLog::addToLog('[SoftModules]: Pages: '.var_export($pages,true));
			}
		$this->get_tree_node($pages);
		return $pages;
		}
1162459
public function getBranchAsTree()
    {
        $lastParents = array();
        
        foreach ($this->getBranch() as $page)
        {
            if (!$page->isRoot())
            {
                $lastParents[$page->getLevel() - 1]->addNestedSetChild($page);
            }
            
            $lastParents[$page->getLevel()] = $page;
        }
        
        return $this;
    }
316318
public function getRoot()
    {
        if ($this->root === null) {
            $this->root = $this->menuFactory->createItem($this->getName());
        }
        return $this->root;
    }
112224
public function getPageOrRoot()
    {
        $page = $this;
        while ($page && !$page->isPage) {
            if ($page instanceof Kwf_Component_Data_Root) return $page;
            $page = $page->parent;
        }
        return $page;
    }
449436
public function pagePermissionsAction()
    {

        $view = new ViewModel();
        //fixes rendering site's header and footer in the dialog
        $view->setTerminal(true);

        /** @var \Rcm\Entity\Site $currentSite */
        $currentSite = $this->getServiceLocator()->get(
            \Rcm\Service\CurrentSite::class
        );

        $currentSiteId = $currentSite->getSiteId();

        $sourcePageName = $this->getEvent()
            ->getRouteMatch()
            ->getParam(
                'rcmPageName',
                'index'
            );

        $pageType = $this->getEvent()
            ->getRouteMatch()
            ->getParam(
                'rcmPageType',
                'n'
            );

        /** @var ResourceName $resourceName */
        $resourceName = $this->getServiceLocator()->get(
            ResourceName::class
        );

        $resourceId = $resourceName->get(
            ResourceName::RESOURCE_SITES,
            $currentSiteId,
            ResourceName::RESOURCE_PAGES,
            $pageType,
            $sourcePageName
        );

        /** @var \RcmUser\Acl\Service\AclDataService $aclDataService */
        $aclDataService = $this->getServiceLocator()->get(
            \RcmUser\Acl\Service\AclDataService::class
        );

        //getting all set rules by resource Id
        $rules = $aclDataService->getRulesByResource($resourceId)->getData();

        //getting list of all dynamically created roles
        $allRoles = $aclDataService->getNamespacedRoles()->getData();

        $rolesHasRules = [];

        foreach ($rules as $setRuleFor) {
            //getting only the ones that are allow
            if ($setRuleFor->getRule() == 'allow') {
                $rolesHasRules[] = $setRuleFor->getRoleId();
            }
        }

        $selectedRoles = [];

        foreach ($allRoles as $key => $role) {
            $roleId = $role->getRoleId();
            if (in_array($roleId, $rolesHasRules)) {
                $selectedRoles[$roleId] = $role;
            }
        }

        $data = [
            'siteId' => $currentSiteId,
            'pageType' => $pageType,
            'pageName' => $sourcePageName,
            'roles' => $allRoles,
            'selectedRoles' => $selectedRoles,
        ];

        $view->setVariable('data', $data);

        $view->setVariable(
            'rcmPageName',
            $sourcePageName
        );
        $view->setVariable(
            'rcmPageType',
            $pageType
        );

        return $view;
    }
920133
public static function getDocumentRoot() {
    if(null === self::$docRoot) {
      self::$docRoot = System::realPath($_SERVER['DOCUMENT_ROOT']);
      if(!self::$docRoot) {
        self::$docRoot = System::realPath(getcwd());
      }
    }
    return self::$docRoot;
  }
295160
public function getParent()
    {
        if ($this->isRoot()) throw new Exception\CMS('No parent for root Catalog');
    
        if (!$this->_parent) {
        
            $fields = self::getDbConnection()->fetchAssoc( 
                " SELECT A.*
                  FROM dir_data A, dir_structure B, dir_structure C 
                  WHERE C.data_id=? and B.data_id=A.id and B.lft<C.lft and B.rght>C.rght and B.level=C.level-1", 
                array( (int)$this->id )
            );        
        
            if ($fields) {
                $this->_parent = Catalog::fetch($fields);
            } else {
                $this->_parent = Catalog::getRoot();
            }
        }
        return $this->_parent;
    }
630772
public function getParent() {

		$pageClass = Yii::$app->cms->getPageClass( $this->type );

		return $this->hasOne( $pageClass, [ 'id' => 'parentId' ] );
	}
479453
public function getInheritsParent()
    {
        $page = $this;
        while ($page && !$page->inherits) {
            if ($page instanceof Kwf_Component_Data_Root) return $page;
            $page = $page->parent;
        }
        return $page;
    }
22333
public function Pages()
    {
        $pages = SiteTree::get();
        $types = $this->PageTypes->getValue();
        if (count($types)) {
            $pages = $pages->filter('ClassName', $types);
        }

        $parents = $this->PageParents()->column('ID');
        if (count($parents)) {
            $pages = $pages->filter('ParentID', $parents);
        }

        return $pages;
    }
1271105
protected function getRootPageFlagStatus()
    {
        $rootPages = $this->getRootPages();
        if (!empty($rootPages)) {
            return null;
        }

        $report = $this->getRenderedReport('RootPageFlagStatus.html');
        return GeneralUtility::makeInstance(
            Status::class,
            /** @scrutinizer ignore-type */ 'Sites',
            /** @scrutinizer ignore-type */ 'No sites found',
            /** @scrutinizer ignore-type */ $report,
            /** @scrutinizer ignore-type */ Status::ERROR
        );
    }
622533
protected function getRootPagesWithoutDomain()
    {
        $rootPagesWithoutDomain = [];
        $rootPages = $this->getRootPages();

        $rootPageIds = [];
        foreach ($rootPages as $rootPage) {
            $rootPageIds[] = $rootPage['uid'];
        }

        $domainRecords = $this->systemDomainRepository->findDomainRecordsByRootPagesIds($rootPageIds);
        foreach ($rootPageIds as $rootPageId) {
            $hasDomainRecord = true;
            $hasDomainInTypoScript = true;

            if (!array_key_exists($rootPageId, $domainRecords)) {
                $hasDomainRecord = false;
            }

            /** @var $siteService SiteService */
            $siteService = GeneralUtility::makeInstance(SiteService::class);
            $domain = $siteService->getFirstDomainForRootPage($rootPageId);
            if ($domain === '') {
                $hasDomainInTypoScript = false;
            }

            if (!$hasDomainRecord && !$hasDomainInTypoScript) {
                $rootPagesWithoutDomain[$rootPageId] = $rootPages[$rootPageId];
            }
        }
        return $rootPagesWithoutDomain;
    }
895091
public function tree()
    {
        $items = $this->model
            ->orderBy('id')
            ->orderBy('parent_id')
            ->with($this->with)
            ->get(['id', 'title', 'parent_id'])
            ->toArray();

        return $this->toTree($items);
    }
820212
private function getViewsToTreat()
    {
        $templateRepo = $this->entityManager->getRepository('VictoireTemplateBundle:Template');
        $rootTemplates = $templateRepo->getInstance()
            ->where('template.template IS NULL')
            ->getQuery()
            ->getResult();
        $templates = [];
        $recursiveGetTemplates = function ($template) use (&$recursiveGetTemplates, &$templates) {
            array_push($templates, $template);
            foreach ($template->getInheritors() as $_template) {
                if ($_template instanceof Template) {
                    $recursiveGetTemplates($_template);
                }
            }
        };

        foreach ($rootTemplates as $rootTemplate) {
            $recursiveGetTemplates($rootTemplate);
        }

        $pageRepo = $this->entityManager->getRepository('VictoirePageBundle:BasePage');
        $pages = $pageRepo->findAll();
        $errorRepo = $this->entityManager->getRepository('VictoireTwigBundle:ErrorPage');
        $errorPages = $errorRepo->findAll();

        return array_merge($templates, array_merge($pages, $errorPages));
    }