MachineApplication.class.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Define a Application sur la machine
  4. * @author Administrateur PRINCIPAL
  5. * @category Plugin
  6. * @license MIT
  7. */
  8. class MachineApplication extends Entity{
  9. public $id;
  10. public $label; //Libellé (Texte)
  11. public $version; //Version (Décimal)
  12. public $url; //Url (Adresse web)
  13. public $monitored; //A surveiller (Vrai ou Faux)
  14. public $machine; //Machine liée (int)
  15. public $referent; //Référent de l'application (user)
  16. const TYPE_UP = 'up';
  17. const TYPE_DOWN = 'down';
  18. protected $TABLE_NAME = 'host_machine_application';
  19. public $entityLabel = 'Application sur la machine';
  20. public $fields = array(
  21. 'id' => array('type'=>'key', 'label' => 'Identifiant'),
  22. 'label' => array('type'=>'text', 'label' => 'Libellé'),
  23. 'version' => array('type'=>'decimal', 'label' => 'Version'),
  24. 'url' => array('type'=>'url', 'label' => 'Url'),
  25. 'monitored' => array('type'=>'boolean', 'label' => 'A surveiller'),
  26. 'machine' => array('type'=>'int', 'label' => 'Machine liée'),
  27. 'referent' => array('type'=>'user', 'label' => 'Référent de l\'application')
  28. );
  29. public $links = array(
  30. 'machine' => 'Machine'
  31. );
  32. //Colonnes indexées
  33. public $indexes = array();
  34. public function remove(){
  35. require_once(__DIR__.SLASH.'ApplicationAccess.class.php');
  36. ApplicationAccess::delete(array('application'=>$this->id));
  37. MachineApplication::deleteById($this->id);
  38. History::delete(array('scope'=>'host_application','uid'=>$this->id));
  39. }
  40. }
  41. ?>