Stud.IP  5.4
Form Class Reference
Inheritance diagram for Form:
Part

Public Member Functions

 __construct (... $parts)
 
 addSORM (\SimpleORMap $object, array $params=[])
 
 setURL ($url)
 
 getURL ()
 
 setSaveButtonText (string $text)
 
 getSaveButtonText ()
 
 setSaveButtonName (string $name)
 
 getSaveButtonName ()
 
 setCancelButtonText (string $text)
 
 getCancelButtonText ()
 
 setCancelButtonName (string $name)
 
 getCancelButtonName ()
 
 setSuccessMessage (string $success_message)
 
 setDebugMode (bool $debug=true)
 
 getDebugMode ()
 
 getSuccessMessage ()
 
 setCollapsable ($collapsing=true)
 
 isCollapsable ()
 
 autoStore ()
 
 validate ()
 
 isAutoStoring ()
 
 addStoreCallback (Callable $c)
 
 setDataSecure ($data_secure)
 
 getDataSecure ()
 
 setId ($id)
 
 getId ()
 
 store ()
 
 addPart (Part $part)
 
 getParts ()
 
 getLastPart ()
 
 addButton (\Studip\Button $button)
 
 getButtons ()
 
 render ()
 
- Public Member Functions inherited from Part
 __construct (... $parts)
 
 setContextObject ($object)
 
 getContextObject ()
 
 addPart (Part $part)
 
 addInput (Input $input)
 
 addText (string $text, bool $text_is_html=true)
 
 addLink (string $title, string $url, ?\Icon $icon=null, array $attributes=[])
 
 render ()
 
 renderWithCondition ()
 
 getAllInputs ()
 
 setParent (Part $parent)
 
 setIfCondition ($if)
 
 getInputFromArray (array $data)
 

Static Public Member Functions

static fromSORM (\SimpleORMap $object, $params=[], $url=null)
 
static create ()
 

Protected Member Functions

 getStoringCallback (Input $input)
 
 getStorableValueFromRequest (Input $input)
 

Protected Attributes

 $store_callbacks = []
 
 $inputs = []
 
 $parts = []
 
 $buttons = []
 
 $url = null
 
 $save_button_text = ''
 
 $save_button_name = 'STUDIPFORM_STORE_BUTTON'
 
 $cancel_button_text = ''
 
 $cancel_button_name = ''
 
 $autoStore = false
 
 $debugmode = false
 
 $success_message = ''
 
 $collapsable = false
 
 $data_secure = true
 
 $id = null
 
- Protected Attributes inherited from Part
 $parent = null
 
 $contextobject = null
 
 $parts = []
 

Additional Inherited Members

- Data Fields inherited from Part
 $if = null
 

Constructor & Destructor Documentation

◆ __construct()

__construct (   $parts)
final

Finalized constructor.

Parameters
mixed[]...$parts

Member Function Documentation

◆ addButton()

addButton ( \Studip\Button  $button)

Adds a Studip-Button object to the footer of the dialog.

Parameters
\Studip\Button$button
Returns
Form

◆ addPart()

addPart ( Part  $part)

Adds a Part object to this form like a fieldset

Parameters
Part$part
Returns
Form|void

◆ addSORM()

addSORM ( \SimpleORMap  $object,
array  $params = [] 
)

Adds a new Fieldset to the Form object with the SORM object's fields as input fields. These fields can be modified or specified by the $params array.

Parameters
\SimpleORMap$object
array$params
Returns
Form $this

◆ addStoreCallback()

addStoreCallback ( Callable  $c)

Adds a callback function that is executed right after the store-method. That callback receives this Form object as the only parameter.

Parameters
callable$c
Returns
Form $this

◆ autoStore()

autoStore ( )

Stores the Form object if this is a POST-request. This also erases the URL so that the auto-save URL will be set automatically to the current $_SERVER['REQUEST_URI'].

Returns
$this
Exceptions

◆ create()

static create ( )
static

A static constructor for an empty Form object.

Returns
Form

◆ fromSORM()

static fromSORM ( \SimpleORMap  $object,
  $params = [],
  $url = null 
)
static

