Fetch articles by pid.

@param int         $pageId   The page id.
@param string|null $inColumn The optional column to filter by.

@return array
483624
public function getArticlesByPid(int $pageId, string $inColumn = null): array
    {
        $builder = $this->connection->createQueryBuilder()
            ->select('id', 'pid', 'inColumn', 'languageMain')
            ->from('tl_article')
            ->where('pid=:pid')
            ->setParameter('pid', $pageId)
            ->orderBy('inColumn')
            ->addOrderBy('sorting');
        if (null !== $inColumn) {
            $builder
                ->andWhere('inColumn=:inColumn')
                ->setParameter('inColumn', $inColumn);
        }

        return $builder
            ->execute()
            ->fetchAll(\PDO::FETCH_ASSOC);
    }
455463
public function itemPageIdsFiltered($pageId, $checkLive = false, $sort = false)
    {
        $filterType = $checkLive ? 'all' : 'live';
        $sortedSuffix = '-sorted';
        $sorted = $sort ? $sortedSuffix : '';

        self::$groupPagesFiltered[$this->id] = empty(self::$groupPagesFiltered[$this->id]) ? [] : self::$groupPagesFiltered[$this->id];

        if (!array_key_exists($filterType.$sorted, self::$groupPagesFiltered[$this->id])) {

            if ($pageIds = $this->itemPageIds($checkLive, $sort)) {

                foreach ($this->blockFilters() as $blockFilter) {

                    // get data to filter by
                    $filterByBlock = Block::preload($blockFilter->filter_by_block_id);
                    $filterByContent = PageBlock::preloadPageBlockLanguage($pageId, $blockFilter->filter_by_block_id, -1, 'block_id')->content;
                    if ($filterByBlock->type == 'selectmultiple') {
                        $filterByContentArr = unserialize($filterByContent);
                        $filterByContentArr = is_array($filterByContentArr) ? $filterByContentArr : [];
                    } else {
                        $filterByContentArr = [$filterByContent];
                    }
                    $filterByContentArr = array_filter($filterByContentArr, function ($filterByContentEl) {
                        return !is_null($filterByContentEl);
                    });

                    if (!empty($filterByContentArr)) {
                        // get block data for block to filter on
                        $blockType = Block::preload($blockFilter->item_block_id)->getTypeObject();

                        // run filter with filterBy content
                        $filteredPageIds = [];
                        foreach ($pageIds as $groupPageId) {
                            foreach ($filterByContentArr as $filterByContentEl) {
                                $groupPageBlockContent = PageBlock::preloadPageBlockLanguage($groupPageId, $blockFilter->item_block_id, -1)->content;
                                if ($blockType->filter($groupPageBlockContent, $filterByContentEl, '=')) {
                                    $filteredPageIds[] = $groupPageId;
                                    break;
                                }
                            }
                        }

                        $pageIds = $filteredPageIds;
                    }

                }

            }

            self::$groupPagesFiltered[$this->id][$filterType.$sorted] = $pageIds;
        }

        return self::$groupPagesFiltered[$this->id][$filterType.$sorted];
    }
359915
public function findOneByPageIdAndByLanguageId($pageId, $languageId)
    {
        $documentCollection = $this->findByPageIdAndByLanguageId($pageId, $languageId);
        return reset($documentCollection);
    }
1047276
public function getPages(Website $website, $pageIds, $isAdmin, $isAPI)
    {
        if (!is_array($pageIds)) {
            $pageIds = [$pageIds];
        }
        $pages = $this->pageRepository->findPages($website, $pageIds, $isAdmin, $isAPI);

        return $pages;
    }
