//import
require_once $_SERVER['DOCUMENT_ROOT'] . '/VirtualDemande/model/DAL/RamDAL.php';
//Définition de l'url
$urlCourante = $_SERVER["HTTP_REFERER"];
$urlGet = explode("&", $urlCourante);
$url = $urlGet[0];
//Définition du message renvoyé
$message = "error";
//Checker de où il vient
$validPage = filter_input(INPUT_POST, 'page', FILTER_SANITIZE_STRING);
if ($validPage == "forms_administration.php") {
    //Récupération de la valeur passée
    $data = filter_input(INPUT_POST, 'idsRam', FILTER_SANITIZE_STRING, FILTER_REQUIRE_ARRAY);
    if (!is_null($data)) {
        //Passer à 0 les distribs pour qu'elles ne soient pas visibles
        $lesRam = RamDAL::findAll();
        foreach ($lesRam as $row) {
            $newRam = $row;
            $newRam->setVisible(false);
            $validUpdate = RamDAL::insertOnDuplicate($newRam);
        }
        $id = 1;
        foreach ($data as $row) {
            $newRam = RamDAL::findById($row);
            $newRam->setVisible(true);
            $validUpdate = RamDAL::insertOnDuplicate($newRam);
        }
        $message = "ok";
    }
}
//Renvoie à la page précédante
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/VirtualDemande/model/DAL/Distrib_AliasDAL.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/VirtualDemande/model/DAL/CpuDAL.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/VirtualDemande/model/DAL/RamDAL.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/VirtualDemande/model/DAL/StockageDAL.php';
$OSList = Distrib_AliasDAL::findAll();
$CPUList = CpuDAL::findAll();
$RAMList = RamDAL::findAll();
$HDDList = StockageDAL::findAll();
?>

<html>
    <body>
        <?php 
if (isset($_SESSION['user_id']) && !empty($_SESSION['user_id']) && $_SESSION['user_id'] !== false && $_SESSION["role_id"] == 3) {
    ?>
        <h2><span class="label label-warning">Visible items configuration - Check the items you want to be visible for the user</span></h2>
        <!--OS settings-->
        <form action="./controller/pages/Update_Distrib_Alias.php" method="post" >
            <div>
                <h3><span class="label label-primary">OS parameters</span></h3>
            </div>
            <div class = "form-group">
                <input name = "page" type = "hidden" class = "form-control" value = "forms_administration.php">
            </div>
            <div class="os-parameters-parent">
                <?php 
    foreach ($OSList as $OS) {
        ?>
                    <div class="os-parameters" >