Creates a new Form object from a SORM object so that each field of the db-table becomes an input-field of the form. You can modify the form by the params.

Parameters
\SimpleORMap$object
array$params
string | null$url
Returns
Form

◆ getButtons()

getButtons ( )

Returns the additional buttons (except the save-button) as an array of objects

Returns
array

◆ getCancelButtonName()

getCancelButtonName ( )

◆ getCancelButtonText()

getCancelButtonText ( )
Returns
string The text for the "save" button in the form.

◆ getDataSecure()

getDataSecure ( )

◆ getDebugMode()

getDebugMode ( )

◆ getId()

getId ( )

Returns the ID if this form. This ID is only relevant for plugins to identify this Form object.

Returns
string|null

◆ getLastPart()

getLastPart ( )

Returns the last part of the form. If there is none yet, it will create a fieldset and return that.

Returns
Part

◆ getParts()

getParts ( )

Returns all the Part objects like Fieldsets as an array.

Returns
array

◆ getSaveButtonName()

getSaveButtonName ( )

◆ getSaveButtonText()

getSaveButtonText ( )
Returns
string The text for the "save" button in the form.

◆ getStorableValueFromRequest()

getStorableValueFromRequest ( Input  $input)
protected

Returns the value for the Input object from the $_REQUEST. This value will also be mapped by the Input's dataMapper function and after that by a special mapper-callback the Input probably has.

Parameters
Input$input
Returns
mixed

◆ getStoringCallback()

getStoringCallback ( Input  $input)
protected

Returns the function to be used to store the value into the input. If the given Input has no storing function it will generate a Closuer to set the value to the SimpleORMap context object.

Parameters
$input
Returns
|void

◆ getSuccessMessage()

getSuccessMessage ( )

◆ getURL()

getURL ( )

Returns the URL where the Form is leading to after the submit.

Returns
string|null

◆ isAutoStoring()

isAutoStoring ( )

◆ isCollapsable()

isCollapsable ( )

◆ render()

render ( )

Renders the whole form as a string.

Returns
string
Exceptions

◆ setCancelButtonName()

setCancelButtonName ( string  $name)

◆ setCancelButtonText()

setCancelButtonText ( string  $text)

◆ setCollapsable()

setCollapsable (   $collapsing = true)

◆ setDataSecure()

setDataSecure (   $data_secure)

Sets if the form should be secured against accidental leaving of the page. Standard is on.

Parameters
$data_secure
Returns
$this

◆ setDebugMode()

setDebugMode ( bool  $debug = true)

◆ setId()

setId (   $id)

Sets the ID if this form. This ID is only relevant for plugins to identify this Form object.

Parameters
string | null$id
Returns
Form $this

◆ setSaveButtonName()

setSaveButtonName ( string  $name)

◆ setSaveButtonText()

setSaveButtonText ( string  $text)

Sets the text for the "save" button in the form.

Parameters
string$textThe text for the button to save the form.
Returns
$this

◆ setSuccessMessage()

setSuccessMessage ( string  $success_message)

◆ setURL()

setURL (   $url)

Sets the URL where the Form should be leading after submitting.

Parameters
$url
Returns
Form $this

◆ store()

store ( )

Returns the number of storing processes

Returns
: a number of storing processes. 0 if nothing was stored.

◆ validate()

validate ( )

Field Documentation

◆ $autoStore

$autoStore = false
protected

◆ $buttons

$buttons = []
protected

◆ $cancel_button_name

$cancel_button_name = ''
protected

◆ $cancel_button_text

$cancel_button_text = ''
protected

◆ $collapsable

$collapsable = false
protected

◆ $data_secure

$data_secure = true
protected

◆ $debugmode

$debugmode = false
protected

◆ $id

$id = null
protected

◆ $inputs

$inputs = []
protected

◆ $parts

$parts = []
protected

◆ $save_button_name

$save_button_name = 'STUDIPFORM_STORE_BUTTON'
protected

◆ $save_button_text

$save_button_text = ''
protected

◆ $store_callbacks

$store_callbacks = []
protected

◆ $success_message

$success_message = ''
protected

◆ $url

$url = null
protected

The documentation for this class was generated from the following file: