DashboardWidget.class.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * Define a Bloc de tableau de bord
  4. * @author Jean CARRUESCO
  5. * @category Plugin
  6. * @license copyright
  7. */
  8. class DashboardWidget extends Entity{
  9. public $id;
  10. public $model; //Modèle (Texte)
  11. public $type; //Type (Liste classique)
  12. public $meta; //Meta (Texte Long)
  13. public $column = 0 ; //Colonne (Nombre Entier)
  14. public $row = 0 ; //Ligne (Nombre Entier)
  15. public $width = 1; //Largeur (Nombre Entier)
  16. public $height = 1; //Hauteur (Nombre Entier)
  17. public $dashboard; //Tableau de bord (Nombre Entier)
  18. protected $TABLE_NAME = 'dashboard_widget';
  19. public $entityLabel = 'Bloc de tableau de bord';
  20. public $fields = array(
  21. 'id' => array('type'=>'key', 'label' => 'Identifiant'),
  22. 'model' => array('type'=>'text','label' => 'Modèle'),
  23. 'type' => array('type'=>'list','label' => 'Type'),
  24. 'meta' => array('type'=>'textarea','label' => 'Meta'),
  25. 'column' => array('type'=>'integer','label' => 'Colonne'),
  26. 'row' => array('type'=>'integer','label' => 'Ligne'),
  27. 'width' => array('type'=>'integer','label' => 'Largeur'),
  28. 'height' => array('type'=>'integer','label' => 'Hauteur'),
  29. 'dashboard' => array('type'=>'integer','label' => 'Tableau de bord','link'=>'plugin/dashboard/Dashboard.class.php')
  30. );
  31. //Colonnes indexées
  32. public $indexes = array();
  33. //liste des Type possibles
  34. public static function types($key=null){
  35. $items = array(
  36. 'widget' => array('label'=>'Widget'),
  37. 'model' => array('label'=>'Modèle de widget'),
  38. );
  39. if(!isset($key)) return $items;
  40. return isset($items[$key]) ? $items[$key] : array('label'=>'Non définis');
  41. }
  42. public static function model($slug = null){
  43. /*$model = array();
  44. Plugin::callHook('widget',array(&$models));
  45. foreach($models as $model)
  46. $models[$model->model] = $model;
  47. if(!isset($modelUid)) return $models;*/
  48. //todo
  49. $model = array(
  50. 'icon' => 'far fa-user',
  51. 'headerBackground' => 'rgb(0, 123, 255)',
  52. 'label' => 'Nouveau widget',
  53. 'content' => '<p class="text-center p-5">Cliquez sur l\'icone <i class="fas fa-ellipsis-v text-muted"></i> en haut à droite pour configurer votre widget</p>',
  54. 'width' => 3,
  55. 'height' => 2
  56. );
  57. /*return isset($models[$modelUid]) ? $models[$modelUid] : $model;*/
  58. return $model;
  59. }
  60. }
  61. ?>