Skip to content
Snippets Groups Projects
Commit 7f14b615 authored by clement's avatar clement
Browse files

correction

parents ff8b42c5 7e26f7ff
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