Esempio n. 1
0
<?php

use yii\web\JsExpression;
use yii\widgets\ActiveForm;
use yii\widgets\Pjax;
use yii\helpers\Html;
use roman444uk\yii\widgets\WidgetPageSize;
use roman444uk\bookmarks\BookmarksModule;
?>

<?php 
Pjax::begin(['id' => 'advert-list-pjax']);
?>

    <?php 
echo \frontend\widgets\AdvertList::widget(['id' => 'advert-list', 'dataProvider' => $dataProvider, 'itemView' => '@frontend/views/advert/_advert', 'showOnEmpty' => true, 'layout' => "{summary}" . WidgetPageSize::widget(['pjaxId' => 'advert-list-pjax', 'viewFile' => '@frontend/widgets/views/widget-page-size', 'independentChanging' => true, 'enableClearFilters' => true, 'filterSelectors' => '#detaile-search-form input[type="text"], #detaile-search-form select', 'clearFiltersButtonOptions' => ['tag' => 'span', 'class' => 'button'], 'dropDownOptions' => ['items' => [5 => 5, 10 => 10, 20 => 20, 30 => 30, 50 => 50, 100 => 100]], 'containerOptions' => ['class' => 'widget-page-size'], 'text' => Yii::t('app', 'Count records')]) . "\n            <div class='clear'></div>\n            {pager}\n            {items}\n            <div class='clear'></div>\n            {pager}\n        ", 'itemOptions' => ['class' => 'advert-container']]);
?>
    
<?php 
Pjax::end();
?>

<?php 
\roman444uk\likes\widgets\Likes::widget();
?>

<?php 
(new \roman444uk\bookmarks\widgets\Bookmarks(['clientEvents' => ['onAdd' => "function(event, data) {\n    \$(this).addClass('bookmarked').attr('title', '" . BookmarksModule::t('Delete from bookmarks') . "');\n}", 'onRemove' => "function(event, data) {\n    \$(this).removeClass('bookmarked').attr('title', '" . BookmarksModule::t('Add to bookmarks') . "')\n}", 'onSuccess' => "function(event, data) {\n    jQuery('#bookmarks-count').html(data.count);\n}", 'onError' => "function(event, jqXHR, link) {\n    alert('Error adding bookmark');\n}"]]))->registerClientScript();
?>

<?php 
Esempio n. 2
0
        
<?php 
Pjax::begin(['id' => 'user-grid-pjax']);
?>

    <?php 
