Vrati hlavni stranky
@param bool $onlyVisible
@return ICollection|Page[]
336669
public function findMain(bool $onlyVisible = false): ICollection
	{
		$result = ($onlyVisible ? $this->findVisible() : $this->findAll())
			->findBy(['parent' => null]);
		return $result;
	}
1300534
public function getParams($alone = false)
    {
        if ($alone) {
            return $this->params;
        } else {
            return array_merge($this->getDefaultViewParams(), $this->params);
        }
    }
58417
public function get_children() {
        // If we should sort and it hasn't already been sorted.
        if ($this->sort && !$this->sorted) {
            if ($this->sortsplit) {
                $categories = array();
                $pages = array();
                foreach ($this->children as $child) {
                    if ($child instanceof admin_category) {
                        $categories[] = $child;
                    } else {
                        $pages[] = $child;
                    }
                }
                core_collator::asort_objects_by_property($categories, 'visiblename');
                core_collator::asort_objects_by_property($pages, 'visiblename');
                if (!$this->sortasc) {
                    $categories = array_reverse($categories);
                    $pages = array_reverse($pages);
                }
                $this->children = array_merge($pages, $categories);
            } else {
                core_collator::asort_objects_by_property($this->children, 'visiblename');
                if (!$this->sortasc) {
                    $this->children = array_reverse($this->children);
                }
            }
            $this->sorted = true;
        }
        return $this->children;
    }
621503
public function visible($visible = [], $override = false)
    {
        $this->each(function ($model) use ($visible, $override) {
            /** @var Model $model */
            $model->visible($visible, $override);
        });

        return $this;
    }
953229
protected function get_visible_fields(int $instanceid) : array {
        $handler = $this;
        return array_filter($this->get_fields(),
            function($field) use($handler, $instanceid) {
                return $handler->can_view($field, $instanceid);
            }
        );
    }
1166186
public function getVisits($items)
  {
    $result = [];
    foreach ($items as $item) {
      $result[] = new Visit($item);
    }

    return $result;
  }
989657
public function getFields($visibility = Field::VISIBILITY_PUBLIC)
    {
        $ret = [];
        foreach ($this->fields as $name => $field) {
            if ($field->getVisibility() & $visibility) {
                $ret[$name] = $field;
            }
        }
        return $ret;
    }
737759
public static function getList()
    {
        $db = Loader::db();
        $r = $db->query("select Pages.cID from Pages inner join Collections on Pages.cID = Collections.cID where cFilename is not null order by cDateModified desc");
        $pages = array();
        while ($row = $r->fetchRow()) {
            $c = Page::getByID($row['cID']);
            $pages[] = $c;
        }

        return $pages;
    }
369729
public function getPossiblePagePartTypes()
    {
        $possiblePPTypes = $this->configurator->getPossiblePagePartTypes();
        $result = array();

        // filter page part types that can only be added x times to the page context.
        // to achieve this, provide a 'pagelimit' parameter when adding the pp type in your PagePartAdminConfiguration
        if (!empty($possiblePPTypes)) {
            foreach ($possiblePPTypes as $possibleTypeData) {
                if (array_key_exists('pagelimit', $possibleTypeData)) {
                    $pageLimit = $possibleTypeData['pagelimit'];
                    /** @var PagePartRefRepository $entityRepository */
                    $entityRepository = $this->em->getRepository('KunstmaanPagePartBundle:PagePartRef');
                    $formPPCount = $entityRepository->countPagePartsOfType(
                        $this->page,
                        $possibleTypeData['class'],
                        $this->configurator->getContext()
                    );
                    if ($formPPCount < $pageLimit) {
                        $result[] = $possibleTypeData;
                    }
                } else {
                    $result[] = $possibleTypeData;
                }
            }
        }

        return $result;
    }
