phpMv -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Loading...
Searching...
No Matches
DataElement Class Reference

DataElement widget for displaying an instance of model. More...

+ Inheritance diagram for DataElement:

Public Member Functions

 __construct ($identifier, $modelInstance=NULL)
 
 compile (JsUtils $js=NULL, &$view=NULL)
 
 getFieldValue ($index)
 
 getHtmlComponent ()
 
 onNewRow ($callback)
 The callback function called after the insertion of each row when fromDatabaseObjects is called callback function takes the parameters $row : the row inserted and $object: the instance of model used.
 
 asForm ()
 
 setColCaptionWidth ($width)
 
 setColValueWidth ($width)
 
 setColWidths ($widths)
 
 run (JsUtils $js)
 
Parameters
JsUtils$js
Returns
SimpleExtComponent
See also
\Ajax\common\html\BaseHtmlrun()
See also
\Ajax\common\html\BaseHtmlrun()
See also
\Ajax\common\html\BaseHtmlrun()

 
- Public Member Functions inherited from Widget
 __construct ($identifier, $model, $modelInstance=NULL)
 
 show ($modelInstance)
 
 getModel ()
 
 setModel ($_model)
 
 getInstanceViewer ()
 
 setInstanceViewer ($_instanceViewer)
 
 setAttached ($value=true)
 
 afterCompile ($index, $callback)
 Associates a $callback function after the compilation of the field at $index position The $callback function can take the following arguments : $field=>the compiled field, $instance : the active instance of the object, $index: the field position.
 
 setColor ($color)
 
 setCaptions ($captions)
 
 setCaption ($index, $caption)
 
 setFields ($fields)
 
 addField ($field, $key=null)
 
 addFields ($fields)
 
 countFields ()
 
 addMessage ($attributes=NULL, $fieldName="message")
 
 addErrorMessage ()
 
 insertField ($index, $field, $key=null)
 
 insertInField ($index, $field, $key=null)
 
 setValueFunction ($index, $callback)
 Defines the function which displays the field value.
 
 setIdentifierFunction ($callback)
 
 getToolbar ()
 
 addInToolbar ($element, $callback=NULL)
 Adds a new element in toolbar.
 
 addItemInToolbar ($caption, $icon=NULL, $callback=NULL)
 
 addItemsInToolbar (array $items, $callback=NULL)
 
 addDropdownInToolbar ($value, $items, $callback=NULL)
 
 addButtonInToolbar ($caption, $cssStyle=null, $callback=NULL)
 
 addButtonsInToolbar (array $captions, $asIcon=false, $callback=NULL)
 
 addLabelledIconButtonInToolbar ($caption, $icon, $before=true, $labeled=false)
 
 addSubmitInToolbar ($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL)
 
 setCaptionCallback ($captionCallback)
 Defines a callback function to call for modifying captions function parameters 0are.
 
 setEdition ($_edition=true)
 Makes the input fields editable.
 
 setDefaultValueFunction ($defaultValueFunction)
 Defines the default function which displays fields value.
 
 getDefaultValueFunction ()
 
 jsDisabled ($disable=true)
 
 addEditButtonInToolbar ($caption, $callback=NULL)
 
 setToolbar (HtmlMenu $_toolbar)
 
 setToolbarPosition ($_toolbarPosition)
 
 getForm ()
 
 setValidationParams (array $_validationParams)
 Sets the parameters for the Form validation (on, inline, delay...)
 
 moveFieldTo ($from, $to)
 
 swapFields ($index1, $index2)
 
 removeField ($index)
 
 asModal ($header=null)
 
 addToProperty ($name, $value, $separator=" ")
 
 getModelInstance ()
 
 hasRules ()
 
- Public Member Functions inherited from HtmlDoubleElement
 setContent ($content)
 
 getContent ()
 
 addContent ($content, $before=false)
 
 setValue ($value)
 
 wrapContent ($before, $after="")
 
 wrapWith (HtmlDoubleElement $container)
 Wraps the element with a container.
 
 getContentInstances ($class)
 
 asLink ($href=NULL, $target=NULL)
 Transforms the element into a link.
 
 getTextContent ()
 
 asEditable (HtmlFormField $field, $asForm=false, $setValueProperty="val()")
 
