Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
ModelViewer Class Reference

Associated with a CRUDController class Responsible of the display. More...

+ Inheritance diagram for ModelViewer:

Public Member Functions

 __construct (HasModelViewerInterface $controller, $style=null)
 
 setStyle ($elm)
 
 getModelDataElement ($instance, $model, $modal)
 Returns a DataElement object for displaying the instance Used in the display method of the CrudController in display route.
 
 getElementCaptions ($captions, $className, $instance)
 Returns the captions for DataElement fields in display route.
 
 getModelDataTable ($instances, $model, $totalCount, $page=1)
 Returns the dataTable responsible for displaying instances of the model.
 
 setDataTableAttributes (DataTable $dataTable, $attributes, $model, $instances, $selector=null)
 
 addEditMemberFonctionality ($part)
 
 recordsPerPage ($model, $totalCount=0)
 
 getGroupByFields ()
 Returns the fields on which a grouping is performed.
 
 addAllButtons (DataTable $dataTable, $attributes)
 
 getTransition ()
 The default transition for display, edit and delete behaviors.
 
 getDataTableId ()
 
 onDataTableRowButton (HtmlButton $bt,?string $name=null)
 To override for modifying the dataTable row buttons.
 
 onConfirmButtons (HtmlButton $confirmBtn, HtmlButton $cancelBtn)
 To override for modifying the showConfMessage dialog buttons.
 
 getCaptions ($captions, $className)
 Returns the captions for list fields in showTable action.
 
 getFkHeaderElementDetails ($member, $className, $object)
 Returns the header for a single foreign object (element is an instance, issue from ManyToOne), (from DataTable)
 
 getFkHeaderListDetails ($member, $className, $list)
 Returns the header for a list of foreign objects (issue from oneToMany or ManyToMany), (from DataTable)
 
 getFkElementDetails ($member, $className, $object)
 Returns a component for displaying a single foreign object (manyToOne relation), (from DataTable)
 
 getFkListDetails ($member, $className, $list)
 Returns a list component for displaying a collection of foreign objects (*ToMany relations), (from DataTable)
 
 getFkMemberElementDetails ($memberFK, $objectFK, $fkClass, $fkTable)
 Returns a component for displaying a foreign object (from DataTable)
 
 onDisplayFkElementListDetails ($element, $member, $className, $object)
 To modify for displaying an element in a list component of foreign objects (from DataTable)
 
 getFkMemberElement ($memberFK, $objectFK, $fkClass, $fkTable)
 Returns a component for displaying a foreign object (from DataElement)
 
 getFkList ($member, $list)
 Returns a list component for displaying a collection of foreign objects (*ToMany relations), (from DataElement)
 
 displayFkElementList ($element, $member, $className, $object)
 To modify for displaying an element in a list component of foreign objects, (from DataElement)
 
 getFkElement ($member, $className, $object)
 Returns a component for displaying a single foreign object (manyToOne relation), (from DataElement)
 
 showDetailsOnDataTableClick ()
 To override to make sure that the detail of a clicked object is displayed or not.
 
- Public Member Functions inherited from FormModelViewerTrait
 getEditMemberParams ()
 
 getForm ($identifier, $instance, $updateUrl='updateModel')
 Returns the form for adding or modifying an object.
 
 getMemberForm ($identifier, $instance, $member, $td, $part, $updateUrl='_updateMember')
 Returns a form for member editing.
 
 setFormFieldsComponent (DataForm $form, $fieldTypes, $attributes=[])
 Sets the components for each field.
 
 setMemberFormFieldsComponent (DataForm $form, $fieldTypes, $attributes=[])
 Sets the components for each field.
 
 onGenerateFormField ($field, $nb, $name)
 For doing something when $field is generated in form.
 
 isModal ($objects, $model)
 Condition to determine if the edit or add form is modal for $model objects.
 
 getFormCaptions ($captions, $className, $instance)
 Returns the captions for form fields.
 
 getFormModalTitle (object $instance)
 Returns the modal Title.
 
 formHasMessage ()
 If true, display a message for editing or updating (default true).
 
 onFormModalButtons (HtmlButton $btOkay, HtmlButton $btCancel)
 Hook for changing the edit/new modal buttons.
 

Protected Member Functions

 getDataTableInstance ($instances, $model, $totalCount, $page=1)
 Returns the dataTable instance for dispaying a list of object.
 
 getDataTableRowButtons ()
 Returns an array of buttons ["display","edit","delete"] to display for each row in dataTable.
 
