diff --git a/include/class_template.inc b/include/class_template.inc index f589585fdf3daa8a77b69b3b3428d616167cbd60..7560af4e10eb4f67b6e67dde7e8be317f2f1dc5e 100644 --- a/include/class_template.inc +++ b/include/class_template.inc @@ -142,6 +142,35 @@ class template return $this->attributes; } + function alterAttributes($mandatories, $readonly, $hidden) + { + foreach ($mandatories as $class => $attrs) { + foreach ($attrs as $attr) { + if (!in_array($attr, $this->attributes[$class])) { + $this->attributes[$class][] = $attr; + } + $this->tabObject->by_object[$class]->attributesAccess[$attr]->setRequired(TRUE); + } + } + foreach ($readonly as $class => $attrs) { + foreach ($attrs as $attr) { + if (!in_array($attr, $this->attributes[$class])) { + $this->attributes[$class][] = $attr; + } + $this->tabObject->by_object[$class]->attributesAccess[$attr]->setDisabled(TRUE); + } + } + foreach ($hidden as $class => $attrs) { + foreach ($attrs as $attr) { + if (!in_array($attr, $this->attributes[$class])) { + $this->attributes[$class][] = $attr; + } + $this->tabObject->by_object[$class]->attributesAccess[$attr]->setDisabled(TRUE); + $this->tabObject->by_object[$class]->attributesAccess[$attr]->setVisible(FALSE); + } + } + } + function serialize() { $ret = array();