- <?php
-
- namespace common\models;
-
- use Yii;
- use common\models\Etablissement;
-
- /**
- * This is the model class for table "developpement_priorite".
- *
- * @property integer $id_user
- * @property integer $id_developpement
- */
- class DeveloppementPriorite extends \yii\db\ActiveRecord {
-
- const PRIORITE_HAUTE = 'haute';
- const PRIORITE_NORMALE = 'normale';
- const PRIORITE_BASSE = 'basse';
-
- /**
- * @inheritdoc
- */
- public static function tableName() {
- return 'developpement_priorite';
- }
-
- /**
- * @inheritdoc
- */
- public function rules() {
- return [
- [['id_etablissement', 'id_developpement'], 'required'],
- [['id_etablissement', 'id_developpement'], 'integer'],
- [['priorite'], 'string'],
- ];
- }
-
- public function getEtablissement() {
- return $this->hasOne(Etablissement::className(), ['id' => 'id_etablissement']);
- }
-
- /**
- * @inheritdoc
- */
- public function attributeLabels() {
- return [
- 'id_etablissement' => 'Établissement',
- 'id_developpement' => 'Développement',
- 'priorite' => 'Priorité'
- ];
- }
-
- public function getStrPriorite() {
- switch ($this->priorite) {
- case self::PRIORITE_BASSE : return 'Basse';
- break;
- case self::PRIORITE_NORMALE : return 'Normale';
- break;
- case self::PRIORITE_HAUTE : return 'Haute';
- break;
- default: return 'Non définie';
- break;
- }
- }
-
- public function getClassCssStyleBouton() {
- $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;
- }
-
- }
|