Example #1
0
use common\models\Game;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\search\GameSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('common', 'Games');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="game-index">

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

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

	<?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'category_id', 'value' => function ($model) {
    return $model->category ? $model->category->title : null;
}, 'filter' => ArrayHelper::map(\common\models\GameCategory::find()->all(), 'id', 'title')], 'name', 'short', ['attribute' => 'thumbnail', 'format' => 'html', 'value' => function ($model) {
    return Html::img(Yii::$app->glide->createSignedUrl(['glide/index', 'path' => $model->thumbnail_path, 'w' => 150], true), ['class' => 'img-responsive']);
}], ['attribute' => 'attr', 'value' => function ($model) {
    return ArrayHelper::getValue(Game::getAttr(), $model->attr);
}, 'filter' => Game::getAttr()], ['class' => \common\grid\EnumColumn::className(), 'attribute' => 'status', 'enum' => [Yii::t('common', 'Not Used'), Yii::t('common', 'In Use')]], ['class' => \common\grid\EnumColumn::className(), 'attribute' => 'is_recommend', 'enum' => [Yii::t('common', 'Not'), Yii::t('common', 'Yes')]], 'sort', ['class' => 'yii\\grid\\ActionColumn']], 'layout' => "{items}\n{summary}\n{pager}"]);
?>

</div>
Example #2
0
?>
	<?php 
echo $form->field($model, 'api_pay');
?>
	<?php 
echo $form->field($model, 'api_check');
?>
	<?php 
echo $form->field($model, 'api_order');
?>

	<?php 
echo $form->field($model, 'q');
?>
	<?php 
echo $form->field($model, 'attr')->dropDownList(Game::getAttr());
?>
	<?php 
echo $form->field($model, 'status')->radioList(Game::getStatus());
?>
	<?php 
echo $form->field($model, 'is_recommend')->checkbox();
?>

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

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

use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\widgets\DetailView;
use common\models\Game;
/* @var $this yii\web\View */
/* @var $model common\models\Game */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common', 'Games'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="game-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' => 'category_id', 'value' => \common\models\GameCategory::find()->where(['id' => $model->category_id])->one()['title']], 'name', 'description:ntext', 'short', 'api_key', 'factory', 'cname', ['attribute' => 'thumbnail', 'format' => 'html', 'value' => Html::img(Yii::$app->glide->createSignedUrl(['glide/index', 'path' => $model->thumbnail_path], true), ['class' => 'img-responsive'])], ['attribute' => 'bg_image', 'format' => 'html', 'value' => Html::img(Yii::$app->glide->createSignedUrl(['glide/index', 'path' => $model->bg_image_path], true), ['class' => 'img-responsive'])], 'coin', 'coin_rate', 'game_web_url:url', 'game_bbs_url:url', 'api_secret', 'api_server', 'api_play', 'api_pay', 'api_check', 'api_order', 'q', ['attribute' => 'attr', 'value' => ArrayHelper::getValue(Game::getAttr(), $model->attr)], ['attribute' => 'is_recommend', 'value' => \common\models\Game::IS_RECOMMEND_YES == $model->is_recommend ? Yii::t('common', 'Yes') : Yii::t('common', 'Not')], 'slug', 'created_at:datetime', 'updated_at:datetime', ['attribute' => 'status', 'value' => \common\models\Game::STATUS_IN_USE == $model->status ? Yii::t('common', 'In Use') : Yii::t('common', 'Not Used')], 'sort']]);
?>

</div>