渲染按钮
@param $type
@param $pageParams
@return string
511692
protected function renderTemplateButtons($type,$pageParams){
        $pageCount = $this->pagination->getPageCount();
        if ($pageCount < 2 && $this->hideOnSinglePage) {
            return '';
        }
        if(!$this->sButtonLabel){
            return '';
        }

        $buttons = [];
        $page=$this->pagination->getPage();
        $pageSize=$this->pagination->getPageSize();
        $BaseUrl=$this->unsetUrlParams($pageParams);

        $inputParam=$type=='j'?$page:$pageSize;
        $buttons[]=$this->renderTemplateInput($type,$inputParam,$BaseUrl,$pageParams);
        $buttons[]=$this->renderTemplateButton($type,$page);

        $options = $this->{$type.'Options'};
        $tag = ArrayHelper::remove($options, 'tag', 'ul');
        return Html::tag($tag, implode("\n", $buttons), $options);
    }
1335460
public function bindParam($column, &$param, $type = null)
    {
        if ($type === null) :
            $this->_statement->bindParam($column, $param);
        else :
            $this->_statement->bindParam($column, $param, $type);
        endif;
    }
598271
private function initRequestParams($type, $params)
	{

		$list = self::$customParams;
		if (!isset($list[$type])) {
			throw new GatewayException('Undefined request type');
		}

		$list = $list[$type];
		$requestParams = array();

		foreach ($list as $key) {
			if (!empty($params[$key])) {
				$requestParams[$key] = trim($params[$key]);
			}
		}

		foreach (Config::getAll() as $key => $value) {
			if(
				in_array($type, array('complete', 'refund')) &&
				in_array($key, array('callbackUrl', 'callbackEmail', 'shopUrl'))
			){
				continue;
			}
			$requestParams[$key] = $value;
		}

		$requestParams = $this->convert($requestParams);

		if($type !== 'callback'){
			$requestParams['time'] = time();
		}

		$requestParams['sign'] = $this->sign($type, $requestParams);

		return $requestParams;

	}
1063484
protected function renderTemplateButton($type,$page){
        $options = $this->{$type.'LiButtonOptions'};
        $linkWrapTag = ArrayHelper::remove($options, 'tag', 'li');
        Html::addCssClass($options, $this->{$type.'LiButtonCssClass'});

        $buttonOptions = $this->{$type.'ButtonOptions'};
        $buttonOptions['id']=$this->{$type.'ButtonIdHeader'}.self::${$type.'Counter'};
        return Html::tag($linkWrapTag, Html::a($this->{$type.'ButtonLabel'},$this->pagination->createUrl($page),$buttonOptions),$options);
    }
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;
    }
  }
993098
public static String getPageDoc(ITypeBinding type, AcceptableLocales locales) {
        return getPageDoc(type.getAnnotations(), locales);
    }