808730
public function getPublicChildren()
	{
		$coll = $this->getChildren(PageLocalization::CN());

		foreach ($coll as $key => $child) {
			if ( ! $child instanceof PageLocalization) {
				$coll->remove($key);
				continue;
			}

			if ( ! $child->isPublic()) {
				$coll->remove($key);
				continue;
			}
		}

		return $coll;
	}
97312
public function AllVisibleComments()
    {
        $list = $this->AllComments();

        // Filter spam comments for non-administrators if configured
        $showSpam = $this->owner->getCommentsOption('frontend_spam') && $this->owner->canModerateComments();

        if (!$showSpam) {
            $list = $list->filter('IsSpam', 0);
        }

        // Filter un-moderated comments for non-administrators if moderation is enabled
        $showUnmoderated = ($this->owner->ModerationRequired === 'None')
            || ($this->owner->getCommentsOption('frontend_moderation') && $this->owner->canModerateComments());
        if (!$showUnmoderated) {
            $list = $list->filter('Moderated', 1);
        }

        $this->owner->extend('updateAllVisibleComments', $list);
        return $list;
    }
937669
public List<Node> getVisibleChildren() {
        List<Node> visibleChildren = new ArrayList<Node>();
        for (Node curChild : children) {
            if (curChild.isVisible()) {
                visibleChildren.add(curChild);
            }
        }
        return visibleChildren;
    }
116745
protected function getFilterArray($onlyActive)
    {
        $cacheKey = ($onlyActive) ? 'public' : 'admin';
        if ($this->cache->tags(['blocks'])->has('blocks:filter:' . $cacheKey)) {
            return $this->cache->tags(['blocks'])->get('blocks:filter:' . $cacheKey);
        } else {
            $blocks = $this->blockRepository->getBlocksWithFilter($onlyActive);
            $filter = $this->buildFilterArray($blocks);
            $this->cache->tags(['blocks'])->forever('blocks:filter:' . $cacheKey, $filter);
            return $filter;
        }
    }
598157
public function getPages()
    {
        $pages = array();

        foreach ($this->children as $child) {
            if ($child instanceof SwatNoteBookChild) {
                $pages = array_merge($pages, $child->getPages());
            }
        }

        return $pages;
    }
1042277
protected function getListPage()
    {
        $conditions = $this->query_filter;
        $conditions['limit'] = $this->data_limit;

        $list = (array) $this->page->getList($conditions);
        $this->prepareListPage($list);
        return $list;
    }
442340
protected function buildFolderTree($parent, $visible, $level, $maxLevel, $exclude, &$resultsList)
    {
        if ($level > $maxLevel) {
            return;
        }

        $search = FolderQuery::create();

        $this->configureI18nProcessing($search, array(
                    'TITLE'
                ));

        $search->filterByParent($parent);

        if ($visible != BooleanOrBothType::ANY) {
            $search->filterByVisible($visible);
        }

        if ($exclude != null) {
            $search->filterById($exclude, Criteria::NOT_IN);
        }

        $search->orderByPosition(Criteria::ASC);

        $results = $search->find();

        foreach ($results as $result) {
            $resultsList[] = array(
                "ID" => $result->getId(),
                "TITLE" => $result->getVirtualColumn('i18n_TITLE'),
                "PARENT" => $result->getParent(),
                "URL" => $this->getReturnUrl() ? $result->getUrl($this->locale) : null,
                "VISIBLE" => $result->getVisible() ? "1" : "0",
                "LEVEL" => $level,
                'CHILD_COUNT' => $result->countChild(),
            );

            $this->buildFolderTree($result->getId(), $visible, 1 + $level, $maxLevel, $exclude, $resultsList);
        }
    }
910010
public function getParams(array $only = null)
    {
        $params = $this->getQueryParams();
        $postParams = $this->getParsedBody();
        if ($postParams) {
            $params = array_replace($params, (array)$postParams);
        }

        if ($only) {
            $onlyParams = [];
            foreach ($only as $key) {
                if (array_key_exists($key, $params)) {
                    $onlyParams[$key] = $params[$key];
                }
            }
            return $onlyParams;
        }

        return $params;
    }