History.class.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * Define a history.
  4. * @author Valentin CARRUESCO
  5. * @category Core
  6. * @license copyright
  7. */
  8. class History extends Entity{
  9. public $id;
  10. public $scope; //Scope (plugin, page...) (Texte)
  11. public $uid; //Item ID/UID concerné (Texte)
  12. public $comment; //Commentaire (Texte Long)
  13. public $type; //Type d'historique (Texte)
  14. public $meta; //Meta données (Texte Long)
  15. public $sort; //Ordre (int)
  16. const TYPE_COMMENT = 'comment';
  17. const TYPE_EDIT = 'edit';
  18. const TYPE_DELETE = 'delete';
  19. protected $TABLE_NAME = 'history';
  20. public $fields = array(
  21. 'id' => 'key',
  22. 'scope' => 'string',
  23. 'uid' => 'string',
  24. 'comment' => 'longstring',
  25. 'type' => 'string',
  26. 'sort' => 'int',
  27. 'meta' => 'longstring'
  28. );
  29. public $links = array(
  30. );
  31. //Colonnes indexées
  32. public $indexes = array();
  33. public static function types($key = null){
  34. $types = array(
  35. self::TYPE_COMMENT => array('slug'=>self::TYPE_COMMENT,'label' => 'Commentaire','icon' => 'far fa-comments','color' => '#6ab04c'),
  36. self::TYPE_EDIT => array('slug'=>self::TYPE_EDIT,'label' => 'Edition','icon' => 'fas fa-marker','color' => '#686de0'),
  37. self::TYPE_DELETE => array('slug'=>self::TYPE_DELETE,'label' => 'Suppression','icon' => 'fas fa-trash-restore','color' => '#eb4d4b')
  38. );
  39. if(!isset($key)) return $types;
  40. return isset($types[$key]) ? $types[$key] : array('slug'=>'undefined','label'=>'','icon'=>'','color'=>'');
  41. }
  42. }
  43. ?>