Maps a list of pages to an array of associative arrays with ID and ParentID keys

@param SS_List $pages
@return array
977622
protected function mapIDs($pages)
    {
        $ids = array();
        if ($pages) {
            foreach ($pages as $page) {
                $ids[] = array('ID' => $page->ID, 'ParentID' => $page->ParentID);
            }
        }
        return $ids;
    }
643537
protected function toList(array $items = [], $level = 0)
    {
        $prefix = str_repeat('&nbsp;&nbsp;', $level);

        $pages = [];

        foreach ($items as $item) {
            $pages[$item['id']] = $prefix . '' . $item['title'];

            if ($item['children']) {
                $pages += $this->toList($item['children'], $level + 1);
            }
        }

        return $pages;
    }
306759
protected function populateIDs()
    {
        $parents = array();
        $this->_cache_ids = array();
        $this->_cache_highlight_ids = array();

        if ($pages = $this->pagesIncluded()) {
            // And keep a record of parents we don't need to get
            // parents of themselves, as well as IDs to mark
            foreach ($pages as $pageArr) {
                $parents[$pageArr['ParentID']] = true;
                $this->_cache_ids[$pageArr['ID']] = true;
                $this->_cache_highlight_ids[$pageArr['ID']] = true;
            }

            while (!empty($parents)) {
                $q = Versioned::get_including_deleted(SiteTree::class)
                    ->byIDs(array_keys($parents));
                $list = $q->map('ID', 'ParentID');
                $parents = array();
                foreach ($list as $id => $parentID) {
                    if ($parentID) {
                        $parents[$parentID] = true;
                    }
                    $this->_cache_ids[$id] = true;
                    $this->_cache_expanded[$id] = true;
                }
            }
        }
    }
1310104
protected function getPages()
    {
        $pages = $this->site->getPages();
        $additionalPageIds = [];
        if (!empty($this->indexingConfiguration['additionalPageIds'])) {
            $additionalPageIds = GeneralUtility::intExplode(',', $this->indexingConfiguration['additionalPageIds']);
        }

        $pages = array_merge($pages, $additionalPageIds);
        sort($pages, SORT_NUMERIC);

        return $pages;
    }
1188917
public static function findAll($page_request = null)
    {
        if($page_request != null){
            return self::listAllAddresses(['page' => $page_request->getPageNumber(), 'size' => $page_request->getSize() ]);
        }else {
            return self::listAllAddresses();
        }
    }
303850
public static function getOrderedPages($pageIds)
    {
        $pages = [];
        foreach ($pageIds as $pageId) {
            $pages[$pageId] = static::preload($pageId);
        }
        uasort($pages, ['self', '_orderAsc']);
        return $pages;
    }
1022114
public function getSubPagesRecursively($pageUid, array &$subPages)
    {
        $queryBuilder = $this->getQueryBuilder('pages');
        $childPages = $queryBuilder
            ->select('uid', 'backend_layout', 'backend_layout_next_level')
            ->from('pages')
            ->where(
                $queryBuilder->expr()->eq(
                    'pid',
                    $queryBuilder->createNamedParameter((int)$pageUid, \PDO::PARAM_INT)
                )
            )
            ->execute()
            ->fetchAll();

        if (!empty($childPages)) {
            foreach ($childPages as $page) {
                if (empty($page['backend_layout'])) {
                    $subPages[] = $page;
                }
                if (empty($page['backend_layout_next_level'])) {
                    $this->getSubPagesRecursively($page['uid'], $subPages);
                }
            }
        }
    }
1119173
protected function _pages($pages)
    {
        $html = '';

        //$html .= $pages['first']->active ? '<li>'.$this->_link($pages['first'], '<i class="icon-fast-backward icon-first"></i>').'</li>' : '';

        $html .= $pages['previous']->active ? '<li>'.$this->_link($pages['previous'], '&laquo;').'</li>' : '';

        $previous = null;
        foreach ($pages['pages'] as $page)
        {
            if ($previous && $page->page - $previous->page > 1) {
                $html .= '<li class="k-is-disabled"><span>&hellip;</span></li>';
            }

            $html .= '<li class="'.($page->active && !$page->current ? '' : 'k-is-active').'">';
            $html .= $this->_link($page, $page->page);
            $html .= '</li>';

            $previous = $page;
        }

        $html  .= $pages['next']->active ? '<li>'.$this->_link($pages['next'], '&raquo;').'</li>' : '';

        //$html  .= $pages['last']->active ? '<li>'.$this->_link($pages['last'], '<i class="icon-fast-forward icon-last"></i>').'</li>' : '';

        return $html;
    }
