const EXCEPTION_UNEXPECTED_CLOSED_GROUP = 0xb03;
/**
- * Private constructor
+ * Protected constructor
*
* @return void
*/
parent::__construct(__CLASS__);
// Set part description
- $this->setObjectDescription("HTML-Formularhilfsklasse");
+ $this->setObjectDescription("Helper class for HTML forms");
+
+ // Create unique ID number
+ $this->createUniqueID();
}
/**
// Add HTML code
$formContent = sprintf("<form name=\"%s\" class=\"forms\" action=\"%s\" method=\"%s\" target=\"%s\"",
$formName,
- $this->getConfigInstance()->readConfig("form_action"),
- $this->getConfigInstance()->readConfig("form_method"),
- $this->getConfigInstance()->readConfig("form_target")
+ $this->getConfigInstance()->readConfig('form_action'),
+ $this->getConfigInstance()->readConfig('form_method'),
+ $this->getConfigInstance()->readConfig('form_target')
);
// Is the form id set?
$this->formName = $formName;
} else {
// Add the hidden field required to identify safely this form
- $this->addInputHiddenField("form", $this->formName);
+ $this->addInputHiddenField('form', $this->formName);
// Is a group open?
if ($this->groupOpened === true) {
* opened. The field's name will be set as id.
*
* @param $fieldName Input field name
- * @param $fieldSize Input size
- * @param $fieldMaxLength Input max length
* @param $fieldValue Input default value (default: empty)
* @return void
* @throws FormClosedException If the form is not yet opened
*/
- public function addInputTextField ($fieldName, $fieldSize, $fieldMaxLength, $fieldValue = "") {
+ public function addInputTextField ($fieldName, $fieldValue = "") {
// Is the form opened?
if ($this->formOpened === false) {
// Throw an exception
}
// Generate the content
- $inputContent = sprintf("<input type=\"text\" class=\"textfield\" id=\"%s\" name=\"%s\" size=\"%d\" maxlength=\"%d\" value=\"%s\" />",
- $fieldName, $fieldName, $fieldSize, $fieldMaxLength, $fieldValue);
+ $inputContent = sprintf("<input type=\"text\" class=\"textfield\" id=\"%s\" name=\"%s\" value=\"%s\" />",
+ $fieldName,
+ $fieldName,
+ $fieldValue
+ );
// And add it maybe with a "li" tag
$this->addContent($inputContent);
* yet opened. The field's name will be set as id.
*
* @param $fieldName Input field name
- * @param $fieldSize Input size
- * @param $fieldMaxLength Input max length
* @param $fieldValue Input default value (default: empty)
* @return void
* @throws FormClosedException If the form is not yet opened
*/
- public function addInputPasswordField ($fieldName, $fieldSize, $fieldMaxLength, $fieldValue = "") {
+ public function addInputPasswordField ($fieldName, $fieldValue = "") {
// Is the form opened?
if ($this->formOpened === false) {
// Throw an exception
}
// Generate the content
- $inputContent = sprintf("<input type=\"password\" class=\"password\" id=\"%s\" name=\"%s\" size=\"%d\" maxlength=\"%d\" value=\"%s\" />",
- $fieldName, $fieldName, $fieldSize, $fieldMaxLength, $fieldValue);
+ $inputContent = sprintf("<input type=\"password\" class=\"password\" id=\"%s\" name=\"%s\" value=\"%s\" />",
+ $fieldName,
+ $fieldName,
+ $fieldValue
+ );
// And add it
$this->addContent($inputContent);
* @return $required Wether the email address is required
*/
public function ifRegisterRequiresEmailVerification () {
- $required = ($this->getConfigInstance()->readConfig("register_requires_email") == "Y");
+ $required = ($this->getConfigInstance()->readConfig('register_requires_email') == "Y");
return $required;
}
* @return $required Wether profile shall be asked
*/
public function ifRegisterIncludesProfile () {
- $required = ($this->getConfigInstance()->readConfig("register_includes_profile") == "Y");
+ $required = ($this->getConfigInstance()->readConfig('register_includes_profile') == "Y");
return $required;
}
* @return $required Wether personal data shall be asked
*/
public function ifRegisterIncludesPersonaData () {
- $required = ($this->getConfigInstance()->readConfig("register_personal_data") == "Y");
+ $required = ($this->getConfigInstance()->readConfig('register_personal_data') == "Y");
return $required;
}
+ /**
+ * Checks wether email addresses can only be once used
+ *
+ * @return $isUnique
+ */
+ public function ifEmailMustBeUnique () {
+ $isUnique = ($this->getConfigInstance()->readConfig('register_email_unique') == "Y");
+ return $isUnique;
+ }
+
/**
* Checks wether the specified chat protocol is enabled in this form
*