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


PHP LinkPager::widget方法代码示例

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


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

示例1: pages

 public function pages($options = [])
 {
     return $this->_adp ? LinkPager::widget(array_merge($options, ['pagination' => $this->_adp->pagination])) : '';
 }
开发者ID:DenisCherniatev,项目名称:easyii,代码行数:4,代码来源:CategoryObject.php

示例2: run

 /**
  * 
  * @return type
  * @throws base\ErrorException
  */
 public function run()
 {
     if (!$this->_filterModel) {
         throw new base\ErrorException('There is no search model');
     }
     $request = Yii::$app->request;
     if ($request->isAjax) {
         Yii::$app->response->format = Response::FORMAT_JSON;
     }
     $data = strtolower($this->requestType) === 'post' && $request->isPost ? $_POST : $_GET;
     $this->_filterModel->load($this->directPopulating ? $data : [$this->_filterModel->formName() => $data]);
     $this->_filterModel->search();
     if ($this->_filterModel->hasErrors()) {
         if ($request->isAjax) {
             return is_callable($this->_validationFailedCallback) ? call_user_func($this->_validationFailedCallback, $this->_filterModel) : ['error' => current($this->_filterModel->getErrors())];
         }
         if (empty($data)) {
             $this->_filterModel->clearErrors();
         }
     }
     if (!($dataProvider = $this->_filterModel->getDataProvider())) {
         throw new base\ErrorException('DataProvider not initialized');
     }
     if ($request->isAjax) {
         return ['list' => $this->_filterModel->buildModels(), 'pagination' => $this->paginationAsHTML ? LinkPager::widget(['pagination' => $dataProvider->getPagination()]) : $dataProvider->getPagination()];
     }
     return $this->controller->render($this->view ?: $this->id, ['filterModel' => $this->_filterModel, 'dataProvider' => $dataProvider, 'requestType' => $this->requestType, 'directPopulating' => $this->directPopulating]);
 }
开发者ID:roman444uk,项目名称:yii2,代码行数:33,代码来源:SearchAction.php

示例3: getPager

 private function getPager($pages)
 {
     if (self::$_pageLinkPagerOn) {
         return LinkPager::widget(['pagination' => $pages]);
     } else {
         return ['defaultPageSize' => $pages->defaultPageSize, 'forcePageParam' => $pages->forcePageParam, 'limit' => $pages->limit, 'links' => $pages->links, 'offset' => $pages->offset, 'page' => $pages->page, 'pageCount' => $pages->pageCount, 'pageParam' => $pages->pageParam, 'pageSize' => $pages->pageSize, 'pageSizeLimit' => $pages->pageSizeLimit, 'pageSizeParam' => $pages->pageSizeParam, 'params' => $pages->params, 'route' => $pages->route, 'totalCount' => $pages->totalCount, 'urlManager' => $pages->urlManager, 'validatePage' => $pages->validatePage];
     }
 }
开发者ID:keigonec,项目名称:XiiBackend,代码行数:8,代码来源:TraitPager.php

示例4: run

 /**
  * Executes the widget.
  *
  * This overrides the parent implementation by initializing jQuery IAS and displaying the generated page buttons.
  *
  * @throws \yii\base\InvalidConfigException
  * @return mixed
  */
 public function run()
 {
     // Initialize jQuery IAS plugin
     $pluginSettings = ['container' => $this->overflowContainer, 'ias' => ['container' => $this->container, 'item' => $this->item, 'pagination' => "{$this->container} .pagination", 'next' => '.next a', 'delay' => $this->delay, 'negativeMargin' => $this->negativeMargin]];
     // Register IAS extensions
     $pluginSettings['extensions'] = $this->registerExtensions([['name' => self::EXTENSION_PAGING], ['name' => self::EXTENSION_SPINNER, 'options' => !empty($this->spinnerSrc) ? ['html' => $this->spinnerTemplate, 'src' => $this->spinnerSrc] : ['html' => $this->spinnerTemplate]], ['name' => self::EXTENSION_TRIGGER, 'options' => ['text' => $this->triggerText, 'html' => $this->triggerTemplate, 'offset' => $this->triggerOffset]], ['name' => self::EXTENSION_NONE_LEFT, 'options' => ['text' => $this->noneLeftText, 'html' => $this->noneLeftTemplate]], ['name' => self::EXTENSION_HISTORY, 'options' => ['prev' => $this->historyPrev], 'depends' => [self::EXTENSION_TRIGGER, self::EXTENSION_PAGING]]]);
     // Register event handlers
     $pluginSettings['events'] = $this->registerEventHandlers(['scroll' => [], 'load' => [], 'loaded' => [], 'render' => [], 'rendered' => [], 'noneLeft' => [], 'next' => [], 'ready' => [], 'pageChange' => [self::EXTENSION_PAGING]]);
     // Render pagination links
     return LinkPager::widget(['pagination' => $this->pagination, 'options' => ['class' => 'pagination hidden', 'role' => 'iasContainer', 'data-ias' => json_encode($pluginSettings)]]);
 }
