* @param $withForm Whether include the form tag
* @return $helperInstance A preparedf instance of this helper
*/
- public static final function createHtmlFormHelper (CompileableTemplate $templateInstance, string $formName, $formId = false, bool $withForm = true) {
+ public static final function createHtmlFormHelper (CompileableTemplate $templateInstance, string $formName, string $formId = NULL, bool $withForm = true) {
// Get new instance
$helperInstance = new HtmlFormHelper();
$helperInstance->setTemplateInstance($templateInstance);
// Is the form id not set?
- if ($formId === false) {
+ if (is_null($formId)) {
// Use form id from form name
$formId = $formName;
} // END - if
* @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 (string $formName = NULL, string $formId = NULL) {
// When the form is not yet opened at least form name must be valid
- if (($this->formOpened === false) && ($formName === false)) {
+ if (($this->formOpened === false) && (is_null($formName))) {
// Thrown an exception
throw new InvalidFormNameException ($this, self::EXCEPTION_FORM_NAME_INVALID);
- } // END - if
+ }
// Close the form is default
$formContent = '</form>';
* @return void
* @throws FormClosedException If the form is not yet opened
*/
- public function addInputTextField ($fieldName, $fieldValue = '') {
+ public function addInputTextField (string $fieldName, string $fieldValue = '') {
// Is the form opened?
if (($this->formOpened === false) && ($this->formEnabled === true)) {
// Throw an exception
* @param $fieldName Input field name
* @return void
*/
- public function addInputTextFieldWithDefault ($fieldName) {
+ public function addInputTextFieldWithDefault (string $fieldName) {
// Get the value from instance
$fieldValue = $this->getValueField($fieldName);
//* DEBUG: */ print __METHOD__.':'.$fieldName.'='.$fieldValue."<br />\n";
* @return void
* @throws FormClosedException If the form is not yet opened
*/
- public function addInputPasswordField ($fieldName, $fieldValue = '') {
+ public function addInputPasswordField (string $fieldName, string $fieldValue = '') {
// Is the form opened?
if (($this->formOpened === false) && ($this->formEnabled === true)) {
// Throw an exception
* @return void
* @throws FormClosedException If the form is not yet opened
*/
- public function addInputHiddenField ($fieldName, $fieldValue = '') {
+ public function addInputHiddenField (string $fieldName, string $fieldValue = '') {
// Is the form opened?
if (($this->formOpened === false) && ($this->formEnabled === true)) {
// Throw an exception
* @param $fieldName Input field name
* @return void
*/
- public function addInputHiddenFieldWithDefault ($fieldName) {
+ public function addInputHiddenFieldWithDefault (string $fieldName) {
// Get the value from instance
$fieldValue = $this->getValueField($fieldName);
//* DEBUG: */ print __METHOD__.':'.$fieldName.'='.$fieldValue."<br />\n";
* @param $prefix Prefix for configuration without trailing _
* @return void
*/
- public function addInputHiddenConfiguredField ($fieldName, $prefix) {
+ public function addInputHiddenConfiguredField (string $fieldName, string $prefix) {
// Get the value from instance
$fieldValue = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry("{$prefix}_{$fieldName}");
//* DEBUG: */ print __METHOD__.':'.$fieldName.'='.$fieldValue."<br />\n";
* @return void
* @throws FormClosedException If the form is not yet opened
*/
- public function addInputCheckboxField ($fieldName, $fieldChecked = true) {
+ public function addInputCheckboxField (string $fieldName, bool $fieldChecked = true) {
// Is the form opened?
if (($this->formOpened === false) && ($this->formEnabled === true)) {
// Throw an exception
} // END - if
// Set whether the check box is checked...
- $checked = ' checked="checked"';
- if ($fieldChecked === false) $checked = ' ';
+ $checked = ($fieldChecked ? ' checked="checked"' : ' ');
// Generate the content
$inputContent = sprintf('<input type="checkbox" name="%s" class="checkbox" id="%s_%s_field" value="1"%s />',
* @return void
* @throws FormClosedException If the form is not yet opened
*/
- public function addInputResetButton ($buttonText) {
+ public function addInputResetButton (string $buttonText) {
// Is the form opened?
if (($this->formOpened === false) && ($this->formEnabled === true)) {
// Throw an exception
* @return void
* @throws FormClosedException If the form is not yet opened
*/
- public function addInputSubmitButton ($buttonText) {
+ public function addInputSubmitButton (string $buttonText) {
// Is the form opened?
if (($this->formOpened === false) && ($this->formEnabled === true)) {
// Throw an exception
* @throws FormClosedException If no form has been opened before
* @throws InvalidArgumentException If $groupId is not set
*/
- public function addFormGroup ($groupId = '', $groupText = '') {
+ public function addFormGroup (string $groupId = '', string $groupText = '') {
// Is a form opened?
if (($this->formOpened === false) && ($this->formEnabled === true)) {
// Throw exception here
* @throws FormFormClosedException If no group has been opened before
* @throws InvalidArgumentException If $subGroupId is not set
*/
- public function addFormSubGroup ($subGroupId = '', $subGroupText = '') {
+ public function addFormSubGroup (string $subGroupId = '', string $subGroupText = '') {
// Is a group opened?
if ($this->ifGroupOpenedPreviously() === false) {
// Throw exception here
* @return void
* @throws FormClosedException If the form is not yet opened
*/
- public function addFieldLabel ($fieldName, $fieldText, $fieldTitle = '') {
+ public function addFieldLabel (string $fieldName, string $fieldText, string $fieldTitle = '') {
// Is the form opened?
if (($this->formOpened === false) && ($this->formEnabled === true)) {
// Throw an exception
* @return void
* @throws FormClosedException If the form is not yet opened
*/
- public function addFormNote ($noteId, $formNotes) {
+ public function addFormNote (string $noteId, string $formNotes) {
// Is the form opened?
if (($this->formOpened === false) && ($this->formEnabled === true)) {
// Throw an exception
* @return void
* @throws FormClosedException If the form is not yet opened
*/
- public function addInputSelectField ($selectId, $firstEntry) {
+ public function addInputSelectField (string $selectId, string $firstEntry) {
// Is the form group opened?
if (($this->formOpened === false) && ($this->formEnabled === true)) {
// Throw an exception
* @throws HelperNoPreviousOpenedSubGroupException If no previously opened sub group was found
* @todo Add checking if sub option is already added
*/
- public function addSelectSubOption ($subName, $subValue) {
+ public function addSelectSubOption (string $subName, string $subValue) {
// Is there a sub group (shall be a selection box!)
if ($this->ifSubGroupOpenedPreviously() === false) {
// Then throw an exception here
* @throws HelperNoPreviousOpenedSubGroupException If no previously opened sub group was found
* @todo Add checking if sub option is already added
*/
- public function addSelectOption ($optionName, $optionValue) {
+ public function addSelectOption (string $optionName, string $optionValue) {
// Is there a sub group (shall be a selection box!)
if ($this->ifSubGroupOpenedPreviously() === false) {
// Then throw an exception here
* @param $formEnabled Whether form is enabled or disabled
* @return void
*/
- public final function enableForm ($formEnabled = true) {
- $this->formEnabled = (bool) $formEnabled;
+ public final function enableForm (bool $formEnabled = true) {
+ $this->formEnabled = $formEnabled;
}
/**
* @param $formName Name of this form
* @return void
*/
- public final function setFormName ($formName) {
- $this->formName = (string) $formName;
+ public final function setFormName (string $formName) {
+ $this->formName = $formName;
}
/**
* @param $formId Id of this form
* @return void
*/
- public final function setFormId ($formId) {
- $this->formId = (string) $formId;
+ public final function setFormId (string $formId) {
+ $this->formId = $formId;
}
/**
*
* @return $required Whether the specified chat protocol is enabled
*/
- public function ifChatEnabled ($chatProtocol) {
+ public function ifChatEnabled (string $chatProtocol) {
$required = (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('chat_enabled_' . $chatProtocol) == 'Y');
return $required;
}