public function getData() { $nameLenght = strlen($this->name); if ($this->isFormSent()) { $this->data = array(); foreach ($_POST as $field => $value) { if (is_array($value)) { foreach ($this->columnNames as $i => $columnName) { if ($field == $columnName) { $field = substr($field, $nameLenght - strlen($field) + 1); foreach ($value as $j => $data) { $this->data[$j][$field] = $data; } } } } } foreach ($this->data as $i => $data) { $pass = false; foreach ($data as $field => $value) { if ($value != "") { $pass = true; break; } } if (!$pass) { unset($this->data[$i]); } } return array($this->getName() => $this->data); } else { return parent::getData(); } }
public function getData($storable = false) { if (isset($_POST[$this->getName()])) { return parent::getData(); } else { return array($this->getName(false) => $this->uncheckedValue); } }