IssueEvent.class.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * Define a issueevent.
  4. * @author Administrateur SYS1
  5. * @category Plugin
  6. * @license copyright
  7. */
  8. class IssueEvent extends Entity{
  9. public $id;
  10. public $type; //Type (Texte)
  11. public $content; //Contenu (Texte Long)
  12. public $issue; //Issue (Entier)
  13. const TYPE_COMMENT = 'comment';
  14. const TYPE_STATE = 'state';
  15. const TYPE_ASSIGNATION = 'assignation';
  16. const TYPE_TAG = 'tag';
  17. protected $TABLE_NAME = 'issue_issue_event';
  18. public $fields =
  19. array(
  20. 'id' => 'key',
  21. 'type' => 'string',
  22. 'content' => 'longstring',
  23. 'issue' => 'int'
  24. );
  25. public $links = array(
  26. 'issue' => 'IssueReport'
  27. );
  28. public static function types($key=null){
  29. $types = array(
  30. TYPE_COMMENT => array('label' => 'Commentaire','icon' => 'fas fa-comment','color' => '#cecece'),
  31. TYPE_STATE => array('label' => 'Changement d\'état','icon' => 'fas fa-comment','color' => '#cecece'),
  32. TYPE_ASSIGNATION => array('label' => 'Nouvelle assignation','icon' => 'fas fa-comment','color' => '#cecece'),
  33. TYPE_TAG => array('label' => 'Modification tags','icon' => 'fas fa-comment','color' => '#cecece'),
  34. );
  35. $default = array('label' => ' - ','icon' => 'fas fa-comment','color' => '#cecece');
  36. if(!isset($key)) return $types;
  37. return isset($types[$key]) ? $types[$key] : $default;
  38. }
  39. public function dir($relativePath = false){
  40. return ($relativePath ? '' : File::dir()).'issue'.SLASH.'attachments'.SLASH.$this->id;
  41. }
  42. public function remove(){
  43. self::deleteById($this->id);
  44. //supression des pieces jointes
  45. if(file_exists($this->dir())) delete_folder_tree($this->dir(),true);
  46. }
  47. }
  48. ?>