BitmaskedComment.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. App::uses('MyModel', 'Tools.Model');
  3. class BitmaskedComment extends MyModel {
  4. public $validate = [
  5. 'status' => [
  6. 'notBlank' => [
  7. 'rule' => 'notBlank',
  8. 'last' => true
  9. ]
  10. ]
  11. ];
  12. public static function types($value = null) {
  13. $options = [
  14. static::TYPE_BUG => 'Bug',
  15. static::TYPE_COMPLAINT => 'Complaint',
  16. static::TYPE_DISCUSSION => 'Discussion',
  17. static::TYPE_RFC => 'Request for change',
  18. ];
  19. return static::enum($value, $options);
  20. }
  21. public static function statuses($value = null) {
  22. $options = [
  23. static::STATUS_ACTIVE => __d('tools', 'Active'),
  24. static::STATUS_PUBLISHED => __d('tools', 'Published'),
  25. static::STATUS_APPROVED => __d('tools', 'Approved'),
  26. static::STATUS_FLAGGED => __d('tools', 'Flagged'),
  27. ];
  28. return static::enum($value, $options);
  29. }
  30. const TYPE_BUG = 0;
  31. const TYPE_COMPLAINT = 1;
  32. const TYPE_DISCUSSION = 2;
  33. const TYPE_RFC = 4;
  34. const STATUS_NONE = 0;
  35. const STATUS_ACTIVE = 1;
  36. const STATUS_PUBLISHED = 2;
  37. const STATUS_APPROVED = 4;
  38. const STATUS_FLAGGED = 8;
  39. }