コード例 #1
0
 protected function launch()
 {
     if (!$this->tag instanceof Tag) {
         $this->tag = Tag::findOne(intval($this->tag));
     }
     if (empty($this->tag)) {
         throw new InvalidConfigException(Yii::t('gromver.platform', 'Tag not found.'));
     }
     echo $this->render($this->layout, ['dataProvider' => new ActiveDataProvider(['query' => $this->tag->getTagToItems(), 'pagination' => ['pageSize' => $this->pageSize]]), 'itemLayout' => $this->itemLayout, 'model' => $this->tag]);
     $this->getView()->registerAssetBundle(TagAsset::className());
 }
コード例 #2
0
 public function init()
 {
     parent::init();
     $this->language or $this->language = Yii::$app->language;
     $this->_tags = (new Query())->select('t.id, t.title, t.alias, t.language, count(t2m.item_id) AS weight')->from(Tag::tableName() . ' t')->innerJoin(Tag::pivotTableName() . ' t2m', 't.id=t2m.tag_id')->where(['t.language' => $this->language])->groupBy('t.id')->all();
     shuffle($this->_tags);
 }
コード例 #3
0
 public function loadModel($id)
 {
     if (!($model = Tag::findOne($id))) {
         throw new NotFoundHttpException(Yii::t('gromver.platform', 'The requested tag does not exist.'));
     }
     return $model;
 }
コード例 #4
0
 /**
  * @param $event \Yii\base\Event
  */
 public function afterSave($event)
 {
     $this->owner->getDb()->transaction(function () use($event) {
         if (isset($this->_tags) && is_array($this->_tags)) {
             $newTags = $this->_tags;
             $this->_tags = null;
             $oldTags = ArrayHelper::map($this->owner->tags, 'id', 'id');
             $this->owner->setIsNewRecord(false);
             $toAppend = array_diff($newTags, $oldTags);
             $toRemove = array_diff($oldTags, $newTags);
             foreach ($toAppend as $id) {
                 if ($tag = Tag::findOne($id)) {
                     $this->owner->link('tags', $tag, ['item_class' => $this->owner->className()]);
                 }
             }
             if ($event->name == BaseActiveRecord::EVENT_AFTER_UPDATE) {
                 foreach ($toRemove as $id) {
                     if ($tag = Tag::findOne($id)) {
                         $this->owner->unlink('tags', $tag, true);
                     }
                 }
             }
         }
     });
 }
コード例 #5
0
 /**
  * @param \gromver\platform\basic\components\MenuRequestInfo $requestInfo
  * @return array
  */
 public function parseTagCloud($requestInfo)
 {
     if (preg_match('/^\\d+$/', $requestInfo->requestRoute)) {
         return ['grom/tag/frontend/default/view', ['id' => $requestInfo->requestRoute]];
     } else {
         /** @var Tag $tag */
         if ($tag = Tag::findOne(['alias' => $requestInfo->requestRoute, 'language' => $requestInfo->menuMap->language])) {
             return ['grom/tag/frontend/default/view', ['id' => $tag->id, 'alias' => $tag->alias, UrlManager::LANGUAGE_PARAM => $requestInfo->menuMap->language]];
         }
     }
 }
コード例 #6
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Tag::find()->with(['translations']);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'status' => $this->status, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'created_by' => $this->created_by, 'updated_by' => $this->updated_by, 'hits' => $this->hits, 'lock' => $this->lock]);
     $query->andFilterWhere(['like', 'language', $this->language])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'alias', $this->alias])->andFilterWhere(['like', 'group', $this->group])->andFilterWhere(['like', 'metakey', $this->metakey])->andFilterWhere(['like', 'metadesc', $this->metadesc]);
     return $dataProvider;
 }
コード例 #7
0
 */
$this->title = Yii::t('gromver.platform', 'Select Post');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="post-index">

    <?php 
