Skip to content
Snippets Groups Projects
Commit a4b308e4 authored by goujonpa's avatar goujonpa
Browse files

bonjour dureefield

parent f77ee0b3
No related branches found
No related tags found
No related merge requests found
<?php
class DureeField extends Field
{
public function html() {
// 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;
}
public function validate()
{
$this->value = $_POST[$this->name];
if (this->value > -1) {
return true;
}
return false;
}
public function show() {
$heures = (int)$this->value / 60;
$minutes = (int)$this->value % 60;
$html = $heures.'h '.$minutes.'min';
return $html;
}
}
......@@ -24,7 +24,8 @@ class Rdv extends Objet
"t" => "DateField"
),
"duree" => array(
"i" => 5
"i" => 5,
"t" => "DureeField"
));
......
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