(at your option) any later version.

  FusionInventory 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 Affero General Public License for more details.

  You should have received a copy of the GNU Affero General Public License
  along with FusionInventory. If not, see <http://www.gnu.org/licenses/>.

  ------------------------------------------------------------------------

  @package   FusionInventory
  @author    David Durieux
  @co-author
  @copyright Copyright (c) 2010-2014 FusionInventory team
  @license   AGPL License 3.0 or (at your option) any later version
             http://www.gnu.org/licenses/agpl-3.0-standalone.html
  @link      http://www.fusioninventory.org/
  @link      http://forge.fusioninventory.org/projects/fusioninventory-for-glpi/
  @since     2010

  ------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
Html::header(__('FusionInventory', 'fusioninventory'), $_SERVER["PHP_SELF"], "plugins", "pluginfusioninventorymenu", "statediscovery");
Session::checkRight('plugin_fusioninventory_task', READ);
PluginFusioninventoryMenu::displayMenu("mini");
$pfStateDiscovery = new PluginFusioninventoryStateDiscovery();
$pfStateDiscovery->display();
Html::footer();
 function import_netdiscovery($arrayinventory, $agentKey)
 {
     PluginFusioninventoryCommunication::addLog('Function PluginFusioninventorySnmpmodelImportExport->import_netdiscovery().');
     $ptap = new PluginFusioninventoryStateDiscovery();
     $pta = new PluginFusioninventoryAgent();
     $agent = $pta->InfosByKey($agentKey);
     if (isset($arrayinventory['AGENT']['START'])) {
         $ptap->updateState($arrayinventory['PROCESSNUMBER'], array('start_time' => date("Y-m-d H:i:s")), $agent['id']);
     } else {
         if (isset($arrayinventory['AGENT']['END'])) {
             $ptap->updateState($arrayinventory['PROCESSNUMBER'], array('end_time' => date("Y-m-d H:i:s")), $agent['id']);
         } else {
             if (isset($arrayinventory['AGENT']['EXIT'])) {
                 $ptap->endState($arrayinventory['PROCESSNUMBER'], date("Y-m-d H:i:s"), $agent['id']);
             } else {
                 if (isset($arrayinventory['AGENT']['NBIP'])) {
                     $ptap->updateState($arrayinventory['PROCESSNUMBER'], array('nb_ip' => $arrayinventory['AGENT']['NBIP']), $agent['id']);
                 }
             }
         }
     }
     if (isset($arrayinventory['AGENT']['AGENTVERSION'])) {
         $agent['last_contact'] = date("Y-m-d H:i:s");
         $pta->update($agent);
     }
     $_SESSION['glpi_plugin_fusioninventory_agentid'] = $agent['id'];
     $count_discovery_devices = 0;
     if (isset($arrayinventory['DEVICE'])) {
         if (is_int(key($arrayinventory['DEVICE']))) {
             $count_discovery_devices = count($arrayinventory['DEVICE']);
         } else {
             $count_discovery_devices = 1;
         }
     }
     if ($count_discovery_devices != "0") {
         $ptap->updateState($_SESSION['glpi_plugin_fusioninventory_processnumber'], array('nb_found' => $count_discovery_devices), $agent['id']);
         if (is_int(key($arrayinventory['DEVICE']))) {
             foreach ($arrayinventory['DEVICE'] as $discovery) {
                 if (count($discovery) > 0) {
                     $pfCommunicationNetworkDiscovery = new PluginFusioninventoryCommunicationNetworkDiscovery();
                     $pfCommunicationNetworkDiscovery->sendCriteria($discovery);
                 }
             }
         } else {
             $pfCommunicationNetworkDiscovery = new PluginFusioninventoryCommunicationNetworkDiscovery();
             $pfCommunicationNetworkDiscovery->sendCriteria($arrayinventory['DEVICE']);
         }
     }
 }