Creates the page buttons.
@return array a list of page buttons (in HTML code).
430245
protected function createPageButtons()
	{
		if(($pageCount=$this->getPageCount())<=1)
			return array();

		list($beginPage,$endPage)=$this->getPageRange();
		$currentPage=$this->getCurrentPage(false); // currentPage is calculated in getPageRange()
		$buttons=array();

		// first page
		if ($this->firstPageLabel !== false) {
			$buttons[]=$this->createPageButton($this->firstPageLabel,0, $this->firstPageCssClass,$currentPage<=0,false);
		}
		// prev page
		if ($this->prevPageLabel !== false) {
			if(($page=$currentPage-1)<0)
				$page=0;
			$buttons[]=$this->createPageButton($this->prevPageLabel,$page, $this->previousPageCssClass,$currentPage<=0,false);
		}

		// internal pages
		for($i=$beginPage;$i<=$endPage;++$i)
			$buttons[]=$this->createPageButton($i+1,$i, $this->internalPageCssClass,false,$i==$currentPage);

		// next page
		if ($this->nextPageLabel !== false) {
			if(($page=$currentPage+1)>=$pageCount-1)
				$page=$pageCount-1;
			$buttons[]=$this->createPageButton($this->nextPageLabel,$page, $this->nextPageCssClass,$currentPage>=$pageCount-1,false);
		}
		// last page
		if ($this->lastPageLabel !== false) {
			$buttons[]=$this->createPageButton($this->lastPageLabel,$pageCount-1, $this->lastPageCssClass,$currentPage>=$pageCount-1,false);
		}

		return $buttons;
	}
