",
$subGroupName,
$subGroupName,
$subGroupName,
$subGroupText,
$subGroupName
);
// Add the content
$this->addContent($content);
// Switch the state and remeber the name
$this->subGroupOpened = true;
$this->subGroupName = $subGroupName;
} else {
// Add the content
$this->addContent($content);
// Switch the state
$this->subGroupOpened = false;
// All call it again if sub group name is not empty
if (!empty($subGroupName)) {
$this->addFormSubGroup($subGroupName, $subGroupText);
} // END - if
}
}
/**
* Add text surrounded by a span block when there is a group opened before
* or else by a div block.
*
* @param $fieldName Field name
* @param $fieldText Text for the field
* @return void
* @throws FormClosedException If the form is not yet opened
*/
public function addFieldText ($fieldName, $fieldText) {
// Is the form opened?
if ($this->formOpened === false) {
// Throw an exception
throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
} // END - if
// Set the block type
$block = "div";
if ($this->groupOpened === true) $block = "span";
// Generate the content
$inputContent = sprintf(" <%s id=\"%s_text\">
%s
%s>",
$block,
$fieldName,
$fieldText,
$block
);
// And add it
$this->addContent($inputContent);
}
/**
* Add text (notes) surrounded by a div block. Still opened groups or sub
* groups will be automatically closed.
*
* @param $formNotes The form notes we shell addd
* @return void
* @throws FormClosedException If the form is not yet opened
*/
public function addFormNote ($formNotes) {
// Is the form opened?
if ($this->formOpened === false) {
// Throw an exception
throw new FormClosedException (array($this, "form_notes"), self::EXCEPTION_CLOSED_FORM);
} // END - if
// Is a group open?
if ($this->groupOpened === true) {
// Then automatically close it here
$this->addFormGroup("", "");
} // END - if
// Generate the content
$inputContent = sprintf("
%s
",
$formNotes
);
// And add it
$this->addContent($inputContent);
}
/**
* Checks wether the registration requires a valid email address
*
* @return $required Wether the email address is required
*/
public function ifRegisterRequiresEmailVerification () {
$required = ($this->getConfigInstance()->readConfig('register_requires_email') == "Y");
return $required;
}
/**
* Checks wether profile data shall be asked
*
* @return $required Wether profile shall be asked
*/
public function ifRegisterIncludesProfile () {
$required = ($this->getConfigInstance()->readConfig('register_includes_profile') == "Y");
return $required;
}
/**
* Checks wether personal data shall be asked
*
* @return $required Wether personal data shall be asked
*/
public function ifRegisterIncludesPersonaData () {
$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
*
* @return $required Wether the specified chat protocol is enabled
*/
public function ifChatEnabled ($chatProtocol) {
$required = ($this->getConfigInstance()->readConfig(sprintf("chat_enabled_%s", $chatProtocol)) == "Y");
return $required;
}
/**
* Checks wether login is enabled or disabled
*
* @return $isEnabled Wether the login is enabled or disabled
*/
public function ifLoginIsEnabled () {
$isEnabled = ($this->getConfigInstance()->readConfig('login_enabled') == "Y");
return $isEnabled;
}
/**
* Checks wether login shall be done by username
*
* @return $isEnabled Wether the login shall be done by username
*/
public function ifLoginWithUsername () {
$isEnabled = ($this->getConfigInstance()->readConfig('login_type') == "username");
return $isEnabled;
}
/**
* Checks wether login shall be done by email
*
* @return $isEnabled Wether the login shall be done by email
*/
public function ifLoginWithEmail () {
$isEnabled = ($this->getConfigInstance()->readConfig('login_type') == "email");
return $isEnabled;
}
/**
* Checks wether guest login is allowed
*
* @return $isAllowed Wether guest login is allowed
*/
public function ifGuestLoginAllowed () {
$isAllowed = ($this->getConfigInstance()->readConfig('guest_login_allowed') == "Y");
return $isAllowed;
}
/**
* Checks wether the email address change must be confirmed
*
* @return $requireConfirm Wether email change must be confirmed
*/
public function ifEmailChangeRequireConfirmation () {
$requireConfirm = ($this->getConfigInstance()->readConfig('email_change_confirmation') == "Y");
return $requireConfirm;
}
/**
* Checks wether the rules has been updated
*
* @return $rulesUpdated Wether rules has been updated
*/
public function ifRulesHaveChanged () {
/* @TODO Implement check if rules have been changed */
return false;
}
/**
* Checks wether email change is allowed
*
* @return $emailChange Wether changing email address is allowed
*/
public function ifEmailChangeAllowed () {
$emailChange = ($this->getConfigInstance()->readConfig('email_change_allowed') == "Y");
return $emailChange;
}
/**
* Checks wether the user account is unconfirmed
*
* @return $isUnconfirmed Wether the user account is unconfirmed
*/
public function ifUserAccountUnconfirmed () {
$isUnconfirmed = ($this->getField('user_status') === $this->getConfigInstance()->readConfig('user_status_unconfirmed'));
return $isUnconfirmed;
}
/**
* Checks wether the user account is locked
*
* @return $isUnconfirmed Wether the user account is locked
*/
public function ifUserAccountLocked () {
$isUnconfirmed = ($this->getField('user_status') === $this->getConfigInstance()->readConfig('user_status_locked'));
return $isUnconfirmed;
}
/**
* Checks wether the user account is a guest
*
* @return $isUnconfirmed Wether the user account is a guest
*/
public function ifUserAccountGuest () {
$isUnconfirmed = ($this->getField('user_status') === $this->getConfigInstance()->readConfig('user_status_guest'));
return $isUnconfirmed;
}
/**
* Flushs the content out (not yet secured against open forms, etc.!) or
* close the form automatically
*
* @return void
* @throws FormOpenedException If the form is still open
*/
public function flushContent () {
// Is the form still open?
if ($this->formOpened === true) {
// Close the form automatically
$this->addFormTag();
} // END - if
// Send content to template engine
$this->getTemplateInstance()->assignVariable($this->formName, $this->getContent());
}
/**
* Getter for direct field values
*
* @param $fieldName Name of the field we shall fetch
* @return $fieldValue Value from field
*/
public function getField ($fieldName) {
// Get the field value
$fieldValue = call_user_func_array(array($this->valueInstance, "getField"), array($fieldName));
// Return it
return $fieldValue;
}
}
// [EOF]
?>