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


PHP widgets\ListView类代码示例

本文整理汇总了PHP中yii\widgets\ListView的典型用法代码示例。如果您正苦于以下问题:PHP ListView类的具体用法?PHP ListView怎么用?PHP ListView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: run

 /**
  * @inheritdoc
  */
 public function run()
 {
     parent::run();
     $id = $this->options['id'];
     ListViewAsset::register($this->getView());
     $this->registerClientOptions($id);
     $this->registerClientEvents($id);
 }
开发者ID:manyoubaby123,项目名称:imshop,代码行数:11,代码来源:ListView.php

示例2: run

 public function run()
 {
     $ret_val = '';
     if (isset($this->header) && is_string($this->header) && !is_bool($this->header)) {
         $ret_val = Html::tag('h2', $this->header);
     }
     switch ($this->displayAs) {
         case 'grid':
             $this->items = is_array($this->items) ? $this->items : [$this->items];
             $this->widgetOptions = array_merge(['summary' => false, 'layout' => '{items}', 'showHeader' => $this->header, 'dataProvider' => new \yii\data\ArrayDataProvider(['allModels' => $this->items]), 'columns' => $this->attributes], $this->widgetOptions);
             $ret_val .= \kartik\grid\GridView::widget($this->widgetOptions);
             break;
         case 'list':
             $this->widgetOptions = array_merge(['itemOptions' => ['tag' => false], 'summary' => false, 'dataProvider' => new \yii\data\ArrayDataProvider(['allModels' => $this->items]), 'itemView' => function ($model, $key, $index, $widget) {
                 return $this->renderListItem($model, $key, $index, $widget);
             }], $this->widgetOptions);
             $ret_val .= \yii\widgets\ListView::widget($this->widgetOptions);
             break;
         case 'csv':
             $ret_val = [];
             foreach ($this->items as $index => $item) {
                 $ret_val[] = $this->renderCsvItem($item, $index);
             }
             $ret_val = Html::tag('div', implode(', ', $ret_val));
             break;
         case 'tags':
             foreach ($this->items as $index => $item) {
                 $ret_val .= $this->renderTagItem($item, $index);
             }
             $ret_val = Html::tag('div', $ret_val);
             break;
         default:
             $this->widgetOptions['class'] = isset($this->widgetOptions['class']) ? $this->widgetOptions['class'] : 'table';
             $this->widgetOptions = array_merge(['model' => $this->items, 'attributes' => $this->attributes, 'options' => ['class' => 'table']], $this->widgetOptions);
             $ret_val .= \yii\widgets\DetailView::widget($this->widgetOptions);
             break;
     }
     return $ret_val;
 }
开发者ID:nhatvuvan,项目名称:yii2-widgets,代码行数:39,代码来源:MetaInfo.php

示例3: run

    public function run()
    {
        $header = Html::tag(ArrayHelper::remove($this->labelOptions, 'tag', 'h4'), 'Parents', $this->labelOptions);
        if (count($this->labelContainerOptions)) {
            $header = Html::tag(ArrayHelper::remove($this->labelContainerOptions, 'tag', 'div'), $header, $this->labelContainerOptions);
        }
        $list = ListView::widget(['summary' => false, 'emptyText' => Html::tag('ul', '', $this->options), 'options' => $this->options, 'itemOptions' => $this->itemOptions, 'dataProvider' => $this->dataProvider, 'itemView' => function ($model, $key, $index, $widget) {
            return $model->name . (!$this->viewOnly ? Html::tag('span', Html::a("Remove " . Icon::show('remove'), '/' . $this->model->isWhat() . "/remove-parent/" . $this->model->getId() . '/' . $model['id'], ['role' => 'parentListItem', 'style' => 'color:white']), ['class' => 'badge']) : '');
        }]);
        if (count($this->listOptions)) {
            $list = Html::tag(ArrayHelper::remove($this->listOptions, 'tag', 'div'), $list, $this->listOptions);
        }
        if (!$this->viewOnly) {
            $script = Html::tag('script', new \yii\web\jsExpression('$(document).ready(function () {
				$("#' . $this->options['id'] . '").find(\'[role="parentListItem"]\').each(function () {
					$(this).on("click", function (event) {
						event.preventDefault();
						var $element = $(this);
						$.post(this.href, function (result) {
							if(result) $element.parents("li").remove();
						});
					});
				});
			})'), ['type' => 'text/javascript']);
        } else {
            $script = '';
        }
        return Html::tag('div', $header . $list, $this->containerOptions) . $script;
    }