233599
public function generatepage_html(){
		$bhtml=BHTML::getInstance();
		$status=200;
		//Forming page from blocks...
		$jsused=array();
		$cssused=array();
		foreach($this->rules as &$c){
			if(isset($this->positions[$c->position])){
				$this->positions[$c->position].=$c->output;
				}else{
				$this->positions[$c->position]=$c->output;
				}
			if($c->status!=200){
				$status=$c->status;
				}
			if(isset($c->locationurl)){
				$bhtml->setLocationUrl($c->locationurl,$c->locationtime);
				}
			if(isset($c->modified)){
				$bhtml->setLastModified($c->modified);
				}
			if(isset($c->title)){
				$bhtml->setTitle($c->title);
				}
			if(isset($c->meta)){
				foreach($c->meta as $meta){
					$bhtml->add_meta($meta['name'],$meta['content'],$meta['http_equiv']);
					}
				}
			if(isset($c->link)){
				foreach($c->link as $link){
					//Remove dublicates...
					$wasused=false;
					if($link['rel']=='stylesheet'){
						$wasused=isset($cssused[$link['href']]);
						$cssused[$link['href']]=1;
						}
					if(!$wasused){
						$bhtml->add_link($link);
						}
					}
				}
			if(isset($c->js)){
				foreach($c->js as $js){
					//Remove dublicates...
					$wasused=false;
					if(!empty($js['file'])){
						$wasused=isset($jsused[$js['file']]);
						$jsused[$js['file']]=1;
						}
					if(!$wasused){
						$bhtml->addJS($js['file'],$js['src'],$js['priority']);
						}
					}
				}
			if(isset($c->style)){
				foreach($c->style as $st){
					$bhtml->addCSSDeclaration($st);
					}
				}
			if(isset($c->frameworks)){
				foreach($c->frameworks as $framework){
					$bhtml->useFramework($framework);
					}
				}
			//Add breadcrumbs elements
			if(isset($c->breadcrumbs)){
				bimport('cms.breadcrumbs');
				$gbc=BGeneralBreadcrumbs::getInstance();
				foreach($c->breadcrumbs as $bc){
					$gbc->elements[]=$bc;
					}
				}
			}
		//Output the page
		header('Content-Type: text/html; charset=utf-8');
		if($status==403){
			header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden');
			}
		if($status==404){
			header($_SERVER['SERVER_PROTOCOL'].' 404 Page Not Found');
			}
		if($status==500){
			header($_SERVER['SERVER_PROTOCOL'].' 500 Server Error!');
			}
		$bhtml->headers_check();
		//Check for last-modified
		if((isset($_SERVER['HTTP_IF_MODIFIED_SINCE']))&&(isset($bhtml->last_modified))){
			$mod_since=new DateTime($_SERVER['HTTP_IF_MODIFIED_SINCE']);
			$interval=date_diff($bhtml->last_modified,$mod_since);
			if($interval->invert==0){
	        		header($_SERVER['SERVER_PROTOCOL'].' 304 Not Modified');
				return;//return nothing!
				}
			}
		if($this->templatename===NULL){
			$this->templatename='default';
			}
		//Detect device...
		$device=BBrowserUseragent::detectDevice();
		if($device==DEVICE_TYPE_MPHONE){
			$suffix='.m';
			}
		elseif($device==DEVICE_TYPE_TABLET){
			$suffix='.m';
			}else{
			$suffix='.d';
			}
		$fn=BTEMPLATESPATH.$this->templatename.DIRECTORY_SEPARATOR.'template'.$suffix.'.php';
		//
		if(!file_exists($fn)){
			$fn=BTEMPLATESPATH.$this->templatename.DIRECTORY_SEPARATOR.'template.d.php';
			}
		//
		if(!file_exists($fn)){
			$fn=BTEMPLATESPATH.'default'.DIRECTORY_SEPARATOR.'template'.$suffix.'.php';
			}
		//
		if(!file_exists($fn)){
			$fn=BTEMPLATESPATH.'default'.DIRECTORY_SEPARATOR.'template.d.php';
			}

		//Starting render
		if(DEBUG_MODE){
			BLog::addToLog('[Router]: Rendering template...');
			}
		ob_start();
		include $fn;
		$tpl_str=ob_get_clean();
		$tpl_str=str_replace('{{head}}','',$tpl_str);
		if(DEBUG_MODE){
			BLog::addToLog('[Router]: Filling empty positions...');
			}
		$pattern='/{{position.(?P<position>\w+)*}}/';
		preg_match_all($pattern, $tpl_str, $matches);
		foreach($matches['position'] as $pos){
			if(!isset($this->positions[$pos])){
				$this->positions[$pos]='';
				}
			}
		if(DEBUG_MODE){
			BLog::addToLog('[Router]: Put content into positions...');
			}
		foreach($this->positions as $p=>$val){
			$tpl_str=str_replace('{{position:'.$p.'}}',$val,$tpl_str);
			}
		//Output debug information, if necessary.
		if(DEBUG_MODE){
			BLog::addToLog('[Router]: Generation time: '.sprintf('%7.7f',self::page_time()));
			BLog::addToLog('[Router]: MySQL queries:'.BMySQL::getQueriesCount());
			$qc=BCache::getQueriesCount();
			BLog::addToLog('[Router]: Cache queries: get-'.$qc['get'].' set-'.$qc['set'].' mset-'.$qc['mset'].' mget-'.$qc['mget'].' gc-'.$qc['gc']);
			BLog::addToLog('[Router]: Outputing the template...');
			}
		echo($tpl_str);
		BLog::addToLog('[Router]: All done!');
		if(!empty($this->htmllogger)){
			$this->htmllogger->print_html();
			}
		}
389152
public function createDefaultButtons()
	{
		$this->setButtonOneLeft(new DualListButton("&#60;--", DualListButtonType::Button));
		$this->setButtonAllLeft(new DualListButton("&#60;&#60;&#60;", DualListButtonType::Button));
		$this->setButtonOneRight(new DualListButton("--&#62;", DualListButtonType::Button));
		$this->setButtonAllRight(new DualListButton("&#62;&#62;&#62;", DualListButtonType::Button));
	}
