Stud.IP  5.4
 All Data Structures Namespaces Files Functions Variables Groups
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 ()
 
 setSuccessMessage (string $success_message)
 
 getSuccessMessage ()
 
 setCollapsable ($collapsing=true)
 
 isCollapsable ()
 
 autoStore ()
 
 isAutoStoring ()
 
 addStoreCallback (Callable $c)
 
 setId ($id)
 
 getId ()
 
 store ()
 
 addPart (Part $part)
 
 getParts ()
 
 getLastPart ()
 
 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 = []
 
 $url = null
 
 $save_button_text = ''
 
 $save_button_name = ''
 
 $autoStore = false
 
 $success_message = ''
 
 $collapsable = false
 
 $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 (   $parts)
final

Finalized constructor.

Parameters
mixed[]...$parts

Member Function Documentation

addPart ( Part  $part)

Adds a Part object to this form like a fieldset

Parameters
Part$part
Returns
Form|void
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 ( 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 ( )

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
\AccessDeniedException
static create ( )
static

A static constructor for an empty Form object.

Returns
Form
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
getId ( )

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

Returns
string|null
getLastPart ( )

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

Returns
Part
getParts ( )

Returns all the Part objects like Fieldsets as an array.

Returns
array
getSaveButtonName ( )
getSaveButtonText ( )
Returns
string The text for the "save" button in the form.
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 ( 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 ( )
getURL ( )

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

Returns
string|null
isAutoStoring ( )
isCollapsable ( )
render ( )

Renders the whole form as a string.

Returns
string
Exceptions
\Flexi_TemplateNotFoundException
setCollapsable (   $collapsing = true)
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 ( string  $name)
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 ( string  $success_message)
setURL (   $url)

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

Parameters
$url
Returns
Form $this
store ( )

Returns the number of storing processes

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

Field Documentation

$autoStore = false
protected
$collapsable = false
protected
$id = null
protected
$inputs = []
protected
$parts = []
protected
$save_button_name = ''
protected
$save_button_text = ''
protected
$store_callbacks = []
protected
$success_message = ''
protected
$url = null
protected

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