Function to view table row
@param \samson\activerecord\material $material Tale material represented as row
@param Pager $pager Pager for multi page table
@return string
178406
public function row(& $material, Pager & $pager = null, $module = NULL)
    {
        /** @var string $tdHTML Table cell HTML code */
        $tdHTML = '';
        $input = null;

        /** @var \samson\cms\CMSField $field Field of current table structure (Table column) */
        foreach ($this->fields as $field) {
            /** @var \samson\activerecord\materialfield $materialField Materialfield object (Table cell) */
            foreach ($material->onetomany['_materialfield'] as $materialField) {

                // If materialfield relates to field (column)
                $isRightField = $materialField->FieldID == $field->FieldID;

                // If field has same locale as passed
                $isRightLocale = $materialField->locale == $this->locale;

                // If field not localized then output it
                $isNotLocalizedField = $materialField->locale == '';

                if ($isRightField && (($isRightLocale) || ($isNotLocalizedField))) {

                    $this->headerFields[$field->id] = $field;
                    if ($field->Type < 9 || $field->Type > 10) {
                        $input = m('samsoncms_input_application')
                            ->createFieldByType($this->dbQuery, $field->Type, $materialField);
                    }
                    // If current field has select type then go to build his value
                    if ($field->Type == 4) {
                        /** @var \samsoncms\input\select\Select $input Select input type */
                        $input->build($field->Value);
                    }
                    
                    // When render the input of table then call all subscribers
                    \samsonphp\event\Event::fire('samson.cms.input.table.render', array($input));
                    
                    // Set HTML row code
                    $tdHTML .= $this->renderModule->view('table/tdView')->set($input, 'input')->output();
                    break;
                }
            }
        }

        // Render field row
        return $this->renderModule
            ->view($this->row_tmpl)
            ->set(m('samsoncms_input_text_application')->createField($this->dbQuery, $material, 'Url'), 'materialName')
            ->set($material->id, 'materialID')
            ->set($material->priority, 'priority')
            ->set($material->parent_id, 'parentID')
            ->set($this->structure->StructureID, 'structureId')
            ->set($tdHTML, 'td_view')
            ->set($pager, 'pager')
            ->output();
    }
719359
protected function tt_content_drawFooter(PageLayoutView $parentObject, array $row)
    {
        $content = '';
        // Get processed values:
        $info = [];
        $parentObject->getProcessedValue('tt_content', 'starttime,endtime,fe_group,space_before_class,space_after_class', $row, $info);

        // Content element annotation
        if (!empty($GLOBALS['TCA']['tt_content']['ctrl']['descriptionColumn']) && !empty($row[$GLOBALS['TCA']['tt_content']['ctrl']['descriptionColumn']])) {
            $info[] = htmlspecialchars($row[$GLOBALS['TCA']['tt_content']['ctrl']['descriptionColumn']]);
        }

        // Call drawFooter hooks
        foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/class.tx_cms_layout.php']['tt_content_drawFooter'] ?? [] as $className) {
            $hookObject = GeneralUtility::makeInstance($className);
            if (!$hookObject instanceof PageLayoutViewDrawFooterHookInterface) {
                throw new \UnexpectedValueException($className . ' must implement interface ' . PageLayoutViewDrawFooterHookInterface::class, 1404378171);
            }
            $hookObject->preProcess($parentObject, $info, $row);
        }

        // Display info from records fields:
        if (!empty($info)) {
            $content = '<div class="t3-page-ce-info">
				' . implode('<br>', $info) . '
				</div>';
        }
        // Wrap it
        if (!empty($content)) {
            $content = '<div class="t3-page-ce-footer">' . $content . '</div>';
        }
        return $content;
    }
162512
public function getPager($criteria, $page = 1)
    {
        $container = $this->getContainer();

        $paginator = $container->get('knp_paginator');

        $settings = $this->getSettings();

        $limit = $settings['articles_per_page'];

        $parameters = [];

        /** @var ArticlesRepository $repository */
        $repository = $this->getRepository();

        $qb = $repository->createQueryBuilder('p');

        $qb->select('p')->orderBy('p.publicationAt', 'DESC');

        if (!isset($criteria['enabled'])) {
            $criteria['enabled'] = true;
        }

        if (isset($criteria['enabled'])) {
            $currentTime = new \DateTime();

            $qb->andWhere('p.enabled = :enabled');
            $qb->andWhere(
                $qb->expr()->lt('p.publicationAt', ':datetime')
            );

            $parameters['datetime'] = $currentTime;
            $parameters['enabled'] = $criteria['enabled'];
        }

        $qb->setParameters($parameters);

        $pagination = $paginator->paginate(
            $qb,
            $page,
            $limit
        );

        return $pagination;
    }