echo GridView::widget(['id' => 'user-grid', 'dataProvider' => $dataProvider, 'itemsOrderDesc' => true, 'pager' => ['options' => ['class' => 'pagination pagination-sm'], 'hideOnSinglePage' => true, 'lastPageLabel' => '>>', 'firstPageLabel' => '<<'], 'filterModel' => $searchModel, 'layout' => '
            <div class="row">
                <div class="col-sm-4">
                    ' . GhostHtml::a('<span class="glyphicon glyphicon-plus-sign"></span> ' . UsersModule::t('back', 'Create'), ['/users/user/create'], ['id' => 'user-grid-create-button', 'class' => 'btn btn-success btn-sm']) . '
                </div>
                <div class="col-sm-4 text-center">
                    {summary}
                </div>
                <div class="col-sm-4 text-right">
                    ' . WidgetPageSize::widget(['pjaxId' => 'user-grid-pjax']) . '
                </div>
            </div>
            {items}
            <div class="row">
                <div class="col-sm-8">
                    {pager}
                </div>
                <div class="col-sm-4 text-right" style="padding: 20px">
                    ' . GridBulkActions::widget(['gridId' => 'user-grid']) . '
                </div>
            </div>
        ', 'columns' => [['class' => 'yii\\grid\\CheckboxColumn', 'options' => ['style' => 'width:10px']], ['class' => 'yii\\grid\\SerialColumn', 'options' => ['style' => 'width:10px']], ['class' => 'roman444uk\\yii\\grid\\StatusColumn', 'attribute' => 'superadmin', 'visible' => Yii::$app->user->isSuperadmin, 'filterInputOptions' => ['class' => 'form-control input-sm']], ['attribute' => 'username', 'value' => function (User $model) {
    return Html::a($model->username, ['view', 'id' => $model->id], ['data-pjax' => 0]);
}, 'format' => 'raw', 'filterInputOptions' => ['class' => 'form-control input-sm']], ['attribute' => 'email', 'format' => 'raw', 'visible' => User::hasPermission('viewUserEmail'), 'filterInputOptions' => ['class' => 'form-control input-sm']], ['class' => 'roman444uk\\yii\\grid\\StatusColumn', 'attribute' => 'email_confirmed', 'visible' => User::hasPermission('viewUserEmail'), 'filterInputOptions' => ['class' => 'form-control input-sm']], ['attribute' => 'gridRoleSearch', 'filter' => ArrayHelper::map(Role::getAvailableRoles(Yii::$app->user->isSuperAdmin), 'name', 'description'), 'value' => function (User $model) {
    return implode(', ', ArrayHelper::map($model->roles, 'name', 'description'));
Esempio n. 3
0
<?php 
Pjax::begin(['id' => 'advert-grid-pjax']);
?>

<?php 
echo \roman444uk\yii\grid\GridView::widget(['id' => 'advert-grid', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'pager' => ['options' => ['class' => 'pagination pagination-sm'], 'hideOnSinglePage' => true, 'lastPageLabel' => '>>', 'firstPageLabel' => '<<'], 'layout' => '
        <div class="row">
            <div class="col-sm-4">
                ' . GhostHtml::a('<span class="glyphicon glyphicon-plus-sign"></span> Создать', ['/advert/create'], ['id' => 'advert-grid-create-button', 'class' => 'btn btn-success btn-sm']) . '
            </div>
            <div class="col-sm-4 text-center">
                {summary}
            </div>
            <div class="col-sm-4 text-right">
                ' . WidgetPageSize::widget(['pjaxId' => 'advert-grid-pjax']) . '
            </div>
        </div>
        {items}
        <div class="row">
            <div class="col-sm-8">
                {pager}
            </div>
            <div class="col-sm-4 text-right" style="padding-top: 20px">
                ' . GridBulkActions::widget(['gridId' => 'user-grid']) . '
            </div>
        </div>', 'columns' => [['class' => 'yii\\grid\\CheckboxColumn', 'options' => ['style' => 'width:10px']], ['class' => 'yii\\grid\\SerialColumn', 'options' => ['style' => 'width:10px']], ['attribute' => 'id', 'header' => '№', 'filterInputOptions' => ['class' => 'form-control input-sm']], ['attribute' => 'content', 'format' => 'raw', 'contentOptions' => ['style' => 'text-align: left'], 'filterInputOptions' => ['class' => 'form-control input-sm']], ['class' => 'roman444uk\\yii\\grid\\AjaxUpdateColumn', 'attribute' => 'status', 'fieldType' => AjaxUpdateColumn::FIELD_TYPE_DROPDOWN, 'fieldOptions' => ['class' => 'form-control input-sm', 'items' => Advert::getTranslatedStatusList()], 'filter' => Advert::getTranslatedStatusList(), 'filterInputOptions' => ['class' => 'form-control input-sm'], 'updateUrl' => function ($model, $key, $index) {
    return Yii::$app->urlManager->createUrl(['advert/update', 'id' => $key]);
}, 'errorUpdate' => new JsExpression("function() {\n                alert('error updating');\n            }")], ['class' => 'roman444uk\\yii\\grid\\AjaxUpdateColumn', 'attribute' => 'category', 'fieldType' => AjaxUpdateColumn::FIELD_TYPE_DROPDOWN, 'fieldOptions' => ['class' => 'form-control input-sm', 'items' => Category::getDropdownList()], 'filter' => Category::getDropdownList(), 'filterInputOptions' => ['class' => 'form-control input-sm'], 'updateUrl' => function ($model, $key, $index) {
    return Yii::$app->urlManager->createUrl(['advert/update', 'id' => $key]);
}, 'errorUpdate' => new JsExpression("function() {\n                alert('error updating');\n            }")], ['attribute' => 'city_id', 'header' => 'Город', 'value' => function ($model, $key, $index) {