/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = PlayerAlbum::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'thumbnail_base_url', $this->thumbnail_base_url])->andFilterWhere(['like', 'thumbnail_path', $this->thumbnail_path])->andFilterWhere(['like', 'url', $this->url]);
     return $dataProvider;
 }
Exemple #2
0
<?php

use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\widgets\DetailView;
use common\models\PlayerAlbum;
/* @var $this yii\web\View */
/* @var $model common\models\PlayerAlbum */
$this->title = $model->user->username;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common', 'Player Albums'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="player-album-view">

	<p>
		<?php 
echo Html::a(Yii::t('backend', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>
		<?php 
echo Html::a(Yii::t('backend', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('backend', 'Are you sure you want to delete this item?'), 'method' => 'post']]);
?>
	</p>

	<?php 
echo DetailView::widget(['model' => $model, 'attributes' => [['attribute' => 'user_id', 'value' => $model->user->username], ['attribute' => 'thumbnail', 'format' => 'html', 'value' => Html::img(Yii::$app->glide->createSignedUrl(['glide/index', 'path' => $model->thumbnail_path, 'w' => 100], true), ['class' => 'img-responsive'])], 'url:url', 'created_at:datetime', 'updated_at:datetime', ['attribute' => 'status', 'value' => ArrayHelper::getValue(PlayerAlbum::getStatus(), $model->status)]]]);
?>

</div>
 /**
  * Finds the PlayerAlbum model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return PlayerAlbum the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = PlayerAlbum::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemple #4
0
 public static function getStatusInUsePlayerAlbum()
 {
     return PlayerAlbum::find()->where(['status' => PlayerAlbum::STATUS_IN_USE])->orderBy('updated_at DESC')->all();
 }