517635
protected function findInitializedPagerId()
    {
        foreach ($this->pagers as $key => $pager) {
            if (isset($pager->totalpages)) {
                return $key;
            }
        }

        return '';
    }
1093571
public function getBreadcrumbTitle($divider = ' - ')
    {
        $pathParts = explode('/', trim($this->getRelativePath(), '/'));

        // from the page from this
        array_pop($pathParts);

        // add the module to the breadcrumb trail.
        $pathParts[] = $this->entity->getTitle();

        $titleParts = array_map(
            array(
                'DocumentationHelper',
                'clean_page_name'
            ),
            $pathParts
        );

        $titleParts = array_filter(
            $titleParts,
            function ($val) {
                if ($val) {
                    return $val;
                }
            }
        );

        if ($this->getTitle()) {
            array_unshift($titleParts, $this->getTitle());
        }

        return implode($divider, $titleParts);
    }
397106
public function getPage($pageColumns = null){
    $pageColumns = empty($pageColumns) && (!is_array($pageColumns)) ? $this->pageColumnsRes : $pageColumns;
    if (empty($pageColumns)) {
      return $this->pageArray;
    }else{
      $r = array();
      foreach ($pageColumns as $index => $key) {
        $r[$key] = $this->pageArray[$key];
      }
      return $r;
    }
  }
1125226
public function initializePager(SimplePager $pager, Criteria\Criteria $criteria)
    {
        // now page
        if ($criteria->offset !== null && $criteria->limit !== null) {
            $pager->setNow(floor($criteria->offset / $criteria->limit) + 1);
            $pager->setPerPage($criteria->limit);
        } elseif ($criteria->limit !== null){
            $pager->setPerPage($criteria->limit);
        }

        // get total rows
        $criteria->columns('COUNT(1)')->limit(null)->offset(null);
        $pager->setTotal($this->getOne($criteria));

        return $pager;
    }
104895
public function render($renderer)
    {
        if ($this->x1 === ReportBaseElement::CURRENT_POSITION) {
            $this->x1 = $renderer->GetX();
        }
        if ($this->y1 === ReportBaseElement::CURRENT_POSITION) {
            $this->y1 = $renderer->GetY();
        }
        if ($this->x2 === ReportBaseElement::CURRENT_POSITION) {
            $this->x2 = $renderer->getMaxLineWidth();
        }
        if ($this->y2 === ReportBaseElement::CURRENT_POSITION) {
            $this->y2 = $renderer->GetY();
        }
        if ($renderer->getRTL()) {
            $renderer->Line($renderer->getPageWidth() - $this->x1, $this->y1, $renderer->getPageWidth() - $this->x2, $this->y2);
        } else {
            $renderer->Line($this->x1, $this->y1, $this->x2, $this->y2);
        }
    }
188064
public function pagerPageRange(PagerViewInterface $pager, $pageRange = null)
    {
        if (null === $pageRange) {
            $pageRange = $this->config->getPageRange();
        }

        $pageNumber = $pager->getCurrentPageNumber();
        $pageCount = $pager->getPageCount();

        if ($pageRange > $pageCount) {
            $pageRange = $pageCount;
        }

        $delta = ceil($pageRange / 2);

        if ($pageNumber - $delta > $pageCount - $pageRange) {
            $lowerBound = $pageCount - $pageRange + 1;
            $upperBound = $pageCount;
        } else {
            if ($pageNumber - $delta < 0) {
                $delta = $pageNumber;
            }

            $offset = $pageNumber - $delta;
            $lowerBound = $offset + 1;
            $upperBound = $offset + $pageRange;
        }

        $pages = array();
        for ($pageNumber = $lowerBound; $pageNumber <= $upperBound; ++$pageNumber) {
            $pages[$pageNumber] = $pageNumber;
        }

        return $pages;
    }