- Protected Member Functions inherited from FormModelViewerTrait
 relationMembersInForm ($form, $instance, $className, $fields, $relations, &$fieldTypes)
 
 manyToOneFormField ($form, $member, $className, $instance)
 
 oneToManyFormField (DataForm $form, $member, $instance, $annot)
 
 oneToManyFormFieldDt (DataForm $form, $member, $instance, $annot)
 
 dtManyField (DataTable $dt, $className, array $relations, array $fields)
 
 dtManyFieldCmb ($dt, $member, $className)
 
 manyToManyFormField (DataForm $form, $member, $instance, $annot)
 
 getEditMemberParams_ ($part)
 
 defaultEditMemberParams ()
 
 getFormTitle ($form, $instance)
 Returns an associative array defining form message title with keys "icon","message","subMessage".
 

Protected Attributes

 $controller
 

Private Attributes

 $jquery
 
 $style
 

Detailed Description

Associated with a CRUDController class Responsible of the display.

Author
jc
Version
1.0.5

Definition at line 25 of file ModelViewer.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( HasModelViewerInterface  $controller,
  $style = null 
)

Definition at line 39 of file ModelViewer.php.

Member Function Documentation

◆ addAllButtons()

addAllButtons ( DataTable  $dataTable,
  $attributes 
)

Definition at line 224 of file ModelViewer.php.

◆ addEditMemberFonctionality()

addEditMemberFonctionality (   $part)

Definition at line 156 of file ModelViewer.php.

◆ displayFkElementList()

displayFkElementList (   $element,
  $member,
  $className,
  $object 
)

To modify for displaying an element in a list component of foreign objects, (from DataElement)

Parameters
\Ajax\common\html\HtmlDoubleElement$element
string$member
string$className
object$object

Definition at line 453 of file ModelViewer.php.

◆ getCaptions()

getCaptions (   $captions,
  $className 
)

Returns the captions for list fields in showTable action.

Parameters
array$captions
string$className

Definition at line 291 of file ModelViewer.php.

◆ getDataTableId()

getDataTableId ( )

Reimplemented from FormModelViewerTrait.

Definition at line 263 of file ModelViewer.php.

◆ getDataTableInstance()

getDataTableInstance (   $instances,
  $model,
  $totalCount,
  $page = 1 
)
protected

Returns the dataTable instance for dispaying a list of object.

Parameters
array$instances
string$model
number$totalCount
number$page
Returns
DataTable

Definition at line 194 of file ModelViewer.php.

◆ getDataTableRowButtons()

getDataTableRowButtons ( )
protected

Returns an array of buttons ["display","edit","delete"] to display for each row in dataTable.

Returns
string[]

Definition at line 220 of file ModelViewer.php.

◆ getElementCaptions()

getElementCaptions (   $captions,
  $className,
  $instance 
)

Returns the captions for DataElement fields in display route.

Parameters
array$captions
string$className

Definition at line 95 of file ModelViewer.php.

◆ getFkElement()

getFkElement (   $member,
  $className,
  $object 
)

Returns a component for displaying a single foreign object (manyToOne relation), (from DataElement)

Parameters
string$member
string$className
object$object
Returns
\Ajax\common\html\BaseHtml

Definition at line 464 of file ModelViewer.php.

◆ getFkElementDetails()

getFkElementDetails (   $member,
  $className,
  $object 
)

Returns a component for displaying a single foreign object (manyToOne relation), (from DataTable)

Parameters
string$member
string$className
object$object
Returns
\Ajax\common\html\BaseHtml

Definition at line 329 of file ModelViewer.php.

◆ getFkHeaderElementDetails()

getFkHeaderElementDetails (   $member,
  $className,
  $object 
)

Returns the header for a single foreign object (element is an instance, issue from ManyToOne), (from DataTable)

Parameters
string$member
string$className
object$object
Returns
HtmlHeader

Definition at line 303 of file ModelViewer.php.

◆ getFkHeaderListDetails()

getFkHeaderListDetails (   $member,
  $className,
  $list 
)

Returns the header for a list of foreign objects (issue from oneToMany or ManyToMany), (from DataTable)

Parameters
string$member
string$className
array$list
Returns
HtmlHeader

Definition at line 316 of file ModelViewer.php.

◆ getFkList()

getFkList (   $member,
  $list 
)

Returns a list component for displaying a collection of foreign objects (*ToMany relations), (from DataElement)