799575
public function fetchColumn($column_number = 0)
	{
		if($this->executed == true)
		{
			if(!$this->resource && $this->isFetched == false)
			{
				return false;
			}
		}
		else
		{
			throw new LikePDOStatement("There is no active statement");
			return false;
		}
		
		$result = NULL;
		
		if($this->isFetched == true)
		{
			if($this->isFetchAll == true)
			{
				return false;
			}
			else
			{
				if(isset($this->columns[$column_number]))
				{
					switch($this->fetchResultMode)
					{
						case LikePDO::FETCH_ASSOC :
							if(isset($this->fetch[$this->columns[$column_number]]))
							{
								return $this->fetch[$this->columns[$column_number]];
							}
						break;
						case LikePDO::FETCH_BOTH :
							if(isset($this->fetch[$this->columns[$column_number]]))
							{
								return $this->fetch[$this->columns[$column_number]];
							}
						break;
						case LikePDO::FETCH_BOUND :
							if(!$this->fetchColumn)
								$this->fetchColumn = $this->pdo->driver->fetch($this->resource, LikePDO::FETCH_NUM);
							
							if(isset($this->fetchColumn[$column_number]))
								return $this->fetchColumn[$column_number];
						break;
						case LikePDO::FETCH_CLASS :
							if(isset($this->fetch->{$this->columns[$column_number]}))
								return $this->fetch->{$this->columns[$column_number]};
						break;
						case LikePDO::FETCH_INTO :
							if(isset($this->fetch->{$this->columns[$column_number]}))
								return $this->fetch->{$this->columns[$column_number]};
						break;
						case LikePDO::FETCH_LAZY :
							if(isset($this->fetch->{$this->columns[$column_number]}))
								return $this->fetch->{$this->columns[$column_number]};
						break;
						case LikePDO::FETCH_NAMED :
							if(!$this->fetchColumn)
								$this->fetchColumn = $this->pdo->driver->fetch($this->resource, LikePDO::FETCH_NUM);
							
							if(isset($this->fetchColumn[$column_number]))
								return $this->fetchColumn[$column_number];
						break;
						case LikePDO::FETCH_NUM :
							if(isset($this->fetch[$column_number]))
								return $this->fetch[$column_number];
						break;
						case LikePDO::FETCH_OBJ :
							if(isset($this->fetch->{$this->columns[$column_number]}))
								return $this->fetch->{$this->columns[$column_number]};
						break;
					}
				}
			}
		}
		else
		{
			if(!$this->fetchColumn)
				$this->fetchColumn = $this->pdo->driver->fetch($this->resource, LikePDO::FETCH_NUM);
							
			if(isset($this->fetchColumn[$column_number]))
				return $this->fetchColumn[$column_number];
		}
		
		return false;
	}
549121
public static function getAllowedPageTypes($pageId, $configurationName = 'pages')
    {
        $rootPath = '';
        $configuration = self::getConfigurationFromPageId($pageId, $rootPath);
        return $configuration->getIndexQueueAllowedPageTypesArrayByConfigurationName($configurationName);
    }
837405
public function getParentByPageId($pageId)
    {
        $data = array();
        $success = 0;

        $treeSite = $this->getServiceLocator()->get('MelisSiteTree');

        if($treeSite){
            $data  = $treeSite->getParentByPageId($pageId);
        }


        return $data;
    }
867406
public function buildRecordQuery($type, $uid, $pageId): Query
    {
        $siteRepository = GeneralUtility::makeInstance(SiteRepository::class);
        $site = $siteRepository->getSiteByPageId($pageId);

        return $this->newSearchQuery('')
            ->useQueryString('*:*')
            ->useFilter('type:' . $type . ' AND uid:' . $uid, 'type')
            ->useFilter('siteHash:' . $site->getSiteHash(), 'siteHash')
            ->useReturnFields(ReturnFields::fromString('*'))
            ->useSortings(Sortings::fromString('type asc, title asc'))
            ->useQueryType('standard')
            ->getQuery();
    }
987593
public function getPosts($blogId, $filters, $publication = self::GET_PUBLISHED_POSTS, $abstract = true)
    {
        if (!isset($filters['hiddenFilters'])) {
            $filters['hiddenFilters'] = [];
        }
        //filter on current blog
        $filters['hiddenFilters'] = [
            'blog' => $blogId,
        ];
        $publicationOptions = [];
        if (self::GET_PUBLISHED_POSTS === $publication) {
            $publicationOptions = ['published' => true];
        } elseif (self::GET_UNPUBLISHED_POSTS === $publication) {
            $publicationOptions = ['published' => false];
        }
        $filters['hiddenFilters'] = array_merge($filters['hiddenFilters'], $publicationOptions);

        return $this->finder->search('Icap\BlogBundle\Entity\Post', $filters, [
            'abstract' => $abstract,
        ]);
    }
832935
public function getFilterableListInstanceIdOnPage($pageId)
    {
        // find module instances of type x on page with setting y
        $query = "SELECT `shop_module_article_list`.`cms_tpl_module_instance_id`
                    FROM `shop_module_article_list`
              INNER JOIN `cms_tpl_page_cms_master_pagedef_spot` ON `shop_module_article_list`.`cms_tpl_module_instance_id` = `cms_tpl_page_cms_master_pagedef_spot`.`cms_tpl_module_instance_id`
                   WHERE `shop_module_article_list`.`can_be_filtered` = '1'
                     AND `cms_tpl_page_cms_master_pagedef_spot`.`cms_tpl_page_id` = :pageId
                 ";
        $instanceData = $this->getDatabaseConnection()->fetchArray($query, array('pageId' => $pageId));
        if (false === $instanceData) {
            return null;
        }

        return $instanceData[0];
    }