1155755
public function getPaginator( $type )
    {
        $type = (string) $type;

        switch ( $type )
        {
            case 'content':
                $joins = array(
                    'paragraph_property_layout' => array(
                        'table'     => array( 'paragraph_property_layout' => 'paragraph_property' ),
                        'where'     => new Expression(
                            '?.? = ?.? AND ?.? = ?',
                            array(
                                'paragraph',                 'id',
                                'paragraph_property_layout', 'paragraphId',
                                'paragraph_property_layout', 'name',
                                'layoutId',
                            ),
                            array(
                                Expression::TYPE_IDENTIFIER, Expression::TYPE_IDENTIFIER,
                                Expression::TYPE_IDENTIFIER, Expression::TYPE_IDENTIFIER,
                                Expression::TYPE_IDENTIFIER, Expression::TYPE_IDENTIFIER,
                                Expression::TYPE_VALUE,
                            )
                        ),
                        'columns'   => array(),
                        'type'      => Select::JOIN_LEFT,
                    ),
                    'paragraph_layout' => array(
                        'table'     => array( 'paragraph_layout' => 'paragraph' ),
                        'where'     => new Expression(
                            'CAST( CASE
                                     WHEN ?.? = \'\' THEN NULL
                                     ELSE ?.?
                                   END AS INT ) = ?.?',
                            array(
                                'paragraph_property_layout', 'value',
                                'paragraph_property_layout', 'value',
                                'paragraph_layout',          'id',
                            ),
                            array(
                                Expression::TYPE_IDENTIFIER, Expression::TYPE_IDENTIFIER,
                                Expression::TYPE_IDENTIFIER, Expression::TYPE_IDENTIFIER,
                                Expression::TYPE_IDENTIFIER, Expression::TYPE_IDENTIFIER,
                            )
                        ),
                        'columns'   => array( 'layoutName' => 'name' ),
                        'type'      => Select::JOIN_LEFT,
                    ),
                );
                $columns = array(
                    'title' => new Expression(
                        '( SELECT ?
                             FROM ? AS ?
                            WHERE ?.? = ?.?
                              AND ?.? = ?
                         ORDER BY CASE ?.?
                                      WHEN ? THEN 3
                                      WHEN ? THEN 2
                                      ELSE 1
                                  END DESC
                            LIMIT 1 )',
                        array(
                            'value',
                            'paragraph_property', 'paragraph_property_title',
                            'paragraph', 'id',
                            'paragraph_property_title', 'paragraphId',
                            'paragraph_property_title', 'name',
                            'title',
                            'paragraph_property_title', 'locale',
                            $this->getLocale(),
                            $this->getPrimaryLanguage(),
                        ),
                        array(
                            Expression::TYPE_IDENTIFIER,
                            Expression::TYPE_IDENTIFIER, Expression::TYPE_IDENTIFIER,
                            Expression::TYPE_IDENTIFIER, Expression::TYPE_IDENTIFIER,
                            Expression::TYPE_IDENTIFIER, Expression::TYPE_IDENTIFIER,
                            Expression::TYPE_IDENTIFIER, Expression::TYPE_IDENTIFIER,
                            Expression::TYPE_VALUE,
                            Expression::TYPE_IDENTIFIER, Expression::TYPE_IDENTIFIER,
                            Expression::TYPE_VALUE,
                            Expression::TYPE_VALUE,
                        )
                    ),
                    'defaultFor' => new Expression(
                        '( SELECT COUNT(*)
                             FROM ?
                            WHERE ?.? = ?.? )',
                        array(
                            'subdomain',
                            'subdomain', 'defaultContentId',
                            'paragraph', 'id',
                        ),
                        array(
                            Expression::TYPE_IDENTIFIER,
                            Expression::TYPE_IDENTIFIER, Expression::TYPE_IDENTIFIER,
                            Expression::TYPE_IDENTIFIER, Expression::TYPE_IDENTIFIER,
                        )
                    ),
                );
                break;

            case 'layout':
                $joins   = null;
                $columns = array(
                    'defaultFor' => new Expression(
                        '( SELECT COUNT(*) FROM ? WHERE ?.? = ?.? )',
                        array(
                            'subdomain',
                            'subdomain', 'defaultLayoutId',
                            'paragraph', 'id',
                        ),
                        array(
                            Expression::TYPE_IDENTIFIER,
                            Expression::TYPE_IDENTIFIER, Expression::TYPE_IDENTIFIER,
                            Expression::TYPE_IDENTIFIER, Expression::TYPE_IDENTIFIER,
                        )
                    ),
                );
                break;

            case 'widget':
                $joins  = array(
                    'paragraph_content' => array(
                        'table'     => array( 'paragraph_content' => 'paragraph' ),
                        'where'     => 'paragraph.rootId = paragraph_content.id',
                        'columns'   => array(
                            'rootName'  => 'name',
                            'rootType'  => 'type',
                        ),
                        'type'      => Select::JOIN_LEFT,
                    ),
                );
                $columns = null;
                break;

            default:
                $joins   = null;
                $columns = null;
                break;
        }

        return $this->getMapper()
                    ->getPaginator(
                        array( 'paragraph.type' => $type ),
                        array( 'rootId'         => 'ASC',
                               'left'           => 'ASC' ),
                        $columns,
                        $joins
                    );
    }
808745
protected function getPageNumber(EncodingParametersInterface $parameters = null)
    {
        return $this->getPagingParameter(Request::PARAM_PAGING_NUMBER, null, $parameters);
    }
80182
public function findPages($type, $page, $numberPerPage)
    {
        $offset = (($page - 1) * $numberPerPage);

        return $this
            ->createQueryBuilder('p')
            ->where('p.enabled = :enabled')
            ->andWhere('p.type = :type')
            ->orderBy('p.publicationDate', 'DESC')
            ->setParameters([
                'enabled' => true,
                'type' => $type,
            ])
            ->setFirstResult($offset)
            ->setMaxResults($numberPerPage)
            ->getQuery()
            ->getArrayResult();
    }
