116 lines
2.6 KiB
PHP
116 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace common\models;
|
|
|
|
use Yii;
|
|
use yii\behaviors\TimestampBehavior;
|
|
use yii\helpers\ArrayHelper;
|
|
|
|
/**
|
|
* This is the model class for table "ugiro".
|
|
*
|
|
* @property integer $id_ugiro
|
|
* @property integer $id_user
|
|
* @property string $path
|
|
* @property string $desta_path
|
|
* @property string $datum
|
|
* @property integer $number
|
|
* @property string $created_at
|
|
* @property string $updated_at
|
|
* @property string $terhelesi_datum
|
|
*/
|
|
class Ugiro extends \yii\db\ActiveRecord
|
|
{
|
|
|
|
public static $PATH_MEGBIZAS = "giro/megbizas";
|
|
public static $PATH_VALASZ = "giro/valasz";
|
|
/**
|
|
* beszed fájl kész
|
|
* */
|
|
public static $STATUS_SENT = 0;
|
|
/**
|
|
* detsta fájl felöltve
|
|
* */
|
|
public static $STATUS_RECIEVED = 10;
|
|
/**
|
|
* detsta fájl feldolgozva
|
|
* */
|
|
public static $STATUS_FINISHED = 20;
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public static function tableName()
|
|
{
|
|
return 'ugiro';
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
];
|
|
}
|
|
|
|
|
|
public function behaviors()
|
|
{
|
|
return ArrayHelper::merge( [
|
|
[
|
|
'class' => TimestampBehavior::className(),
|
|
'value' => function(){ return date('Y-m-d H:i:s' ); }
|
|
],
|
|
], parent::behaviors());
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function attributeLabels()
|
|
{
|
|
return [
|
|
'id_ugiro' => Yii::t('common/ticket_installment_request', 'Id Ugiro'),
|
|
'id_user' => Yii::t('common/ticket_installment_request', 'Id User'),
|
|
'created_at' => Yii::t('common/ticket_installment_request', 'Created At'),
|
|
'updated_at' => Yii::t('common/ticket_installment_request', 'Updated At'),
|
|
];
|
|
}
|
|
|
|
public function getUser(){
|
|
return $this->hasOne( User::className(), ["id" =>"id_user" ] );
|
|
}
|
|
|
|
public function getMessageDetsta(){
|
|
return $this->hasOne( MessageDetsta::className(), ["id_ugiro" =>"id_ugiro" ] );
|
|
}
|
|
|
|
|
|
public function getRequests()
|
|
{
|
|
return $this->hasMany(TicketInstallmentRequest::className(), ['id_ticket_installment_request' => 'id_request'])
|
|
->viaTable('ugiro_request_assignment', ['id_ugiro' => 'id_ugiro']);
|
|
}
|
|
|
|
|
|
public static function statuses() {
|
|
return [
|
|
static::$STATUS_SENT =>"Folyamatban",
|
|
static::$STATUS_FINISHED =>"Befejezve",
|
|
static::$STATUS_RECIEVED =>"Detsta fájl feltöltve",
|
|
]
|
|
;
|
|
}
|
|
|
|
public function getStatusName( ) {
|
|
$statuses = static::statuses() ;
|
|
$result = "Ismeretlen";
|
|
if ( array_key_exists($this->status, $statuses)){
|
|
$result = $statuses[$this->status];
|
|
}
|
|
return $result;
|
|
}
|
|
|
|
}
|