开发者ID:nhatvuvan,项目名称:yii2-widgets,代码行数:29,代码来源:ParentList.php

示例4: run

 /**
  * Runs the widget.
  */
 public function run()
 {
     parent::run();
     $options = Json::htmlEncode($this->getClientOptions());
     $view = $this->getView();
     ListViewAsset::register($view);
     $view->registerJs("jQuery('#{$this->id}').yiiListView({$options});");
 }
开发者ID:roman444uk,项目名称:yii2,代码行数:11,代码来源:ListView.php

示例5: testLabelsExplicit

 public function testLabelsExplicit()
 {
     $dataProvider = new ActiveDataProvider(['query' => Order::find(), 'models' => [new Order()], 'totalCount' => 1, 'sort' => ['attributes' => ['total'], 'route' => 'site/index']]);
     ob_start();
     echo ListView::widget(['dataProvider' => $dataProvider, 'layout' => "{sorter}"]);
     $actualHtml = ob_get_clean();
     $this->assertFalse(strpos($actualHtml, '<a href="/index.php?r=site%2Findex&amp;sort=customer_id" data-sort="customer_id">Customer</a>') !== false);
     $this->assertTrue(strpos($actualHtml, '<a href="/index.php?r=site%2Findex&amp;sort=total" data-sort="total">Invoice Total</a>') !== false);
 }
开发者ID:howq,项目名称:yii2,代码行数:9,代码来源:LinkSorterTest.php

示例6: run

 /**
  * Runs the widget.
  */
 public function run()
 {
     $id = $this->options['id'];
     $view = $this->getView();
     $options = Json::encode(['options' => $this->clientOptions, 'encode' => $this->encode, 'action' => $this->action, 'method' => $this->method]);
     JuiAsset::register($this->getView());
     SortableListViewAsset::register($view);
     $view->registerJs("jQuery('#{$id}').sortableListView({$options});");
     parent::run();
 }
开发者ID:simplator,项目名称:base,代码行数:13,代码来源:SortableListView.php

示例7: run

 public function run()
 {
     $this->view->registerJs('function refreshGpGallery() {
         $(".gpgallery").collagePlus({"targetHeight": 250, "allowPartialLastRow": true, "childrenFilterSelector": ".inline"});
         $(".gpgallery").collageCaption({"images": $(".inline:not(:has(div))")});
     }
     $(window).load(function() { refreshGpGallery(); });
     $(window).resize(function() { refreshGpGallery(); });');
     echo ListView::widget(['dataProvider' => $this->dataProvider, 'itemOptions' => ['tag' => false], 'itemView' => $this->itemView, 'layout' => "<div class=\"gpgallery\">{items}</div>\n{pager}", 'pager' => ['class' => \kop\y2sp\ScrollPager::className(), 'triggerOffset' => 999999, 'noneLeftText' => 'No more item to display', 'noneLeftTemplate' => '<div class="clearfix"></div><div class="ias-noneleft" style="text-align: center;"><small class="text-muted">{text}</small>', 'enabledExtensions' => [\kop\y2sp\ScrollPager::EXTENSION_TRIGGER, \kop\y2sp\ScrollPager::EXTENSION_SPINNER, \kop\y2sp\ScrollPager::EXTENSION_NONE_LEFT], 'eventOnRendered' => "function() { refreshGpGallery(); }"]]);
 }
开发者ID:pafnow,项目名称:yii2-widgets,代码行数:10,代码来源:GpGallery.php

示例8:

<?php

