Admidio API
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Packages

  • com
    • tecnick
      • tcpdf
  • None
  • PHPMailer
    • easypeasyics
  • PHPWavUtils
  • Securimage
    • classes

Classes

  • AutoLogin
  • Component
  • ComponentUpdate
  • ConditionParser
  • Database
  • DateTimeExtended
  • Email
  • Folder
  • FormValidation
  • FunctionClass
  • Htaccess
  • HtmlDiv
  • HtmlElement
  • HtmlForm
  • HtmlFormBasic
  • HtmlFormInstallation
  • HtmlList
  • HtmlNavbar
  • HtmlPage
  • HtmlTable
  • HtmlTableBasic
  • Image
  • Inventory
  • InventoryFields
  • Language
  • LanguageData
  • ListConfiguration
  • Menu
  • Message
  • ModuleAnnouncements
  • ModuleDates
  • ModuleLists
  • ModuleMenu
  • ModuleMessages
  • Modules
  • ModuleWeblinks
  • MyFiles
  • Navigation
  • ntlm_sasl_client_class
  • Organization
  • Participants
  • PasswordHash
  • PasswordHashing
  • ProfileFields
  • RoleDependency
  • RolesRights
  • RSSfeed
  • Session
  • SystemMail
  • TableAccess
  • TableAnnouncement
  • TableCategory
  • TableDate
  • TableFile
  • TableFolder
  • TableGuestbook
  • TableGuestbookComment
  • TableInventory
  • TableInventoryField
  • TableLists
  • TableMembers
  • TableMessage
  • TablePhotos
  • TableRoles
  • TableRooms
  • TableText
  • TableUserField
  • TableUsers
  • TableWeblink
  • UploadHandlerDownload
  • UploadHandlerPhoto
  • User
  • UserRegistration

Exceptions

  • AdmException
  • WavFileException
  • WavFormatException

Functions

  • admFuncAutoload
  • admFuncGeneratePagination
  • admFuncGetBytesFromSize
  • admFuncGetDirectoryEntries
  • admFuncMaxUploadSize
  • admFuncProcessableImageSize
  • admFuncShowCreateChangeInfoById
  • admFuncShowCreateChangeInfoByName
  • admFuncVariableIsValid
  • admReadTemplateFile
  • admStrIsValidFileName
  • admStrStripTagsSpecial
  • admStrToLower
  • admStrToUpper
  • bzip2Version
  • checkDatabaseVersion
  • checkPhpVersion
  • EmailAttachment
  • FileSizeNiceDisplay
  • FormattedTimeRemaining
  • FunctionIsDisabled
  • getFormerRolesFromDatabase
  • getFutureRolesFromDatabase
  • getmicrotime
  • getRoleMemberships
  • getRolesFromDatabase
  • gzipVersion
  • hasRole
  • hl_attrval
  • hl_bal
  • hl_cmtcd
  • hl_ent
  • hl_prot
  • hl_regex
  • hl_spec
  • hl_tag
  • hl_tag2
  • hl_tidy
  • hl_version
  • htmLawed
  • HTMLFilter
  • isGroupLeader
  • isMember
  • kses
  • kses_hook
  • MySQLdumpVersion
  • OutputInformation
  • SafeExec
  • showNotice
  • strAddSlashesDeep
  • strNextLetter
  • strStripSlashesDeep
  • strStripTags
  • strValidCharacters
  • tln_body2div
  • tln_casenormalize
  • tln_deent
  • tln_defang
  • tln_findnxreg
  • tln_findnxstr
  • tln_fixatts
  • tln_fixstyle
  • tln_fixurl
  • tln_getnxtag
  • tln_sanitize
  • tln_skipspace
  • tln_tagprint
  • tln_unspace
  • version_compare_replacement
  • version_compare_replacement_sub

Class HtmlForm

HtmlElement
Extended by HtmlFormBasic
Extended by HtmlForm

Direct known subclasses

HtmlFormInstallation

Copyright: 2004-2016 The Admidio Team
License: GNU General Public License v2.0 only **********************************************************************************************
Brief:

Creates an Admidio specific form with special elements

This class inherits the common HtmlFormBasic class and extends their elements with custom Admidio form elements. The class should be used to create the html part of all Admidio forms. The Admidio elements will contain the label of fields and some other specific features like a identification of mandatory fields, help buttons and special css classes for every element.


