作者:manyoubaby12
项目:imsho
/**
* @inheritdoc
*/
public function run()
{
parent::run();
$id = $this->options['id'];
ListViewAsset::register($this->getView());
$this->registerClientOptions($id);
$this->registerClientEvents($id);
}
作者:nhatvuva
项目:yii2-widget
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;
}
作者:nhatvuva
项目:yii2-widget
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;
}
作者:roman444u
项目:yii
/**
* 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});");
}
作者:how
项目:yii
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&sort=customer_id" data-sort="customer_id">Customer</a>') !== false);
$this->assertTrue(strpos($actualHtml, '<a href="/index.php?r=site%2Findex&sort=total" data-sort="total">Invoice Total</a>') !== false);
}
作者:simplato
项目:bas
/**
* 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();
}
作者:pafno
项目:yii2-widget
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(); }"]]);
}
作者:giicm
项目:tou
<?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">
作者:gouchaoe
项目:yii2-starter-ki
<?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>
作者:VEKsoftwar
项目:yii2-report-manage
use reportmanager\models\ReportsConditions;
?>
<?php
echo Html::a(Yii::t('reportmanager', 'Add Condition'), ['condition', 'report_id' => $model->id], ['class' => 'btn btn-primary', 'name' => 'add-condition']);
?>
<?php
echo ListView::widget(['dataProvider' => $condDataProvider, 'itemOptions' => ['class' => 'list'], 'itemView' => function ($model, $key, $index, $widget) use($condition) {
$param = NULL;
if ($model->functionObj->paramType) {
if (is_array($model->value)) {
$all_values = $model->config['values'];
$values = array_map(function ($v) use($all_values) {
return array_key_exists($v, $all_values) ? $all_values[$v] : NULL;
}, $model->value);
$param = join(', ', $values);
} else {
$param = $model->value;
}
}
$title = '' . $model->operationsList[$model->operation] . ': ' . $model->conditionLabel . ' ' . $model->functionObj->label . ' ' . ($param ? $param : '');
return '' . Html::a('▲', ['condition', 'report_id' => $model->report->id, 'id' => $model->id], ['data' => ['operation' => 'up']]) . Html::a('▼', ['condition', 'report_id' => $model->report->id, 'id' => $model->id], ['data' => ['operation' => 'down']]) . (isset($condition) && $condition->id == $model->id ? Html::tag('span', $title) : Html::a($title, ['condition', 'report_id' => $model->report->id, 'id' => $model->id]));
}]);
?>
<?php
$this->registerJs('
if ($.support.pjax) {
$(document).on("click", "a[data-operation]", function(event) {
$.pjax.click(event, {type: "post", push: false, container: "#all", data: {operation: $(event.currentTarget).attr("data-operation")}})
})
作者:nguyendt
项目:VietvietTrave
} else {
echo "RESULT";
}
?>
</h3>
<div class="sort">
<form id="sort-tour" class="form-inline" action="<?php
echo \yii\helpers\Url::to(['tour/sort']);
?>
" method="post" role="form">
<div class="form-group">
<label for="sort_tour">Sorting Tour</label>
<select name="sort-tour" id="sort" class="form-control">
<option value="">None</option>
<option value="Descending">Descending</option>
<option value="Ascending">Ascending</option>
</select>
<?php
echo $sort->link('length', ['id' => 'length_desc', 'class' => 'sr-only']);
?>
</div>
</form>
</div>
<div class="thumb-content">
<?php
echo ListView::widget(['dataProvider' => $provider, 'summary' => '', 'itemView' => '_show']);
?>
</div>
</div>
</div>
作者:scorp7mi
项目:yi
use yii\widgets\ListView;
/* @var $this yii\web\View */
/* @var $searchModel common\models\Search\UserSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Users';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-index">
<h1><?php
echo Html::encode($this->title);
?>
</h1>
<?php
echo $this->render('_search', ['model' => $searchModel]);
?>
<p>
<?php
echo Html::a('Create User', ['create'], ['class' => 'btn btn-success']);
?>
</p>
<?php
echo ListView::widget(['dataProvider' => $dataProvider, 'itemOptions' => ['class' => 'item'], 'itemView' => function ($model, $key, $index, $widget) {
return Html::a(Html::encode($model->id), ['view', 'id' => $model->id]);
}]);
?>
</div>
作者:harish-reglobb
项目:Auctio
<div class="col-lg-12">
<h1 class="page-header">Company: <?= $model->name?></h1>
</div>
<!-- /.col-lg-12 -->
</div>
<!-- /.row -->
<?php
$dataProvider = $model->companyDetails;
echo ListView::widget([
'dataProvider' => new ArrayDataProvider(['allModels' => $dataProvider,'pagination' => false]),
'itemView' => '_row1',
'summary' => false,
'itemOptions' => [
'class' => 'col-lg-3 col-md-6'
],
'options' => [
'class' => 'row',
'id' => false
]
])?>
<!-- /.row -->
<div class="row">
<div class="col-lg-8">
<div class="chat-panel panel panel-green">
<div class="panel-heading">
<i class="fa fa-comments fa-fw"></i>
Latest Dealer Bids
<div class="btn-group pull-right">
</div>
</div>
作者:frenzelgmb
项目:cm-addres
},
type:'POST'
}).done(function(){container.slideUp()});
}
return false;
});
DEL;
$this->registerJs($deleteJS);
?>
<div class="panel-body">
<?php
Pjax::begin(['id' => 'WidgetLocationPjax']);
echo ListView::widget(array('id' => 'LocationsTable', 'dataProvider' => $dpLocations, 'itemView' => '@frenzelgmbh/cmaddress/widgets/views/iviews/_location_view', 'layout' => '{items}'));
echo "<p> </p>";
?>
<div class="navbar navbar-default">
<?php
echo Html::a('<span class="btn btn-success navbar-btn pull-right tipster" title="add location">' . Icon::show('plus', ['class' => 'fa'], Icon::FA) . ' add location</span>', array("/posts/widgetconfig/addlocation", 'id' => $id, 'module' => $module), array('class' => 'create'));
?>
</div>
<?php
Pjax::end();
?>
</div>
作者:alexus00
项目:budge
?>
<hr>
<?php
echo $this->render('tmpl/_total_income', ['budgetModel' => $model, 'type' => \app\models\BudgetItem::TYPE_INCOME]);
?>
<?php
echo $this->render('tmpl/modal_income', ['budgetModel' => $model, 'modelHistory' => $modelHistory]);
?>
</div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<!-- costs -->
<?php
echo ListView::widget(['dataProvider' => $providerCost, 'itemView' => 'tmpl/_cost']);
?>
<hr>
<?php
echo $this->render('tmpl/_total_costs', ['budgetModel' => $model, 'type' => \app\models\BudgetItem::TYPE_COST]);
?>
<?php
echo $this->render('tmpl/modal_costs', ['budgetModel' => $model, 'modelHistory' => $modelHistory]);
?>
</div>
</div>
</div>
</div>
</div>
作者:krodo9
项目:yii_sho
<?php
use yii\helpers\Html;
use yii\widgets\ListView;
use yii\widgets\Menu;
/* @var $this yii\web\View */
$title = $category === null ? 'Bienvenido' : $category->title;
$this->title = Html::encode($title);
?>
<h1><?php
echo Html::encode($title);
?>
</h1>
<div class="container-fluid">
<div class="row">
<div class="col-xs-4">
<?php
echo Menu::widget(['items' => $menuItems, 'options' => ['class' => 'menu']]);
?>
</div>
<div class="col-xs-8">
<?php
echo ListView::widget(['dataProvider' => $productsDataProvider, 'itemView' => '_product']);
?>
</div>
</div>
</div>
作者:positionrelativ
项目:kertgyros.h
</div>
<div class="col-md-3 pull-right view">
<span>Nézet</span>
<?php
echo Html::a("Rács", Yii::$app->urlManager->createAbsoluteUrl(["/category/view", "justcategory" => $categoryData["slug"], "tipus" => 'racs']), ['class' => 'racs ' . ($type == "racs" ? "active" : "")]);
echo Html::a("Lista", Yii::$app->urlManager->createAbsoluteUrl(["/category/view", "justcategory" => $categoryData["slug"], "tipus" => 'lista']), ['class' => 'lista ' . ($type == "lista" ? "active" : "")]);
?>
</div>
<div class="clearfix"></div>
</div>
<div class="product-categories-index">
<?php
echo ListView::widget(['dataProvider' => $dataProvider, 'itemOptions' => ['class' => 'product-item col-md-6'], 'itemView' => 'itemview']);
?>
</div>
<?php
$this->registerJs('
$(".listorder").on("change", function() {
var url = $(this).find("option:selected").val();
window.location = url;
});
$("input[name*=\\"topping\\"]").on("click", function() {
var propPrice = parseInt($(this).data("price"));
var currentPriceContainer = $(this).parents(".product-item").find(".price");
作者:absol311
项目:sonneboutiqu
</div>
</div>
-->
<!--/discount panel end-->
</div>
</div>
<!--right column-->
<div class="col-lg-9 col-md-9 col-sm-12">
<div class="w100 clearfix category-top">
<?php
echo Html::tag('h2', $this->title);
?>
<div class="categoryImage">
<img src="/images/site/category.jpg" class="img-responsive" alt="img">
</div>
</div>
<?php
Pjax::begin();
?>
<?php
echo ListView::widget(['options' => ['id' => 'product-listview'], 'layout' => $template, 'dataProvider' => $dataProvider, 'itemOptions' => ['class' => 'item col-lg-3 col-md-3 col-sm-6 col-xs-12'], 'itemView' => function ($model, $key, $index, $widget) {
return $this->render('_product_item', ['model' => $model]);
}, 'summaryOptions' => ['class' => 'pull-left']]);
?>
<?php
Pjax::end();
?>
<!--/.categoryFooter-->
</div>
作者:GalkinDmitri
项目:evalott
</td>
<td class="c23">
<h1><?php
echo Html::encode($model->title);
?>
</h1>
<?//= Html::img('/image/bannerfans_15821322.jpg', ['width'=>'100%']); ?>
<p><?php
echo Html::encode($model->description);
?>
<br><br></p>
<? if (!(Yii::$app->user->isGuest)) Pjax::begin(['id' => 'notes']); ?>
<?php
echo ListView::widget(['dataProvider' => $products, 'itemOptions' => ['class' => '_product'], 'layout' => "{items}\n{pager}\n", 'itemView' => '//product/_product', 'viewParams' => array('groups' => $groups)]);
?>
<? if (!(Yii::$app->user->isGuest)) Pjax::end(); ?>
</td>
</tr>
</table>
<?php
echo Html::input('hidden', 'this_category_id', $model->category_id, $options = ['class' => 'this_category_id']);
echo Html::input('hidden', 'group_this_category_id', $model->category_id, $options = ['class' => 'group_this_category_id']);
?>
作者:luhao
项目:mcwik
public function init()
{
parent::init();
$this->options['class'] .= ' row component component-resource-list';
$this->itemOptions['tag'] = false;
$this->summary = false;
}