1220054
protected function getButtons()
    {
        /** @var UriBuilder $uriBuilder */
        $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);

        $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();

        // Create new
        $newRecordButton = $buttonBar->makeLinkButton()
            ->setHref((string)$uriBuilder->buildUriFromRoute(
                'record_edit',
                [
                    'edit' => ['sys_redirect' => ['new'],
                ],
                'returnUrl' => (string)$uriBuilder->buildUriFromRoute('site_redirects'),
            ]
            ))
            ->setTitle($this->getLanguageService()->getLL('redirect_add_text'))
            ->setIcon($this->iconFactory->getIcon('actions-add', Icon::SIZE_SMALL));
        $buttonBar->addButton($newRecordButton, ButtonBar::BUTTON_POSITION_LEFT, 10);

        // Reload
        $reloadButton = $buttonBar->makeLinkButton()
            ->setHref(GeneralUtility::getIndpEnv('REQUEST_URI'))
            ->setTitle($this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.reload'))
            ->setIcon($this->iconFactory->getIcon('actions-refresh', Icon::SIZE_SMALL));
        $buttonBar->addButton($reloadButton, ButtonBar::BUTTON_POSITION_RIGHT);

        // Shortcut
        $mayMakeShortcut = $this->getBackendUserAuthentication()->mayMakeShortcut();
        if ($mayMakeShortcut) {
            $getVars = ['id', 'route'];

            $shortcutButton = $buttonBar->makeShortcutButton()
                ->setModuleName('site_redirects')
                ->setGetVariables($getVars);
            $buttonBar->addButton($shortcutButton, ButtonBar::BUTTON_POSITION_RIGHT);
        }
    }
893547
protected function initUserIndexButton()
    {
        if (!isset($this->buttons['userindex'])) {
            $this->buttons['userindex'] = function ($url, $model, $key) {
                return Html::a('<span class="glyphicon glyphicon-user"></span>', $url, array_merge([
                    'title' => \Yii::t('yii', '角色用户管理'),
                    'data-pjax' => '0',
                ], $this->buttonOptions));
            };
        }
    }
1081842
protected function getEditButtons()
    {
        $buttons         = [];
        $basicDefinition = $this->getDataDefinition()->getBasicDefinition();

        $buttonTemplate = new ContaoBackendViewTemplate('dc_general_button');

        $buttonTemplate->setData(
            [
                'label'      => $this->getButtonLabel('save'),
                'attributes' => [
                    'type'      => 'submit',
                    'name'      => 'save',
                    'id'        => 'save',
                    'class'     => 'tl_submit',
                    'accesskey' => 's'
                ]
            ]
        );
        $buttons['save'] = $buttonTemplate->parse();

        $buttonTemplate->setData(
            [
                'label'      => $this->getButtonLabel('saveNclose'),
                'attributes' => [
                    'type'      => 'submit',
                    'name'      => 'saveNclose',
                    'id'        => 'saveNclose',
                    'class'     => 'tl_submit',
                    'accesskey' => 'c'
                ]
            ]
        );
        $buttons['saveNclose'] = $buttonTemplate->parse();

        if (!$this->isPopup() && $basicDefinition->isCreatable()) {
            $buttonTemplate->setData(
                [
                    'label'      => $this->getButtonLabel('saveNcreate'),
                    'attributes' => [
                        'type'      => 'submit',
                        'name'      => 'saveNcreate',
                        'id'        => 'saveNcreate',
                        'class'     => 'tl_submit',
                        'accesskey' => 'n'
                    ]
                ]
            );
            $buttons['saveNcreate'] = $buttonTemplate->parse();
        }

        if ($this->getEnvironment()->getInputProvider()->hasParameter('s2e')) {
            $buttonTemplate->setData(
                [
                    'label'      => $this->getButtonLabel('saveNedit'),
                    'attributes' => [
                        'type'      => 'submit',
                        'name'      => 'saveNedit',
                        'id'        => 'saveNedit',
                        'class'     => 'tl_submit',
                        'accesskey' => 'e'
                    ]
                ]
            );
            $buttons['saveNedit'] = $buttonTemplate->parse();
        } elseif (!$this->isPopup()
                  && ((BasicDefinitionInterface::MODE_PARENTEDLIST === $basicDefinition->getMode())
                      || '' !== $basicDefinition->getParentDataProvider()
                      || $basicDefinition->isSwitchToEditEnabled()
                  )
        ) {
            $buttonTemplate->setData(
                [
                    'label'      => $this->getButtonLabel('saveNback'),
                    'attributes' => [
                        'type'      => 'submit',
                        'name'      => 'saveNback',
                        'id'        => 'saveNback',
                        'class'     => 'tl_submit',
                        'accesskey' => 'g'
                    ]
                ]
            );
            $buttons['saveNback'] = $buttonTemplate->parse();
        }

        $event = new GetEditModeButtonsEvent($this->getEnvironment());
        $event->setButtons($buttons);

        $this->getEnvironment()->getEventDispatcher()->dispatch($event::NAME, $event);

        $submitButtons = ['toggleIcon' => Image::getHtml('navcol.svg')];
        $editButtons   = $event->getButtons();
        if (\array_key_exists('save', $editButtons)) {
            $submitButtons['save'] = $editButtons['save'];
            unset($editButtons['save']);
        }

        if (\count($editButtons)) {
            $submitButtons['buttonGroup'] = $editButtons;
        }

        $submitButtonTemplate = new ContaoBackendViewTemplate('dc_general_submit_button');
        $submitButtonTemplate->setData($submitButtons);

        return \preg_replace('/(\s\s+|\t|\n)/', '', $submitButtonTemplate->parse());
    }