/*<h1><?= Html::encode($this->title) ?></h1>*/
?>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'id' => 'grid', 'pjax' => true, 'pjaxSettings' => ['neverTimeout' => true], 'columns' => [['attribute' => 'id', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'width' => '60px'], ['attribute' => 'category_id', 'vAlign' => GridView::ALIGN_MIDDLE, 'width' => '80px', 'value' => function ($model) {
    return @$model->category->title;
}, 'filter' => \yii\helpers\ArrayHelper::map(\gromver\platform\basic\modules\news\models\Category::find()->excludeRoots()->orderBy('lft')->all(), 'id', function ($model) {
    return str_repeat(" • ", max($model->level - 2, 0)) . $model->title;
})], ['attribute' => 'language', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'width' => '60px', 'filter' => Yii::$app->getAcceptedLanguagesList()], ['attribute' => 'title', 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    /** @var $model \gromver\platform\basic\modules\news\models\Post */
    return $model->title . '<br/>' . Html::tag('small', $model->alias, ['class' => 'text-muted']);
}, 'format' => 'html'], ['attribute' => 'status', 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    /** @var $model \gromver\platform\basic\modules\news\models\Post */
    return $model->getStatusLabel();
}, 'width' => '100px', 'filter' => \gromver\platform\basic\modules\news\models\Post::statusLabels()], ['attribute' => 'published_at', 'vAlign' => GridView::ALIGN_MIDDLE, 'format' => ['date', 'd MMM Y H:mm'], 'width' => '160px', 'filterType' => GridView::FILTER_DATE, 'filterWidgetOptions' => ['pluginOptions' => ['format' => 'dd.mm.yyyy'], 'type' => \kartik\date\DatePicker::TYPE_RANGE, 'attribute2' => 'published_at_to']], ['attribute' => 'tags', 'width' => '120px', 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    /** @var $model \gromver\platform\basic\modules\news\models\Category */
    return implode(', ', \yii\helpers\ArrayHelper::map($model->tags, 'id', 'title'));
}, 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => \yii\helpers\ArrayHelper::map(\gromver\platform\basic\modules\tag\models\Tag::find()->where(['id' => $searchModel->tags])->all(), 'id', 'title'), 'theme' => \kartik\select2\Select2::THEME_BOOTSTRAP, 'pluginOptions' => ['allowClear' => true, 'placeholder' => Yii::t('gromver.platform', 'Select ...'), 'ajax' => ['url' => \yii\helpers\Url::to(['/grom/tag/backend/default/tag-list'])]]]], ['header' => Yii::t('gromver.platform', 'Action'), 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) use($route) {
    /** @var $model \gromver\platform\basic\modules\news\models\Post */
    return Html::a(Yii::t('gromver.platform', 'Select'), '#', ['class' => 'btn btn-primary btn-xs', 'onclick' => \gromver\widgets\ModalIFrame::postDataJs(['id' => $model->id, 'title' => $model->title, 'description' => Yii::t('gromver.platform', 'Post: {title}', ['title' => $model->title]), 'route' => \gromver\platform\basic\modules\menu\models\MenuItem::toRoute($route, ['id' => $model->id]), 'link' => Yii::$app->urlManager->createUrl($model->getFrontendViewLink()), 'value' => $model->id . ':' . $model->alias])]);
}, 'width' => '80px', 'mergeHeader' => true, 'format' => 'raw']], 'responsive' => true, 'hover' => true, 'condensed' => true, 'floatHeader' => true, 'floatHeaderOptions' => ['scrollingTop' => 0], 'bordered' => false, 'panel' => ['heading' => '<h3 class="panel-title"><i class="glyphicon glyphicon-th-list"></i> ' . Html::encode($this->title) . '</h3>', 'type' => 'info', 'after' => Html::a('<i class="glyphicon glyphicon-repeat"></i> ' . Yii::t('gromver.platform', 'Reset List'), [null], ['class' => 'btn btn-info']), 'showFooter' => false]]);
?>

</div>
コード例 #8
0
ファイル: index.php プロジェクト: gromver/yii2-platform-basic
    'modelClass' => 'Category',
]), ['create'], ['class' => 'btn btn-success']) ?>
    </p>*/
?>

    <?php 