- Public Member Functions inherited from HtmlSingleElement
 setClass ($classNames)
 
 addClass ($classNames)
 
 setRole ($value)
 
 setTitle ($value)
 
 setStyle ($value)
 
 fromArray ($array)
 
 setSize ($size)
 
- Public Member Functions inherited from BaseHtml
 getTagName ()
 
 setTagName ($tagName)
 
 fromDatabaseObjects ($objects, $function)
 
 fromDatabaseObject ($object, $function)
 
 wrap ($before, $after="")
 
 getElementById ($identifier, $elements)
 
 getBsComponent ()
 
 setBsComponent ($bsComponent)
 
 setDraggable ($attr="id", $dropZone=null, $parameters=[])
 Sets the element draggable, and eventualy defines the dropzone (HTML5 drag and drop)
 
 asDropZone ($jsCallback="", $jqueryDone="append", $parameters=[])
 Declares the element as a drop zone (HTML5 drag and drop)
 
 asFileDropZone ($responseElement=null, $url=null, $progress=null, $jsCallback="", $parameters=[])
 Declares the element as a drop zone for file uploading (HTML5 drag and drop)
 
 __toString ()
 
 onPostCompile ($callback)
 
 onPreCompile ($callback)
 
- Public Member Functions inherited from BaseWidget
 __construct ($identifier)
 
 getIdentifier ()
 
 setIdentifier ($identifier)
 
 getLibraryId ()
 
 setLibraryId ($_libraryId)
 
- Public Member Functions inherited from BaseHtmlEventsTrait
 addEvent ($event, $jsCode, $stopPropagation=false, $preventDefault=false)
 
 trigger ($event, $params="[]")
 
 jsTrigger ($event, $params="[this]")
 
 _addEvent ($event, $jsCode)
 
 on ($event, $jsCode, $stopPropagation=false, $preventDefault=false)
 
 onClick ($jsCode, $stopPropagation=false, $preventDefault=true)
 
 setClick ($jsCode)
 
 onCreate ($jsCode)
 
 addEventsOnRun (JsUtils $js=NULL)
 
 _ajaxOn ($operation, $event, $url, $responseElement="", $parameters=array())
 
 getOn ($event, $url, $responseElement="", $parameters=array())
 Performs a get to $url on the event $event on $element and display it in $responseElement.
 
 getOnClick ($url, $responseElement="", $parameters=array())
 Performs a get to $url on the click event on $element and display it in $responseElement.
 
 postOn ($event, $url, $params="{}", $responseElement="", $parameters=array())
 Performs a post to $url on the event $event on $element and display it in $responseElement.
 
 postOnClick ($url, $params="{}", $responseElement="", $parameters=array())
 Performs a post to $url on the click event on $element and display it in $responseElement.
 
 postFormOn ($event, $url, $form, $responseElement="", $parameters=array())
 Performs a post form with ajax.
 
 postFormOnClick ($url, $form, $responseElement="", $parameters=array())
 Performs a post form with ajax on click.
 
 jsDoJquery ($jqueryCall, $param="")
 
 executeOnRun ($jsCode)
 
 jsHtml ($content="")
 
 jsShow ()
 
 jsHide ()
 
 jsToggle ($value)
 
 getEvents ()
 
- Public Member Functions inherited from BaseHtmlPropertiesTrait
 getProperties ()
 
 setProperties ($properties)
 
 setProperty ($name, $value)
 
 getProperty ($name)
 
 addProperties ($properties)
 
 removePropertyValue ($name, $value)
 
 addToPropertyCtrl ($name, $value, $typeCtrl)
 
 addToPropertyCtrlCheck ($name, $value, $typeCtrl)
 
 removeProperty ($name)
 
 propertyContains ($propertyName, $value)
 
