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

Ubiquity\controllers\crud$CRUDController This class is part of Ubiquity. More...

+ Inheritance diagram for CRUDController:

Public Member Functions

 __construct ()
 Constructor initialize $view variable.
 
 _setStyle ($elm)
 
 index ()
 Default page : list all objects Uses modelViewer.isModal, modelViewer.getModelDataTable Uses CRUDFiles.getViewIndex template (default : @framework/crud/index.html) Triggers the events onDisplayElements,beforeLoadView.
 
 updateMember ($member, $callback=false)
 
 refresh_ ()
 Refreshes the area corresponding to the DataTable.
 
 edit ($modal="no", $ids="")
 Edits an instance.
 
 newModel ($modal="no")
 Adds a new instance and edits it.
 
 editMember ($member)
 
 display ($modal="no", $ids="")
 Displays an instance.
 
 delete ($ids)
 Deletes an instance.
 
 refreshTable ($id=null)
 
 updateModel ()
 Updates an instance from the data posted in a form.
 
 showDetail ($ids)
 Shows associated members with foreign keys.
 
 detailClick ($url, $responseElement='#divTable', $attributes=["attr"=> "data-ajax"])
 
- Public Member Functions inherited from ControllerBase
 initialize ()
 Method called before each action Can be override in derived class.
 
 finalize ()
 Method called after each action Can be override in derived class.
 
- Public Member Functions inherited from Controller
 loadView (string $viewName, $pData=null, bool $asString=false)
 Loads the view $viewName possibly passing the variables $pdata.
 
 loadDefaultView ($pData=null, bool $asString=false)
 Loads the default view (controllerName/actionName) possibly passing the variables $pdata.
 
 getDefaultViewName ()
 Returns the default view name for this controller/action i.e ControllerName/actionName.html for the action actionName in ControllerName If there is an activeTheme @activeTheme/ControllerName/actionName.html
 
 isValid ($action)
 Returns True if access to the controller is allowed To be override in sub classes.
 
 onInvalidControl ()
 Called if isValid () returns false To be override in sub classes.
 
 forward (string $controller, string $action='index', $params=[], bool $initialize=false, bool $finalize=false)
 Loads the controller $controller and calls its $action method by passing the parameters $params.
 
 redirectToRoute (string $routeName, $parameters=[], bool $initialize=false, bool $finalize=false)
 Redirect to a route by its name.
 
 getView ()
 Returns the associated view instance.
 
- Public Member Functions inherited from MessagesTrait
 _getFiles ()
 
 _showSimpleMessage ($content, $type, $title=null, $icon="info", $timeout=NULL, $staticName=null, $closeAction=null, $toast=false)
 
- Public Member Functions inherited from CRUDControllerUtilitiesTrait
 loadView (string $viewName, $pData=null, bool $asString=false)
 
 _getBaseRoute ()
 
 _getAdminData ()
 
 _getFiles ()
 
- Public Member Functions inherited from InsertJqueryTrait
 _insertJquerySemantic ()
 
- Public Member Functions inherited from HasModelViewerInterface
 _getAdminData ()
 
 _getBaseRoute ()
 
 _getFiles ()
 

Protected Member Functions

 refreshAsJson ($instances)
 Return a JSON representation of $instances for the JsonDataTable component.
 
- Protected Member Functions inherited from MessagesTrait
 _getModelViewer ()
 
 showSimpleMessage_ (CRUDMessage $message, $staticName=null, $toast=false)
 
 showConfMessage_ (CRUDMessage $message, $url, $responseElement, $data, $attributes=NULL)
 
 _showConfMessage ($content, $type, $title, $icon, $url, $responseElement, $data, $attributes=NULL)
 
- Protected Member Functions inherited from CRUDControllerUtilitiesTrait
 showSimpleMessage_ (CRUDMessage $message, $staticName=null)
 
 showConfMessage_ (CRUDMessage $message, $url, $responseElement, $data, $attributes=null)
 
 getInstances (&$totalCount, $page=1, $id=null)
 
 search ($model, $search)
 
 updateMemberDataElement ($member, $instance)
 
 _edit ($instance, $modal="no")
 
 _showModel ($id=null)
 
 _deleteMultiple ($data, $action, $target, $condition, $params=[])
 Helper to delete multiple objects.
 
 refreshInstance ($instance, $isNew)
 
 getAdminData ()
 To override for defining a new adminData.
 
 getModelViewer ()
 To override for defining a new ModelViewer.
 
 _getModelViewer ()
 
 getFiles ()
 To override for changing view files.
 
 getEvents ()
 To override for changing events.
 
 getInstanceToString ($instance)
 

