From 11e0c84be4e25c21ea582d24be1199874817d373 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sat, 9 Mar 2013 18:41:10 +0000 Subject: [PATCH] added function to add simple text input fields --- lam/lib/baseModule.inc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lam/lib/baseModule.inc b/lam/lib/baseModule.inc index eccb2e5b..72bf8b13 100644 --- a/lam/lib/baseModule.inc +++ b/lam/lib/baseModule.inc @@ -1160,6 +1160,26 @@ abstract class baseModule { */ public abstract function display_html_attributes(); + /** + * Adds a simple text input field to the given htmlTable. + * The field name will be the same as the attribute name. There must also be a help entry with the attribute name as ID. + * A new line will also be added after this entry so multiple calls will show the fields one below the other. + * + * @param htmlTable $container parent container + * @param String $attrName attribute name + * @param String $label label name + * @param boolean $required this is a required field (default false) + */ + protected function addSimpleInputTextField(&$container, $attrName, $label, $required = false) { + $value = ''; + if (isset($this->attributes[$attrName][0])) { + $value = $this->attributes[$attrName][0]; + } + $input = new htmlTableExtendedInputField($label, $attrName, $value, $attrName); + $input->setRequired($required); + $container->addElement($input, true); + } + /** * Returns a list of managed object classes for this module. *