Skip to content
Snippets Groups Projects
Commit 4e0ce3da authored by goujonpa's avatar goujonpa
Browse files
parents c463af4a bbc6a196
No related branches found
No related tags found
No related merge requests found
......@@ -2,15 +2,15 @@
class Client extends Personne
{
protected $numTel;
protected $num_tel;
public function numTel()
public function num_tel()
{
return $this->numTel;
return $this->num_tel;
}
public function setNumTel($numTel)
public function setNum_tel($num_tel)
{
$this->numTel = $numTel;
$this->num_tel = $num_tel;
}
}
\ No newline at end of file
......@@ -2,26 +2,26 @@
class Employe extends Personne
{
protected $idNational;
protected $isVeterinaire;
protected $id_national;
protected $is_veterinaire;
public function idNational()
public function id_national()
{
return $this->idNational;
return $this->id_national;
}
public function setIdNational($idNational)
public function setId_national($id_national)
{
$this->idNational = $idNational;
$this->id_national = $id_national;
}
public function isVeterinaire()
public function is_veterinaire()
{
return $this->isVeterinaire;
return $this->is_veterinaire;
}
public function setIsVeterinaire($isVeterinaire)
public function setIs_veterinaire($isVeterinaire)
{
$this->isVeterinaire = $isVeterinaire;
$this->is_veterinaire = $isVeterinaire;
}
}
\ No newline at end of file
......@@ -3,6 +3,7 @@
class Form {
protected $object;
protected $action;
protected $error = null;
public function __construct(&$obj) {
$this->object =& $obj;
......@@ -26,11 +27,17 @@ class Form {
// If all validators ok, commit
if($success) {
if($this->action == "Modifier") {
$this->object->update();
} else {
$this->object->insert();
try {
if($this->action == "Modifier") {
$this->object->update();
} else {
$this->object->insert();
}
} catch (Exception $e) {
$this->error = $e->getMessage();
}
} else {
$this->error = "Tout les conditions de validations de formulaire ne sont pas passés.";
}
} else {
$post = false;
......@@ -50,7 +57,13 @@ class Form {
}
public function getAlerts() {
return '<p class="bg-danger">Code en cours d\'implémentation, l\'enregistrement n\'a pas été ajouté !</p>';
if($this->error) {
return '<p class="bg-danger">'.$this->error.'</p>';
} else {
if(isset($_POST["submitForm"])) {
return '<p class="bg-success">L\'opération a réussi avec succès.</p>';
}
}
}
}
\ No newline at end of file
......@@ -77,12 +77,16 @@ class Objet
$req = "INSERT INTO ".$dbName." (".implode(",", array_keys($values)).")
VALUES (".implode(",", array_values($values)).")";
//debug
//echo $req;
//die();
$requete_prepare = $bdd->db->prepare($req); // on prépare notre requête
$requete_prepare->execute($params);
if (!$requete_prepare) {
throw new Exception("PDO::errorInfo(): (STEP 1)\n". print_r($bdd->db->errorInfo(), true));
}
$result = $requete_prepare->execute($params);
if($result != 1) {
throw new Exception("RESULT : ".print_r($result,true)."\n".print_r($requete_prepare->errorInfo(),true));
}
}
}
\ No newline at end of file
......@@ -15,14 +15,15 @@ switch($action) {
case "listePersonnel":
$listArray = Employe::getAll();
$listParams = array("title" => "Liste du personnel",
"keys" => array("id", "nom", "prenom", "isVeterinaire", "idNational"));
"keys" => array("id", "nom", "prenom", "is_veterinaire", "id_national"));
$editLink = "editPersonnel";
include 'view/list.php';
break;
case "listeClient":
$listArray = Client::getAll();
$listParams = array("title" => "Liste des clients",
"keys" => array("id", "nom", "prenom", "numTel"));
"keys" => array("id", "nom", "prenom", "num_tel"));
$editLink = "editClient";
include 'view/list.php';
break;
case "addPersonnel":
......@@ -36,10 +37,14 @@ switch($action) {
include 'view/form.php';
break;
case "editPersonnel":
$employe = new Employe();
$formConf = $employe->getForm();
include 'view/form.php';
break;
case "editClient":
$client = new Client();
$formConf = $client->getForm();
include 'view/form.php';
break;
default:
include 'view/404.php';
......
......@@ -7,15 +7,15 @@
background-color: #f5f5f5;
}
.footer_container {
.footer-container {
width: auto;
max-width: 680px;
padding-top: 10px;
padding-bottom: 0px;
/*text-align : center;*/
text-align: center;
}
.text-footer {
/*text-align : center;*/
color : black;
text-align: center;
color: black;
}
\ No newline at end of file
......@@ -6,27 +6,5 @@ html {
}
body {
/* Margin bottom by footer height */
margin-bottom: 60px;
}
#footer {
position: absolute;
bottom: 0;
width: 100%;
/* Set the fixed height of the footer here */
height: 60px;
background-color: #f5f5f5;
}
/* Custom page CSS
-------------------------------------------------- */
/* Not required for template or sticky footer method. */
.container {
width: auto;
max-width: 680px;
padding: 0 15px;
}
.container .text-muted {
margin: 20px 0;
}
margin-bottom: 30px;
}
\ No newline at end of file
<div id="footer">
<div class="container">
<div class="footer-container">
<p class="text-footer">NF17 - ©Team CAMP 2014 - Developed by Matthieu GUFFROY, Clément MERCIER, Alexandre CORTYL & Paul GOUJON</p>
</div>
</div>
......
......@@ -12,7 +12,7 @@
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="http://tuxa.sme.utc/~nf17p110/css/bootstrap.css">
<link rel="stylesheet" href="http://tuxa.sme.utc/~nf17p110/css/custom_boostrap.css">
<link rel="stylesheet" href="http://tuxa.sme.utc/~nf17p110/css/custom_bootstrap.css">
<link href="http://tuxa.sme.utc/~nf17p110/css/sticky-footer.css" rel="stylesheet">
......
......@@ -15,7 +15,7 @@
<?php foreach($listParams["keys"] as $key): ?>
<td><?php echo $line->{$key}(); ?></td>
<?php endforeach; ?>
<td> <a type="button" class="btn btn-primary" href="""<?php echo $base_url.$editLink.'?'.$listParams['keys'][0].'='.$line->{$listParams["keys"][0]}() ?>""">Editer</a>
<td> <a type="button" class="btn btn-primary" href="<?php echo $base_url.$page.'/'.$editLink.'?'.$listParams['keys'][0].'='.$line->{$listParams['keys'][0]}() ?>">Editer</a>
</tr>
<?php endforeach; ?>
</tbody>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment