<? // Include the file for the specific functions on Courts $CourtGroundType= array( "Dur","Gazon","Synthétique","Terre battue" ); require_once '../../../Models/Courts.php'; if(!empty($_POST)) { $data=$_POST; if (!isset($data["CourtAvailSat"])) { $data["CourtAvailSat"]="off"; } if (!isset($data["CourtAvailSun"])) { $data["CourtAvailSun"]="off"; } $Court= new CourtsModel(); $Court->Insert($data); } ?> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <h4>Ajouter un terrain</h4> <form method="post"> <select name="CourtGroundType" required> <? foreach ($CourtGroundType as $Type):?> <option value="<? echo $Type; ?>"><? echo $Type;?></option> <? endforeach;?> </select> <input name="CourtAddress" placeholder="Adresse du terrain" type="address" required/> <input name="CourtAddressN" placeholder="Numéro" type="number" required/>
<? // Include the file for the specific functions on Users require_once '../../../Models/Courts.php'; // New Helper to use the functions $id=$_GET["id"]; $Court= new CourtsModel(); // Performing a select with all "*" and specifiying the RoleId=2 for selecting only users $results = $Court->Delete(array( "CourtId" => $id )); header("Location: ./index.php"); ?>
<? // Include the file for the specific functions on Courts require_once '../../../Models/Courts.php'; // New Helper to use the functions $Tour= new CourtsModel(); // Performing a select with all "*" and specifiying the RoleId=2 for selecting only Courts $results = $Tour->SelectAll(); $labels = array("Numéro de terrain","Type de terrain", "Adresse" , "Propriété","Commentaires","Disponible Samedi","Disponible Dimanche", "Nom du proprietaire","Actions" ); ?> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <a href="create.php">Créer un nouveau terrain</a> <h4>Liste des terrain</h4> <table> <tr> <?php foreach ($labels as $label) { ?> <td><?php echo $label; ?> </td> <?php } ?> </tr> <?php foreach ($results as $result) { ?> <tr>
<? // Array Helpers $CourtGroundType= array( "Dur","Gazon","Synthétique","Terre battue" ); $CourtType=array("Public","Privé"); require_once '../../../Models/Courts.php'; // New Helper to use the functions $id=$_GET["id"]; $Court= new CourtsModel(); // Performing a select with all "*" and specifiying the CourtId to edit $results = $Court->SelectSpecific("*",array( "CourtId" => $id )); $results=$results[0]; //If an edit is performed if(! empty($_POST)) { $data=$_POST; if (!isset($data["CourtAvailSat"])) { $data["CourtAvailSat"]="off"; } if (!isset($data["CourtAvailSun"])) { $data["CourtAvailSun"]="off"; } $answer=$Court->Update($data,array( "CourtId" => $id )); header("Location: ./index.php"); }