开发者ID:nhatvuvan,项目名称:yii2-widgets,代码行数:19,代码来源:ScrollPager.php

示例5: actionUploadDict

 public function actionUploadDict()
 {
     $sougouDir = Yii::$app->params['sougouDictDir'];
     $dictFiles = array();
     if (file_exists($sougouDir)) {
         if (is_writable($sougouDir)) {
             $oDir = dir($sougouDir);
             while (($file = $oDir->read()) !== false) {
                 if (strcasecmp($file, '.') != 0 && strcasecmp($file, '..') != 0) {
                     $filename = $sougouDir . '/' . $file;
                     if (is_dir($filename)) {
                         $subDir = dir($filename);
                         while (($subFile = $subDir->read()) !== false) {
                             if (strcasecmp($subFile, '.') != 0 && strcasecmp($subFile, '..') != 0) {
                                 $dictFiles[$file][] = $subFile;
                             }
                         }
                     }
                 }
             }
         } else {
             exit('目录不可写');
         }
     }
     $count = count($dictFiles);
     $page = isset($_REQUEST['page']) ? $_REQUEST['page'] ? $_REQUEST['page'] : 1 : 1;
     $pageSize = 10;
     $start = ($page - 1) * $pageSize;
     $pager = new \yii\data\Pagination(array('defaultPageSize' => $pageSize, 'totalCount' => $count));
     if ($page > $pager->getPageCount() && $page != 1) {
         exit('超过最大页数');
     }
     $data = array();
     if ($count) {
         $sArr = array_slice($dictFiles, $start, $pageSize, true);
         foreach ($sArr as $time => $value) {
             if (!empty($value)) {
                 foreach ($value as $key => $val) {
                     if (preg_match('/\\.scel/', $val)) {
                         $file = $sougouDir . '/' . $time . '/' . $val;
                         $data[$time][$key] = array('filename' => mb_convert_encoding($val, 'UTF-8', 'GBK,GB2312'), 'filesize' => \app\common\XUtils::file_size_format(filesize($file)), 'filetype' => filetype($file), 'filetime' => date('Y-m-d H:i:s', filemtime($file)));
                     }
                 }
             }
         }
     }
     if (Yii::$app->request->isPost) {
         exit(json_encode(array('data' => $data, 'pager' => \yii\widgets\LinkPager::widget(['pagination' => $pager, 'prevPageLabel' => '上一页', 'nextPageLabel' => '下一页']))));
     }
     return $this->render('uploaddict', array('data' => $data, 'pager' => $pager));
 }
开发者ID:HabiCat,项目名称:searchkeyword,代码行数:51,代码来源:ToolsController.php

示例6: testFirstLastPageLabels

 public function testFirstLastPageLabels()
 {
     $pagination = new Pagination();
     $pagination->setPage(5);
     $pagination->totalCount = 500;
     $pagination->route = 'test';
     $output = LinkPager::widget(['pagination' => $pagination, 'firstPageLabel' => true, 'lastPageLabel' => true]);
     static::assertContains('<li class="first"><a href="/?r=test&amp;page=1" data-page="0">1</a></li>', $output);
     static::assertContains('<li class="last"><a href="/?r=test&amp;page=25" data-page="24">25</a></li>', $output);
     $output = LinkPager::widget(['pagination' => $pagination, 'firstPageLabel' => 'First', 'lastPageLabel' => 'Last']);
     static::assertContains('<li class="first"><a href="/?r=test&amp;page=1" data-page="0">First</a></li>', $output);
     static::assertContains('<li class="last"><a href="/?r=test&amp;page=25" data-page="24">Last</a></li>', $output);
     $output = LinkPager::widget(['pagination' => $pagination, 'firstPageLabel' => false, 'lastPageLabel' => false]);
     static::assertNotContains('<li class="first">', $output);
     static::assertNotContains('<li class="last">', $output);
 }