$path = Yii::$app->urlManager->createAbsoluteUrl('/webroot/');
use giicms\forum\components\widgets\CategoryWidget;
use yii\widgets\ListView;
?>
<section class="content">
    <div class="container">
        <div class="row">
            <div class="col-lg-8 col-md-8">
                <!-- POST -->
                <?php 
echo ListView::widget(['dataProvider' => $dataProvider, 'options' => ['tag' => 'div'], 'layout' => "{pager}\n{items}\n{summary}", 'itemView' => '_post']);
?>
                


                <!-- POST -->
                
            </div>
            <div class="col-lg-4 col-md-4">

                <!-- -->

                <!-- -->
                <div class="sidebarblock">
                    <h3>Poll of the Week</h3>
                    <div class="divline"></div>
                    <div class="blocktxt">
                        <p>Which game you are playing this week?</p>
                        <form action="http://forum.azyrusthemes.com/index.html#" method="post" class="form">
开发者ID:giicms,项目名称:tour,代码行数:31,代码来源:index.php

示例9:

<?php

/* @var $this yii\web\View */
$this->title = Yii::t('frontend', 'Articles');
echo $this->render('_typehead');
?>
<div id="article-index">
    <h1><?php 
echo Yii::t('frontend', 'Articles');
?>
</h1>
    <?php 
echo \yii\widgets\ListView::widget(['dataProvider' => $dataProvider, 'pager' => ['hideOnSinglePage' => true], 'itemView' => '_item']);
?>
</div>
开发者ID:gouchaoer,项目名称:yii2-starter-kit,代码行数:15,代码来源:index.php

示例10: init

 public function init()
 {
     parent::init();
     $this->options['class'] .= ' row component component-resource-list';
     $this->itemOptions['tag'] = false;
     $this->summary = false;
 }
开发者ID:luhaoz,项目名称:mcwiki,代码行数:7,代码来源:ResourceList.php

示例11: renderPager

 /**
  * @inheritdoc
  */
 public function renderPager()
 {
     if ($this->dataProvider->getPagination()->pageSize == 0) {
         return '';
     }
     return parent::renderPager();
 }
开发者ID:frostiks25,项目名称:rzwebsys7,代码行数:10,代码来源:ListView.php

示例12: renderSection

 /**
  * Renders a section of the specified name.
  * If the named section is not supported, false will be returned.
  * @param string $name the section name, e.g., `{summary}`, `{items}`.
  * @return string|boolean the rendering result of the section, or false if the named section is not supported.
  */
 public function renderSection($name)
 {
     if ($name == '{pagerTop}') {
         return $this->renderPagerTop();
     }
     return parent::renderSection($name);
 }
开发者ID:mg-code,项目名称:yii2-infinite-list-view,代码行数:13,代码来源:ListView.php

示例13: renderEmpty

 /**
  * @inheritdoc
  */
 public function renderEmpty()
 {
     // run normal parent implementation if view is not set
     if (empty($this->emptyView)) {
         return parent::renderEmpty();
     }
     // render closure/view
     return $this->emptyView instanceof Closure ? call_user_func($this->emptyView) : $this->getView()->render($this->emptyView, $this->emptyViewParams);
 }
开发者ID:amnah,项目名称:yii2-classes,代码行数:12,代码来源:ExtListView.php

示例14: init

 public function init()
 {
     parent::init();
     $LatLngCenter = new LatLng(['lat' => $this->centerPoint['lat'], 'lng' => $this->centerPoint['lng']]);
     $this->map = new Map(['zoom' => $this->zoom, 'center' => $LatLngCenter, 'width' => '100%']);
     $this->initMarkers();
     $this->pushMarkers();
     $this->flushMap();
 }
开发者ID:elitedivision,项目名称:amos-core,代码行数:9,代码来源:MapView.php

示例15: renderSection

 /**
  * @inheritdoc
  */
 public function renderSection($name)
 {
     switch ($name) {
         case "{pagesizer}":
             return $this->renderPagesizer();
         default:
             return parent::renderSection($name);
     }
 }
开发者ID:nkovacs,项目名称:yii2-pagesizer,代码行数:12,代码来源:ListView.php


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