a base class for crud controllers
A controller is used to implement one or many actions, one method for each action.
| package |
jelix |
|---|---|
| subpackage |
controllers |
| since | 1.0b3 |
__construct(\jRequest $request)
_afterCreate(\jFormsBase $form, mixed $id, \jResponseHtml $resp)
mixedthe new id of the inserted record
_afterUpdate(\jFormsBase $form, mixed $id, \jResponseHtml $resp)
mixedthe new id of the updated record
_beforeSaveCreate(\jFormsBase $form, \jDaoRecordBase $form_daorec)
_beforeSaveUpdate(\jFormsBase $form, \jDaoRecordBase $form_daorec, mixed $id)
_checkData(\jFormsBase $form, boolean $calltype) : boolean
You can also do some other things. It is called only if the $form->check() is ok. and before the save of the data.
booleantrue for an update, false for a create
booleantrue if it is ok.
_create(\jFormsBase $form, \jResponseHtml $resp, \jtpl $tpl)
\jtplthe template to display the edit form
_createForm( $formId = null) : \jFormsBase
Don't do a jForms::get or jForms::fill in this method ! called in methods: index, precreate, create, preupdate, view
| since | 1.1 |
|---|---|
\jFormsBasethe form
_delete(mixed $id, \jResponseHtml $resp) : boolean
mixedthe id of the record to delete
booleantrue if the record can be deleted
_editUpdate(\jFormsBase $form, \jResponseHtml $resp, \jtpl $tpl)
\jtplthe template to display the edit form
_getAction(string $method) : string
stringname of one of method of this controller
stringan action selector
_getForm( $formId = null) : \jFormsBase
Don't do a jForms::create or jForms::fill in this method ! called in methods: create, savecreate, editupdate, saveupdate
| since | 1.1 |
|---|---|
\jFormsBasethe form
_getResponse() : \jResponseHtml
_index(\jResponseHtml $resp, \jtpl $tpl)
_indexSetConditions(\jDaoConditions $cond)
_preCreate(\jFormsBase $form)
_preUpdate(\jFormsBase $form)
_view(\jFormsBase $form, \jResponseHtml $resp, \jtpl $tpl)
\jtplthe template to display the form content
boolParam(string $parName, mixed $parDefaultValue = null, boolean $useDefaultIfEmpty = false) : boolean
stringthe name of the request parameter
mixedthe default returned value if the parameter doesn't exists
booleantrue: says to return the default value the value is ""
booleanthe request parameter value
create()
delete()
editupdate()
floatParam(string $parName, mixed $parDefaultValue = null, boolean $useDefaultIfEmpty = false) : float
stringthe name of the request parameter
mixedthe default returned value if the parameter doesn't exists
booleantrue: says to return the default value the value is ""
floatthe request parameter value
getResponse(string $name = '', boolean $useOriginal = false) : \jResponse|\jResponseHtml|\jResponseRedirect|\jResponseJson
stringthe name of the response type (ex: "html")
booleantrue:don't use the response object redefined by the application
\jResponse|\jResponseHtml|\jResponseRedirect|\jResponseJsonthe response object
index()
intParam(string $parName, mixed $parDefaultValue = null, boolean $useDefaultIfEmpty = false) : integer
stringthe name of the request parameter
mixedthe default returned value if the parameter doesn't exists
booleantrue: says to return the default value the value is ""
integerthe request parameter value
param(string $parName, mixed $parDefaultValue = null, boolean $useDefaultIfEmpty = false) : mixed
stringthe name of the request parameter
mixedthe default returned value if the parameter doesn't exists
booleantrue: says to return the default value if the parameter value is ""
mixedthe request parameter value
params() : array
arrayall request parameters
precreate()
preupdate()
savecreate()
saveupdate()
view()
dao : string
It should be filled by child controller.
| var |
|---|
string
form : string
| var |
|---|
string
propertiesForList : array
this property is only usefull when you use the default "list" template
| var |
|---|
array
propertiesForRecordsOrder : array
if empty list (default), the list is in a natural order. keys are properties name, and values are "asc" or "desc".
| var |
|---|
array
listTemplate : string
| var |
|---|
string
editTemplate : string
| var |
|---|
string
viewTemplate : string
| var |
|---|
string
viewErrorTemplate : string
| var | |
|---|---|
| since |
string
listPageSize : integer
| var |
|---|
integer
templateAssign : string
| var |
|---|
string
offsetParameterName : string
| var |
|---|
string
pseudoFormId : string
| var |
|---|
string
uploadsDirectory : string|false
Set it to false if you want to handle yourself the uploaded files. Set it with an empty string if you want to stored files in the default var/uploads directory.
| var |
|---|
string|false
dbProfile :
pluginParams : array
this array should contains all parameters needed by installed plugins for each action, see the documentation of each plugins to know this parameters. keys : name of an action or * for parameters to all action values : array that contains all plugin parameters
| var |
|---|
array
sensitiveParameters :
List of names of parameters that can have sensitive values like password etc. This list is used by the logger for example, to replace values by a dummy value. See also sensitiveParameters into error_handling section of the configuration.
| since | |
|---|---|