IssueReport.class.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * Define a issuereport.
  4. * @author Administrateur
  5. * @category Plugin
  6. * @license copyright
  7. */
  8. class IssueReport extends Entity{
  9. public $id,$comment,$browser,$browserVersion,$online,$os,$from,$width,$height,$ip,$history,$state,$assign;
  10. protected $TABLE_NAME = 'issue_report';
  11. public $fields =
  12. array(
  13. 'id' => 'key',
  14. 'browser' => 'string',
  15. 'browserVersion' => 'string',
  16. 'online' => 'boolean',
  17. 'state' => 'string',
  18. 'assign' => 'string',
  19. 'os' => 'string',
  20. 'from' => 'string',
  21. 'width' => 'int',
  22. 'height' => 'int',
  23. 'history' => 'longstring',
  24. 'ip' => 'string'
  25. );
  26. public static function states($key=null){
  27. $states = array(
  28. 'open' => array('icon'=>'far fa-clock','label'=>'Ouvert','color'=>'#3c3c3c'),
  29. 'closed' => array('icon'=>'fas fa-check','label'=>'Résolu','color'=>'#2cbe4e'),
  30. 'canceled' => array('icon'=>'fas fa-ban','label'=>'Annulé','color'=>'#cb2431'),
  31. );
  32. if(!isset($key)) return $states;
  33. return isset($states[$key]) ? $states[$key] : array();
  34. }
  35. public function remove($cascading = true){
  36. self::deleteById($this->id);
  37. if($cascading){
  38. require_once(__DIR__.SLASH.'IssueEvent.class.php');
  39. foreach(IssueEvent::loadAll(array('issue'=>$this->id)) as $event){
  40. $event->remove();
  41. }
  42. }
  43. }
  44. }
  45. ?>