Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

DeveloppementPriorite.php 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. namespace common\models;
  3. use Yii;
  4. use common\models\Etablissement;
  5. /**
  6. * This is the model class for table "developpement_priorite".
  7. *
  8. * @property integer $id_user
  9. * @property integer $id_developpement
  10. */
  11. class DeveloppementPriorite extends \yii\db\ActiveRecord {
  12. const PRIORITE_HAUTE = 'haute';
  13. const PRIORITE_NORMALE = 'normale';
  14. const PRIORITE_BASSE = 'basse';
  15. /**
  16. * @inheritdoc
  17. */
  18. public static function tableName() {
  19. return 'developpement_priorite';
  20. }
  21. /**
  22. * @inheritdoc
  23. */
  24. public function rules() {
  25. return [
  26. [['id_etablissement', 'id_developpement'], 'required'],
  27. [['id_etablissement', 'id_developpement'], 'integer'],
  28. [['priorite'], 'string'],
  29. ];
  30. }
  31. public function getEtablissement() {
  32. return $this->hasOne(Etablissement::className(), ['id' => 'id_etablissement']);
  33. }
  34. /**
  35. * @inheritdoc
  36. */
  37. public function attributeLabels() {
  38. return [
  39. 'id_etablissement' => 'Établissement',
  40. 'id_developpement' => 'Développement',
  41. 'priorite' => 'Priorité'
  42. ];
  43. }
  44. public function getStrPriorite() {
  45. switch ($this->priorite) {
  46. case self::PRIORITE_BASSE : return 'Basse';
  47. break;
  48. case self::PRIORITE_NORMALE : return 'Normale';
  49. break;
  50. case self::PRIORITE_HAUTE : return 'Haute';
  51. break;
  52. default: return 'Non définie';
  53. break;
  54. }
  55. }
  56. public function getClassCssStyleBouton() {
  57. $style_bouton = 'default';
  58. if ($this->priorite == DeveloppementPriorite::PRIORITE_BASSE)
  59. $style_bouton = 'info';
  60. elseif ($this->priorite == DeveloppementPriorite::PRIORITE_NORMALE)
  61. $style_bouton = 'warning';
  62. elseif ($this->priorite == DeveloppementPriorite::PRIORITE_HAUTE)
  63. $style_bouton = 'danger';
  64. return $style_bouton;
  65. }
  66. }