static function showMenu() { global $CFG_GLPI; echo "<table class='tab_cadre_fixe'>"; echo "<tr><th>" . __('Configuration') . "</th></tr>"; echo "<tr class='tab_bg_1'><td class='center b'>"; echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/ocsinventoryng/front/ocsserver.php'>" . _n('OCSNG server', 'OCSNG servers', 2, 'ocsinventoryng') . "</a>"; echo "</td></tr>"; if (PluginOcsinventoryngOcsServer::useMassImport()) { echo "<tr class='tab_bg_1'><td class='center b'>"; echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/ocsinventoryng/front/config.form.php'>" . __("Automatic synchronization's configuration", 'ocsinventoryng') . "</a>"; echo "</td></tr>"; } echo "</table>"; }
/** * Print ocs menu * * @param $plugin_ocsinventoryng_ocsservers_id Integer : Id of the ocs config * * @return Nothing (display) **/ static function ocsMenu($plugin_ocsinventoryng_ocsservers_id) { global $CFG_GLPI, $DB; $name = ""; echo "<div class='center'>"; echo "<img src='" . $CFG_GLPI["root_doc"] . "/plugins/ocsinventoryng/pics/ocsinventoryng.png' " . "alt='OCS Inventory NG' title='OCS Inventory NG'>"; echo "</div>"; $numberActiveServers = countElementsInTable('glpi_plugin_ocsinventoryng_ocsservers', "`is_active`='1'"); if ($numberActiveServers > 0) { echo "<form action=\"" . $CFG_GLPI['root_doc'] . "/plugins/ocsinventoryng/front/ocsng.php\"\n method='post'>"; echo "<div class='center'><table class='tab_cadre' width='40%'>"; echo "<tr class='tab_bg_2'><th colspan='2'>" . __('Choice of an OCSNG server', 'ocsinventoryng') . "</th></tr>\n"; echo "<tr class='tab_bg_2'><td class='center'>" . __('Name') . "</td>"; echo "<td class='center'>"; Dropdown::show('PluginOcsinventoryngOcsServer', array("condition" => "`is_active`='1'", "value" => $_SESSION["plugin_ocsinventoryng_ocsservers_id"], "on_change" => "submit()", "display_emptychoice" => false)); echo "</td></tr></table></div>"; Html::closeForm(); } $sql = "SELECT `name`, `is_active`\n FROM `glpi_plugin_ocsinventoryng_ocsservers`\n WHERE `id` = '" . $plugin_ocsinventoryng_ocsservers_id . "'"; $result = $DB->query($sql); $isactive = 0; if ($DB->numrows($result) > 0) { $datas = $DB->fetch_array($result); $name = " : " . $datas["name"]; $isactive = $datas["is_active"]; } $usemassimport = PluginOcsinventoryngOcsServer::useMassImport(); echo "<div class='center'><table class='tab_cadre' width='40%'>"; echo "<tr><th colspan='" . ($usemassimport ? 4 : 2) . "'>"; printf(__('%1$s %2$s'), __('OCSNG server', 'ocsinventoryng'), $name); echo "</th></tr>"; if (plugin_ocsinventoryng_haveRight('ocsng', 'w')) { //config server echo "<tr class='tab_bg_1'><td class='center b' colspan='2'>\n <a href='ocsserver.form.php?id={$plugin_ocsinventoryng_ocsservers_id}'>\n <img src='" . $CFG_GLPI["root_doc"] . "/plugins/ocsinventoryng/pics/ocsserver.png' " . "alt='" . __s("Configuration of OCSNG server", 'ocsinventoryng') . "' " . "title=\"" . __s("Configuration of OCSNG server", 'ocsinventoryng') . "\">\n <br>" . sprintf(__('Configuration of OCSNG server %s', 'ocsinventoryng'), $name) . "\n </a></td>"; if ($isactive) { if ($usemassimport) { //config massimport echo "<td class='center b' colspan='2'>\n <a href='config.form.php'>\n <img src='" . $CFG_GLPI["root_doc"] . "/plugins/ocsinventoryng/pics/synchro.png' " . "alt='" . __s("Automatic synchronization's configuration", 'ocsinventoryng') . "' " . "title=\"" . __s("Automatic synchronization's configuration", 'ocsinventoryng') . "\">\n <br>" . __("Automatic synchronization's configuration", 'ocsinventoryng') . "\n </a></td>"; } echo "</tr>\n"; //manual import echo "<tr class='tab_bg_1'><td class='center b' colspan='2'>\n <a href='ocsng.import.php'>\n <img src='" . $CFG_GLPI["root_doc"] . "/plugins/ocsinventoryng/pics/import.png' " . "alt='" . __s('Import new computers', 'ocsinventoryng') . "' " . "title=\"" . __s('Import new computers', 'ocsinventoryng') . "\">\n <br>" . __('Import new computers', 'ocsinventoryng') . "\n </a></td>"; if ($usemassimport) { //threads echo "<td class='center b' colspan='2'>\n <a href='thread.php'>\n <img src='" . $CFG_GLPI["root_doc"] . "/plugins/ocsinventoryng/pics/thread.png' " . "alt='" . __s('Scripts execution of automatic actions', 'ocsinventoryng') . "' " . "title=\"" . __s('Scripts execution of automatic actions', 'ocsinventoryng') . "\">\n <br>" . __('Scripts execution of automatic actions', 'ocsinventoryng') . "\n </a></td>"; } echo "</tr>\n"; //manual synchro echo "<tr class='tab_bg_1'><td class='center b' colspan='2'>\n <a href='ocsng.sync.php'>\n <img src='" . $CFG_GLPI["root_doc"] . "/plugins/ocsinventoryng/pics/synchro1.png' " . "alt='" . __s('Synchronize computers already imported', 'ocsinventoryng') . "' " . "title=\"" . __s('Synchronize computers already imported', 'ocsinventoryng') . "\">\n <br>" . __('Synchronize computers already imported', 'ocsinventoryng') . "\n </a></td>"; if ($usemassimport) { //host imported by thread echo "<td class='center b' colspan='2'>\n <a href='detail.php'>\n <img src='" . $CFG_GLPI["root_doc"] . "/plugins/ocsinventoryng/pics/detail.png' " . "alt='" . __s('Computers imported by automatic actions', 'ocsinventoryng') . "' " . "title=\"" . __s('Computers imported by automatic actions', 'ocsinventoryng') . "\">\n <br>" . __('Computers imported by automatic actions', 'ocsinventoryng') . "\n </a></td>"; } echo "</tr>\n"; //link echo "<tr class='tab_bg_1'><td class='center b' colspan='2'>\n <a href='ocsng.link.php'>\n <img src='" . $CFG_GLPI["root_doc"] . "/plugins/ocsinventoryng/pics/link.png' " . "alt='" . __s('Link new OCSNG computers to existing GLPI computers', 'ocsinventoryng') . "' " . "title=\"" . __s('Link new OCSNG computers to existing GLPI computers', 'ocsinventoryng') . "\">\n <br>" . __('Link new OCSNG computers to existing GLPI computers', 'ocsinventoryng') . "\n </a></td>"; if ($usemassimport) { //host not imported by thread echo "<td class='center b' colspan='2'>\n <a href='notimportedcomputer.php'>\n <img src='" . $CFG_GLPI["root_doc"] . "/plugins/ocsinventoryng/pics/notimported.png' " . "alt='" . __s('Computers not imported by automatic actions', 'ocsinventoryng') . "' " . "title=\"" . __s('Computers not imported by automatic actions', 'ocsinventoryng') . "\" >\n <br>" . __('Computers not imported by automatic actions', 'ocsinventoryng') . "\n </a></td>"; } echo "</tr>\n"; } else { echo "<tr class='tab_bg_2'><td class='center red' colspan='2'>"; _e('The selected server is not active. Import and synchronisation is not available', 'ocsinventoryng'); echo "</td></tr>\n"; } } if (plugin_ocsinventoryng_haveRight('clean_ocsng', 'r') && $isactive) { echo "<tr class='tab_bg_1'><td class='center b' colspan='" . ($usemassimport ? 4 : 2) . "'>\n <a href='ocsng.clean.php'>\n <img src='" . $CFG_GLPI["root_doc"] . "/plugins/ocsinventoryng/pics/clean.png' " . "alt='" . __s('Clean links between GLPI and OCSNG', 'ocsinventoryng') . "' " . "title=\"" . __s('Clean links between GLPI and OCSNG', 'ocsinventoryng') . "\" >\n <br>" . __('Clean links between GLPI and OCSNG', 'ocsinventoryng') . "\n </a></td><tr>"; } echo "</table></div>"; }