瀏覽代碼

Refactoring/traduction modèle DeveloppementPriorite > DevelopmentPriority

dev
Guillaume Bourgeois 6 年之前
父節點
當前提交
58019d85df
共有 2 個文件被更改,包括 35 次插入32 次删除
  1. +1
    -1
      common/models/Development.php
  2. +34
    -31
      common/models/DevelopmentPriority.php

+ 1
- 1
common/models/Development.php 查看文件

@@ -42,7 +42,7 @@ use Yii;
use common\models\DeveloppementPriorite;

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

common/models/DeveloppementPriorite.php → common/models/DevelopmentPriority.php 查看文件

@@ -39,27 +39,27 @@ termes.
namespace common\models;

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_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
*/
public static function tableName()
{
return 'developpement_priorite';
return 'development_priority';
}

/**
@@ -68,9 +68,9 @@ class DeveloppementPriorite extends \yii\db\ActiveRecord
public function rules()
{
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'],
];
}
@@ -78,9 +78,9 @@ class DeveloppementPriorite extends \yii\db\ActiveRecord
* Relations
*/

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

/**
@@ -89,9 +89,9 @@ class DeveloppementPriorite extends \yii\db\ActiveRecord
public function attributeLabels()
{
return [
'id_etablissement' => 'Établissement',
'id_developpement' => 'Développement',
'priorite' => 'Priorité'
'id_producer' => 'Producteur',
'id_producer' => 'Développement',
'priority' => 'Priorité'
];
}

@@ -100,14 +100,14 @@ class DeveloppementPriorite extends \yii\db\ActiveRecord
*
* @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;
case self::PRIORITE_NORMALE : return 'Normale';
case self::PRIORITY_NORMAL : return 'Normale';
break;
case self::PRIORITE_HAUTE : return 'Haute';
case self::PRIORITY_HIGH : return 'Haute';
break;
default: return 'Non définie';
break;
@@ -119,17 +119,20 @@ class DeveloppementPriorite extends \yii\db\ActiveRecord
*
* @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…
取消
儲存