1263834
public function PagedComments()
    {
        $list = $this->Comments();

        // Add pagination
        $list = PaginatedList::create($list, Controller::curr()->getRequest());
        $list->setPaginationGetVar('commentsstart' . $this->owner->ID);
        $list->setPageLength($this->owner->getCommentsOption('comments_per_page'));

        $this->owner->extend('updatePagedComments', $list);
        return $list;
    }
482047
public function renderButtons()
    {
        list($name, $id) = $this->resolveNameID();
        $buttons   = array();
        $checked   = $this->hasModel() ? (!$this->model->{$this->attribute}) : true;
        $buttons[] = \CHtml::radioButton($name, $checked, array('id' => $id . '_on', 'value' => 1));
        $buttons[] = \CHtml::label($this->offLabel, $id . '_on');
        $checked   = $checked ? false : true;
        $buttons[] = \CHtml::radioButton($name, $checked, array('id' => $id . '_off', 'value' => 1));
        $buttons[] = \CHtml::label($this->onLabel, $id . '_off');
        $buttons[] = '<span></span>';

        return \CHtml::tag('div', $this->htmlOptions, implode("\n", $buttons));
    }
689096
public function initButtons() {
    	
        if (empty($this->columnName) || empty($this->actionButtons))
            return;

	    $this->buttons = array();
        foreach ($this->actionButtons as $action)
	        $this->buttons[] = $this->convertToTbButtonConfig($action);
    }
113288
protected function renderButtons()
    {
        if (!empty($this->buttons)) {
            $html = '';

            foreach ($this->buttons as $button) {
                    $html .= "$button\n";
            }

            return Html::tag('div', $html, ['class' => 'actions btn-set']);
        }

        return '';
    }
1305023
private function renderPages()
    {
        $html = '';

        for($i=1; $i<=$this->page->total_pages; $i++) {
            if ($i == $this->page->current) {
                $html .= $this->renderElement($i, $i, 'active');
            } elseif($this->isPrintablePage($i)) {
                $html .= $this->renderElement($i, $i);
            } elseif($this->isMiddleOffsetPage($i)) {
                $html .= $this->renderElement($this->page->current, '...', 'more');
            }
        }

        return $html;
    }
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;
    }
