moduleinstallation.class.inc.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. // Copyright (C) 2010-2017 Combodo SARL
  3. //
  4. // This file is part of iTop.
  5. //
  6. // iTop is free software; you can redistribute it and/or modify
  7. // it under the terms of the GNU Affero General Public License as published by
  8. // the Free Software Foundation, either version 3 of the License, or
  9. // (at your option) any later version.
  10. //
  11. // iTop is distributed in the hope that it will be useful,
  12. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. // GNU Affero General Public License for more details.
  15. //
  16. // You should have received a copy of the GNU Affero General Public License
  17. // along with iTop. If not, see <http://www.gnu.org/licenses/>
  18. /**
  19. * Persistent class ModuleInstallation to record the installed modules
  20. * Log of module installations
  21. *
  22. * @copyright Copyright (C) 2010-2017 Combodo SARL
  23. * @license http://opensource.org/licenses/AGPL-3.0
  24. */
  25. class ModuleInstallation extends cmdbAbstractObject
  26. {
  27. public static function Init()
  28. {
  29. $aParams = array
  30. (
  31. "category" => "core,view_in_gui",
  32. "key_type" => "autoincrement",
  33. "name_attcode" => "",
  34. "state_attcode" => "",
  35. "reconc_keys" => array(),
  36. "db_table" => "priv_module_install",
  37. "db_key_field" => "id",
  38. "db_finalclass_field" => "",
  39. "display_template" => "",
  40. );
  41. MetaModel::Init_Params($aParams);
  42. //MetaModel::Init_InheritAttributes();
  43. MetaModel::Init_AddAttribute(new AttributeString("name", array("allowed_values"=>null, "sql"=>"name", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array())));
  44. MetaModel::Init_AddAttribute(new AttributeString("version", array("allowed_values"=>null, "sql"=>"version", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
  45. MetaModel::Init_AddAttribute(new AttributeDateTime("installed", array("allowed_values"=>null, "sql"=>"installed", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
  46. MetaModel::Init_AddAttribute(new AttributeText("comment", array("allowed_values"=>null, "sql"=>"comment", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
  47. MetaModel::Init_AddAttribute(new AttributeExternalKey("parent_id", array("targetclass"=>"ModuleInstallation", "jointype"=> "", "allowed_values"=>null, "sql"=>"parent_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array())));
  48. // Display lists
  49. MetaModel::Init_SetZListItems('details', array('name', 'version', 'installed', 'comment', 'parent_id')); // Attributes to be displayed for the complete details
  50. MetaModel::Init_SetZListItems('list', array('name', 'version', 'installed', 'parent_id')); // Attributes to be displayed for a list
  51. // Search criteria
  52. // MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form
  53. // MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form
  54. }
  55. }
  56. /**
  57. * Persistent class ExtensionInstallation to record the installed extensions
  58. * Log of extensions installations
  59. *
  60. * @copyright Copyright (C) 2017 Combodo SARL
  61. * @license http://opensource.org/licenses/AGPL-3.0
  62. */
  63. class ExtensionInstallation extends cmdbAbstractObject
  64. {
  65. public static function Init()
  66. {
  67. $aParams = array
  68. (
  69. "category" => "core,view_in_gui",
  70. "key_type" => "autoincrement",
  71. "name_attcode" => "",
  72. "state_attcode" => "",
  73. "reconc_keys" => array(),
  74. "db_table" => "priv_extension_install",
  75. "db_key_field" => "id",
  76. "db_finalclass_field" => "",
  77. "display_template" => "",
  78. );
  79. MetaModel::Init_Params($aParams);
  80. //MetaModel::Init_InheritAttributes();
  81. MetaModel::Init_AddAttribute(new AttributeString("code", array("allowed_values"=>null, "sql"=>"code", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array())));
  82. MetaModel::Init_AddAttribute(new AttributeString("label", array("allowed_values"=>null, "sql"=>"label", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array())));
  83. MetaModel::Init_AddAttribute(new AttributeString("version", array("allowed_values"=>null, "sql"=>"version", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array())));
  84. MetaModel::Init_AddAttribute(new AttributeString("source", array("allowed_values"=>null, "sql"=>"source", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array())));
  85. MetaModel::Init_AddAttribute(new AttributeDateTime("installed", array("allowed_values"=>null, "sql"=>"installed", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array())));
  86. // Display lists
  87. MetaModel::Init_SetZListItems('details', array('code', 'label', 'version', 'installed', 'source')); // Attributes to be displayed for the complete details
  88. MetaModel::Init_SetZListItems('list', array('code', 'label', 'version', 'installed', 'source')); // Attributes to be displayed for a list
  89. MetaModel::Init_SetZListItems('standard_search', array('code', 'label', 'version', 'installed', 'source')); // Attributes to be displayed in the search form
  90. }
  91. }