Parameters
string$member
string$className
array | \Traversable$list
Returns
\Ajax\common\html\HtmlCollection

Definition at line 439 of file ModelViewer.php.

◆ getFkListDetails()

getFkListDetails (   $member,
  $className,
  $list 
)

Returns a list component for displaying a collection of foreign objects (*ToMany relations), (from DataTable)

Parameters
string$member
string$className
array | \Traversable$list
Returns
\Ajax\common\html\HtmlCollection

Definition at line 342 of file ModelViewer.php.

◆ getFkMemberElement()

getFkMemberElement (   $memberFK,
  $objectFK,
  $fkClass,
  $fkTable 
)

Returns a component for displaying a foreign object (from DataElement)

Parameters
string$memberFK
mixed$objectFK
string$fkClass
string$fkTable
Returns
string|NULL

Definition at line 407 of file ModelViewer.php.

◆ getFkMemberElementDetails()

getFkMemberElementDetails (   $memberFK,
  $objectFK,
  $fkClass,
  $fkTable 
)

Returns a component for displaying a foreign object (from DataTable)

Parameters
string$memberFK
mixed$objectFK
string$fkClass
string$fkTable
Returns
\Ajax\semantic\html\elements\HtmlHeader[]|\Ajax\common\html\BaseHtml[]|NULL

Definition at line 358 of file ModelViewer.php.

◆ getGroupByFields()

getGroupByFields ( )

Returns the fields on which a grouping is performed.

Definition at line 181 of file ModelViewer.php.

◆ getModelDataElement()

getModelDataElement (   $instance,
  $model,
  $modal 
)

Returns a DataElement object for displaying the instance Used in the display method of the CrudController in display route.

Parameters
object$instance
string$modelThe model class name (long name)
boolean$modal
Returns
\Ajax\semantic\widgets\dataelement\DataElement

Definition at line 64 of file ModelViewer.php.

◆ getModelDataTable()

getModelDataTable (   $instances,
  $model,
  $totalCount,
  $page = 1 
)

Returns the dataTable responsible for displaying instances of the model.

Parameters
array$instancesobjects to display
string$modelmodel class name (long name)
Returns
DataTable

Definition at line 106 of file ModelViewer.php.

◆ getTransition()

getTransition ( )

The default transition for display, edit and delete behaviors.

Returns
string

Definition at line 259 of file ModelViewer.php.

◆ onConfirmButtons()

onConfirmButtons ( HtmlButton  $confirmBtn,
HtmlButton  $cancelBtn 
)

To override for modifying the showConfMessage dialog buttons.

Parameters
HtmlButton$confirmBtnThe confirmation button
HtmlButton$cancelBtnThe cancellation button

Definition at line 282 of file ModelViewer.php.

◆ onDataTableRowButton()

onDataTableRowButton ( HtmlButton  $bt,
?string  $name = null 
)

To override for modifying the dataTable row buttons.

Parameters
HtmlButton$bt
?string$name

Definition at line 273 of file ModelViewer.php.

◆ onDisplayFkElementListDetails()

onDisplayFkElementListDetails (   $element,
  $member,
  $className,
  $object 
)

To modify for displaying an element in a list component of foreign objects (from DataTable)

Parameters
\Ajax\common\html\HtmlDoubleElement$element
string$member
string$className
object$object

Definition at line 395 of file ModelViewer.php.

◆ recordsPerPage()

recordsPerPage (   $model,
  $totalCount = 0 
)
Parameters
string$modelThe model class name (long name)
number$totalCountThe total count of objects
Returns
void|number default : 6

Definition at line 171 of file ModelViewer.php.

◆ setDataTableAttributes()

setDataTableAttributes ( DataTable  $dataTable,
  $attributes,
  $model,
  $instances,
  $selector = null 
)

Definition at line 129 of file ModelViewer.php.

◆ setStyle()

setStyle (   $elm)

Definition at line 45 of file ModelViewer.php.

◆ showDetailsOnDataTableClick()

showDetailsOnDataTableClick ( )

To override to make sure that the detail of a clicked object is displayed or not.

Returns
boolean Return true if you want to see details

Definition at line 474 of file ModelViewer.php.

Field Documentation

◆ $controller

$controller
protected

Definition at line 37 of file ModelViewer.php.

◆ $jquery

$jquery
private

Definition at line 30 of file ModelViewer.php.

◆ $style

$style
private

Definition at line 31 of file ModelViewer.php.


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