name = $name; $this->editable = $editable; $this->value = $value; $this->relatedClass = $relatedClass; $this->list = $list; } public function getName() { return $this->name; } public function setName($value) { $this->name = $value; } public function isEditable() { return $this->editable; } public function hasSystemInit() { return $this->systemInit; } public function isList() { if ($this->attrProperties == null) return $this->list !== null; else return $this->attrProperties->incl(new AttrProperty(AttrProperty::AP_LIST)); } public function isFK() { return $this->relatedClass != 0; } public function isBool() { return $this->attrProperties->incl(new AttrProperty(AttrProperty::AP_BOOL)); } public function getValue() { return $this->value; } public function setValue($value = null) { if ($this->typeClass == null) { if ($this->attrProperties->incl(new AttrProperty(AttrProperty::AP_FLOAT))) $this->value = str_replace(",",".",$value); else { if ($value) $value = htmlentities($value, ENT_XML1); $this->value = $value; } } else { $this->value = $this->typeClass->newInstance($value); } } public function getList() { return $this->list; } public function setList($value) { $this->list = $value; // to have the size value consistent $this->value = count($value); } public function getRelatedClass() { return $this->relatedClass; } public function setRelatedClass($value) { $this->relatedClass = $value; } public function setAttrProperties($value) { $this->attrProperties = $value; $this->systemInit = $this->attrProperties->incl(new AttrProperty(AttrProperty::AP_INIT)); $this->editable = $this->attrProperties->incl(new AttrProperty(AttrProperty::AP_SET)); } public function setTypeClass($app, $value) { $this->typeClassName = $value; $this->typeClass = new ReflectionClass($value); } public function getTypeClass() { return $this->typeClass; } public function recover() { if ($this->typeClassName != "") { $this->typeClass = new ReflectionClass($this->typeClassName); } } public function __toString() { $value = $this->value; if ($this->typeClass != null) return $value->__toString(); if ($this->isList()) return "List($value)"; if ($this->isFK()) return "#$value"; if ($this->attrProperties->incl(new AttrProperty(AttrProperty::AP_FLOAT))) return str_replace(".",",",$value); return $value; } /* public function toXmlElem() { if ($this->isList()) { $xml_ele = $this->value; for ($i=0; $i<$this->value; $i++) { $no = $i+1; $elem = $this->list[$i]; $xml_ele = "$xml_ele$elem"; } return $xml_ele; } return $this->__toString(); } */ }