121463
public function getUrl($type, $path, $params = array()) {
        $url = self::$URL_TABLE[$type] . $path;
        if (!empty($params)) {
            $url .= '?' . http_build_query($params);
        }
        return $url;
    }
982149
public function getPagesByName(
        SiteEntity $site,
        $pageName,
        $pageType = PageTypes::NORMAL
    ) {
        $queryBuilder = $this->createQueryBuilder('page')
            ->leftJoin('page.publishedRevision', 'publishedRevision')
            ->leftJoin('publishedRevision.pluginWrappers', 'pluginWrappers')
            ->leftJoin('pluginWrappers.instance', 'pluginInstances')
            ->where('page.site = :site')
            ->andWhere('page.name = :pageName')
            ->andWhere('page.pageType = :pageType')
            ->setParameter('site', $site)
            ->setParameter('pageName', $pageName)
            ->setParameter('pageType', $pageType);

        return $queryBuilder->getQuery()->useQueryCache(true)->getResult();
    }
1107308
private static function defineParam(string $type, array $params, array $config = [])
    {
        // params
        if (isset($params[$type]) && !empty($params[$type])) {
            return $params[$type];
        // config
        } elseif (isset($config[$type]) && !empty($config[$type])) {
            return $config[$type];
        }

        // default
        return self::$$type;
    }
951086
private function getPagedListResponse(
        $methodName,
        array $optionalArgs,
        $decodeType,
        Message $request,
        $interfaceName = null
    ) {
        $callStack = $this->createCallStack(
            $this->configureCallConstructionOptions($methodName, $optionalArgs)
        );
        $descriptor = new PageStreamingDescriptor(
            $this->descriptors[$methodName]['pageStreaming']
        );
        $callStack = new PagedMiddleware($callStack, $descriptor);

        $call = new Call(
            $this->buildMethod($interfaceName, $methodName),
            $decodeType,
            $request,
            [],
            Call::UNARY_CALL
        );

        $this->modifyUnaryCallable($callStack);
        return $callStack($call, $optionalArgs)->wait();
    }
780671
protected function renderTemplateInput($type,$inputParam,$baseUrl,$jsParam){
        $options = $this->{$type.'LiInputOptions'};
        $linkWrapTag = ArrayHelper::remove($options , 'tag' , 'li');
        Html::addCssClass($options, $this->{$type.'LiInputCssClass'});

        $inputParam=$type=='j'?($inputParam+1):$inputParam;
        $linkOptions = $this->{$type.'InputOptions'};
        $counter = self::${$type.'Counter'};
        $linkOptions['min'] = 1;

        $linkOptions['max'] = $type=='j'?$this->pagination->getPageCount():$this->pagination->pageSizeLimit[1];
        $linkOptions['id'] = $this->{$type.'InputIdHeader'}.$counter;
        $linkOptions['baseurl']=$baseUrl;

        if(empty($linkOptions['js'])){
            $this->renderJs($linkOptions['id'],$this->{$type.'ButtonIdHeader'}.$counter,$linkOptions['max'],$jsParam);
        }

        return Html::tag($linkWrapTag,Html::input($this->{$type.'InpuType'},empty($linkOptions['name'])?'name':$linkOptions['name'],$inputParam,$linkOptions),$options);

    }
1209511
public function getPage4Type($type)
    {
        $cachingKey = Caching::PAGE_INFO . '_' . $type;

        $pageInfo = $this->cachingHelperService->getItem($cachingKey, function () use ($type) {
            /** @var \PServerCore\Entity\Repository\PageInfo $repository */
            $repository = $this->entityManager->getRepository(
                $this->collectionOptions->getEntityOptions()->getPageInfo()
            );
            return $repository->getPageData4Type($type);
        });

        return $pageInfo;
    }
1025965
public function generate($entity,$type = self::TYPE_LINK_DEFAULT,$parameters = array())
    {
        if($type === null){
            $type = self::TYPE_LINK_DEFAULT;
        }
        $entityConfig = $this->getEntityConf($entity);
        $link = '';
        if($entityConfig){
            $link = $this->generateFromConfig($entity,$entityConfig,$type,$parameters);
        }
        return $link;
    }
483233
private static function paramValidator($param, $type)
    {
        $allowedTypes = explode('|', $type);

        foreach ($allowedTypes as $allowedType) {
            $validationFunction = 'is_' . $allowedType;
            if ($validationFunction($param)) {
                return true;
            }
        }

        return false;
    }