142092
protected function getPages(): array
    {
        $pages = [];

        $pages['previous_page'] = $this->pagerfanta->hasPreviousPage() ?
            $this->generateUrl($this->pagerfanta->getPreviousPage()) :
            false;

        $pages['first_page'] = $this->startPage > 1 ? $this->generateUrl(1) : false;
        $pages['mobile_first_page'] = $this->pagerfanta->getCurrentPage() > 2 ? $this->generateUrl(1) : false;

        $pages['second_page'] = $this->startPage === 3 ? $this->generateUrl(2) : false;

        $pages['separator_before'] = $this->startPage > 3;

        $middlePages = [];
        for ($i = $this->startPage, $end = $this->endPage; $i <= $end; ++$i) {
            $middlePages[$i] = $this->generateUrl($i);
        }

        $pages['middle_pages'] = $middlePages;

        $pages['separator_after'] = $this->endPage < $this->pagerfanta->getNbPages() - 2;

        $pages['second_to_last_page'] = $this->endPage === $this->pagerfanta->getNbPages() - 2 ?
            $this->generateUrl($this->pagerfanta->getNbPages() - 1) :
            false;

        $pages['last_page'] = $this->pagerfanta->getNbPages() > $this->endPage ?
            $this->generateUrl($this->pagerfanta->getNbPages()) :
            false;

        $pages['mobile_last_page'] = $this->pagerfanta->getCurrentPage() < $this->pagerfanta->getNbPages() - 1 ?
            $this->generateUrl($this->pagerfanta->getNbPages()) :
            false;

        $pages['next_page'] = $this->pagerfanta->hasNextPage() ?
            $this->generateUrl($this->pagerfanta->getNextPage()) :
            false;

        return $pages;
    }
408603
def page_list(cls, pages, base_url='/'):
        """"""
        plist = []
        for page in pages:
            url = "<a href=\"{}{}\">{}</a>".format(base_url, cls.slugify(page), page)
            plist.append(url)
        return plist
111310
protected function getChildrenUrls(BasePage $page)
    {
        $urls = [];

        $children = $page->getInstances();

        //parse the children
        foreach ($children as $child) {
            $url = $child->getUrl();
            $urls[] = $url;

            unset($url);
        }

        return $urls;
    }
932890
public function listAction($page = 1, $pageSize = 10, $sort = 'id', $sortDirection = "ASC")
    {
        return parent::listAction($page, $pageSize, $sort, $sortDirection);
    }
118988
public function getPermissionsByPage($page, $sid)
    {
        $objectIdentity = $this->getClassScopeObjectIdentity($page);

        try{

            $ace = $this->getObjectAce($objectIdentity, $sid);
        }
        catch (\Exception $e){

            if (null !== $page->getParent()) {

                return $this->getPermissionsByPage($page->getParent(), $sid);
            }
            elseif ($page->isRoot()){

                try{
                    $ace = $this->getClassAce($this->getClassScopeObjectIdentity(ClassUtils::getRealClass($page)), $sid);
                }
                catch (\Exception $e){
                    return [];
                }
            }
            else{
                return [];
            }
        }

        return $this->getAccessGranted($ace);
    }