319992
public function renderButtons() {
		
		$output = '';
		foreach ($this->getButtons() as $button) {
			$output .= $this->renderElement($button);
		}

		if ($output !== '' && $this->activeFormWidget->type !== TbActiveForm::TYPE_INLINE) {
			$output = "<div class=\"form-actions\">\n" . $output . "</div>\n";
		}

		return $output;
	}
275058
private function createPaginationItems()
    {
        // Grab overrides if present
        $linkClass = $this->getOption('linkClass', 'page-link');
        $itemClass = $this->getOption('itemClass', 'page-item');
        $itemActiveClass = $this->getOption('itemActiveClass', 'page-item active');
        $previousCaption = ' &laquo; ' . $this->getOption('previousCaption', '');
        $nextCaption = $this->getOption('nextCaption', '') . ' &raquo; ';

        // To be returned
        $items = array();

        // First - check if first previous page available
        if ($this->paginator->hasPreviousPage()) {
            $items[] = $this->createListItem($itemClass, $this->renderLink($previousCaption, $this->paginator->getPreviousPageUrl(), $linkClass));
        }

        foreach ($this->paginator->getPageNumbers() as $page) {
            if (is_numeric($page)) {
                $currentClass = $this->paginator->isCurrentPage($page) ? $itemActiveClass : $itemClass;
                $items[] = $this->createListItem($currentClass, $this->renderLink($page, $this->paginator->getUrl($page), $linkClass));
            } else {
                $items[] = $this->createListItem($itemClass, $this->renderLink($page, '#', $linkClass));
            }
        }

        // Last - check if next page available
        if ($this->paginator->hasNextPage()) {
            $items[] = $this->createListItem($itemClass, $this->renderLink($nextCaption, $this->paginator->getNextPageUrl(), $linkClass));
        }

        return $items;
    }
354616
public function createButtonGroup()
    {
        $node = new Group();
        $this->childNodes->push($node);

        return $this->childNodes->last();
    }
182106
protected function getPageList() {
		$linkPage = '';
		$linkPage .= $this->replaceLine(1);
		$lastList = floor($this->get('length') / 2);
		$i = 0;
		$length = 0;
		if ($this->pageTotal < $this->get('length') || $this->get('page') - $lastList < 2 || $this->pageTotal - $this->get('length') < 2) {
			$i = 2;
			if ($this->pageTotal <= $this->get('length')) {
				$length = $this->pageTotal - 1;
			} else {
				$length = $this->get('length');
			}
		} elseif ($this->get('page') - $lastList>= 2 && $this->get('page') + $lastList <= $this->pageTotal) {
			$i = $this->get('page')- $lastList;
			$length = $this->get('page') + $lastList- 1;
		} elseif ($this->get('page') + $lastList > $this->pageTotal) {
			$i = $this->pageTotal - $this->get('length') + 1;
			$length = $this->pageTotal - 1;
		}
		if ($this->get('page') > $lastList + 1 && $i > 2) {
			$linkPage .= $this->getOmit();
		}
		for (; $i <= $length; $i ++) {
			$linkPage .= $this->replaceLine($i);
		}
		if ($this->get('page') < $this->pageTotal - $lastList && $length < $this->pageTotal - 1) {
			$linkPage .= $this->getOmit();
		}
		$linkPage .= $this->replaceLine($this->pageTotal);
		return $linkPage;
	}
161280
protected function setEditButtons()
    {
        global $APPLICATION;

        if (!$APPLICATION->GetShowIncludeAreas() || $this->showEditButtons === false)
        {
            return false;
        }

        $buttons = \CIBlock::GetPanelButtons(
            $this->arParams['IBLOCK_ID'],
            $this->arResult['ID'],
            $this->arParams['SECTION_ID'],
            []
        );

        $this->addIncludeAreaIcons(\CIBlock::GetComponentMenu($APPLICATION->GetPublicShowMode(), $buttons));

        if (is_array($buttons['intranet']))
        {
            Asset::getInstance()->addJs(BX_ROOT.'/js/main/utils.js');

            foreach ($buttons['intranet'] as $button)
            {
                $this->addEditButton($button);
            }
        }
    }