echo GridView::widget(['id' => 'table-grid', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'pjax' => true, 'pjaxSettings' => ['neverTimeout' => true], 'columns' => [['class' => '\\kartik\\grid\\CheckboxColumn'], ['attribute' => 'id', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'width' => '60px'], ['attribute' => 'language', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'width' => '80px', 'value' => function ($model) {
    /** @var \gromver\platform\basic\modules\news\models\Category $model */
    return \gromver\platform\basic\modules\main\widgets\TranslationsBackend::widget(['model' => $model]);
}, 'format' => 'raw', 'filter' => Yii::$app->getAcceptedLanguagesList()], ['attribute' => 'title', 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    /** @var \gromver\platform\basic\modules\news\models\Category $model */
    return str_repeat(" • ", max($model->level - 2, 0)) . $model->title . '<br/>' . Html::tag('small', ' — ' . $model->path, ['class' => 'text-muted']);
}, 'format' => 'html'], ['attribute' => 'tags', 'width' => '120px', 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    /** @var $model \gromver\platform\basic\modules\news\models\Category */
    return implode(', ', \yii\helpers\ArrayHelper::map($model->tags, 'id', 'title'));
}, 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => \yii\helpers\ArrayHelper::map(\gromver\platform\basic\modules\tag\models\Tag::find()->where(['id' => $searchModel->tags])->all(), 'id', 'title'), 'theme' => \kartik\select2\Select2::THEME_BOOTSTRAP, 'pluginOptions' => ['allowClear' => true, 'placeholder' => Yii::t('gromver.platform', 'Select ...'), 'ajax' => ['url' => \yii\helpers\Url::to(['/grom/tag/backend/default/tag-list'])]]]], ['attribute' => 'published_at', 'vAlign' => GridView::ALIGN_MIDDLE, 'format' => ['date', 'd MMM Y H:mm'], 'width' => '160px', 'filterType' => GridView::FILTER_DATE, 'filterWidgetOptions' => ['pluginOptions' => ['format' => 'dd.mm.yyyy'], 'type' => \kartik\date\DatePicker::TYPE_RANGE, 'attribute2' => 'published_at_to']], ['attribute' => 'status', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model, $index, $widget) {
    /** @var $model \gromver\platform\basic\modules\news\models\Category */
    return $model->status === \gromver\platform\basic\modules\news\models\Category::STATUS_PUBLISHED ? Html::a('<i class="glyphicon glyphicon-ok-circle"></i>', \yii\helpers\Url::to(['unpublish', 'id' => $model->id]), ['class' => 'btn btn-default btn-xs', 'data-pjax' => '0', 'data-method' => 'post']) : Html::a('<i class="glyphicon glyphicon-remove-circle"></i>', \yii\helpers\Url::to(['publish', 'id' => $model->id]), ['class' => 'btn btn-danger btn-xs', 'data-pjax' => '0', 'data-method' => 'post']);
}, 'filter' => \gromver\platform\basic\modules\news\models\Category::statusLabels(), 'format' => 'raw', 'width' => '100px'], ['attribute' => 'ordering', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model, $index) {
    /** @var \gromver\platform\basic\modules\news\models\Category $model */
    return Html::input('text', 'order', $model->ordering, ['class' => 'form-control']);
}, 'format' => 'raw', 'width' => '100px'], ['header' => Yii::t('gromver.platform', 'Posts'), 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    /** @var \gromver\platform\basic\modules\news\models\Category $model */
    return Html::a('(' . $model->getPosts()->count() . ')', ['/grom/news/backend/post/index', 'PostSearch[category_id]' => $model->id], ['data-pjax' => 0]);
}, 'mergeHeader' => true, 'format' => 'raw'], ['class' => 'kartik\\grid\\ActionColumn', 'deleteOptions' => ['data-method' => 'delete']]], 'responsive' => true, 'hover' => true, 'condensed' => true, 'floatHeader' => true, 'bordered' => false, 'panel' => ['heading' => '<h3 class="panel-title"><i class="glyphicon glyphicon-th-list"></i> ' . Html::encode($this->title) . ' </h3>', 'type' => 'info', 'before' => Html::a('<i class="glyphicon glyphicon-plus"></i> ' . Yii::t('gromver.platform', 'Add'), ['create'], ['class' => 'btn btn-success', 'data-pjax' => '0']), 'after' => Html::a('<i class="glyphicon glyphicon-sort-by-attributes"></i> ' . Yii::t('gromver.platform', 'Ordering'), ['ordering'], ['class' => 'btn btn-default', 'data-pjax' => '0', 'onclick' => 'processOrdering(this); return false']) . ' ' . Html::a('<i class="glyphicon glyphicon-trash"></i> ' . Yii::t('gromver.platform', 'Delete'), ['bulk-delete'], ['class' => 'btn btn-danger', 'data-pjax' => '0', 'onclick' => 'processAction(this); return false']) . ' ' . Html::a('<i class="glyphicon glyphicon-repeat"></i> ' . Yii::t('gromver.platform', 'Reset List'), ['index'], ['class' => 'btn btn-info']), 'showFooter' => false]]);
?>