Class: HtmlForm
Code:

// create a simple form with one input field and a button $form = new HtmlForm('simple-form', 'next_page.php'); $form->openGroupBox('gbSimpleForm', $gL10n->get('SYS_SIMPLE_FORM')); $form->addInput('name', $gL10n->get('SYS_NAME'), $formName); $form->addSelectBox('type', $gL10n->get('SYS_TYPE'), array('simple' => 'SYS_SIMPLE', 'very-simple' => 'SYS_VERY_SIMPLE'), array('defaultValue' => 'simple', 'showContextDependentFirstEntry' => true)); $form->closeGroupBox(); $form->addSubmitButton('next-page', $gL10n->get('SYS_NEXT'), array('icon' => 'layout/forward.png')); $form->show(); @endcode


Par: Examples
Located at htmlform.php

Methods summary

public
# __construct( string $id, string $action, HtmlPage $htmlPage = null, array $options = array() )

Constructor creates the form element

Constructor creates the form element

Parameters

$id
Id of the form
$action
Action attribute of the form
$htmlPage
(optional) A HtmlPage object that will be used to add javascript code or files to the html output page.
$options

(optional) An array with the following possible entries: - @b type : Set the form type. Every type has some special features: + @b default : A form that can be used to edit and save data of a database table. The label and the element have a horizontal orientation. + @b vertical : A form that can be used to edit and save data but has a vertical orientation. The label is positioned above the form element. + @b navbar : A form that should be used in a navbar. The form content will be send with the 'GET' method and this form should not get a default focus. - @b enableFileUpload : Set specific parameters that are necessary for file upload with a form - @b showRequiredFields : If this is set to @b true (default) then every required field got a special css class and also the form got a @b div that explains the required layout. If this is set to @b false then only the html flag @b required will be set. - @b setFocus : Default is set to @b true. Set the focus on page load to the first field of this form. - @b class : An additional css classname. The class @b form-horizontal is set as default and need not set with this parameter.

Overrides

HtmlFormBasic::__construct
public
# addButton( string $id, string $text, array $options = array() )

Add a new button with a custom text to the form. This button could have an icon in front of the text.

Add a new button with a custom text to the form. This button could have an icon in front of the text.

Parameters

$id
Id of the button. This will also be the name of the button.
$text
Text of the button
$options

(optional) An array with the following possible entries: - @b icon : Optional parameter. Path and filename of an icon. If set a icon will be shown in front of the text. - @b link : If set a javascript click event with a page load to this link will be attached to the button. - @b onClickText : A text that will be shown after a click on this button until the next page is loaded. The button will be disabled after click. - @b class : Optional an additional css classname. The class @b admButton is set as default and need not set with this parameter. - @b type : Optional a button type could be set. The default is @b button.

public
# addCaptcha( string $id, string $class = '' )

Add a captcha with an input field to the form. The captcha could be a picture with a character code or a simple mathematical calculation that must be solved.

Add a captcha with an input field to the form. The captcha could be a picture with a character code or a simple mathematical calculation that must be solved.

Parameters

$id
Id of the captcha field. This will also be the name of the captcha field.
$class

(optional) An additional css classname. The class @b admTextInput is set as default and need not set with this parameter.

public
# addCheckbox( string $id, string $label, boolean $checked = false, array $options = array() )

Add a new checkbox with a label to the form.

Add a new checkbox with a label to the form.

Parameters

$id
Id of the checkbox. This will also be the name of the checkbox.
$label
The label of the checkbox.
$checked

A value for the checkbox. The value could only be @b 0 or @b 1. If the value is @b 1 then the checkbox will be checked when displayed.

$options

(optional) An array with the following possible entries: - @b property : With this param you can set the following properties: + @b FIELD_DEFAULT : The field can accept an input. + @b FIELD_REQUIRED : The field will be marked as a mandatory field where the user must insert a value. + @b FIELD_DISABLED : The field will be disabled and could not accept an input. - @b helpTextIdLabel : A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA. If set a help icon will be shown after the control label where the user can see the text if he hover over the icon. If you need an additional parameter for the text you can add an array. The first entry must be the unique text id and the second entry will be a parameter of the text id. - @b helpTextIdInline : A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA. If set the complete text will be shown after the form element. If you need an additional parameter for the text you can add an array. The first entry must be the unique text id and the second entry will be a parameter of the text id. - @b icon : An icon can be set. This will be placed in front of the label. - @b class : An additional css classname. The class @b admSelectbox is set as default and need not set with this parameter.

