コード例 #1
0
 public function actionIndex($slug)
 {
     $query = Vidmage::find()->joinWith('vidmageCategories.category')->where(['category.slug' => $slug])->orderBy(['id' => SORT_DESC]);
     $vidmages = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]]);
     $channel = Category::findOne(['slug' => $slug]);
     return $this->render('index', compact('vidmages', 'channel'));
 }
コード例 #2
0
 public function actionIndex($slug)
 {
     $query = Vidmage::find()->joinWith('vidmageAuthors.author')->where(['author.slug' => $slug])->orderBy(['id' => SORT_DESC]);
     $vidmages = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]]);
     $author = Author::findOne(['slug' => $slug]);
     return $this->render('index', compact('vidmages', 'author'));
 }
コード例 #3
0
 public function actionIndex($slug)
 {
     $query = Vidmage::find()->joinWith('vidmageTags.tag')->where(['tag.name' => $slug])->orderBy(['id' => SORT_DESC]);
     $vidmages = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]]);
     $tag = Tag::findOne(['name' => $slug]);
     return $this->render('index', compact('vidmages', 'tag'));
 }
コード例 #4
0
 public function actionIndex($slug)
 {
     $meme = Meme::findOne(['slug' => $slug]);
     $query = Vidmage::find()->joinWith('memeVidmages.meme')->where(['meme.id' => $meme->id])->andWhere(['meme_vidmage.is_the_origin' => false]);
     $vidmages = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]]);
     return $this->render('index', compact('meme', 'vidmages'));
 }
コード例 #5
0
 /**
 * Creates data provider instance with search query applied
 *
 * @param array $params
 *
 * @return ActiveDataProvider
 */
 public function search($params)
 {
     $query = Vidmage::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id, 'platform_id' => $this->platform_id, 'views' => $this->views, 'is_active' => $this->is_active, 'created_by' => $this->created_by, 'updated_by' => $this->updated_by, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'slug', $this->slug])->andFilterWhere(['like', 'id_url', $this->id_url]);
     return $dataProvider;
 }
コード例 #6
0
ファイル: _form.php プロジェクト: RubenDjOn/originofthememes
            <?php 
$form = ActiveForm::begin(['id' => 'MemeVidmage', 'layout' => 'horizontal', 'enableClientValidation' => true, 'errorSummaryCssClass' => 'error-summary alert alert-error']);
?>

            <div class="">
                <?php 
$this->beginBlock('main');
?>

                <p>
            <?php 
echo $form->field($model, 'meme_id')->dropDownList(Meme::getMappedArray());
?>
            <?php 
echo $form->field($model, 'vidmage_id')->dropDownList(Vidmage::getMappedArray());
?>
			<?php 
echo $form->field($model, 'is_the_origin')->checkBox();
?>
			<?php 
echo $form->field($model, 'likes')->textInput();
?>
                </p>
                <?php 
$this->endBlock();
?>

                <?php 
echo Tabs::widget(['encodeLabels' => false, 'items' => [['label' => 'MemeVidmage', 'content' => $this->blocks['main'], 'active' => true]]]);
?>
コード例 #7
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getVidmages()
 {
     return $this->hasMany(\common\models\Vidmage::className(), ['platform_id' => 'id']);
 }
コード例 #8
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getVidmage()
 {
     return $this->hasOne(\common\models\Vidmage::className(), ['id' => 'vidmage_id']);
 }
コード例 #9
0
<?php

use yii\helpers\Html;
use common\models\Category;
use common\models\Tag;
use common\models\Author;
use common\models\Meme;
use common\models\Vidmage;
use common\helpers\Tools;
$channels = Category::find()->all();
$tags = Tag::find()->orderBy(['recount' => SORT_DESC])->limit(10)->all();
$authors = Author::find()->orderBy(['recount' => SORT_DESC])->limit(5)->all();
$latestMemes = Meme::find()->orderBy(['id' => SORT_DESC])->limit(10)->all();
$latestReplicas = Vidmage::find()->joinWith('memeVidmages')->where(['meme_vidmage.is_the_origin' => false])->orderBy(['id' => SORT_DESC])->limit(10)->all();
?>

<?php 
echo $this->render('_left-column-list-items', ['items' => $latestMemes, 'title' => 'Latest Memes', 'icon' => 'globe', 'divId' => 'latest-memes', 'class' => 'success']);
?>

<?php 
echo $this->render('_left-column-list-items', ['items' => $latestReplicas, 'title' => 'Latest Replicas', 'icon' => 'film', 'divId' => 'latest-replicas', 'class' => 'info']);
?>

<?php 
echo $this->render('_left-column-list-items', ['items' => $channels, 'title' => 'Channels', 'icon' => 'blackboard', 'divId' => 'channels', 'class' => 'warning']);
?>

<?php 
echo $this->render('_left-column-list-items', ['items' => $tags, 'title' => 'Trending Tags', 'icon' => 'tag', 'divId' => 'tags', 'class' => 'danger']);
?>
コード例 #10
0
ファイル: _form.php プロジェクト: RubenDjOn/originofthememes
                            Vidmage Origin
                        </label>
                        <div class="col-sm-6">
                            <?php 
echo Select2::widget(['name' => 'memeVidmageOrigin', 'data' => Vidmage::getMappedArray(), 'value' => $model->originMemeVidmageAsArray, 'options' => ['placeholder' => 'Select Vidmage Origin ...', 'multiple' => false], 'pluginOptions' => ['tags' => false]]);
?>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="control-label col-sm-3" for="meme-memevidmages">
                            Vidmages
                        </label>
                        <div class="col-sm-6">
                            <?php 
echo Select2::widget(['name' => 'memeVidmages', 'data' => Vidmage::getMappedArray(), 'value' => ArrayHelper::getColumn($model->notOriginMemeVidmages, 'vidmage_id'), 'options' => ['placeholder' => 'Select a Vidmage ...', 'multiple' => true], 'pluginOptions' => ['tags' => true]]);
?>
                        </div>
                    </div>

                    <?php 
echo $form->field($model, 'description')->widget(Summernote::className(), ['clientOptions' => []]);
?>

                    <?php 
echo $form->field($model, 'url_info')->textInput(['maxlength' => true]);
?>
                </p>
                <?php 
$this->endBlock();
?>
コード例 #11
0
 /**
  * Finds the Vidmage model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Vidmage the loaded model
  * @throws HttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Vidmage::findOne($id)) !== null) {
         return $model;
     } else {
         throw new HttpException(404, 'The requested page does not exist.');
     }
 }
コード例 #12
-4
 public function actionIndex()
 {
     $mostPopularMeme = Meme::mostPopular();
     $newReplicas = Vidmage::find()->joinWith('memeVidmages')->where(['meme_vidmage.is_the_origin' => false])->orderBy(['id' => SORT_DESC])->limit(4)->all();
     $editorMemePick = Meme::findOne(7);
     $newMemes = Meme::find()->joinWith('memeVidmages')->where(['meme_vidmage.is_the_origin' => true])->orderBy(['id' => SORT_DESC])->limit(4)->all();
     return $this->render('index', compact('mostPopularMeme', 'newReplicas', 'editorMemePick', 'newMemes'));
 }