diff --git a/class/employe.php b/class/employe.php index be84cec62b1d4f1bf1f273fd6d24903723d60dcb..980920066528550234500d181f45e20bc605cfd0 100644 --- a/class/employe.php +++ b/class/employe.php @@ -6,7 +6,11 @@ class Employe extends Personne protected $is_veterinaire; public $_specialFields = array( "is_veterinaire" => array( - "t" => "BoolField" + "t" => "BoolField", + "label" => "Veterinaire" + ), + "id_national" => array( + "label" => "Identifiant national" )); public function id_national() diff --git a/class/field.php b/class/field.php index 55356cb555c3926bd0833211504fed703464ba45..497637e371dc8b6d677744a75b91ea56f74c2790 100644 --- a/class/field.php +++ b/class/field.php @@ -4,11 +4,13 @@ class Field { protected $name; protected $value; protected $primary; + public $label; public function __construct($name, &$value, $primary=false) { $this->name = $name; $this->value =& $value; $this->primary = $primary; + $this->label = ucfirst($name); } public function html($form) { @@ -44,7 +46,7 @@ class Field { } public function getLabel() { - return ucfirst($this->name); + return $this->label; } } diff --git a/class/objet.php b/class/objet.php index 7512c16a713885762a0af0b2d436dae10c1f16db..76c0f2e0feb904cfa941742068796b9d87a7ec2e 100644 --- a/class/objet.php +++ b/class/objet.php @@ -52,13 +52,18 @@ class Objet { $ret = array(); foreach(array_keys(get_object_vars($this)) as $keyName) { + $field = null; if($keyName[0] == "_") { continue; } if($keyName == $this->_primaryAttr && $this->_primaryAttr == "id") { $ret[] = new Field($keyName, $this->$keyName, true); continue; } - if(in_array($keyName, array_keys($this->_specialFields))) { - $ret[] = new $this->_specialFields[$keyName]["t"]($keyName, $this->$keyName); + if(isset($this->_specialFields[$keyName]["t"])) { + $field = new $this->_specialFields[$keyName]["t"]($keyName, $this->$keyName); } else { - $ret[] = new Field($keyName, $this->$keyName); + $field = new Field($keyName, $this->$keyName); } + if(isset($this->_specialFields[$keyName]["label"])) { + $field->label = $this->_specialFields[$keyName]["label"]; + } + $ret[] = $field; } return $ret; }