public
# addCustomContent( string $label, string $content, array $options = array() )

Add custom html content to the form within the default field structure. The Label will be set but instead of an form control you can define any html. If you don't need the field structure and want to add html then use the method addHtml()

Add custom html content to the form within the default field structure. The Label will be set but instead of an form control you can define any html. If you don't need the field structure and want to add html then use the method addHtml()

Parameters

$label
The label of the custom content.
$content
A simple Text or html that would be placed instead of an form element.
$options

(optional) An array with the following possible entries: - @b referenceId : Optional the id of a form control if this is defined within the custom content - @b helpTextIdLabel : A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA. If set a help icon will be shown after the control label where the user can see the text if he hover over the icon. If you need an additional parameter for the text you can add an array. The first entry must be the unique text id and the second entry will be a parameter of the text id. - @b helpTextIdInline : A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA. If set the complete text will be shown after the form element. If you need an additional parameter for the text you can add an array. The first entry must be the unique text id and the second entry will be a parameter of the text id. - @b icon : An icon can be set. This will be placed in front of the label. - @b class : An additional css classname. The class @b admSelectbox is set as default and need not set with this parameter.

public
# addDescription( string $text )

Add a line with a custom description to the form. No form elements will be displayed in this line.

Add a line with a custom description to the form. No form elements will be displayed in this line.

Parameters

$text
The (html) text that should be displayed.
public
# addEditor( string $id, string $label, string $value, array $options = array() )

Add a new CKEditor element to the form.

Add a new CKEditor element to the form.

Parameters

$id
Id of the password field. This will also be the name of the password field.
$label
The label of the password field.
$value
A value for the editor field. The editor will contain this value when created.
$options

(optional) An array with the following possible entries: - @b property : With this param you can set the following properties: + @b FIELD_DEFAULT : The field can accept an input. + @b FIELD_REQUIRED : The field will be marked as a mandatory field where the user must insert a value. - @b toolbar : Optional set a predefined toolbar for the editor. Possible values are

B

AdmidioDefault, @b AdmidioGuestbook and @b AdmidioPlugin_WC - @b height : Optional set the height in pixel of the editor. The default will be 300px. - @b labelVertical : If set to @b true (default) then the label will be display above the control and the control get a width of 100%. Otherwise the label will be displayed in front of the control. - @b helpTextIdLabel : A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA. If set a help icon will be shown after the control label where the user can see the text if he hover over the icon. If you need an additional parameter for the text you can add an array. The first entry must be the unique text id and the second entry will be a parameter of the text id. - @b helpTextIdInline : A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA. If set the complete text will be shown after the form element. If you need an additional parameter for the text you can add an array. The first entry must be the unique text id and the second entry will be a parameter of the text id. - @b icon : An icon can be set. This will be placed in front of the label. - @b class : An additional css classname. The class @b admSelectbox is set as default and need not set with this parameter.


public
# addFileUpload( string $id, string $label, array $options = array() )

Add a field for file upload. If necessary multiple files could be uploaded. The fields for multiple upload could be added dynamically to the form by the user.

Add a field for file upload. If necessary multiple files could be uploaded. The fields for multiple upload could be added dynamically to the form by the user.

Parameters

$id
Id of the input field. This will also be the name of the input field.
$label
The label of the input field.
$options

