define('GLPI_ROOT', '..'); include GLPI_ROOT . "/inc/includes.php"; checkRight("ocsng", "w"); commonHeader($LANG['ocsng'][0], $_SERVER['PHP_SELF'], "utils", "ocsng", "sync"); $display_list = true; if (isset($_SESSION["ocs_update"]['computers'])) { if ($count = count($_SESSION["ocs_update"]['computers'])) { $percent = min(100, round(100 * ($_SESSION["ocs_update_count"] - $count) / $_SESSION["ocs_update_count"], 0)); $key = array_pop($_SESSION["ocs_update"]['computers']); $action = OcsServer::updateComputer($key, $_SESSION["ocsservers_id"], 2); OcsServer::manageImportStatistics($_SESSION["ocs_update"]['statistics'], $action['status']); OcsServer::showStatistics($_SESSION["ocs_update"]['statistics']); displayProgressBar(400, $percent); glpi_header($_SERVER['PHP_SELF']); } else { OcsServer::showStatistics($_SESSION["ocs_update"]['statistics'], true); unset($_SESSION["ocs_update"]); $display_list = false; echo "<div class='center b'><br>"; echo "<a href='" . $_SERVER['PHP_SELF'] . "'>" . $LANG['buttons'][13] . "</a></div>"; } } if (!isset($_POST["update_ok"])) { if (!isset($_GET['check'])) { $_GET['check'] = 'all'; } if (!isset($_GET['start'])) { $_GET['start'] = 0; } OcsServer::manageDeleted($_SESSION["ocsservers_id"]); if ($display_list) {
$entity = -1; } if (isset($_SESSION["ocs_import"]["locations_id"][$key])) { $location = $_SESSION["ocs_import"]["locations_id"][$key]; } else { $location = -1; } $conf = OcsServer::getConfig($_SESSION["ocsservers_id"]); $action = OcsServer::processComputer($key, $_SESSION["ocsservers_id"], 0, $entity, $location); OcsServer::manageImportStatistics($_SESSION["ocs_import"]['statistics'], $action['status']); OcsServer::showStatistics($_SESSION["ocs_import"]['statistics']); displayProgressBar(400, $percent); glpi_header($_SERVER['PHP_SELF']); } else { //displayProgressBar(400, 100); OcsServer::showStatistics($_SESSION["ocs_import"]['statistics'], true); unset($_SESSION["ocs_import"]); echo "<div class='center b'><br>"; echo "<a href='" . $_SERVER['PHP_SELF'] . "'>" . $LANG['buttons'][13] . "</a></div>"; $display_list = false; } } if (!isset($_POST["import_ok"])) { if (!isset($_GET['check'])) { $_GET['check'] = 'all'; } if (!isset($_GET['start'])) { $_GET['start'] = 0; } if (isset($_SESSION["ocs_import"])) { unset($_SESSION["ocs_import"]);