Exemplo n.º 1
0
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

Ocsinventoryng plugin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with ocsinventoryng. If not, see <http://www.gnu.org/licenses/>.
-------------------------------------------------------------------------- */
include '../../../inc/includes.php';
Session::checkSeveralRightsOr(array("plugin_ocsinventoryng" => READ, "plugin_ocsinventoryng_clean" => READ));
Html::header('OCS Inventory NG', '', "tools", "pluginocsinventoryngmenu", "ocsinventoryng");
if (isset($_SESSION["ocs_import"])) {
    unset($_SESSION["ocs_import"]);
}
if (isset($_SESSION["ocs_link"])) {
    unset($_SESSION["ocs_link"]);
}
if (isset($_SESSION["ocs_update"])) {
    unset($_SESSION["ocs_update"]);
}
if (isset($_POST["plugin_ocsinventoryng_ocsservers_id"])) {
    $_SESSION["plugin_ocsinventoryng_ocsservers_id"] = $_POST["plugin_ocsinventoryng_ocsservers_id"];
} else {
    $_SESSION["plugin_ocsinventoryng_ocsservers_id"] = PluginOcsinventoryngOcsServer::getFirstServer();
}
PluginOcsinventoryngOcsServer::ocsMenu($_SESSION["plugin_ocsinventoryng_ocsservers_id"]);
PluginOcsinventoryngOcsServer::checkOCSconnection($_SESSION["plugin_ocsinventoryng_ocsservers_id"]);
Html::footer();
Exemplo n.º 2
0
 /**
  * @param CommonGLPI $item
  * @param int $withtemplate
  * @return array|string
  */
 function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     global $CFG_GLPI;
     switch ($item->getType()) {
         case __CLASS__:
             $ocsServers = getAllDatasFromTable('glpi_plugin_ocsinventoryng_ocsservers', "`is_active`='1'");
             if (!empty($ocsServers)) {
                 $ong[0] = __('Server Setup', 'ocsinventoryng');
                 $ong[1] = __('Inventory Import', 'ocsinventoryng');
                 $ong[2] = __('IPDiscover Import', 'ocsinventoryng');
                 if (isset($_POST["plugin_ocsinventoryng_ocsservers_id"])) {
                     $_SESSION["plugin_ocsinventoryng_ocsservers_id"] = $_POST["plugin_ocsinventoryng_ocsservers_id"];
                 } else {
                     $_SESSION["plugin_ocsinventoryng_ocsservers_id"] = PluginOcsinventoryngOcsServer::getFirstServer();
                 }
                 if (isset($_SESSION["plugin_ocsinventoryng_ocsservers_id"]) && $_SESSION["plugin_ocsinventoryng_ocsservers_id"] > 0) {
                     if (PluginOcsinventoryngOcsServer::checkOCSconnection($_SESSION["plugin_ocsinventoryng_ocsservers_id"])) {
                         $ocsClient = new PluginOcsinventoryngOcsServer();
                         $client = $ocsClient->getDBocs($_SESSION["plugin_ocsinventoryng_ocsservers_id"]);
                         $version = $client->getTextConfig('GUI_VERSION');
                         $snmp = $client->getIntConfig('SNMP');
                         if ($version > $ocsClient::OCS2_1_VERSION_LIMIT && $snmp) {
                             $ong[3] = __('SNMP Import', 'ocsinventoryng');
                         }
                     }
                 }
             } else {
                 $ong = array();
                 echo "<div align='center'>";
                 echo Html::image($CFG_GLPI["root_doc"] . "/pics/warning.png", array('alt' => __('Warning')));
                 echo "<br>";
                 echo "<div class='red b'>";
                 _e('No OCSNG server defined', 'ocsinventoryng');
                 echo "<br>";
                 _e('You must to configure a OCSNG server', 'ocsinventoryng');
                 echo " : <a href='" . $CFG_GLPI["root_doc"] . "/plugins/ocsinventoryng/front/ocsserver.form.php'>";
                 _e('Add a OCSNG server', 'ocsinventoryng');
                 echo "</a>";
                 echo "</div></div>";
             }
             return $ong;
         default:
             return '';
     }
 }