(optional) An array with the following possible entries: - @b property : With this param you can set the following properties: + @b FIELD_DEFAULT : The field can accept an input. + @b FIELD_REQUIRED : The field will be marked as a mandatory field where the user must insert a value. + @b FIELD_DISABLED : The field will be disabled and could not accept an input. - @b allowedMimeTypes : An array with the allowed MIME types (https://wiki.selfhtml.org/wiki/Referenz:MIME-Typen). If this is set then the user can only choose the specified files with the browser file dialog. You should check the uploaded file against the MIME type because the file could be manipulated. - @b maxUploadSize : The size in byte that could be maximum uploaded. The default will be $gPreferences['max_file_upload_size'] * 1024 * 1024. - @b enableMultiUploads : If set to true a button will be added where the user can add new upload fields to upload more than one file. - @b multiUploadLabel : The label for the button who will add new upload fields to the form. - @b hideUploadField : Hide the upload field if multi uploads are enabled. Then the first upload field will be shown if the user will click the multi upload button. - @b helpTextIdLabel : A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA. If set a help icon will be shown after the control label where the user can see the text if he hover over the icon. If you need an additional parameter for the text you can add an array. The first entry must be the unique text id and the second entry will be a parameter of the text id. - @b helpTextIdInline : A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA. If set the complete text will be shown after the form element. If you need an additional parameter for the text you can add an array. The first entry must be the unique text id and the second entry will be a parameter of the text id. - @b icon : An icon can be set. This will be placed in front of the label. - @b class : An additional css classname. The class @b admSelectbox is set as default and need not set with this parameter.

public
# addInput( string $id, string $label, string $value, array $options = array() )

Add a new input field with a label to the form.

Add a new input field with a label to the form.

Parameters

$id
Id of the input field. This will also be the name of the input field.
$label
The label of the input field.
$value
A value for the text field. The field will be created with this value.
$options

(optional) An array with the following possible entries: - @b type : Set the type if the field. Default will be @b text. Possible values are @b text,

B

number, @b date, @b datetime or @b birthday. If @b date, @b datetime or @b birthday are set than a small calendar will be shown if the date field will be selected. - @b maxLength : The maximum number of characters that are allowed in a text field. - @b minNumber : The minimum number that is allowed in a number field. - @b maxNumber : The maximum number that is allowed in a number field. - @b step : The steps between two numbers that are allowed. E.g. if steps is set to 5 then only values 5, 10, 15 ... are allowed - @b property : With this param you can set the following properties: + @b FIELD_DEFAULT : The field can accept an input. + @b FIELD_REQUIRED : The field will be marked as a mandatory field where the user must insert a value. + @b FIELD_DISABLED : The field will be disabled and could not accept an input. + @b FIELD_HIDDEN : The field will not be shown. Useful to transport additional informations. - @b helpTextIdLabel : A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA. If set a help icon will be shown after the control label where the user can see the text if he hover over the icon. If you need an additional parameter for the text you can add an array. The first entry must be the unique text id and the second entry will be a parameter of the text id. - @b helpTextIdInline : A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA. If set the complete text will be shown after the form element. If you need an additional parameter for the text you can add an array. The first entry must be the unique text id and the second entry will be a parameter of the text id. - @b icon : An icon can be set. This will be placed in front of the label. - @b class : An additional css classname. The class @b admSelectbox is set as default and need not set with this parameter. - @b htmlAfter : Add html code after the input field.


public
# addLine( )

Add a simple line to the form. This could be used to structure a form. The line has only a visual effect.

Add a simple line to the form. This could be used to structure a form. The line has only a visual effect.

public
# addMultilineTextInput( string $id, string $label, string $value, integer $rows, array $options = array() )

Add a new textarea field with a label to the form.

Add a new textarea field with a label to the form.

Parameters

$id
Id of the input field. This will also be the name of the input field.
$label
The label of the input field.
$value
A value for the text field. The field will be created with this value.
$rows
The number of rows that the textarea field should have.
$options

(optional) An array with the following possible entries: - @b maxLength : The maximum number of characters that are allowed in this field. If set then show a counter how many characters still available - @b property : With this param you can set the following properties: + @b FIELD_DEFAULT : The field can accept an input. + @b FIELD_REQUIRED : The field will be marked as a mandatory field where the user must insert a value. + @b FIELD_DISABLED : The field will be disabled and could not accept an input. - @b helpTextIdLabel : A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA. If set a help icon will be shown after the control label where the user can see the text if he hover over the icon. If you need an additional parameter for the text you can add an array. The first entry must be the unique text id and the second entry will be a parameter of the text id. - @b helpTextIdInline : A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA. If set the complete text will be shown after the form element. If you need an additional parameter for the text you can add an array. The first entry must be the unique text id and the second entry will be a parameter of the text id. - @b icon : An icon can be set. This will be placed in front of the label. - @b class : An additional css classname. The class @b admSelectbox is set as default and need not set with this parameter.

public
# addRadioButton( string $id, string $label, array $values, array $options = array() )

Add a new radio button with a label to the form. The radio button could have different status which could be defined with an array.

Add a new radio button with a label to the form. The radio button could have different status which could be defined with an array.

Parameters

$id
Id of the radio button. This will also be the name of the radio button.
$label
The label of the radio button.
$values

Array with all entries of the radio button; Array key will be the internal value of the entry Array value will be the visual value of the entry

$options

(optional) An array with the following possible entries: - @b property : With this param you can set the following properties: + @b FIELD_DEFAULT : The field can accept an input. + @b FIELD_REQUIRED : The field will be marked as a mandatory field where the user must insert a value. + @b FIELD_DISABLED : The field will be disabled and could not accept an input. - @b defaultValue : This is the value of that radio button that is preselected. - @b showNoValueButton : If set to true than one radio with no value will be set in front of the other array. This could be used if the user should also be able to set no radio to value. - @b helpTextIdLabel : A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA. If set a help icon will be shown after the control label where the user can see the text if he hover over the icon. If you need an additional parameter for the text you can add an array. The first entry must be the unique text id and the second entry will be a parameter of the text id. - @b helpTextIdInline : A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA. If set the complete text will be shown after the form element. If you need an additional parameter for the text you can add an array. The first entry must be the unique text id and the second entry will be a parameter of the text id. - @b icon : An icon can be set. This will be placed in front of the label. - @b class : An additional css classname. The class @b admSelectbox is set as default and need not set with this parameter.

public
# addSelectBox( string $id, string $label, array $values, array $options = array() )

Add a new selectbox with a label to the form. The selectbox could have different values and a default value could be set.

Add a new selectbox with a label to the form. The selectbox could have different values and a default value could be set.

Parameters

$id
Id of the selectbox. This will also be the name of the selectbox.
$label
The label of the selectbox.
$values

Array with all entries of the select box; Array key will be the internal value of the entry Array value will be the visual value of the entry

$options

(optional) An array with the following possible entries: - @b property : With this param you can set the following properties: + @b FIELD_DEFAULT : The field can accept an input. + @b FIELD_REQUIRED : The field will be marked as a mandatory field where the user must insert a value. + @b FIELD_DISABLED : The field will be disabled and could not accept an input. - @b defaultValue : This is the value the selectbox shows when loaded. If @b multiselect is activated than an array with all default values could be set. - @b showContextDependentFirstEntry : If set to @b true the select box will get an additional first entry. If FIELD_REQUIRED is set than "Please choose" will be the first entry otherwise an empty entry will be added so you must not select something. - @b firstEntry : Here you can define a string that should be shown as firstEntry and will be the default value if no other value is set. This entry will only be added if @b showContextDependentFirstEntry is set to false! - @b multiselect : If set to @b true than the jQuery plugin Select2 will be used to create a selectbox where the user could select multiple values from the selectbox. Then an array will be created within the $_POST array. - @b maximumSelectionNumber : If @b multiselect is enabled then you can configure the maximum number of selections that could be done. If this limit is reached the user can't add another entry to the selectbox. - @b helpTextIdLabel : A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA. If set a help icon will be shown after the control label where the user can see the text if he hover over the icon. If you need an additional parameter for the text you can add an array. The first entry must be the unique text id and the second entry will be a parameter of the text id. - @b helpTextIdInline : A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA. If set the complete text will be shown after the form element. If you need an additional parameter for the text you can add an array. The first entry must be the unique text id and the second entry will be a parameter of the text id. - @b icon : An icon can be set. This will be placed in front of the label. - @b class : An additional css classname. The class @b admSelectbox is set as default and need not set with this parameter.

public
# addSelectBoxFromSql( string $id, string $label, Database $database, string $sql, array $options = array() )

Add a new selectbox with a label to the form. The selectbox get their data from a sql statement. You can create any sql statement and this method should create a selectbox with the found data. The sql must contain at least two columns. The first column represents the value and the second column represents the label of each option of the selectbox. Optional you can add a third column to the sql statement. This column will be used as label for an optiongroup. Each time the value of the third column changed a new optiongroup will be created.

Add a new selectbox with a label to the form. The selectbox get their data from a sql statement. You can create any sql statement and this method should create a selectbox with the found data. The sql must contain at least two columns. The first column represents the value and the second column represents the label of each option of the selectbox. Optional you can add a third column to the sql statement. This column will be used as label for an optiongroup. Each time the value of the third column changed a new optiongroup will be created.

Parameters

$id
Id of the selectbox. This will also be the name of the selectbox.
$label
The label of the selectbox.
$database
Object of the class Database. This should be the default global object @b $gDb.
$sql

Any SQL statement that return 2 columns. The first column will be the internal value of the selectbox item and will be submitted with the form. The second column represents the displayed value of the item. Each row of the result will be a new selectbox entry.

$options

(optional) An array with the following possible entries: - @b property : With this param you can set the following properties: + @b FIELD_DEFAULT : The field can accept an input. + @b FIELD_REQUIRED : The field will be marked as a mandatory field where the user must insert a value. + @b FIELD_DISABLED : The field will be disabled and could not accept an input. - @b defaultValue : This is the value the selectbox shows when loaded. If @b multiselect is activated than an array with all default values could be set. - @b showContextDependentFirstEntry : If set to @b true the select box will get an additional first entry. If FIELD_REQUIRED is set than "Please choose" will be the first entry otherwise an empty entry will be added so you must not select something. - @b firstEntry : Here you can define a string that should be shown as firstEntry and will be the default value if no other value is set. This entry will only be added if @b showContextDependentFirstEntry is set to false! - @b multiselect : If set to @b true than the jQuery plugin Select2 will be used to create a selectbox where the user could select multiple values from the selectbox. Then an array will be created within the $_POST array. - @b maximumSelectionNumber : If @b multiselect is enabled then you can configure the maximum number of selections that could be done. If this limit is reached the user can't add another entry to the selectbox. - @b helpTextIdLabel : A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA. If set a help icon will be shown after the control label where the user can see the text if he hover over the icon. If you need an additional parameter for the text you can add an array. The first entry must be the unique text id and the second entry will be a parameter of the text id. - @b helpTextIdInline : A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA. If set the complete text will be shown after the form element. If you need an additional parameter for the text you can add an array. The first entry must be the unique text id and the second entry will be a parameter of the text id. - @b icon : An icon can be set. This will be placed in front of the label. - @b class : An additional css classname. The class @b admSelectbox is set as default and need not set with this parameter.

Code

// create a selectbox with all profile fields of a specific category $sql = 'SELECT usf_id, usf_name FROM '.TBL_USER_FIELDS.' WHERE usf_cat_id = 4711' $form = new HtmlForm('simple-form', 'next_page.php'); $form->addSelectBoxFromSql('admProfileFieldsBox', $gL10n->get('SYS_FIELDS'), $gDb, $sql, array('defaultValue' => $gL10n->get('SYS_SURNAME'), 'showContextDependentFirstEntry' => true)); $form->show(); @endcode


Par

Examples
public
# addSelectBoxFromXml( string $id, string $label, string $xmlFile, string $xmlValueTag, string $xmlViewTag, array $options = array() )

Add a new selectbox with a label to the form. The selectbox could have different values and a default value could be set.

Add a new selectbox with a label to the form. The selectbox could have different values and a default value could be set.

Parameters

$id
Id of the selectbox. This will also be the name of the selectbox.
$label
The label of the selectbox.
$xmlFile
Serverpath to the xml file
$xmlValueTag
Name of the xml tag that should contain the internal value of a selectbox entry
$xmlViewTag
Name of the xml tag that should contain the visual value of a selectbox entry
$options

(optional) An array with the following possible entries: - @b property : With this param you can set the following properties: + @b FIELD_DEFAULT : The field can accept an input. + @b FIELD_REQUIRED : The field will be marked as a mandatory field where the user must insert a value. + @b FIELD_DISABLED : The field will be disabled and could not accept an input. - @b defaultValue : This is the value the selectbox shows when loaded. If @b multiselect is activated than an array with all default values could be set. - @b showContextDependentFirstEntry : If set to @b true the select box will get an additional first entry. If FIELD_REQUIRED is set than "Please choose" will be the first entry otherwise an empty entry will be added so you must not select something. - @b firstEntry : Here you can define a string that should be shown as firstEntry and will be the default value if no other value is set. This entry will only be added if @b showContextDependentFirstEntry is set to false! - @b multiselect : If set to @b true than the jQuery plugin Select2 will be used to create a selectbox where the user could select multiple values from the selectbox. Then an array will be created within the $_POST array. - @b maximumSelectionNumber : If @b multiselect is enabled then you can configure the maximum number of selections that could be done. If this limit is reached the user can't add another entry to the selectbox. - @b helpTextIdLabel : A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA. If set a help icon will be shown after the control label where the user can see the text if he hover over the icon. If you need an additional parameter for the text you can add an array. The first entry must be the unique text id and the second entry will be a parameter of the text id. - @b helpTextIdInline : A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA. If set the complete text will be shown after the form element. If you need an additional parameter for the text you can add an array. The first entry must be the unique text id and the second entry will be a parameter of the text id. - @b icon : An icon can be set. This will be placed in front of the label. - @b class : An additional css classname. The class @b admSelectbox is set as default and need not set with this parameter.

public
# addSelectBoxForCategories( string $id, string $label, Database $database, string $categoryType, string $selectboxModus, array $options = array() )

Add a new selectbox with a label to the form. The selectbox get their data from table adm_categories. You must define the category type (roles, dates, links ...). All categories of this type will be shown.

Add a new selectbox with a label to the form. The selectbox get their data from table adm_categories. You must define the category type (roles, dates, links ...). All categories of this type will be shown.

Parameters

$id
Id of the selectbox. This will also be the name of the selectbox.
$label
The label of the selectbox.
$database
A Admidio database object that contains a valid connection to a database
$categoryType
Type of category ('DAT', 'LNK', 'ROL', 'USF') that should be shown
$selectboxModus

The selectbox could be shown in 2 different modus. - @b EDIT_CATEGORIES : First entry will be "Please choose" and default category will be preselected. - @b FILTER_CATEGORIES : First entry will be "All" and only categories with childs will be shown.

$options

(optional) An array with the following possible entries: - @b property : With this param you can set the following properties: + @b FIELD_DEFAULT : The field can accept an input. + @b FIELD_REQUIRED : The field will be marked as a mandatory field where the user must insert a value. + @b FIELD_DISABLED : The field will be disabled and could not accept an input. - @b defaultValue : Id of category that should be selected per default. - @b showSystemCategory : Show user defined and system categories - @b helpTextIdLabel : A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA. If set a help icon will be shown after the control label where the user can see the text if he hover over the icon. If you need an additional parameter for the text you can add an array. The first entry must be the unique text id and the second entry will be a parameter of the text id. - @b helpTextIdInline : A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA. If set the complete text will be shown after the form element. If you need an additional parameter for the text you can add an array. The first entry must be the unique text id and the second entry will be a parameter of the text id. - @b icon : An icon can be set. This will be placed in front of the label. - @b class : An additional css classname. The class @b admSelectbox is set as default and need not set with this parameter.

public
# addStaticControl( string $id, string $label, string $value, array $options = array() )

Add a new static control to the form. A static control is only a simple text instead of an input field. This could be used if the value should not be changed by the user.

Add a new static control to the form. A static control is only a simple text instead of an input field. This could be used if the value should not be changed by the user.

Parameters

$id
Id of the static control. This will also be the name of the static control.
$label
The label of the static control.
$value
A value of the static control. The control will be created with this value.
$options

(optional) An array with the following possible entries: - @b helpTextIdLabel : A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA. If set a help icon will be shown after the control label where the user can see the text if he hover over the icon. If you need an additional parameter for the text you can add an array. The first entry must be the unique text id and the second entry will be a parameter of the text id. - @b helpTextIdInline : A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA. If set the complete text will be shown after the form element. If you need an additional parameter for the text you can add an array. The first entry must be the unique text id and the second entry will be a parameter of the text id. - @b icon : An icon can be set. This will be placed in front of the label. - @b class : An additional css classname. The class @b admSelectbox is set as default and need not set with this parameter.

public
# addSubmitButton( string $id, string $text, array $options = array() )

Add a new button with a custom text to the form. This button could have an icon in front of the text. Different to addButton this method adds an additional @b div around the button and the type of the button is @b submit.

Add a new button with a custom text to the form. This button could have an icon in front of the text. Different to addButton this method adds an additional @b div around the button and the type of the button is @b submit.

Parameters

$id
Id of the button. This will also be the name of the button.
$text
Text of the button
$options

(optional) An array with the following possible entries: - @b icon : Optional parameter. Path and filename of an icon. If set a icon will be shown in front of the text. - @b link : If set a javascript click event with a page load to this link will be attached to the button. - @b onClickText : A text that will be shown after a click on this button until the next page is loaded. The button will be disabled after click. - @b class : Optional an additional css classname. The class @b admButton is set as default and need not set with this parameter. - @b type : If set to true this button get the type @b submit. This will be the default.

public
# closeButtonGroup( )

Close an open bootstrap btn-group

Close an open bootstrap btn-group

protected
# closeControlStructure( string|string[] $helpTextId = null, array $parameters = array() )

Closes a field structure that was added with the method openControlStructure.

Closes a field structure that was added with the method openControlStructure.

Parameters

$helpTextId

A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA. If set the complete text will be shown after the form element.

$parameters
If you need an additional parameter for the text you can set this array.
public
# closeGroupBox( )

Close all html elements of a groupbox that was created before.

Close all html elements of a groupbox that was created before.

public
# openButtonGroup( )

Open a bootstrap btn-group if the form need more than one button.

Open a bootstrap btn-group if the form need more than one button.

protected
# openControlStructure( string $id, string $label, integer $property = FIELD_DEFAULT, string $helpTextId = '', string $icon = '', string $class = '' )

Creates a html structure for a form field. This structure contains the label and the div for the form element. After the form element is added the method closeControlStructure must be called.

Creates a html structure for a form field. This structure contains the label and the div for the form element. After the form element is added the method closeControlStructure must be called.

Parameters

$id
The id of this field structure.
$label
The label of the field. This string should already be translated.
$property

(optional) With this param you can set the following properties: - @b FIELD_DEFAULT : The field can accept an input. - @b FIELD_REQUIRED : The field will be marked as a mandatory field where the user must insert a value. - @b FIELD_DISABLED : The field will be disabled and could not accept an input.

$helpTextId

(optional) A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA. If set a help icon will be shown where the user can see the text if he hover over the icon. If you need an additional parameter for the text you can add an array. The first entry must be the unique text id and the second entry will be a parameter of the text id.

$icon
(optional) An icon can be set. This will be placed in front of the label.
$class

(optional) An additional css classname for the row. The class @b admFieldRow is set as default and need not set with this parameter.

public
# openGroupBox( string $id, string $headline = null, string $class = '' )

Add a new groupbox to the form. This could be used to group some elements together. There is also the option to set a headline to this group box.

Add a new groupbox to the form. This could be used to group some elements together. There is also the option to set a headline to this group box.

Parameters

$id
Id the the groupbox.
$headline
(optional) A headline that will be shown to the user.
$class

(optional) An additional css classname for the row. The class @b admFieldRow is set as default and need not set with this parameter.

public static string
# getHelpTextIcon( string|string[] $textId, string $parameter = null )

Add a small help icon to the form at the current element which shows the translated text of the text-id on mouseover or when you click on the icon.

Add a small help icon to the form at the current element which shows the translated text of the text-id on mouseover or when you click on the icon.

Parameters

$textId
A unique text id from the translation xml files that should be shown e.g. SYS_ENTRY_MULTI_ORGA.
$parameter
If you need an additional parameter for the text you can set this parameter.

Returns

string
Return a html snippet that contains a help icon with a link to a popup box that shows the message.
public string|null
# show( boolean $directOutput = true )

This method send the whole html code of the form to the browser. Call this method if you have finished your form layout. If mandatory fields were set than a notice which marker represents the mandatory will be shown before the form.

This method send the whole html code of the form to the browser. Call this method if you have finished your form layout. If mandatory fields were set than a notice which marker represents the mandatory will be shown before the form.

Parameters

$directOutput

(optional) If set to @b true (default) the form html will be directly send to the browser. If set to @b false the html will be returned.

Returns

string|null
If $directOutput is set to @b false this method will return the html code of the form.

Methods inherited from HtmlFormBasic

addFieldSet(), addLabel(), addLegend(), addOption(), addOptionGroup(), addSelect(), addSimpleButton(), addSimpleInput(), addTextArea(), closeFieldSet(), closeOptionGroup(), closeSelect(), getHtmlForm()

Methods inherited from HtmlElement

addAttribute(), addData(), addElement(), addHtml(), addParentElement(), closeParentElement(), getHtmlElement(), setAttributesFromArray()

Properties summary

protected $flagRequiredFields
#
protected $flagFieldListOpen
#
protected $showRequiredFields
#
protected $htmlPage
#
protected $countElements
#
protected $datepickerInitialized
#
protected $type
#
protected $id
#
protected $buttonGroupOpen
#

Properties inherited from HtmlElement

$arrParentElements, $currentElement, $currentElementAttributes, $currentElementDataWritten, $htmlString, $mainElement, $mainElementAttributes, $mainElementWritten, $nesting, $parentFlag

Admidio API API documentation generated by ApiGen