|
|
@@ -4,6 +4,7 @@ namespace domain\Communication\AutomaticEmail; |
|
|
|
|
|
|
|
use common\components\ActiveRecordCommon; |
|
|
|
use common\components\Date; |
|
|
|
use domain\_\StatusInterface; |
|
|
|
use domain\Producer\Producer\Producer; |
|
|
|
use yii\db\ActiveQuery; |
|
|
|
|
|
|
@@ -37,6 +38,33 @@ class AutomaticEmail extends ActiveRecordCommon |
|
|
|
]; |
|
|
|
} |
|
|
|
|
|
|
|
/* Méthodes */ |
|
|
|
|
|
|
|
public function isEnabled(): bool |
|
|
|
{ |
|
|
|
return (bool) $this->getStatus() == StatusInterface::STATUS_ONLINE; |
|
|
|
} |
|
|
|
|
|
|
|
public function getDayAsString(): string |
|
|
|
{ |
|
|
|
return Date::getDayOfWeekStringByNumber($this->getDay()); |
|
|
|
} |
|
|
|
|
|
|
|
public function getDelayBeforeDistributionAsString(): string |
|
|
|
{ |
|
|
|
return $this->getDelayBeforeDistribution().' jour(s) avant'; |
|
|
|
} |
|
|
|
|
|
|
|
public function getStatusAsHtml(): string |
|
|
|
{ |
|
|
|
if($this->getStatus()) { |
|
|
|
return '<span class="label label-success">Activé</span>'; |
|
|
|
} |
|
|
|
else { |
|
|
|
return '<span class="label label-danger">Désactivé</span>'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/* Getters / Setters */ |
|
|
|
|
|
|
|
public function getId(): ?int |
|
|
@@ -127,26 +155,4 @@ class AutomaticEmail extends ActiveRecordCommon |
|
|
|
{ |
|
|
|
return $this->hasOne(Producer::class, ['id' => 'id_producer']); |
|
|
|
} |
|
|
|
|
|
|
|
/* Méthodes */ |
|
|
|
|
|
|
|
public function getDayAsString(): string |
|
|
|
{ |
|
|
|
return Date::getDayOfWeekStringByNumber($this->getDay()); |
|
|
|
} |
|
|
|
|
|
|
|
public function getDelayBeforeDistributionAsString(): string |
|
|
|
{ |
|
|
|
return $this->getDelayBeforeDistribution().' jour(s) avant'; |
|
|
|
} |
|
|
|
|
|
|
|
public function getStatusAsHtml(): string |
|
|
|
{ |
|
|
|
if($this->getStatus()) { |
|
|
|
return '<span class="label label-success">Activé</span>'; |
|
|
|
} |
|
|
|
else { |
|
|
|
return '<span class="label label-danger">Désactivé</span>'; |
|
|
|
} |
|
|
|
} |
|
|
|
} |