开发者ID:howq,项目名称:yii2,代码行数:16,代码来源:LinkPagerTest.php

示例7: actionIndex

 /**
  * 用户列表
  * @return [type] [description]
  */
 public function actionIndex()
 {
     $model = new \app\models\WAdmin();
     $currentPage = $this->_getPost('page') ? $this->_getPost('page') : 1;
     $pageSize = $this->_getPost('pageSize') ? $this->_getPost('pageSize') : 10;
     $where = 1;
     if ($this->_getPost('searchName')) {
         $where = $this->buildQuery(['username' => $this->_getPost('searchName')], 'and');
     }
     $data = $model->getAdminList(($currentPage - 1) * $pageSize, $pageSize, $where);
     foreach ($data['data'] as $key => $value) {
         $data['data'][$key]['last_login_time'] = date('Y-m-d H:i:s', $value['last_login_time']);
     }
     $pager = new \yii\data\Pagination(array('defaultPageSize' => $pageSize, 'totalCount' => $data['count']['n']));
     if (\Yii::$app->request->isGet) {
         return $this->render('index', array('datalist' => $data['data'], 'pager' => $pager));
     } else {
         exit(json_encode(array('datalist' => $data['data'], 'pager' => \yii\widgets\LinkPager::widget(['pagination' => $pager, 'prevPageLabel' => '上一页', 'nextPageLabel' => '下一页']))));
     }
 }
开发者ID:HabiCat,项目名称:searchkeyword,代码行数:24,代码来源:AdminController.php

示例8: run

 public function run()
 {
     if (!$this->_filterModel) {
         throw new base\ErrorException('Не указана модель поиска');
     }
     $request = Yii::$app->request;
     if ($request->isAjax) {
         Yii::$app->response->format = Response::FORMAT_JSON;
     }
     // Проставляем данные
     $data = strtolower($this->requestType) === 'post' && $request->isPost ? $_POST : $_GET;
     $this->_filterModel->load($this->directPopulating ? $data : [$this->_filterModel->formName() => $data]);
     // Производим выборку в модели поиска
     $this->_filterModel->search();
     // Если при поиске произошла ошибка валидации
     if ($this->_filterModel->hasErrors()) {
         /**
          * В зависимости от запроса решаем что делать,
          * если ajax то сбрасываем ошибку, иначе если входящих данных нет, очищаем ошибки
          */
         if ($request->isAjax) {
             return is_callable($this->_validationFailedCallback) ? call_user_func($this->_validationFailedCallback, $this->_filterModel) : ['error' => current($this->_filterModel->getErrors())];
         }
         if (empty($data)) {
             $this->_filterModel->clearErrors();
         }
     }
     if (!($dataProvider = $this->_filterModel->getDataProvider())) {
         throw new base\ErrorException('Не проинициализирован DataProvider');
     }
     if ($request->isAjax) {
         // Возвращаем корректно сформированную коллекцию объектов
         return ['list' => $this->_filterModel->buildModels(), 'pagination' => $this->paginationAsHTML ? LinkPager::widget(['pagination' => $dataProvider->getPagination()]) : $dataProvider->getPagination()];
     }
     return $this->controller->render($this->view ?: $this->id, ['filterModel' => $this->_filterModel, 'dataProvider' => $dataProvider, 'requestType' => $this->requestType, 'directPopulating' => $this->directPopulating]);
 }
开发者ID:hogvarce,项目名称:cms,代码行数:36,代码来源:ListAction.php

示例9: foreach

                        <p class="entry-summary">
                            <?php 
        echo $post->post_excerpt;
        ?>
...
                        </p>
                        <footer class="footer-meta">
                            <h3>
                                <?php 
        $tags = $post->getTerms()->innerJoinWith(['taxonomy'])->andWhere(['taxonomy_slug' => 'tag'])->all();
        foreach ($tags as $tag) {
            echo Html::a($tag->term_name, $tag->url, ['class' => 'badge']) . "\n";
        }
        ?>
                            </h3>
                        </footer>
                    </div>
                </div>
            </article>
        <?php 
    }
    ?>
        <nav id="archive-pagination">
            <?php 
    echo LinkPager::widget(['pagination' => $pages, 'activePageCssClass' => 'active', 'disabledPageCssClass' => 'disabled', 'options' => ['class' => 'pagination']]);
    ?>
        </nav>
    <?php 
}
?>
</div>
开发者ID:ochiem,项目名称:app-cms,代码行数:31,代码来源:view.php

