<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/VirtualDemande/model/DAL/MachineDAL.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/VirtualDemande/model/DAL/GroupeDAL.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'; require_once $_SERVER['DOCUMENT_ROOT'] . '/VirtualDemande/model/DAL/UtilisateurDAL.php'; $userId = $_SESSION["user_id"]; $rowsFonctionnal = MachineDAL::findSuccessByUser($_SESSION["user_id"]); $rowsCreated = MachineDAL::findNotCreatByUser($_SESSION["user_id"]); $OSDisplayed = Distrib_AliasDAL::findByVisible(); $CPUDisplayed = CpuDAL::findByVisible(); $RAMDisplayed = RamDAL::findByVisible(); $HDDisplayed = StockageDAL::findByVisible(); $canCreate = UtilisateurDAL::isFull($_SESSION["user_id"]); if (!(isset($_SESSION['user_id']) && !empty($_SESSION['user_id']) && $_SESSION['user_id'] !== false)) { header('Location: ?page=home'); } ?> <html> <!--Javascript file for dynamic select--> <script src="./view/javascript/manage_containers.js"></script> <body> <!--List of the containers that are fonctionnals--> <div> <h2><span class="label label-primary">Fonctionnal containers</span></h2> <table class = "table table-bordered table-hover"> <thead> <tr>
public function getCpu() { $cpu = null; if (is_int($this->cpu)) { $cpu = CpuDAL::findById($this->cpu); $this->cpu = $cpu; } else { if (is_a($this->cpu, "Cpu")) { $cpu = $this->cpu; } } return $cpu; }
//sera utile pour l'insertt en base $newMachine->setRam($ram); $valueRam = $ram->getValeur(); //sera utile pour le ws, ram } $validStockId = filter_input(INPUT_POST, 'stock', FILTER_SANITIZE_STRING); if (!is_null($validStockId)) { $stock = StockageDAL::findById($validStockId); //sera utile pour l'insertt en base $newMachine->setStockage($stock); $valueStock = $stock->getValeur(); //sera utile pour le ws, stockage } $validCpuId = filter_input(INPUT_POST, 'cpu', FILTER_SANITIZE_STRING); if (!is_null($validCpuId)) { $cpu = CpuDAL::findById($validCpuId); //sera utile pour l'insertt en base $newMachine->setCpu($cpu); $valueCpu = $cpu->getNbCoeur(); //sera utile pour le ws, cpu } $validUserId = $_SESSION["user_id"]; //sera utile pour l'insert if (!is_null($validUserId)) { $user = UtilisateurDAL::findById($validUserId); //sert à l'insert $newMachine->setUtilisateur($user); $loginUtilisateur = $user->getLogin(); } $newDateCreation = date("Y-m-d"); $newMachine->setDateCreation($newDateCreation);
<?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" >
require_once $_SERVER['DOCUMENT_ROOT'] . '/VirtualDemande/model/DAL/CpuDAL.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, 'idsCpu', FILTER_SANITIZE_STRING, FILTER_REQUIRE_ARRAY); if (!is_null($data)) { //Passer à 0 les distribs pour qu'elles ne soient pas visibles $lesCpu = CpuDAL::findAll(); foreach ($lesCpu as $row) { $newCpu = $row; $newCpu->setVisible(false); $validUpdate = CpuDAL::insertOnDuplicate($newCpu); } $id = 1; foreach ($data as $row) { $newCpu = CpuDAL::findById($row); $newCpu->setVisible(true); $validUpdate = CpuDAL::insertOnDuplicate($newCpu); } $message = "ok"; } } //Renvoie à la page précédante echo "<meta http-equiv='refresh' content='1; url=" . $url . '&message=' . $message . "' />";