kulcsok új és szerkesztési nézetek fordítása, legördülő lista alkalmazása type-ra

This commit is contained in:
rocho 2015-12-01 17:55:28 +01:00
parent 4872abbb20
commit 783d889ec7
8 changed files with 36 additions and 11 deletions

View File

@ -18,8 +18,9 @@ class KeySearch extends Key
public function rules() public function rules()
{ {
return [ return [
[['id_key', 'status', 'type'], 'integer'], /*[['id_key', 'status', 'type'], 'integer'],
[['number', 'created_at', 'updated_at'], 'safe'], [['number', 'created_at', 'updated_at'], 'safe'],*/
[['number'], 'safe']
]; ];
} }

View File

@ -17,14 +17,14 @@ use common\models\Key;
<?= $form->field($model, 'status')->dropDownList( Key::statuses() ) /*->textInput()*/ ?> <?= $form->field($model, 'status')->dropDownList( Key::statuses() ) /*->textInput()*/ ?>
<?= $form->field($model, 'type')->textInput() ?> <?= $form->field($model, 'type')->dropDownList( Key::types() /* array(10=>"kulcs") // <--ez így ok */ ) /* $form->field($model, 'type')->textInput() */ ?>
<?php //echo $form->field($model, 'created_at')->textInput() ?> <?php //echo $form->field($model, 'created_at')->textInput() ?>
<?php //echo $form->field($model, 'updated_at')->textInput() ?> <?php //echo $form->field($model, 'updated_at')->textInput() ?>
<div class="form-group"> <div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('backend/key', 'Create') : Yii::t('backend/key', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> <?= Html::submitButton($model->isNewRecord ? Yii::t('backend/key', 'Create Save') : Yii::t('backend/key', 'Update Save'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div> </div>
<?php ActiveForm::end(); ?> <?php ActiveForm::end(); ?>

View File

@ -10,7 +10,10 @@ use common\models\Key;
?> ?>
<div class="key-search"> <div class="key-search">
<div class="row">
<div class="col-md-4">
<?php $form = ActiveForm::begin([ <?php $form = ActiveForm::begin([
'action' => ['index'], 'action' => ['index'],
'method' => 'get', 'method' => 'get',
@ -31,9 +34,11 @@ use common\models\Key;
<div class="form-group"> <div class="form-group">
<?= Html::submitButton(Yii::t('backend/key', 'Search'), ['class' => 'btn btn-primary']) ?> <?= Html::submitButton(Yii::t('backend/key', 'Search'), ['class' => 'btn btn-primary']) ?>
<?php echo Html::resetButton(Yii::t('backend/key', 'Reset'), ['class' => 'btn btn-default']); /* Reset gomb */ ?> <?php //echo Html::resetButton(Yii::t('backend/key', 'Reset'), ['class' => 'btn btn-default']); /* Reset gomb */ ?>
</div> </div>
<?php ActiveForm::end(); ?> <?php ActiveForm::end(); ?>
</div><!-- col-md-4 END -->
</div><!-- row END -->
</div> </div>

View File

@ -1,7 +1,7 @@
<?php <?php
use yii\helpers\Html; use yii\helpers\Html;
use common\models\Key;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\Key */ /* @var $model common\models\Key */

View File

@ -11,7 +11,7 @@ use common\models\Key;
$this->title = Yii::t('backend/key', 'Keys'); $this->title = Yii::t('backend/key', 'Keys');
$this->params['breadcrumbs'][] = $this->title; $this->params['breadcrumbs'][] = $this->title;
?> ?>
<div class="key-index"> <div class="key-index">
<h1><?= Html::encode($this->title) ?></h1> <h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search', ['model' => $searchModel]); /* ezt megcsinálni hogy csak numberre lehessen itt a fitness-web/backend/views/key/_search.php töltődik be */?> <?php echo $this->render('_search', ['model' => $searchModel]); /* ezt megcsinálni hogy csak numberre lehessen itt a fitness-web/backend/views/key/_search.php töltődik be */?>
@ -43,7 +43,10 @@ $this->params['breadcrumbs'][] = $this->title;
'created_at', 'created_at',
// 'updated_at', // 'updated_at',
['class' => 'yii\grid\ActionColumn'], [
'class' => 'yii\grid\ActionColumn',
'template' => '{view} {update}',
],
], ],
]); ?> ]); ?>

View File

@ -1,6 +1,7 @@
<?php <?php
use yii\helpers\Html; use yii\helpers\Html;
use common\models\Key;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\Key */ /* @var $model common\models\Key */

View File

@ -1,8 +1,14 @@
<?php <?php
return [ return [
'Keys' => 'Kulcsok', 'Keys' => 'Kulcsok',
'Key' => 'Kulcs',
'Create Key' => 'Új kulcs', 'Create Key' => 'Új kulcs',
'Search' => 'Keresés', 'Search' => 'Keresés',
'Reset' => 'Mégsem' 'Reset' => 'Mégsem',
'Update {modelClass}: ' => 'Szerkesztés {modelClass}: ',
'Update' => 'Szerkesztés',
'Update Save' => 'Mentés',
'Create Save' => 'Mentés',
]; ];
?> ?>

View File

@ -19,6 +19,8 @@ class Key extends \yii\db\ActiveRecord
{ {
const STATUS_DELETED = 0; const STATUS_DELETED = 0;
const STATUS_ACTIVE = 10; const STATUS_ACTIVE = 10;
const TYPE_NORMAL = 10;
const TYPE_DEFAULT = self::TYPE_NORMAL;
/** /**
* @inheritdoc * @inheritdoc
*/ */
@ -72,4 +74,11 @@ class Key extends \yii\db\ActiveRecord
self::STATUS_DELETED => Yii::t('common/key', 'Inactive'), self::STATUS_DELETED => Yii::t('common/key', 'Inactive'),
]; ];
} }
public static function types(){
return [
self::TYPE_NORMAL => Yii::t('common/key', 'Key'),
];
}
} }