示例10:

                            class="comment-total"> · <?php 
    echo $article['comment_total'] > 0 ? '已经有' . $article['comment_total'] . '个用户发表了读后感' : '还没人鸟我哟';
    ?>
</span>
                    </section>
                    <div class="article-content">
                        <?php 
    echo \yii\helpers\StringHelper::truncateWords($parsedown->parse($article['text']), 10);
    ?>
                    </div>
                </article>
            <?php 
}
?>
            <?php 
echo \yii\widgets\LinkPager::widget(['pagination' => $articles['pagination']]);
?>
        </div>
        <div class="hidden-xs col-md-3 col-lg-4">
            <div class="panel panel-default">
                <div class="panel-heading">分类简介</div>
                <div class="panel-body"><?php 
echo $category['description'] ?: '唔,这个分类的介绍被搞丢了。。。';
?>
</div>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">分类热门</div>
                <div class="list-group">
                    <?php 
foreach ($hotArticles['data'] as $article) {
开发者ID:luobenyu,项目名称:blog-1,代码行数:31,代码来源:view.php

示例11:

                    <td><?php 
    echo $model->stateName;
    ?>
</td>
                    <td><?php 
    echo $model->replyUser['nickname'];
    ?>
</td>
                    <td><?php 
    echo $model->replyContent;
    ?>
</td>
                    <td><?php 
    echo $model->replyDate;
    ?>
</td>
                </tr>
            <?php 
}
?>
            </tbody>
        </table>
        <nav class="pull-right pagination_footer">
            <?php 
echo \yii\widgets\LinkPager::widget(['pagination' => $pages]);
?>
        </nav>
        <div class="clearfix"></div>
    </div>
</div>
开发者ID:krissss,项目名称:YunDou-advanced,代码行数:30,代码来源:index.php

示例12: api_pages

 public function api_pages()
 {
     return $this->_adp ? LinkPager::widget(['pagination' => $this->_adp->pagination]) : '';
 }
开发者ID:oakcms,项目名称:oakcms,代码行数:4,代码来源:Article.php

示例13: date

                            <div class="tour-info fl">
                                <img src="<?php 
    echo $this->theme->getUrl('assets/img/calendar_icon_grey.png');
    ?>
" alt="">
                                <span class="font-style-2 color-dark-2"><?php 
    echo date('d.m.y', strtotime($model->dateCreate));
    ?>
</span>
                            </div>
                        </div>
                        <br>
                        <a href="<?php 
    echo $model->oneUrl;
    ?>
" class="c-button small bg-dr-blue-2 hv-dr-blue-2-o"><span>Подробнее</span></a>
                    </div>
                </div>
            </div>
            <?php 
}
?>
        </div>
        <div class="c_pagination clearfix">
            <?php 
echo LinkPager::widget(['pagination' => $pagination, 'options' => ['class' => 'cp_content color-3']]);
?>
        </div>
    </div>
</div>
开发者ID:ivphpan,项目名称:darhan-butique,代码行数:30,代码来源:list.php

示例14:

        ?>
                            </td>
                        </tr>
                        <?php 
    }
}
?>
                        </tbody>
                    </table>
                    

                </div>

                    <div class="mail-body text-right tooltip-demo">
                       <?php 
echo LinkPager::widget(['pagination' => $pagination, 'firstPageLabel' => "First", 'prevPageLabel' => 'Prev', 'nextPageLabel' => 'Next', 'lastPageLabel' => 'Last']);
?>
                    </div>
                    <div class="clearfix"></div>
                </div>

            </div>
        </div>
        </div>
<!--模态框->添加菜单-->
<div class="modal inmodal fade" id="myModa" tabindex="-1" role="dialog"  aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">

            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
开发者ID:dlpc,项目名称:yii2-plane,代码行数:31,代码来源:index.php

示例15: date

<?php

use yii\widgets\LinkPager;
echo date("Y-m-d", $firstDay);
?>

<?php 
foreach ($materials as $material) {
    ?>

<?php 
    echo $material->title;
    ?>
</br>
<?php 
}
?>

<?php 
echo LinkPager::widget(['pagination' => $pages, 'registerLinkTags' => true]);
开发者ID:mickeyur,项目名称:yii2-article,代码行数:20,代码来源:month.php


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