569986
public function gets($params, &$pager=null)
	{
		if (empty($params))
		{
			throw new \Exception("no params.");
		}

		$selectdb = new SelectDB($this->db);
		$selectdb->from($this->table);
		$selectdb->primary = $this->primary;
		$selectdb->select($this->select);

		if (!isset($params['order']))
		{
			$params['order'] = "`{$this->table}`.{$this->primary} desc";
		}
		$selectdb->put($params);

		if (isset($params['page']))
		{
			$selectdb->paging();
			$pager = $selectdb->pager;
		}

		return $selectdb->getall();
	}
938495
public function map(Pagerfanta $pager): array
    {
        $data = [];
        $contentTypeIds = [];

        foreach ($pager as $content) {
            /** @var \eZ\Publish\API\Repository\Values\Content\Content $content */
            $contentInfo = $content->getVersionInfo()->getContentInfo();

            $contributor = (new UserExists($this->userService))->isSatisfiedBy($contentInfo->ownerId)
                ? $this->userService->loadUser($contentInfo->ownerId) : null;

            $contentTypeIds[] = $contentInfo->contentTypeId;
            $data[] = [
                'content' => $content,
                'contentTypeId' => $contentInfo->contentTypeId,
                'contentId' => $content->id,
                'name' => $contentInfo->name,
                'language' => $contentInfo->mainLanguageCode,
                'contributor' => $contributor,
                'version' => $content->versionInfo->versionNo,
                'content_type' => $content->getContentType(),
                'modified' => $content->versionInfo->modificationDate,
                'initialLanguageCode' => $content->versionInfo->initialLanguageCode,
                'content_is_user' => (new ContentIsUser($this->userService))->isSatisfiedBy($content),
            ];
        }

        // load list of Content Types with proper translated names
        $contentTypes = $this->contentTypeService->loadContentTypeList(
            array_unique($contentTypeIds),
            $this->userLanguagePreferenceProvider->getPreferredLanguages()
        );
        foreach ($data as $idx => $item) {
            /** @var \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType */
            // get content type from bulk-loaded list or fallback to lazy loaded one if not present
            $contentType = isset($contentTypes[$item['contentTypeId']])
                ? $contentTypes[$item['contentTypeId']]
                : $item['content']->getContentType();
            $data[$idx]['type'] = $contentType->getName();
            unset($data[$idx]['content'], $data[$idx]['contentTypeId']);
        }

        return $data;
    }
