Ejemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = IndexSlide::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'game_id' => $this->game_id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'status' => $this->status, 'sort' => $this->sort]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'caption', $this->caption])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'access_url', $this->access_url])->andFilterWhere(['like', 'official_url', $this->official_url])->andFilterWhere(['like', 'thumbnail_base_url', $this->thumbnail_base_url])->andFilterWhere(['like', 'thumbnail_path', $this->thumbnail_path]);
     return $dataProvider;
 }
Ejemplo n.º 2
0
use yii\helpers\ArrayHelper;
use yii\grid\GridView;
use common\models\IndexSlide;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\search\IndexSlideSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('common', 'Index Slide');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="index-slide-index">

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

	<p>
		<?php 
echo Html::a(Yii::t('backend', 'Create {modelClass}', ['modelClass' => Yii::t('common', 'Index Slide')]), ['create'], ['class' => 'btn btn-success']);
?>
	</p>

	<?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'game_id', 'value' => function ($model) {
    return $model->game->name;
}, 'filter' => ArrayHelper::map(\common\models\Game::find()->statusInUse()->all(), 'id', 'name')], 'name', 'sort', ['attribute' => 'thumbnail', 'format' => 'html', 'value' => function ($model) {
    return Html::img(Yii::$app->glide->createSignedUrl(['glide/index', 'path' => $model->thumbnail_path, 'w' => '600'], true), ['class' => 'img-responsive']);
}], ['class' => \common\grid\EnumColumn::className(), 'attribute' => 'status', 'enum' => IndexSlide::getStatus()], ['class' => 'yii\\grid\\ActionColumn']], 'layout' => "{items}\n{summary}\n{pager}"]);
?>

</div>
Ejemplo n.º 3
0
 public static function getActiveIndexSlide()
 {
     return IndexSlide::find()->where(['status' => IndexSlide::STATUS_IN_USE])->orderBy('sort ASC')->all();
 }
Ejemplo n.º 4
0
echo $form->field($model, 'thumbnail')->widget(\trntv\filekit\widget\Upload::className(), ['url' => ['/file-storage/upload'], 'maxFileSize' => 5000000]);
?>

	<?php 
echo $form->field($model, 'sort')->textInput();
?>

	<?php 
echo $form->field($model, 'access_url')->textInput(['maxlength' => true]);
?>

	<?php 
echo $form->field($model, 'official_url')->textInput(['maxlength' => true]);
?>

	<?php 
echo $form->field($model, 'status')->dropDownList(IndexSlide::getStatus());
?>

	<div class="form-group">
		<?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('common', 'Create') : Yii::t('common', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
	</div>

	<?php 
ActiveForm::end();
?>

</div>
Ejemplo n.º 5
0
 /**
  * Finds the IndexSlide model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return IndexSlide the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = IndexSlide::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }