diff --git a/class/datefield.php b/class/datefield.php index 19667dc8b30e013e300b9f1015bdc6f09609002d..07879d584c5c6f14b11d2a270af91a2dce77fde4 100644 --- a/class/datefield.php +++ b/class/datefield.php @@ -1,10 +1,12 @@ <?php + +class DateField extends Field { public function html() { - $html = '<div class = "form-group"> - <label for = "form'.$this->name.'"> - <input type = "date" name = "'.$this->name.'" value ="'.$this->value.'"> '.$this->label.' - </label> + // Todo, if isset($_POST[$this->name]) && !$this->validate() => Show a error msg explanation for this line. + $html = '<div class="form-group"> + <label for="form'.$this->name.'">'.$this->label.'</label> + <input type="number" class="form-control" name="'.$this->name.'" value="'.$this->value.'"> </div>'; return $html; } @@ -12,16 +14,20 @@ public function validate() { - /*if (isset($_POST[$this->name])) + if (isset($_POST[$this->name])) { - $_POST[$this->name] = htmlspecialchars($_POST[$this->name]); - if (preg_match("#^0[1-68]([-. ]?[0-9]{2}){4}$#", $_POST[$this->name])) - { - $this->value = $_POST[$this->name]; - return true; - } - */ + $this->value = $_POST[$this->name]; + if ($this->value > -1) { + return true; + } + } return false; } + public function show() { + $prix = $this->value; + $html = (string)$prix; + $html .= "€"; + return $html; + } } diff --git a/class/espece.php b/class/espece.php index 84205bef3be4571eb7849f9a649e908d4f0e21ef..fcd2c9d330eaaf6a47b3688f5af34c6add9f2d99 100644 --- a/class/espece.php +++ b/class/espece.php @@ -5,6 +5,18 @@ class Espece extends Objet protected $id; protected $nom; protected $prix_consultation; + public $_specialFields = array( + "id" => array( + "i" => 1 + ), + "nom" => array( + "i" => 2 + ), + "prix_consultation" => array( + "i" => 3, + "label" => "Prix de la consultation", + "t" => "PriceField" + )); public function id() { diff --git a/class/facture.php b/class/facture.php index 80d12d6abc8cedf3f59490d44c82c6be816318c5..8171392c66f77654b4c3e6893821c3e824667817 100644 --- a/class/facture.php +++ b/class/facture.php @@ -30,7 +30,8 @@ class Facture extends Objet ), "prix_total" => array( "label" => "Prix total", - "i" => 9 + "i" => 9, + "t" => "PriceField" )); public function id() diff --git a/class/ordonnance.php b/class/ordonnance.php index 02e7f2069faab745a97e0bd1325b31b1e5e7b080..7ccc0602a0ffff71ab8e68be12f5efc5f67ddeff 100644 --- a/class/ordonnance.php +++ b/class/ordonnance.php @@ -22,7 +22,8 @@ class Ordonnance extends Objet "t" => "ForeignField" ), "prix" => array( - "i" => 5 + "i" => 5, + "t" => "PriceField" )); public function id() diff --git a/class/prestation.php b/class/prestation.php index 527c9ba792a65c0f431db75af5523d8785b1016a..0459ddfd9e51c2e4fe32916507271c4289d8f408 100644 --- a/class/prestation.php +++ b/class/prestation.php @@ -17,7 +17,8 @@ class Prestation extends Objet "i" => 1 ) "prix" => array( - "i" => 4 + "i" => 4, + "t" => "PriceField" )); public function id() diff --git a/class/produit.php b/class/produit.php index 81b04529c4153e4ff29df9c1b6bb46625a42ec57..a91e6ace240b90cc2efba26f6cd2c3729683ab8d 100644 --- a/class/produit.php +++ b/class/produit.php @@ -20,6 +20,7 @@ class Produit extends Objet ), "prix" => array( "i" => 4, + "t" => "PriceField" )); public function id() diff --git a/class/race.php b/class/race.php index 31e06816dd4b0559b21659374c7806574c99a2a0..fdd35fe019dc3f7e6930536551423b84e7b9ac25 100644 --- a/class/race.php +++ b/class/race.php @@ -20,7 +20,8 @@ class Race extends Objet ), "prix_intervention" => array( "label" => "Prix de l'intervetion", - "i" => 4 + "i" => 4, + "t" => "PriceField" )); public function id()