- Public Member Functions inherited from FieldAsTrait
 setPropertyValues ($property, $indexValues)
 Defines the values for the fields for a property (or html attribute).
 
 fieldAsProgress ($index, $label=NULL, $attributes=array())
 
 fieldAsRating ($index, $max=5, $icon="")
 
 fieldAsLabel ($index, $icon=NULL, $attributes=NULL)
 
 fieldAsHeader ($index, $niveau=1, $icon=NULL, $attributes=NULL)
 
 fieldAsImage ($index, $size=Size::MINI, $circular=false)
 
 fieldAsFlag ($index)
 
 fieldAsIcon ($index)
 
 fieldAsAvatar ($index, $attributes=NULL)
 
 fieldAsRadio ($index, $attributes=NULL)
 
 fieldAsRadios ($index, $elements=[], $attributes=NULL)
 
 fieldAsList ($index, $classNames="", $attributes=NULL)
 
 fieldAsInput ($index, $attributes=NULL)
 
 fieldAsLabeledInput ($index, $attributes=NULL)
 
 fieldAsDataList ($index, ?array $items=[], $attributes=NULL)
 
 fieldAsFile ($index, $attributes=NULL)
 
 fieldAsTextarea ($index, $attributes=NULL)
 
 fieldAsElement ($index, $tagName="div", $baseClass="", $attributes=NULL)
 
 fieldAsHidden ($index, $attributes=NULL)
 
 fieldAsCheckbox ($index, $attributes=NULL)
 
 fieldAsDropDown ($index, $elements=[], $multiple=false, $attributes=NULL)
 
 fieldAsMessage ($index, $attributes=NULL)
 
 fieldAsLink ($index, $attributes=NULL)
 
 fieldsAs (array $types)
 Change fields type.
 
 fieldAs ($index, $type, $attributes=NULL)
 
 fieldAsSubmit ($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL)
 
 fieldAsButton ($index, $cssStyle=NULL, $attributes=NULL)
 
 fieldAsDataTable ($index, $model, $instances=null, $fields=[], $attributes=NULL)
 
- Public Member Functions inherited from FormTrait
 setLoading ()
 
 setState ($state)
 
 jsState ($state)
 
 submitOn ($event, $identifierOrElement, $url, $responseElement, $parameters=NULL)
 
 submitOnClick ($identifier, $url, $responseElement, $parameters=NULL)
 
 addSubmit ($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL)
 
 setSubmitParams ($url, $responseElement=NULL, $parameters=NULL)
 
 addReset ($identifier, $value, $cssStyle=NULL)
 
 onValid ($jsCode)
 Callback on each valid field.
 
 onSuccess ($jsCode)
 Callback if a form is all valid.
 
 addExtraFieldRules ($fieldname, $rules)
 
 addExtraFieldRule ($fieldname, $type, $prompt=NULL, $value=NULL)
 
 setOptional ($fieldname, $optional=true)
 
 setActionTarget (string $action, string $target)
 
- Public Member Functions inherited from BaseHooksTrait
 hookExists ($hookKey)
 
 getHook ($hookKey)
 
 addHook ($hookKey, $callable)
 Adds a new Hook.
 
 execHook ($hookKey,... $variables)
 Executes the hook with key $hookKey.
 
- Public Member Functions inherited from BaseTrait
 addToProperty ($name, $value, $separator=" ")
 
 setProperty ($name, $value)
 
 addContent ($content, $before=false)
 
 onCreate ($jsCode)
 
 addVariation ($variation)
 
 addState ($state)
 
 setVariation ($variation)
 
 setVariations ($variations)
 
 setState ($state)
 
 addVariations ($variations=array())
 
 addStates ($states=array())
 
 setStates ($states)
 
 addIcon ($icon, $before=true)
 
 addSticky ($context="body")
 
 setSize ($size)
 
 setDisabled ($disable=true)
 show it is currently unable to be interacted with
 
 setColor ($color)
 
 setFluid ()
 
 asHeader ()
 
 setActive ($value=true)
 show it is currently the active user selection
 
 setAttached ($value=true)
 
 setInverted ($recursive=true)
 can be formatted to appear on dark backgrounds
 
 setCircular ()
 
 setFloated ($direction="right")
 
 floatRight ()
 
 floatLeft ()
 
 getBaseClass ()
 
 getVariations ()
 
 getStates ()
 