34453
public function getPageLayout($pageId, $pageThemeId = null)
    {
        $sections = $templateSections = [];
        $error    = '';
        $details  = [];

        /** @var $pageModel \PageBuilder\Model\PageModel */
        $pageModel = $this->getServiceLocator()->get('pagebuilder\model\page');

        /** @var $themeModel \PageBuilder\Model\BaseModel */
        $themeModel = $this->getServiceLocator()->get('pagebuilder\model\theme');

        /** @var $templateModel \PageBuilder\Model\BaseModel */
        $templateModel = $this->getServiceLocator()->get('pagebuilder\model\template');

        /** @var $page \PageBuilder\Entity\Page */
        if ($page = $pageModel->getRepository()->find($pageId)) {

            $details = [
                'id'          => $page->getId(),
                'title'       => $page->getTitle(),
                'description' => $page->getDescription(),
                'template'    => $page->getTemplate() ? $page->getTemplate()->getTitle() : '',
                'layout'      => '',
                'pageTheme'   => '',
                'themeId'     => '',
                'layoutType'  => 'Custom Layout',
                'parent'      => $page->getParent() ? $page->getParent()->getTitle() : '',

            ];
        }
        $themeId = $pageTheme = null;
        if ($pageThemeId) {
            /** @var $pageThemeModel \PageBuilder\Model\BaseModel */
            $pageThemeModel = $this->getServiceLocator()->get('pagebuilder\model\pageTheme');
            $pageTheme      = $pageThemeModel->findObject($pageThemeId);
            $themeId        = $pageTheme->getId();
        }

        if ($themeId and $pageTheme) {
            $details['themeId'] = $themeId;

            $details['layout']    = $pageTheme->getLayout();
            $details['pageTheme'] = $pageTheme->getId();

            /** @var $temp \PageBuilder\Entity\Template */
            if ($temp = $page->getTemplate()) {
                $sections = $temp->getTemplateSections()->toArray();
            } elseif ($temp = $page->getParent()->getTemplate()) {
                $sections = $temp->getTemplateSections()->toArray();
            }
        }
        /** @var $section \PageBuilder\Entity\Join\TemplateSection */
        foreach ($sections as $section) {
            $slug                    = $section->getSectionId()->getSlug();
            $templateSections[$slug] = [
                'title'  => $section->getSectionId()->getTitle(),
                'status' => $section->getIsActive() ? 1 : 0,
                'class'  => $section->getIsActive() ? '' : 'in-active',
            ];
        }

        if ($themeData = $themeModel->getRepository()->findAll()) {
            /** @var $theme \PageBuilder\Entity\Theme */
            foreach ($themeData as $theme) {
                $details['themes'][$theme->getId()] = $theme->toArray();
            }
        } else {
            $details['themes'] = [];
        }

        /** @var $templateModel \PageBuilder\Model\TemplateModel */
        $templates  = $templateModel->listTemplates();
        $components = $this->getServiceLocator()->get('pagebuilder\model\component')->listItemsByTitle();

        /** @var $widgetUtil \PageBuilder\Util\Widget */
        $widgetUtil = $this->getServiceLocator()->get('util\widget');

        $widgetList = $widgetUtil->getWidgetList();
        $urlHelper  = $this->getServiceLocator()->get('ViewHelperManager')->get('url');

        $return = [
            'error'     => $error,
            'page'      => $details,
            'editUrl'   => $pageThemeId
                ? $urlHelper('builder\theme', ['id' => $pageThemeId])
                : $urlHelper(
                    'builder', ['id' => $pageId]
                ),
            'sections'  => $templateSections,
            'title'     => 'Layout Manager - ' . ($page ? $page->getTitle() : ''),
            'widgets'   => [
                'title' => 'Widgets',
                'items' => $widgetUtil->getRegistry(),
                'total' => count($widgetUtil->getRegistry()),
                'list'  => $widgetList,
                'id'    => PageBuilder::LAYOUT_WIDGET,
            ],
            'assets'    => [
                PageBuilder::LAYOUT_USER_DEFINED => [
                    'title' => 'User Defined',
                    'items' => $components,
                ],
            ],
            'templates' => [
                'title' => 'Templates',
                'items' => $templates,
            ],
            'tags'      => $this->_getTaglist(),
        ];

        return $return;
    }
147006
public function getPagePart(EntityManager $em)
    {
        return $em->getRepository($this->getPagePartEntityname())->find($this->getPagePartId());
    }
346139
public function getMessagesPager(Subject $subject, $page = 1, $max = 20)
    {
        $messages = $this->messageRepo->findBySubject($subject);

        return $this->pagerFactory->createPagerFromArray($messages, $page, $max);
    }
566789
protected function getItemRecordOverlayed(Item $item, $language, $systemLanguageContentOverlay)
    {
        $itemRecord = $item->getRecord();

        if ($language > 0) {
            $page = GeneralUtility::makeInstance(PageRepository::class);
            $page->init(false);
            $itemRecord = $page->getRecordOverlay($item->getType(), $itemRecord, $language, $systemLanguageContentOverlay);
        }

        if (!$itemRecord) {
            $itemRecord = null;
        }

        return $itemRecord;
    }
52562
public function getView(int $row, array $row_data, Linker $linker): string
    {
        // Auto set _href for update links
        if (!$this->getHref()) {
            $tmp = $_GET;
            $tmp['do'] = str_replace('_default', '', $tmp['do']);
            $tmp['do'] = ($tmp['do'] ? '_' : '') . $tmp['do'] . '_delete';
            $tmp['id'] = '{%id%}';
            $this->setHref(urldecode('?' . http_build_query($tmp)));
        }

        $value = $this->getCellData($row_data);

        if (!$value) {
            $value = '<i class="fa fa-trash-o"></i>';
        }

        $cell_view = $this->getHrefView($value, $this->getParsedHref($row_data, $linker, ['do' => '_delete', 'id' => $row_data['id']]));

        return $this->getCellView($cell_view, $row_data);
    }
130211
public function generatePager(BasePager $pager, array $options = []): string
    {
        $data = array_merge(array_merge($this->options, $options), [
            'itemsCount'  => $pager->count(),
            'limit'       => max(1, $pager->getMaxPerPage()),
            'currentPage' => $pager->getPage(),
        ]);

        $data['lastPage'] = self::getNumPages((int) $data['limit'], (int) $data['itemsCount']);

        return $this->environment->render($data['template'], $data);
    }