|
- <?php
-
-
-
- namespace common\models;
-
- use Yii;
- use common\components\ActiveRecordCommon ;
- use common\models\Producer;
-
-
- class DevelopmentPriority extends ActiveRecordCommon
- {
-
- const PRIORITY_HIGH = 'high';
- const PRIORITY_NORMAL = 'normal';
- const PRIORITY_LOW = 'low';
-
-
-
- public static function tableName()
- {
- return 'development_priority';
- }
-
-
-
- public function rules()
- {
- return [
- [['id_producer', 'id_development'], 'required'],
- [['id_producer', 'id_development'], 'integer'],
- [['priority'], 'string'],
- ];
- }
-
-
-
-
- public function getProducer()
- {
- return $this->hasOne(Producer::className(), ['id' => 'id_producer']);
- }
-
-
-
- public function attributeLabels()
- {
- return [
- 'id_producer' => 'Producteur',
- 'id_producer' => 'Développement',
- 'priority' => 'Priorité'
- ];
- }
-
-
-
- public static function defaultOptionsSearch() {
- return [
- 'with' => [],
- 'join_with' => [],
- 'orderby' => '',
- 'attribute_id_producer' => 'development_priority.id_producer'
- ] ;
- }
-
-
-
- public function getStrPriority()
- {
- switch ($this->priority) {
- case self::PRIORITY_LOW : return 'Basse';
- break;
- case self::PRIORITY_NORMAL : return 'Normale';
- break;
- case self::PRIORITY_HIGH : return 'Haute';
- break;
- default: return 'Non définie';
- break;
- }
- }
-
-
-
- public function getClassCssStyleButton()
- {
- $styleButton = 'default';
- if ($this->priority == DevelopmentPriority::PRIORITY_LOW) {
- $styleButton = 'info';
- }
- elseif ($this->priority == DevelopmentPriority::PRIORITY_NORMAL) {
- $styleButton = 'warning';
- }
- elseif ($this->priority == DevelopmentPriority::PRIORITY_HIGH) {
- $styleButton = 'danger';
- }
-
- return $styleButton;
- }
-
- }
|