当前位置: 首页>>代码示例>>PHP>>正文


PHP DataGrid::link方法代码示例

本文整理汇总了PHP中DataGrid::link方法的典型用法代码示例。如果您正苦于以下问题:PHP DataGrid::link方法的具体用法?PHP DataGrid::link怎么用?PHP DataGrid::link使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataGrid的用法示例。


在下文中一共展示了DataGrid::link方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderPaginator

 /**
  * Renders data grid paginator.
  * @return string
  */
 public function renderPaginator()
 {
     $paginator = $this->dataGrid->paginator;
     if ($paginator->pageCount <= 1) {
         return '';
     }
     $container = $this->getWrapper('paginator container');
     $translator = $this->dataGrid->getTranslator();
     $a = Html::el('a');
     $a->addClass(DataGridAction::$ajaxClass);
     // to-first button
     $first = $this->getWrapper('paginator button first');
     $title = $this->dataGrid->translate('First');
     $link = clone $a->href($this->dataGrid->link('page', 1));
     if ($first instanceof Html) {
         if ($paginator->isFirst()) {
             $first->addClass('inactive');
         } else {
             $first = $link->add($first);
         }
         $first->title($title);
     } else {
         $first = $link->setText($title);
     }
     $container->add($first);
     // previous button
     $prev = $this->getWrapper('paginator button prev');
     $title = $this->dataGrid->translate('Previous');
     $link = clone $a->href($this->dataGrid->link('page', $paginator->page - 1));
     if ($prev instanceof Html) {
         if ($paginator->isFirst()) {
             $prev->addClass('inactive');
         } else {
             $prev = $link->add($prev);
         }
         $prev->title($title);
     } else {
         $prev = $link->setText($title);
     }
     $container->add($prev);
     // page input
     $controls = $this->getWrapper('paginator controls container');
     $form = $this->dataGrid->getForm(TRUE);
     $format = $this->dataGrid->translate($this->paginatorFormat);
     $html = str_replace(array('%label%', '%input%', '%count%'), array($form['page']->label, $form['page']->control, $paginator->pageCount), $format);
     $controls->add(Html::el()->setHtml($html));
     $container->add($controls);
     // next button
     $next = $this->getWrapper('paginator button next');
     $title = $this->dataGrid->translate('Next');
     $link = clone $a->href($this->dataGrid->link('page', $paginator->page + 1));
     if ($next instanceof Html) {
         if ($paginator->isLast()) {
             $next->addClass('inactive');
         } else {
             $next = $link->add($next);
         }
         $next->title($title);
     } else {
         $next = $link->setText($title);
     }
     $container->add($next);
     // to-last button
     $last = $this->getWrapper('paginator button last');
     $title = $this->dataGrid->translate('Last');
     $link = clone $a->href($this->dataGrid->link('page', $paginator->pageCount));
     if ($last instanceof Html) {
         if ($paginator->isLast()) {
             $last->addClass('inactive');
         } else {
             $last = $link->add($last);
         }
         $last->title($title);
     } else {
         $last = $link->setText($title);
     }
     $container->add($last);
     // page change submit
     $control = $form['pageSubmit']->control;
     $control->title = $control->value;
     $container->add($control);
     unset($first, $prev, $next, $last, $button, $paginator, $link, $a, $form);
     return $container->render();
 }
开发者ID:romansklenar,项目名称:nette-datagrid,代码行数:88,代码来源:DataGridRenderer.php


注:本文中的DataGrid::link方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。