IssueEvent.class.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * Define a issueevent.
  4. * @author Administrateur
  5. * @category Plugin
  6. * @license MIT
  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' => array('type'=> 'int','label'=>'Ticket','link'=>'plugin/issue/IssueReport.class.php')
  24. );
  25. public $indexes = array('issue');
  26. public static function types($key=null){
  27. $types = array(
  28. TYPE_COMMENT => array('label' => 'Commentaire','icon' => 'fas fa-comment','color' => '#cecece'),
  29. TYPE_STATE => array('label' => 'Changement d\'état','icon' => 'fas fa-comment','color' => '#cecece'),
  30. TYPE_ASSIGNATION => array('label' => 'Nouvelle assignation','icon' => 'fas fa-comment','color' => '#cecece'),
  31. TYPE_TAG => array('label' => 'Modification tags','icon' => 'fas fa-comment','color' => '#cecece'),
  32. );
  33. $default = array('label' => ' - ','icon' => 'fas fa-comment','color' => '#cecece');
  34. if(!isset($key)) return $types;
  35. return isset($types[$key]) ? $types[$key] : $default;
  36. }
  37. public function dir($relativePath = false){
  38. return ($relativePath ? '' : File::dir()).'issue'.SLASH.'attachments'.SLASH.$this->id;
  39. }
  40. public function remove(){
  41. self::deleteById($this->id);
  42. //supression des pieces jointes
  43. if(file_exists($this->dir())) delete_folder_tree($this->dir(),true);
  44. }
  45. }
  46. ?>