Protected Member Functions

 _generateContent ($table)
 
 _applyStyleAttributes (HtmlTable $table)
 
 _getFieldName ($index)
 
 _getFieldCaption ($index)
 
 _getFieldIdentifier ($prefix, $name="")
 
 _setToolbarPosition ($table, $captions=NULL)
 {}
 
- Protected Member Functions inherited from Widget
 _init ($instanceViewer, $contentKey, $content, $edition)
 
 _getIndex ($fieldName)
 
 runForm (JsUtils $js)
 
 _compileForm ()
 
- Protected Member Functions inherited from HtmlDoubleElement
 _getContentInstances ($class, $content)
 
 compile_once (\Ajax\JsUtils $js=NULL, &$view=NULL)
 {}
 
- Protected Member Functions inherited from BaseHtml
 getTemplate (JsUtils $js=NULL, $view=null)
 
 ctrl ($name, $value, $typeCtrl)
 
 setMemberCtrl (&$name, $value, $typeCtrl)
 
 addToMemberUnique (&$name, $value, $typeCtrl, $separator=" ")
 
 addToMemberCtrl (&$name, $value, $typeCtrl, $separator=" ")
 
 addToMember (&$name, $value, $separator=' ')
 
 removeOldValues (&$oldValue, $allValues)
 
 _getElementBy ($callback, $elements)
 
 setWrapBefore ($wrapBefore)
 
 setWrapAfter ($wrapAfter)
 
 compile_once (JsUtils $js=NULL, &$view=NULL)
 
- Protected Member Functions inherited from BaseWidget
 cleanIdentifier ($id)
 
- Protected Member Functions inherited from BaseHtmlEventsTrait
 _eventsOnCreate (JsUtils $js=NULL)
 
- Protected Member Functions inherited from BaseHtmlPropertiesTrait
 removePropertyValues ($name, $values)
 
 addToPropertyUnique ($name, $value, $typeCtrl)
 
 setPropertyCtrl ($name, $value, $typeCtrl)
 
 getElementByPropertyValue ($propertyName, $value, $elements)
 
- Protected Member Functions inherited from FieldAsTrait
 _buttonAsSubmit (BaseHtml &$button, $event, $url, $responseElement=NULL, $parameters=NULL)
 
 _applyAttributes (BaseHtml $element, &$attributes, $index, $instance=null)
 
 _addRules (HtmlFormField $element, &$attributes)
 
 _prepareFormFields (HtmlFormField &$field, $name, &$attributes)
 
 _fieldAs ($elementCallback, &$index, $attributes=NULL, $prefix=null)
 
- Protected Member Functions inherited from FormTrait
 addCompoValidation (Form $compo, HtmlFormField $field)
 
 addExtraCompoValidation (Form $compo, FieldValidation $validation)
 
 _runValidationParams (Form &$compo, JsUtils $js=NULL)
 
 _compileAjaxSubmit ($ajaxSubmit, JsUtils $js=null)
 
 _buttonAsSubmit (BaseHtml &$button, $event, $url, $responseElement=NULL, $parameters=NULL)
 
- Protected Member Functions inherited from BaseTrait
 setPropertyCtrl ($name, $value, $typeCtrl)
 
 addToPropertyCtrl ($name, $value, $typeCtrl)
 
 addToPropertyCtrlCheck ($name, $value, $typeCtrl)
 
 addBehavior (&$array, $key, $value, $before="", $after="")
 

Protected Attributes

 $_colWidths
 
- Protected Attributes inherited from Widget
 $_model
 
 $_modelInstance
 
 $_instanceViewer
 
 $_toolbar
 
 $_toolbarPosition
 
 $_edition
 
 $_form
 
 $_generated
 
 $_runned
 
 $_hasRules
 