1057653
private function getPagesDatas($rootPages)
	{
		$idPage = $this->params()->fromQuery('nodeId', -1);

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

		$pageMelisKey = 'meliscms_page';
		$melisAppConfig =$this->getServiceLocator()->get('MelisCoreConfig');
		$appsConfig = $melisAppConfig->getItem($pageMelisKey);

		if (!empty($appsConfig['conf']['id']))
			$zoneId = $appsConfig['conf']['id'];
		else
			$zoneId = 'id_meliscms_page';


		// Get the children
		$melisTree = $this->serviceLocator->get('MelisEngineTree');
		if (!empty($rootPages))
		{
			if ($rootPages[0] == -1 || $idPage != -1)
			{
				$children = $melisTree->getPageChildren($idPage);
				$children = $children->toArray();
			}
			else
			{
				$children = array();
				$tablePageTree = $this->getServiceLocator()->get('MelisEngineTablePageTree');
				foreach ($rootPages as $idPage)
				{
					$pageDetails = $tablePageTree->getFullDatasPage($idPage, '');
					$pageDetails = $pageDetails->toArray();
					$children = array_merge($children, $pageDetails);
				}
			}
		}
		else
		{
			return array();
		}


		// Making a new array with one unique page from published or save
		$final = array();
		foreach($children as $page)
		{
			$data_page_id = $page['tree_page_id'];

			/**
			 * Check which table must be used depending on if there's data
			 * in saved or published table.
			 * Saved results come withe same column name prefixed by s_
			 */
			if (!empty($page['s_page_id']))
			{
				$has_saved_version = 1;
				$prefixTable = 's_';
			}
			else
			{
				$has_saved_version = 0;
				$prefixTable = '';
			}

			// Prefix the id with the pageId
			$zoneIdTmp = $data_page_id . '_' . $zoneId;

			// Check if node has children
			$has_children = false;
			$childrenTmp = $melisTree->getPageChildren($data_page_id);
			if ($childrenTmp)
			{
				$childrenTmp = $childrenTmp->toArray();
				if (count($childrenTmp) > 0)
					$has_children = true;
			}

			// Check if the publish page is online to know for our result
			$is_online = 0;
			if (!empty($page['page_status']) && $page['page_status'] == 1)
				$is_online = 1;

			// Type of page is in table defined previously
			$data_page_type = $page[$prefixTable . 'page_type'];

			// We show always published name in tree, saved if no published
			if (!empty($page['page_name']))
				$data_page_name = $page['page_name'];
			else
			{
				if (!empty($page['s_page_name']))
					$data_page_name = $page['s_page_name'];
				else
					$data_page_name = $page['page_name'];
			}

			switch ($data_page_type) {
				case 'PAGE': 
					$data_icon = 'fa fa-file-o';
					break;
				case 'SITE': 
					$data_icon = 'fa fa-home';
					break;
				case 'FOLDER': 
					$data_icon = 'fa fa-folder-open-o';
					break;
				case 'NEWSLETTER': 
					$data_icon = 'fa fa-newspaper-o';
					break;
				default: 
					$data_icon = '';
					break;
			}

			$newpage = array(
				// These datas are common to all treeviews
				'item_zoneid' => $zoneIdTmp,
				'item_melisKey' => $pageMelisKey,
				'item_name' => $data_page_id . ' - ' . $data_page_name,
				'item_is_on' => $is_online,
				'item_has_version' => $has_saved_version,
				'item_icon' => $data_icon,
				'item_has_children' => $has_children,
				'item_dragdrop' => $this->isAllowedDragDrop(),

				// These datas are added and will be sent back when calling the view from the melisKey
				'item_datas' => array(
					'page_title' => $data_page_name,
					'page_id' => $data_page_id,
					'page_has_saved_version' => $has_saved_version,
					'page_is_online' => $is_online,
					'page_type' => $data_page_type,
					'item_zoneid' => $zoneIdTmp,
					'item_melisKey' => $pageMelisKey,
				)
			);

			array_push($final, $newpage);
		}

		return $final;
	}
63862
static function FindPageGroup(Page $page)
    {
        $currPage = $page;
        $result = null;
        do 
        {
            $result = $currPage->GetUserGroup();
            $currPage = $currPage->GetParent();
        } 
        while (!$result && $currPage);
        if (!$result && $page->GetSite())
        {
            return $page->GetSite()->GetUserGroup();
        }
        return $result;
    }
89366
public function getAncestorsAction(Page $page)
    {
        $ancestors = $this->getPageRepository()->getAncestors($page);

        return $this->createResponse($this->formatCollection($ancestors));
    }
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;
    }