glpi / setup.php @ 18eae138
History | View | Annotate | Download (9.77 KB)
1 | efcf5ecf | Francois POIROTTE | <?php
|
---|---|---|---|
2 | |||
3 | a5c9df40 | Thibault Louet | require __DIR__ . "/hook.php"; |
4 | efcf5ecf | Francois POIROTTE | |
5 | a5c9df40 | Thibault Louet | function plugin_init_vigilo() |
6 | { |
||
7 | efcf5ecf | Francois POIROTTE | global $PLUGIN_HOOKS; |
8 | 0d761a49 | Romain CHOLLET | global $DB; |
9 | efcf5ecf | Francois POIROTTE | $hooks =& $PLUGIN_HOOKS; |
10 | $p = "vigilo"; |
||
11 | $hookObj = new VigiloHooks(); |
||
12 | $hooks['csrf_compliant'][$p] = true; |
||
13 | 8b28e91d | Romain CHOLLET | $hooks['item_add'][$p] = array("Computer" => array($hookObj, "addComputer"), |
14 | "NetworkEquipment" => array($hookObj, "addNetworkEquipment"), |
||
15 | 18eae138 | Romain CHOLLET | "Printer" => array($hookObj, "addPrinter"), |
16 | a5c9df40 | Thibault Louet | "ComputerDisk" => array($hookObj,"manageDisks"), |
17 | "NetworkPort" => array($hookObj,"manageNetworks"), |
||
18 | "IPAddress" => array($hookObj,"manageAddresses"), |
||
19 | "DeviceProcessor" => array($hookObj,"manageNetworks"), |
||
20 | "DeviceMemory" => array($hookObj,"manageNetworks"), |
||
21 | "DeviceHardDrive" => array($hookObj,"manageNetworks"), |
||
22 | "DeviceControl" => array($hookObj,"manageNetworks"), |
||
23 | "DeviceSoundCard" => array($hookObj,"manageNetworks"), |
||
24 | "Software" => array($hookObj,"manageSoftwares"), |
||
25 | "Location" => array($hookObj,"updateGroups"), |
||
26 | "Entity" => array($hookObj,"updateGroups"), |
||
27 | 79397eb3 | Romain CHOLLET | "Computer_SoftwareVersion" => array($hookObj, "manageComputerSoftwareVersion"), |
28 | a5c9df40 | Thibault Louet | "Manufacturer" => array($hookObj,"updateGroups")); |
29 | 8b28e91d | Romain CHOLLET | $hooks['item_update'][$p] = array("Computer" => array($hookObj, "updateComputer"), |
30 | "NetworkEquipment" => array($hookObj, "updateNetworkEquipment"), |
||
31 | 18eae138 | Romain CHOLLET | "Printer" => array($hookObj, "updatePrinter"), |
32 | a5c9df40 | Thibault Louet | "ComputerDisk" => array($hookObj,"manageDisks"), |
33 | "NetworkPort" => array($hookObj,"manageNetworks"), |
||
34 | "IPAddress" => array($hookObj,"manageAddresses"), |
||
35 | "DeviceProcessor" => array($hookObj,"manageNetworks"), |
||
36 | "DeviceMemory" => array($hookObj,"manageNetworks"), |
||
37 | "DeviceHardDrive" => array($hookObj,"manageNetworks"), |
||
38 | "DeviceControl" => array($hookObj,"manageNetworks"), |
||
39 | "DeviceSoundCard" => array($hookObj,"manageNetworks"), |
||
40 | "Software" => array($hookObj,"manageSoftwares"), |
||
41 | "Location" => array($hookObj,"updateGroups"), |
||
42 | 79397eb3 | Romain CHOLLET | "Computer_SoftwareVersion" => array($hookObj, "manageComputerSoftwareVersion"), |
43 | a5c9df40 | Thibault Louet | "Entity" => array($hookObj,"updateGroups"), |
44 | 79397eb3 | Romain CHOLLET | "Manufacturer" => array($hookObj,"updateGroups")); |
45 | bef4271a | Thibault Louet | $hooks['item_purge'][$p] = array("Computer" => array($hookObj, "delete"), |
46 | 8b28e91d | Romain CHOLLET | "NetworkEquipment" => array($hookObj, "delete"), |
47 | 18eae138 | Romain CHOLLET | "Printer" => array($hookObj, "delete"), |
48 | a5c9df40 | Thibault Louet | "ComputerDisk" => array($hookObj,"manageDisks"), |
49 | "NetworkPort" => array($hookObj,"manageNetworks"), |
||
50 | "IPAddress" => array($hookObj,"manageAddresses"), |
||
51 | "DeviceProcessor" => array($hookObj,"manageNetworks"), |
||
52 | "DeviceMemory" => array($hookObj,"manageNetworks"), |
||
53 | "DeviceHardDrive" => array($hookObj,"manageNetworks"), |
||
54 | "DeviceControl" => array($hookObj,"manageNetworks"), |
||
55 | "DeviceSoundCard" => array($hookObj,"manageNetworks"), |
||
56 | "Software" => array($hookObj,"manageSoftwares"), |
||
57 | "Location" => array($hookObj,"updateGroups"), |
||
58 | 79397eb3 | Romain CHOLLET | "Computer_SoftwareVersion" => array($hookObj, "manageComputerSoftwareVersion"), |
59 | a5c9df40 | Thibault Louet | "Entity" => array($hookObj,"updateGroups"), |
60 | "Manufacturer" => array($hookObj,"updateGroups")); |
||
61 | bef4271a | Thibault Louet | $hooks['item_delete'][$p] = array("Computer" => array($hookObj, "delete"), |
62 | 8b28e91d | Romain CHOLLET | "NetworkEquipment" => array($hookObj, "delete"), |
63 | 18eae138 | Romain CHOLLET | "Printer" => array($hookObj, "delete"), |
64 | a5c9df40 | Thibault Louet | "ComputerDisk" => array($hookObj,"manageDisks"), |
65 | "NetworkPort" => array($hookObj,"manageNetworks"), |
||
66 | "IPAddress" => array($hookObj,"manageAddresses"), |
||
67 | "DeviceProcessor" => array($hookObj,"manageNetworks"), |
||
68 | "DeviceMemory" => array($hookObj,"manageNetworks"), |
||
69 | "DeviceHardDrive" => array($hookObj,"manageNetworks"), |
||
70 | "DeviceControl" => array($hookObj,"manageNetworks"), |
||
71 | "DeviceSoundCard" => array($hookObj,"manageNetworks"), |
||
72 | "Software" => array($hookObj,"manageSoftwares"), |
||
73 | "Location" => array($hookObj,"updateGroups"), |
||
74 | 79397eb3 | Romain CHOLLET | "Computer_SoftwareVersion" => array($hookObj, "manageComputerSoftwareVersion"), |
75 | a5c9df40 | Thibault Louet | "Entity" => array($hookObj,"updateGroups"), |
76 | "Manufacturer" => array($hookObj,"updateGroups")); |
||
77 | 8b28e91d | Romain CHOLLET | $hooks['item_restore'][$p] = array("Computer" => array($hookObj, "addComputer"), |
78 | "NetworkEquipment" => array($hookObj, "addNetworkEquipment"), |
||
79 | 18eae138 | Romain CHOLLET | "Printer" => array($hookObj, "addPrinter"), |
80 | a5c9df40 | Thibault Louet | "ComputerDisk" => array($hookObj,"manageDisks"), |
81 | "NetworkPort" => array($hookObj,"manageNetworks"), |
||
82 | "IPAddress" => array($hookObj,"manageAddresses"), |
||
83 | "DeviceProcessor" => array($hookObj,"manageNetworks"), |
||
84 | "DeviceMemory" => array($hookObj,"manageNetworks"), |
||
85 | "DeviceHardDrive" => array($hookObj,"manageNetworks"), |
||
86 | "DeviceControl" => array($hookObj,"manageNetworks"), |
||
87 | "DeviceSoundCard" => array($hookObj,"manageNetworks"), |
||
88 | "Software" => array($hookObj,"manageSoftwares"), |
||
89 | "Location" => array($hookObj,"updateGroups"), |
||
90 | 79397eb3 | Romain CHOLLET | "Computer_SoftwareVersion" => array($hookObj, "manageComputerSoftwareVersion"), |
91 | a5c9df40 | Thibault Louet | "Entity" => array($hookObj,"updateGroups"), |
92 | "Manufacturer" => array($hookObj,"updateGroups")); |
||
93 | efcf5ecf | Francois POIROTTE | $hooks["menu_toadd"][$p]['plugins'] = 'PluginVigiloMenu'; |
94 | $hooks['config_page'][$p] = 'front/menu.php?itemtype=vigilo'; |
||
95 | 0d761a49 | Romain CHOLLET | $hooks['autoinventory_information'][$p] = array( |
96 | 'Computer' => array('PluginVigiloComputer', |
||
97 | 'showComputerInfo'));
|
||
98 | |||
99 | 79397eb3 | Romain CHOLLET | if (!FieldExists('glpi_computers', 'vigilo_template')) |
100 | 0d761a49 | Romain CHOLLET | { |
101 | $query = "ALTER TABLE glpi_computers ADD vigilo_template VARCHAR(30)"; |
||
102 | $DB->queryOrDie($query, "Ajout d'une colonne vigilo_template dans la table glpi_computers"); |
||
103 | } |
||
104 | } |
||
105 | |||
106 | function getSearchOptions() { |
||
107 | $computer = new Computer(); |
||
108 | $options = $computer->getSearchOptions(); |
||
109 | |||
110 | $options['vigilo'] = 'Vigilo Template'; |
||
111 | |||
112 | $options['7007']['name'] = 'vigilo_template'; |
||
113 | $options['7007']['table'] = 'glpi_computers'; |
||
114 | $options['7007']['field'] = 'vigilo_template'; |
||
115 | $options['7007']['searchtype'] = 'equals'; |
||
116 | $options['7007']['datatype'] = 'dropdown'; |
||
117 | |||
118 | return $options; |
||
119 | efcf5ecf | Francois POIROTTE | } |
120 | |||
121 | a5c9df40 | Thibault Louet | function plugin_version_vigilo() |
122 | { |
||
123 | return array('name' => 'Vigilo monitoring', |
||
124 | efcf5ecf | Francois POIROTTE | 'version' => '0.1', |
125 | 'author' => 'CSSI', |
||
126 | 'license' => 'GPLv2+', |
||
127 | 'homepage' => 'http://vigilo-nms.org', |
||
128 | 'minGlpiVersion' => '9.1'); |
||
129 | } |
||
130 | |||
131 | a5c9df40 | Thibault Louet | function plugin_vigilo_check_config($verbose = false) |
132 | { |
||
133 | if (version_compare(GLPI_VERSION, '9.1', 'lt')) { |
||
134 | efcf5ecf | Francois POIROTTE | echo "This plugin requires GLPI >= 9.1"; |
135 | return false; |
||
136 | } |
||
137 | return true; |
||
138 | } |
||
139 | |||
140 | a5c9df40 | Thibault Louet | function plugin_vigilo_check_prerequisites() |
141 | { |
||
142 | efcf5ecf | Francois POIROTTE | return true; |
143 | } |
||
144 | |||
145 | a5c9df40 | Thibault Louet | function plugin_vigilo_install() |
146 | { |
||
147 | efcf5ecf | Francois POIROTTE | return true; |
148 | } |
||
149 | |||
150 | a5c9df40 | Thibault Louet | function plugin_vigilo_uninstall() |
151 | { |
||
152 | efcf5ecf | Francois POIROTTE | return true; |
153 | } |