</div>
<script>
    function processOrdering(el) {
        var $el = $(el),
コード例 #9
0
 /**
  * @param \gromver\platform\basic\components\MenuRequestInfo $requestInfo
  * @return array
  */
 public function parseAllPosts($requestInfo)
 {
     if ($requestInfo->requestRoute == 'rss') {
         return ['grom/news/frontend/post/rss', []];
     } elseif (preg_match("#^(\\d{4})/(\\d{1,2})/(\\d{1,2})\$#", $requestInfo->requestRoute, $matches)) {
         //новости за определенную дату
         return ['grom/news/frontend/post/day', ['year' => $matches[1], 'month' => $matches[2], 'day' => $matches[3]]];
     } elseif (preg_match("#^((.*)/)(([^/]+)\\.{$this->postSuffix})\$#", $requestInfo->requestRoute, $matches)) {
         //ищем пост
         $categoryPath = $matches[2];
         //путь категории поста
         $postAlias = $matches[4];
         //алиас поста
         /** @var Category $category */
         $category = Category::findOne(['path' => $categoryPath, 'language' => $requestInfo->menuMap->language]);
         if ($category && ($postId = Post::find()->select('id')->where(['alias' => $postAlias, 'category_id' => $category->id])->scalar())) {
             return ['grom/news/frontend/post/view', ['id' => $postId]];
         }
     } elseif (preg_match("#^(tag/([^/]+))\$#", $requestInfo->requestRoute, $matches)) {
         //ищем тег
         $tagAlias = $matches[2];
         if ($tagId = Tag::find()->select('id')->where(['alias' => $tagAlias, 'language' => \Yii::$app->language])->scalar()) {
             //return ['grom/tag/frontend/default/posts', ['tag_id' => $tagId]];
             return ['grom/news/frontend/post/tag', ['tag_id' => $tagId]];
         }
     }
 }
コード例 #10
0
 * @var yii\data\ActiveDataProvider $dataProvider
 * @var gromver\platform\basic\modules\tag\models\TagSearch $searchModel
 * @var string $route
 */
$this->title = Yii::t('gromver.platform', 'Select Tag');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="tag-index">

	<?php 
/*<h1><?= Html::encode($this->title) ?></h1>*/
?>

	<?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

	<?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'id' => 'grid', 'pjax' => true, 'pjaxSettings' => ['neverTimeout' => true], 'columns' => [['attribute' => 'id', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'width' => '60px'], ['attribute' => 'language', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'width' => '60px', 'filter' => Yii::$app->getAcceptedLanguagesList()], ['attribute' => 'title', 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    /** @var $model \gromver\platform\basic\modules\tag\models\Tag */
    return $model->title . '<br/>' . Html::tag('small', $model->alias, ['class' => 'text-muted']);
}, 'format' => 'html'], ['attribute' => 'group', 'width' => '150px', 'vAlign' => GridView::ALIGN_MIDDLE, 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => \yii\helpers\ArrayHelper::map(\gromver\platform\basic\modules\tag\models\Tag::find()->groupBy('group')->andWhere('[[group]] != "" AND [[group]] IS NOT NULL')->all(), 'group', 'group'), 'theme' => \kartik\select2\Select2::THEME_BOOTSTRAP, 'pluginOptions' => ['allowClear' => true, 'multiple' => false, 'placeholder' => Yii::t('gromver.platform', 'Select ...')]]], ['attribute' => 'status', 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    /** @var $model \gromver\platform\basic\modules\tag\models\Tag */
    return $model->getStatusLabel();
}, 'width' => '100px', 'filter' => \gromver\platform\basic\modules\tag\models\Tag::statusLabels()], ['header' => Yii::t('gromver.platform', 'Action'), 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) use($route) {
    /** @var $model \gromver\platform\basic\modules\tag\models\Tag */
    return Html::a(Yii::t('gromver.platform', 'Select'), '#', ['class' => 'btn btn-primary btn-xs', 'onclick' => \gromver\widgets\ModalIFrame::postDataJs(['id' => $model->id, 'title' => $model->title, 'description' => Yii::t('gromver.platform', 'Tag: {title}', ['title' => $model->title]), 'route' => \gromver\platform\basic\modules\menu\models\MenuItem::toRoute($route, ['id' => $model->id]), 'link' => Yii::$app->urlManager->createUrl($model->getFrontendViewLink()), 'value' => $model->id . ':' . $model->alias])]);
}, 'width' => '80px', 'mergeHeader' => true, 'format' => 'raw']], 'responsive' => true, 'hover' => true, 'condensed' => true, 'floatHeader' => true, 'floatHeaderOptions' => ['scrollingTop' => 0], 'bordered' => false, 'panel' => ['heading' => '<h3 class="panel-title"><i class="glyphicon glyphicon-th-list"></i> ' . Html::encode($this->title) . '</h3>', 'type' => 'info', 'after' => Html::a('<i class="glyphicon glyphicon-repeat"></i> ' . Yii::t('gromver.platform', 'Reset List'), [null], ['class' => 'btn btn-info']), 'showFooter' => false]]);
?>

