Skip to content
Snippets Groups Projects
Commit 875525e5 authored by Matthieu Guffroy's avatar Matthieu Guffroy
Browse files

Formulaires avancement

parent bd228428
No related branches found
No related tags found
No related merge requests found
......@@ -2,12 +2,10 @@
class Form {
protected $object;
public function __construct() {
}
public function setObject(&$obj) {
public function __construct(&$obj) {
$this->object =& $obj;
$this->fields = $this->object->getFields();
// TODO: Check if there is $_POST data (and if yes, insert or update the corresponding row)
}
public function getTitle() {
......@@ -19,7 +17,7 @@ class Form {
}
public function getFields() {
return Array();
return $this->fields();
}
}
\ No newline at end of file
......@@ -8,7 +8,9 @@ class Objet
$attKeys = array_keys($att);
for ($i=0; $i < count($att); $i++) {
$this->$attKeys[$i] = $arr[$attKeys[$i]];
if(array_key_exists($attKeys[$i], $arr)) {
$this->$attKeys[$i] = $arr[$attKeys[$i]];
}
}
}
......@@ -37,4 +39,13 @@ class Objet
$form->setObject($this);
return $form;
}
public function getFields()
{
$ret = array();
foreach(array_keys(get_object_vars($this)) as $keyName) {
$ret[] = new Field($keyName);
}
return $ret;
}
}
\ No newline at end of file
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