add newsletter
This commit is contained in:
86
common/models/Newsletter.php
Normal file
86
common/models/Newsletter.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace common\models;
|
||||
|
||||
use Yii;
|
||||
use common\components\Helper;
|
||||
|
||||
/**
|
||||
* This is the model class for table "newsletter".
|
||||
*
|
||||
* @property integer $id_newsletter
|
||||
* @property string $subject
|
||||
* @property string $body
|
||||
* @property integer $status
|
||||
* @property integer $sent
|
||||
* @property string $sent_at
|
||||
* @property string $created_at
|
||||
* @property string $updated_at
|
||||
*/
|
||||
class Newsletter extends \common\models\BaseFitnessActiveRecord
|
||||
{
|
||||
|
||||
public static $STATUS_DELETED = 0;
|
||||
public static $STATUS_ACTIVE = 10;
|
||||
|
||||
public static $SENT_NOT = 0;
|
||||
public static $SENT_TRUE = 10;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return 'newsletter';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['body'], 'string'],
|
||||
[['subject'], 'string', 'max' => 255]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function attributeLabels()
|
||||
{
|
||||
return [
|
||||
'id_newsletter' => Yii::t('common/newsletter', 'Hírlevél azonosító'),
|
||||
'subject' => Yii::t('common/newsletter', 'Tárgy'),
|
||||
'body' => Yii::t('common/newsletter', 'Szöveg'),
|
||||
'status' => Yii::t('common/newsletter', 'Státusz'),
|
||||
'sent' => Yii::t('common/newsletter', 'Elküldve'),
|
||||
'sent_at' => Yii::t('common/newsletter', 'Küldés ideje'),
|
||||
'created_at' => Yii::t('common/newsletter', 'Létrehozva'),
|
||||
'updated_at' => Yii::t('common/newsletter', 'Módosítva'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function statuses( ) {
|
||||
return [
|
||||
self::$STATUS_ACTIVE => 'Aktív',
|
||||
self::$STATUS_DELETED=> 'Törölve',
|
||||
];
|
||||
}
|
||||
|
||||
public function getStatusName(){
|
||||
return Helper::getArrayValue(self::statuses(), $this->status, "");
|
||||
}
|
||||
|
||||
public function getSentName(){
|
||||
if ( $this->sent == self::$SENT_NOT){
|
||||
return "Nincs elküldve";
|
||||
}else if ( $this->sent == self::$SENT_TRUE){
|
||||
return "Elküldve";
|
||||
}else{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user