- Protected Attributes inherited from HtmlDoubleElement
 $content
 
 $wrapContentBefore = ""
 
 $wrapContentAfter = ""
 
 $_editableContent
 
- Protected Attributes inherited from BaseHtml
 $_template
 
 $tagName
 
 $_wrapBefore = array()
 
 $_wrapAfter = array()
 
 $_bsComponent
 
 $_compiled = false
 
 $_runned = false
 
 $_postCompile
 
 $_preCompile
 
- Protected Attributes inherited from BaseWidget
 $identifier
 
 $_identifier
 
 $_libraryId
 
 $_self
 
- Protected Attributes inherited from BaseHtmlEventsTrait
 $_events =array ()
 
- Protected Attributes inherited from BaseHtmlPropertiesTrait
 $properties =array ()
 
- Protected Attributes inherited from BaseHooksTrait
 $_hooks =[]
 
- Protected Attributes inherited from BaseTrait
 $_variations =[ ]
 
 $_states =[ ]
 
 $_baseClass
 

Detailed Description

DataElement widget for displaying an instance of model.

Version
1.0
Author
jc
Since
2.2

Definition at line 20 of file DataElement.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $identifier,
  $modelInstance = NULL 
)

Reimplemented from HtmlDoubleElement.

Definition at line 23 of file DataElement.php.

Member Function Documentation

◆ _applyStyleAttributes()

_applyStyleAttributes ( HtmlTable  $table)
protected

Definition at line 78 of file DataElement.php.

◆ _generateContent()

_generateContent (   $table)
protected
Parameters
HtmlTable$table

Definition at line 52 of file DataElement.php.

◆ _getFieldCaption()

_getFieldCaption (   $index)
protected

Reimplemented from Widget.

Definition at line 85 of file DataElement.php.

◆ _getFieldIdentifier()

_getFieldIdentifier (   $prefix,
  $name = "" 
)
protected

Reimplemented from Widget.

Definition at line 89 of file DataElement.php.

◆ _getFieldName()

_getFieldName (   $index)
protected

Reimplemented from Widget.

Definition at line 81 of file DataElement.php.

◆ _setToolbarPosition()

_setToolbarPosition (   $table,
  $captions = NULL 
)
protected

{}

See also
\Ajax\common\Widget::_setToolbarPosition()

Reimplemented from Widget.

Definition at line 106 of file DataElement.php.

◆ asForm()

asForm ( )

Definition at line 121 of file DataElement.php.

◆ compile()

compile ( JsUtils  $js = NULL,
$view = NULL 
)

Reimplemented from BaseHtml.

Definition at line 29 of file DataElement.php.

◆ getFieldValue()

getFieldValue (   $index)

Definition at line 64 of file DataElement.php.

◆ getHtmlComponent()

getHtmlComponent ( )

See also
\Ajax\common\Widget::getHtmlComponent()
Returns
HtmlTable

Reimplemented from Widget.

Definition at line 98 of file DataElement.php.

◆ onNewRow()

onNewRow (   $callback)

The callback function called after the insertion of each row when fromDatabaseObjects is called callback function takes the parameters $row : the row inserted and $object: the instance of model used.

Parameters
callable$callback
Returns
DataElement

Definition at line 116 of file DataElement.php.

◆ run()

run ( JsUtils  $js)

Parameters
JsUtils$js
Returns
SimpleExtComponent
See also
\Ajax\common\html\BaseHtmlrun()
See also
\Ajax\common\html\BaseHtmlrun()
See also
\Ajax\common\html\BaseHtmlrun()

See also
\Ajax\common\html\BaseHtml::run()

Reimplemented from Widget.

Definition at line 140 of file DataElement.php.

◆ setColCaptionWidth()

setColCaptionWidth (   $width)

Definition at line 125 of file DataElement.php.

◆ setColValueWidth()

setColValueWidth (   $width)

Definition at line 130 of file DataElement.php.

◆ setColWidths()

setColWidths (   $widths)

Definition at line 135 of file DataElement.php.

Field Documentation

◆ $_colWidths

$_colWidths
protected

Definition at line 21 of file DataElement.php.


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