1267399
public function getAllSubpages($pageId)
    {
        $results = array();
        //Services
        $melisTree = $this->serviceLocator->get('MelisEngineTree');
        $pagePub   = $this->getServiceLocator()->get('MelisEngineTablePagePublished');
        $pageSave  = $this->getServiceLocator()->get('MelisEngineTablePageSaved');

        $pageSearchType = null;
        $pages = $melisTree->getPageChildren($pageId,2);
        
        
        if($pages)
        {
            $rpages = $pages->toArray();
            
            foreach ($rpages as $page)
            {
                $pageStat = $page['page_status'] ?? null;
                //if the page is published
                if($pageStat){
                    $pageData       = $pagePub->getEntryById($page['tree_page_id'])->current();
                    $pageSearchType = $pageData->page_search_type ?? null;
                }
                //if the page is unpublished
                else{
                    $pageData = $pageSave->getEntryById($page['tree_page_id'])->current();
                    //if the unpublishedData is not present in page_saved table
                    if(!$pageData){
                        //Get the pageData in page_published table
                        $pageData = $pagePub->getEntryById($page['tree_page_id'])->current();
                    }
                    $pageSearchType = $pageData->page_search_type ?? null;
                }

                $tmp = $this->formatPageInArray($page,$pageSearchType);
                $children = $this->getAllSubpages($page['tree_page_id'] ?? null);

                if (!empty($children))
                    $tmp['pages'] = $children;

                $results[] = $tmp;
            }
        }
        return $results;
    }
735529
public function getPageContent($pageId)
    {
        // Retrieve cache version if front mode to avoid multiple calls
        $melisEngineCacheSystem = $this->getServiceLocator()->get('MelisEngineCacheSystem');
        $pageContent = $melisEngineCacheSystem->getCacheByKey($this->cachekey.$pageId, $this->cacheConfig, true);
        
        return $pageContent;
    }
1306564
private function getPageFilter($filterName, $storeId = null)
    {
        $pageFilters = $this->getPageFilters($storeId);
        if ($pageFilters && @$pageFilters->$filterName) {
            return (array)$pageFilters->$filterName;
        }
        return [];
    }
469855
public static function view_page($pageid) {
        global $DB, $CFG;
        require_once($CFG->dirroot . "/mod/page/lib.php");

        $params = self::validate_parameters(self::view_page_parameters(),
                                            array(
                                                'pageid' => $pageid
                                            ));
        $warnings = array();

        // Request and permission validation.
        $page = $DB->get_record('page', array('id' => $params['pageid']), '*', MUST_EXIST);
        list($course, $cm) = get_course_and_cm_from_instance($page, 'page');

        $context = context_module::instance($cm->id);
        self::validate_context($context);

        require_capability('mod/page:view', $context);

        // Call the page/lib API.
        page_view($page, $course, $cm, $context);

        $result = array();
        $result['status'] = true;
        $result['warnings'] = $warnings;
        return $result;
    }
934165
public function search(AdminInterface $admin, $term, $page = 0, $offset = 20)
    {
        $datagrid = $admin->getDatagrid();

        $found = false;
        foreach ($datagrid->getFilters() as $filter) {
            /** @var $filter FilterInterface */
            if ($filter->getOption('global_search', false)) {
                $filter->setOption('case_sensitive', $this->caseSensitive);
                $filter->setCondition(FilterInterface::CONDITION_OR);
                $datagrid->setValue($filter->getFormName(), null, $term);
                $found = true;
            }
        }

        if (!$found) {
            return false;
        }

        $datagrid->buildPager();

        $pager = $datagrid->getPager();
        $pager->setPage($page);
        $pager->setMaxPerPage($offset);
        $pager->init();

        return $pager;
    }
901701
private function listEntityIdsWithCps(PagerInterface $pager = null, array $query_params = []): array
    {
        $query_params = [
                'expand' => 'false',
            ] + $query_params;
        if ($pager) {
            return $this->getResultsInRange($pager, $query_params);
        } else {
            $ids = $this->getResultsInRange($this->createPager(), $query_params);
            if (empty($ids)) {
                return [];
            }
            $lastId = end($ids);
            do {
                $tmp = $this->getResultsInRange($this->createPager(0, $lastId), $query_params);
                // Remove the first item from the list because it is the same
                // as the current last item of $ids.
                // Apigee Edge response always starts with the requested entity
                // id (startKey).
                array_shift($tmp);

                if (count($tmp) > 0) {
                    $ids = array_merge($ids, $tmp);
                    $lastId = end($tmp);
                } else {
                    $lastId = false;
                }
            } while ($lastId);

            return $ids;
        }
    }
216828
public function get($pageId, array $params = array())
    {
        $endpoint = '/admin/pages/'.$pageId.'.json';
        $response = $this->request($endpoint, 'GET', $params);
        return $this->createObject(Page::class, $response['page']);
    }