a base class for crud controllers, for DAO which have a primary key based on two fields, a "static" field (a field that we know the value and which is a criteria to to select all viewed record), and a "dynamic" field (the value of the field is created by the user or autoincremented)
A controller is used to implement one or many actions, one method for each action.
| package |
jelix |
|---|---|
| subpackage |
controllers |
| since | 1.1 |
__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(string $spk, \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.
stringthe static value of the primary key of the record
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
_delete(mixed $spk, mixed $dpk, \jResponseHtml $resp) : boolean
mixedthe static value of the primary key of the record to delete
mixedthe dynamic value of the primary key 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
_getPk( $spk, $dpk, $dao = null)
_getResponse() : \jResponseHtml
_index(\jResponseHtml $resp, \jtpl $tpl)
_indexSetConditions(\jDaoConditions $cond)
_isPkAutoIncrement( $dao = null)
_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()
dpkName :
spkName :
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
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 | |
|---|---|