</div>
コード例 #11
0
ファイル: index.php プロジェクト: gromver/yii2-platform-basic
    'modelClass' => 'Tag',
]), ['create'], ['class' => 'btn btn-success']) ?>
    </p>*/
?>

    <?php 
echo GridView::widget(['id' => 'table-grid', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'pjax' => true, 'pjaxSettings' => ['neverTimeout' => true], 'columns' => [['class' => '\\kartik\\grid\\CheckboxColumn'], ['attribute' => 'id', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'width' => '60px'], ['attribute' => 'language', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'width' => '80px', 'value' => function ($model) {
    /** @var $model \gromver\platform\basic\modules\tag\models\Tag */
    return \gromver\platform\basic\modules\main\widgets\TranslationsBackend::widget(['model' => $model]);
}, 'format' => 'html', 'filter' => Yii::$app->getAcceptedLanguagesList()], ['attribute' => 'title', 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    /** @var \gromver\platform\basic\modules\tag\models\Tag $model */
    return $model->title . '<br/>' . Html::tag('small', ' — ' . $model->alias, ['class' => 'text-muted']);
}, 'format' => 'html'], ['attribute' => 'group', 'width' => '150px', 'vAlign' => GridView::ALIGN_MIDDLE, 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['data' => \yii\helpers\ArrayHelper::map(\gromver\platform\basic\modules\tag\models\Tag::find()->groupBy('group')->andWhere('[[group]] != "" AND [[group]] IS NOT NULL')->all(), 'group', 'group'), 'theme' => \kartik\select2\Select2::THEME_BOOTSTRAP, 'pluginOptions' => ['allowClear' => true, 'multiple' => false, 'placeholder' => Yii::t('gromver.platform', 'Select ...')]]], ['attribute' => 'status', 'hAlign' => GridView::ALIGN_CENTER, 'vAlign' => GridView::ALIGN_MIDDLE, 'value' => function ($model) {
    /** @var $model \gromver\platform\basic\modules\tag\models\Tag */
    return $model->status === \gromver\platform\basic\modules\tag\models\Tag::STATUS_PUBLISHED ? Html::a('<i class="glyphicon glyphicon-ok-circle"></i>', \yii\helpers\Url::to(['unpublish', 'id' => $model->id]), ['class' => 'btn btn-default btn-xs', 'data-pjax' => '0', 'data-method' => 'post']) : Html::a('<i class="glyphicon glyphicon-remove-circle"></i>', \yii\helpers\Url::to(['publish', 'id' => $model->id]), ['class' => 'btn btn-danger btn-xs', 'data-pjax' => '0', 'data-method' => 'post']);
}, 'filter' => \gromver\platform\basic\modules\tag\models\Tag::statusLabels(), 'format' => 'raw', 'width' => '80px'], ['class' => 'kartik\\grid\\ActionColumn', 'deleteOptions' => ['data-method' => 'delete']]], 'responsive' => true, 'hover' => true, 'condensed' => true, 'floatHeader' => true, 'bordered' => false, 'panel' => ['heading' => '<h3 class="panel-title"><i class="glyphicon glyphicon-th-list"></i> ' . Html::encode($this->title) . ' </h3>', 'type' => 'info', 'before' => Html::a('<i class="glyphicon glyphicon-plus"></i> ' . Yii::t('gromver.platform', 'Add'), ['create'], ['class' => 'btn btn-success', 'data-pjax' => 0]), 'after' => Html::a('<i class="glyphicon glyphicon-trash"></i> ' . Yii::t('gromver.platform', 'Delete'), ['bulk-delete'], ['class' => 'btn btn-danger', 'data-pjax' => '0', 'onclick' => 'processAction(this); return false']) . ' ' . Html::a('<i class="glyphicon glyphicon-repeat"></i> ' . Yii::t('gromver.platform', 'Reset List'), ['index'], ['class' => 'btn btn-info']), 'showFooter' => false]]);
?>
</div>

