* Whether the form tag is opened (keep at false or else your forms will
* never work!)
*/
- private $formOpened = false;
+ private $formOpened = FALSE;
/**
* Name of the form
/**
* Whether form tag is enabled (default: true)
*/
- private $formEnabled = true;
+ private $formEnabled = TRUE;
// Class Constants
const EXCEPTION_FORM_NAME_INVALID = 0x120;
* @param $withForm Whether include the form tag
* @return $helperInstance A preparedf instance of this helper
*/
- public static final function createWebFormHelper (CompileableTemplate $templateInstance, $formName, $formId = false, $withForm = true) {
+ public static final function createWebFormHelper (CompileableTemplate $templateInstance, $formName, $formId = FALSE, $withForm = TRUE) {
// Get new instance
$helperInstance = new WebFormHelper();
$helperInstance->setTemplateInstance($templateInstance);
// Is the form id not set?
- if ($formId === false) {
+ if ($formId === FALSE) {
// Use form id from form name
$formId = $formName;
} // END - if
$helperInstance->setFormName($formName);
// A form-less field may say 'false' here...
- if ($withForm === true) {
+ if ($withForm === TRUE) {
// Create the form
$helperInstance->addFormTag($formName, $formId);
} else {
* @param $formName Name of the form (default: false)
* @param $formId Id of the form (attribute 'id'; default: false)
* @return void
- * @throws InvalidFormNameException If the form name is invalid ( = false)
+ * @throws InvalidFormNameException If the form name is invalid ( = FALSE)
* @todo Add some unique PIN here to bypass problems with some browser and/or extensions
*/
- public function addFormTag ($formName = false, $formId = false) {
+ public function addFormTag ($formName = FALSE, $formId = FALSE) {
// When the form is not yet opened at least form name must be valid
- if (($this->formOpened === false) && ($formName === false)) {
+ if (($this->formOpened === FALSE) && ($formName === FALSE)) {
// Thrown an exception
throw new InvalidFormNameException ($this, self::EXCEPTION_FORM_NAME_INVALID);
} // END - if
$formContent = '</form>';
// Check whether we shall open or close the form
- if (($this->formOpened === false) && ($this->formEnabled === true)) {
+ if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
// Add HTML code
$formContent = sprintf("<form name=\"%s\" class=\"forms\" action=\"%s/%s\" method=\"%s\" target=\"%s\"",
$formName,
$formContent .= '>';
// Open the form and remeber the form name
- $this->formOpened = true;
+ $this->formOpened = TRUE;
// Add it to the content
$this->addHeaderContent($formContent);
} // END - if
// Simply close it
- $this->formOpened = false;
+ $this->formOpened = FALSE;
// Add it to the content
$this->addFooterContent($formContent);
*/
public function addInputTextField ($fieldName, $fieldValue = '') {
// Is the form opened?
- if (($this->formOpened === false) && ($this->formEnabled === true)) {
+ if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
// Throw an exception
throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
} // END - if
*/
public function addInputPasswordField ($fieldName, $fieldValue = '') {
// Is the form opened?
- if (($this->formOpened === false) && ($this->formEnabled === true)) {
+ if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
// Throw an exception
throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
} // END - if
*/
public function addInputHiddenField ($fieldName, $fieldValue = '') {
// Is the form opened?
- if (($this->formOpened === false) && ($this->formEnabled === true)) {
+ if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
// Throw an exception
throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
} // END - if
* @return void
* @throws FormClosedException If the form is not yet opened
*/
- public function addInputCheckboxField ($fieldName, $fieldChecked = true) {
+ public function addInputCheckboxField ($fieldName, $fieldChecked = TRUE) {
// Is the form opened?
- if (($this->formOpened === false) && ($this->formEnabled === true)) {
+ if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
// Throw an exception
throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
} // END - if
// Set whether the check box is checked...
$checked = " checked=\"checked\"";
- if ($fieldChecked === false) $checked = ' ';
+ if ($fieldChecked === FALSE) $checked = ' ';
// Generate the content
$inputContent = sprintf("<input type=\"checkbox\" name=\"%s\" class=\"checkbox %s_field\" value=\"1\"%s/>",
*/
public function addInputResetButton ($buttonText) {
// Is the form opened?
- if (($this->formOpened === false) && ($this->formEnabled === true)) {
+ if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
// Throw an exception
throw new FormClosedException (array($this, 'reset'), self::EXCEPTION_CLOSED_FORM);
} // END - if
*/
public function addInputSubmitButton ($buttonText) {
// Is the form opened?
- if (($this->formOpened === false) && ($this->formEnabled === true)) {
+ if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
// Throw an exception
throw new FormClosedException (array($this, 'submit'), self::EXCEPTION_CLOSED_FORM);
} // END - if
*/
public function addFormGroup ($groupId = '', $groupText = '') {
// Is a form opened?
- if (($this->formOpened === false) && ($this->formEnabled === true)) {
+ if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
// Throw exception here
throw new FormClosedException(array($this, $groupId), self::EXCEPTION_CLOSED_FORM);
} // END - if
// At least the group name should be set
- if ((empty($groupId)) && ($this->ifGroupOpenedPreviously() === false)) {
+ if ((empty($groupId)) && ($this->ifGroupOpenedPreviously() === FALSE)) {
// Throw exception here
throw new EmptyVariableException(array($this, 'groupId'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
} elseif (empty($groupId)) {
}
// Same group to open?
- if (($this->ifGroupOpenedPreviously() === false) && ($groupId === $this->getPreviousGroupId())) {
+ if (($this->ifGroupOpenedPreviously() === FALSE) && ($groupId === $this->getPreviousGroupId())) {
// Abort here silently
return false;
} // END - if
$content = " </div>\n</div><!-- Group - CLOSE //-->";
// Is this group opened?
- if ($this->ifGroupOpenedPreviously() === false) {
+ if ($this->ifGroupOpenedPreviously() === FALSE) {
// Begin the div/span blocks
$content = sprintf("<!-- Group %s - OPEN //-->
<div class=\"group_box\" id=\"%s_group_box\">
*/
public function addFormSubGroup ($subGroupId = '', $subGroupText = '') {
// Is a group opened?
- if ($this->ifGroupOpenedPreviously() === false) {
+ if ($this->ifGroupOpenedPreviously() === FALSE) {
// Throw exception here
throw new FormFormClosedException(array($this, $subGroupId), self::EXCEPTION_UNEXPECTED_CLOSED_GROUP);
} // END - if
// At least the sub group name should be set
- if ((empty($subGroupId)) && ($this->ifSubGroupOpenedPreviously() === false)) {
+ if ((empty($subGroupId)) && ($this->ifSubGroupOpenedPreviously() === FALSE)) {
// Throw exception here
throw new EmptyVariableException(array($this, 'subGroupId'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
} elseif (empty($subGroupId)) {
}
// Same sub group to open?
- if (($this->ifSubGroupOpenedPreviously() === false) && ($subGroupId == $this->getPreviousSubGroupId())) {
+ if (($this->ifSubGroupOpenedPreviously() === FALSE) && ($subGroupId == $this->getPreviousSubGroupId())) {
// Abort here silently
return false;
} // END - if
$content = " </div>\n</div><!-- Sub group- CLOSE //-->";
// Is this group opened?
- if ($this->ifSubGroupOpenedPreviously() === false) {
+ if ($this->ifSubGroupOpenedPreviously() === FALSE) {
// Begin the span block
$content = sprintf("<!-- Sub group %s - OPEN //-->
<div class=\"subgroup_box\" id=\"%s_subgroup_box\">
*/
public function addFieldText ($fieldName, $fieldText) {
// Is the form opened?
- if (($this->formOpened === false) && ($this->formEnabled === true)) {
+ if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
// Throw an exception
throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
} // END - if
*/
public function addFormNote ($noteId, $formNotes) {
// Is the form opened?
- if (($this->formOpened === false) && ($this->formEnabled === true)) {
+ if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
// Throw an exception
throw new FormClosedException (array($this, 'form_notes'), self::EXCEPTION_CLOSED_FORM);
} // END - if
*/
public function addInputSelectField ($selectId, $firstEntry) {
// Is the form group opened?
- if (($this->formOpened === false) && ($this->formEnabled === true)) {
+ if (($this->formOpened === FALSE) && ($this->formEnabled === TRUE)) {
// Throw an exception
throw new FormClosedException (array($this, 'form_notes'), self::EXCEPTION_CLOSED_FORM);
} // END - if
// Shall we close or open the sub group?
- if (($this->ifSubGroupOpenedPreviously() === false) && ($this->getPreviousSubGroupId() !== $selectId)) {
+ if (($this->ifSubGroupOpenedPreviously() === FALSE) && ($this->getPreviousSubGroupId() !== $selectId)) {
// Initialize first entry (which might be non-selectable if content is provided
if (!empty($firstEntry)) {
// Add selection around it
*/
public function addSelectSubOption ($subName, $subValue) {
// Is there a sub group (shall be a selection box!)
- if ($this->ifSubGroupOpenedPreviously() === false) {
+ if ($this->ifSubGroupOpenedPreviously() === FALSE) {
// Then throw an exception here
throw new HelperNoPreviousOpenedSubGroupException(array($this, $content), self::EXCEPTION_NO_PREVIOUS_SUB_GROUP_OPENED);
} // END - if
*/
public function addSelectOption ($optionName, $optionValue) {
// Is there a sub group (shall be a selection box!)
- if ($this->ifSubGroupOpenedPreviously() === false) {
+ if ($this->ifSubGroupOpenedPreviously() === FALSE) {
// Then throw an exception here
throw new HelperNoPreviousOpenedSubGroupException(array($this, $content), self::EXCEPTION_NO_PREVIOUS_SUB_GROUP_OPENED);
} // END - if
* @param $formEnabled Whether form is enabled or disabled
* @return void
*/
- public final function enableForm ($formEnabled = true) {
+ public final function enableForm ($formEnabled = TRUE) {
$this->formEnabled = (bool) $formEnabled;
}
*/
public function flushContent () {
// Is the form still open?
- if (($this->formOpened === true) && ($this->formEnabled === true)) {
+ if (($this->formOpened === TRUE) && ($this->formEnabled === TRUE)) {
// Close the form automatically
$this->addFormTag();
- } elseif ($this->formEnabled === false) {
+ } elseif ($this->formEnabled === FALSE) {
if ($this->ifSubGroupOpenedPreviously()) {
// Close sub group
$this->addFormSubGroup();