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::checkRight("plugin_ocsinventoryng", UPDATE);
Html::header('OCS Inventory NG', '', "tools", "pluginocsinventoryngmenu", "syncsnmp");
$display_list = true;
if (isset($_POST["delete"]) && isset($_POST["toupdate"])) {
    if ($count = count($_POST["toupdate"])) {
        foreach ($_POST['toupdate'] as $key => $val) {
            if ($val == "on") {
                $link = new PluginOcsinventoryngSnmpOcslink();
                $link->delete(array('id' => $key), 1);
            }
        }
        Html::redirect($_SERVER['PHP_SELF']);
    }
}
if (isset($_SESSION["ocs_updatesnmp"]['id'])) {
    if ($count = count($_SESSION["ocs_updatesnmp"]['id'])) {
        $percent = min(100, round(100 * ($_SESSION["ocs_updatesnmp_count"] - $count) / $_SESSION["ocs_updatesnmp_count"], 0));
        $key = array_pop($_SESSION["ocs_updatesnmp"]['id']);
        $action = PluginOcsinventoryngSnmpOcslink::updateSnmp($key, $_SESSION["plugin_ocsinventoryng_ocsservers_id"]);
        PluginOcsinventoryngOcsServer::manageImportStatistics($_SESSION["ocs_updatesnmp"]['statistics'], $action['status'], true);
        PluginOcsinventoryngOcsServer::showStatistics($_SESSION["ocs_updatesnmp"]['statistics'], false, true);
        Html::displayProgressBar(400, $percent);
        Html::redirect($_SERVER['PHP_SELF']);
    } else {