<leirás>

This commit is contained in:
rocho
2015-11-30 19:21:27 +01:00
parent 4935aaa4a2
commit 4872abbb20
10 changed files with 81 additions and 26 deletions

View File

@@ -0,0 +1,8 @@
<?php
return [
'Keys' => 'Kulcsok',
'Create Key' => 'Új kulcs',
'Search' => 'Keresés',
'Reset' => 'Mégsem'
];
?>

View File

@@ -0,0 +1,11 @@
<?php
return [
'Active' => 'Aktív',
'Inactive' => 'Inaktív',
'Number' => 'Név, szám',
'Status' => 'Státusz',
'Search' => 'Keresés',
'Type' => 'Típus',
'Created At' => 'Létrehozva',
];
?>

View File

@@ -3,6 +3,7 @@
namespace common\models;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "key".
@@ -16,6 +17,8 @@ use Yii;
*/
class Key extends \yii\db\ActiveRecord
{
const STATUS_DELETED = 0;
const STATUS_ACTIVE = 10;
/**
* @inheritdoc
*/
@@ -30,15 +33,26 @@ class Key extends \yii\db\ActiveRecord
public function rules()
{
return [
[['status', 'type'], 'integer'],
[['created_at', 'updated_at'], 'required'],
[['created_at', 'updated_at'], 'safe'],
[['number'], 'string', 'max' => 255]
[['status', 'type'], 'integer'], //csak szám
//[['created_at', 'updated_at'], 'required'],//kötelezőek
//[['created_at', 'updated_at'], 'safe'], //bármi lehet
[['number'], 'string', 'max' => 255],
[['number' ], 'unique'],
];
}
public function behaviors()
{
return [
[ 'class' => TimestampBehavior::className(), //mentés előtt kitölti a save methódus meghívása előtt kitölti a created... mezőket
'value' => function(){ return date('Y-m-d H:i:s' ); }
]
];
}
/**
* @inheritdoc
* @inheritdoc Minden modelnak van egy Attribut labels függvénye ami modelhez tartalmazza a fordítások
*/
public function attributeLabels()
{
@@ -51,4 +65,11 @@ class Key extends \yii\db\ActiveRecord
'updated_at' => Yii::t('common/key', 'Updated At'),
];
}
static function statuses() {
return [
self::STATUS_ACTIVE => Yii::t('common/key', 'Active'), // t - translate a key a kategoria common/messages/hu/common/key.php mappa (létre kell hozni a fájlt)
self::STATUS_DELETED => Yii::t('common/key', 'Inactive'),
];
}
}