Protected Attributes

 $model
 
 $activePage =1
 
 $style
 
- Protected Attributes inherited from ControllerBase
string $headerView = '@activeTheme/main/vHeader.html'
 
string $footerView = '@activeTheme/main/vFooter.html'
 
- Protected Attributes inherited from Controller
View $view
 
- Protected Attributes inherited from CRUDControllerUtilitiesTrait
 $modelViewer
 
 $adminDatas
 
 $events
 
 $crudFiles
 

Additional Inherited Members

- Data Fields inherited from InsertJqueryTrait
 $jquery
 

Detailed Description

Ubiquity\controllers\crud$CRUDController This class is part of Ubiquity.

Author
jc
Version
1.0.3

Definition at line 26 of file CRUDController.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Constructor initialize $view variable.

Reimplemented from Controller.

Definition at line 31 of file CRUDController.php.

Member Function Documentation

◆ _setStyle()

_setStyle (   $elm)

Reimplemented from CRUDControllerUtilitiesTrait.

Definition at line 50 of file CRUDController.php.

◆ delete()

delete (   $ids)

Deletes an instance.

Parameters
mixed$ids@route("methods"=>["post","get"])

Definition at line 224 of file CRUDController.php.

◆ detailClick()

detailClick (   $url,
  $responseElement = '#divTable',
  $attributes = [ "attr" => "data-ajax"] 
)

Definition at line 343 of file CRUDController.php.

◆ display()

display (   $modal = "no",
  $ids = "" 
)

Displays an instance.

Parameters
string$modal
string$ids

Definition at line 201 of file CRUDController.php.

◆ edit()

edit (   $modal = "no",
  $ids = "" 
)

Edits an instance.

Parameters
string$modalAccept "no" or "modal" for a modal dialog
string$idsthe primary value(s)

Definition at line 147 of file CRUDController.php.

◆ editMember()

editMember (   $member)
Parameters
$member
Exceptions

Exception

Postcondition

Definition at line 183 of file CRUDController.php.

◆ index()

index ( )

Default page : list all objects Uses modelViewer.isModal, modelViewer.getModelDataTable Uses CRUDFiles.getViewIndex template (default : @framework/crud/index.html) Triggers the events onDisplayElements,beforeLoadView.

Reimplemented from Controller.

Definition at line 65 of file CRUDController.php.

◆ newModel()

newModel (   $modal = "no")

Adds a new instance and edits it.

Parameters
string$modalAccept "no" or "modal" for a modal dialog

Definition at line 163 of file CRUDController.php.

◆ refresh_()

refresh_ ( )

Refreshes the area corresponding to the DataTable.

Definition at line 115 of file CRUDController.php.

◆ refreshAsJson()

refreshAsJson (   $instances)
protected

Return a JSON representation of $instances for the JsonDataTable component.

Parameters
array$instances
Returns
string

Definition at line 43 of file CRUDController.php.

◆ refreshTable()

refreshTable (   $id = null)

Definition at line 256 of file CRUDController.php.

◆ showDetail()

showDetail (   $ids)

Shows associated members with foreign keys.

Parameters
mixed$ids

Reimplemented in MultiResourceCRUDController.

Definition at line 307 of file CRUDController.php.

◆ updateMember()

updateMember (   $member,
  $callback = false 
)
Parameters
$member
boolean$callback
Exceptions

Exception

Postcondition

Definition at line 84 of file CRUDController.php.

◆ updateModel()

updateModel ( )

Updates an instance from the data posted in a form.

Returns
object The updated instance
Postcondition

Definition at line 271 of file CRUDController.php.

Field Documentation

◆ $activePage

$activePage =1
protected

Definition at line 28 of file CRUDController.php.

◆ $model

$model
protected

Definition at line 27 of file CRUDController.php.

◆ $style

$style
protected

Definition at line 29 of file CRUDController.php.


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