Browse Source

Refactoring/traduction modèle DeveloppementPriorite > DevelopmentPriority

dev
Guillaume Bourgeois 6 years ago
parent
commit
58019d85df
2 changed files with 35 additions and 32 deletions
  1. +1
    -1
      common/models/Development.php
  2. +34
    -31
      common/models/DevelopmentPriority.php

+ 1
- 1
common/models/Development.php View File

use common\models\DeveloppementPriorite; use common\models\DeveloppementPriorite;


/** /**
* This is the model class for table "developpement".
* This is the model class for table "development".
* *
* @property integer $id * @property integer $id
* @property string $subject * @property string $subject

common/models/DeveloppementPriorite.php → common/models/DevelopmentPriority.php View File

namespace common\models; namespace common\models;


use Yii; use Yii;
use common\models\Etablissement;
use common\models\Producer;


/** /**
* This is the model class for table "developpement_priorite".
* This is the model class for table "development_priority".
* *
* @property integer $id_user * @property integer $id_user
* @property integer $id_developpement
* @property integer $id_development
*/ */
class DeveloppementPriorite extends \yii\db\ActiveRecord
class DevelopmentPriority extends \yii\db\ActiveRecord
{ {


const PRIORITE_HAUTE = 'haute';
const PRIORITE_NORMALE = 'normale';
const PRIORITE_BASSE = 'basse';
const PRIORITY_HIGH = 'high';
const PRIORITY_NORMAL = 'normal';
const PRIORITY_LOW = 'low';


/** /**
* @inheritdoc * @inheritdoc
*/ */
public static function tableName() public static function tableName()
{ {
return 'developpement_priorite';
return 'development_priority';
} }


/** /**
public function rules() public function rules()
{ {
return [ return [
[['id_etablissement', 'id_developpement'], 'required'],
[['id_etablissement', 'id_developpement'], 'integer'],
[['priorite'], 'string'],
[['id_producer', 'id_development'], 'required'],
[['id_producer', 'id_development'], 'integer'],
[['priority'], 'string'],
]; ];
} }
* Relations * Relations
*/ */


public function getEtablissement()
public function getProducert()
{ {
return $this->hasOne(Etablissement::className(), ['id' => 'id_etablissement']);
return $this->hasOne(Producer::className(), ['id' => 'id_producer']);
} }


/** /**
public function attributeLabels() public function attributeLabels()
{ {
return [ return [
'id_etablissement' => 'Établissement',
'id_developpement' => 'Développement',
'priorite' => 'Priorité'
'id_producer' => 'Producteur',
'id_producer' => 'Développement',
'priority' => 'Priorité'
]; ];
} }


* *
* @return string * @return string
*/ */
public function getStrPriorite()
public function getStrPriority()
{ {
switch ($this->priorite) {
case self::PRIORITE_BASSE : return 'Basse';
switch ($this->priority) {
case self::PRIORITY_LOW : return 'Basse';
break; break;
case self::PRIORITE_NORMALE : return 'Normale';
case self::PRIORITY_NORMAL : return 'Normale';
break; break;
case self::PRIORITE_HAUTE : return 'Haute';
case self::PRIORITY_HIGH : return 'Haute';
break; break;
default: return 'Non définie'; default: return 'Non définie';
break; break;
* *
* @return string * @return string
*/ */
public function getClassCssStyleBouton()
public function getClassCssStyleButton()
{ {
$style_bouton = 'default';
if ($this->priorite == DeveloppementPriorite::PRIORITE_BASSE)
$style_bouton = 'info';
elseif ($this->priorite == DeveloppementPriorite::PRIORITE_NORMALE)
$style_bouton = 'warning';
elseif ($this->priorite == DeveloppementPriorite::PRIORITE_HAUTE)
$style_bouton = 'danger';

return $style_bouton;
$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;
} }


} }

Loading…
Cancel
Save