<script>
    function processAction(el) {
        var $el = $(el),
            $grid = $('#table-grid'),
            selection = $grid.yiiGridView('getSelectedRows')
        if(!selection.length) {
            alert(<?php 
echo json_encode(Yii::t('gromver.platform', 'Select items.'));
?>
)
            return
        }
コード例 #12
0
<?php

/**
 * @var $this yii\web\View
 * @var $tags Tag[]
 */
use yii\helpers\Html;
use gromver\platform\basic\modules\tag\models\Tag;
echo Html::beginTag('div', ['class' => 'tag-cloud']);
foreach ($tags as $tag) {
    echo Html::a(Html::encode($tag['title']), Tag::frontendViewLink($tag), ['style' => 'font-size: ' . ($this->context->fontBase + $this->context->fontSpace / $this->context->maxWeight * $tag['weight']) . 'px', 'class' => 'tag']);
}
echo Html::endTag('div');
コード例 #13
0
ファイル: _form.php プロジェクト: gromver/yii2-platform-basic
        <div class="col-sm-6">
            <?php 
echo $form->field($model, 'alias', ['wrapperOptions' => ['class' => 'col-sm-9']])->textInput(['maxlength' => 255, 'placeholder' => Yii::t('gromver.platform', 'Auto-generate')]);
?>
        </div>
    </div>

    <div class="row">
        <div class="col-sm-6">
            <?php 
echo $form->field($model, 'language', ['wrapperOptions' => ['class' => 'col-sm-9']])->dropDownList(Yii::$app->getAcceptedLanguagesList(), ['prompt' => Yii::t('gromver.platform', 'Select ...')]);
?>
        </div>
        <div class="col-sm-6">
            <?php 
echo $form->field($model, 'group', ['wrapperOptions' => ['class' => 'col-sm-9']])->widget(\kartik\select2\Select2::className(), ['theme' => \kartik\select2\Select2::THEME_BOOTSTRAP, 'data' => \yii\helpers\ArrayHelper::map(\gromver\platform\basic\modules\tag\models\Tag::find()->groupBy('group')->andWhere('[[group]] != "" AND [[group]] IS NOT NULL')->all(), 'group', 'group'), 'pluginOptions' => ['tags' => true, 'allowClear' => true, 'multiple' => false, 'placeholder' => Yii::t('gromver.platform', 'Select ...')]]);
?>
        </div>
    </div>

    <div class="row">
        <div class="col-sm-6">
            <?php 
echo $form->field($model, 'status', ['wrapperOptions' => ['class' => 'col-sm-9']])->dropDownList(['' => Yii::t('gromver.platform', 'Select ...')] + $model->statusLabels());
?>
        </div>
        <div class="col-sm-6">

        </div>
    </div>
コード例 #14
0
 /**
  * Finds the Tag model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Tag the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Tag::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException(Yii::t('gromver.platform', 'The requested page does not exist.'));
     }
 }