コード例 #1
0
 protected function launch()
 {
     $tags = Post::find()->category($this->categoryId)->published()->innerJoinWith('tags', false)->select(['id' => '{{%core_tag}}.id', 'title' => '{{%core_tag}}.title', 'alias' => '{{%core_tag}}.alias', 'weight' => 'count({{%core_tag}}.id)'])->groupBy('{{%core_tag}}.id')->asArray()->all();
     $maxWeight = 0;
     array_walk($tags, function ($v) use(&$maxWeight) {
         $maxWeight = max($v['weight'], $maxWeight);
     });
     echo $this->render('tag/tagPostCloud', ['tags' => $tags, 'fontBase' => $this->fontBase, 'fontSpace' => $this->fontSpace, 'maxWeight' => $maxWeight, 'categoryId' => $this->categoryId]);
     $this->getView()->registerAssetBundle(TagAsset::className());
 }
コード例 #2
0
ファイル: TagItems.php プロジェクト: ezsky/yii2-platform-core
 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());
 }
コード例 #3
0
ファイル: TagCloud.php プロジェクト: ezsky/yii2-platform-core
 protected function launch()
 {
     echo $this->render('tag/tagCloud', ['tags' => $this->_tags]);
     $this->getView()->registerAssetBundle(TagAsset::className());
 }