Class jControllerDaoCrud

Description

a base class for crud controllers

  • since: 1.0b3

Located in /controllers/jControllerDaoCrud.class.php (line 26)

jController
   |
   --jControllerDaoCrud
Variable Summary
Method Summary
void create ()
void delete ()
void editupdate ()
void index ()
void precreate ()
void preupdate ()
void savecreate ()
void saveupdate ()
void view ()
void _afterCreate (jFormsBase $form, mixed $id, jResponseHtml $resp)
void _afterUpdate (jFormsBase $form, mixed $id, jResponseHtml $resp)
void _beforeSaveCreate (jFormsBase $form, jDaoRecordBase $form_daorec)
void _beforeSaveUpdate (jFormsBase $form, jDaoRecordBase $form_daorec, mixed $id)
boolean _checkData (jFormsBase $form, boolean $calltype)
void _create (jFormsBase $form, jResponseHtml $resp, jtpl $tpl)
jFormsBase _createForm ([ $formId = null])
boolean _delete (mixed $id, jResponseHtml $resp)
void _editUpdate (jFormsBase $form, jResponseHtml $resp, jtpl $tpl)
string _getAction (string $method)
jFormsBase _getForm ([ $formId = null])
void _index (jResponseHtml $resp, jtpl $tpl)
void _preCreate (jFormsBase $form)
void _preUpdate (jFormsBase $form)
void _view (jFormsBase $form, jResponseHtml $resp, jtpl $tpl)
Variables
string $dao = '' (line 33)

selector of the dao to use for the crud.

It should be filled by child controller.

  • access: protected
mixed $dbProfile = '' (line 115)

the jDb profile to use with the dao

  • access: protected
string $editTemplate = 'jelix~crud_edit' (line 68)

template to display the form

  • access: protected
string $form = '' (line 40)

selector of the form to use to edit and display a record It should be filled by child controller.

  • access: protected
integer $listPageSize = 20 (line 80)

number of record to display in the list page

  • access: protected
string $listTemplate = 'jelix~crud_list' (line 62)

template to display the list of records

  • access: protected
string $offsetParameterName = 'offset' (line 93)

name of the parameter which contains the page offset, for the index action

  • access: protected
array $propertiesForList = array() (line 48)

list of properties to show in the list page if empty list (default), it shows all properties.

this property is only usefull when you use the default "list" template

  • access: protected
array $propertiesForRecordsOrder = array() (line 56)

list of properties which serve to order the record list.

if empty list (default), the list is in a natural order. keys are properties name, and values are "asc" or "desc".

  • access: protected
string $pseudoFormId = 'jelix_crud_roxor' (line 100)

id for the "pseudo" form used to show a record. You can change it if the default one corresponds to a possible id in your dao.

  • access: protected
string $templateAssign = 'MAIN' (line 87)

the template variable name to display a CRUD content in the main template

of the html response

  • access: protected
string|false $uploadsDirectory = '' (line 110)

full path to the directory where uploaded files will be stored automatically by jForms.

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.

  • access: protected
string $viewTemplate = 'jelix~crud_view' (line 74)

template to display a record

  • access: protected

Inherited Variables

Inherited from jController

jController::$pluginParams
jController::$request
Methods
create (line 269)

display a form to create a record

void create ()
delete (line 542)

delete a record

void delete ()
editupdate (line 403)

displays a forms to edit an existing record. The form should be

prepared with the preupdate before, so a refresh of the page won't cause a reset of the form

void editupdate ()
index (line 176)

list all records

void index ()
precreate (line 246)

prepare a form to create a record.

void precreate ()
preupdate (line 357)

prepare a form in order to edit an existing record, and redirect to the editupdate action

void preupdate ()
savecreate (line 313)

save data of a form in a new record

void savecreate ()
saveupdate (line 453)

save data of a form in a new record

void saveupdate ()
view (line 499)

displays a record

void view ()
_afterCreate (line 350)

redefine this method if you wan to do additionnal things after the creation of a record. For example, you can handle here the uploaded files. If you do such handling, set the uploadsDirectory property to false, to prevent the default behavior on uploaded files in the controller.

  • access: protected
void _afterCreate (jFormsBase $form, mixed $id, jResponseHtml $resp)
_afterUpdate (line 492)

redefine this method if you wan to do additionnal things after the update of a record. For example, you can handle here the uploaded files. If you do such handling, set the uploadsDirectory property to false, to prevent the default behavior on uploaded files in the controller.

  • access: protected
void _afterUpdate (jFormsBase $form, mixed $id, jResponseHtml $resp)
_beforeSaveCreate (line 306)

redefine this method if you wan to do additionnal things on the dao generated by the

jFormsBase::prepareDaoFromControls method

  • since: 1.1
  • access: protected
void _beforeSaveCreate (jFormsBase $form, jDaoRecordBase $form_daorec)
_beforeSaveUpdate (line 446)

redefine this method if you wan to do additionnal things on the dao generated by the

jFormsBase::prepareDaoFromControls method

  • since: 1.1
  • access: protected
void _beforeSaveUpdate (jFormsBase $form, jDaoRecordBase $form_daorec, mixed $id)
_checkData (line 169)

you can do your own data check of a form by redefining this method.

You can also do some other things. It is called only if the $form->check() is ok. and before the save of the data.

  • return: true if it is ok.
  • access: protected
boolean _checkData (jFormsBase $form, boolean $calltype)
  • jFormsBase $form: the current form
  • boolean $calltype: true for an update, false for a create
_create (line 295)

redefine this method if you want to do additionnal things on the response and on the edit template during the create action.

  • access: protected
void _create (jFormsBase $form, jResponseHtml $resp, jtpl $tpl)
_createForm (line 134)

create the form. You can redefine this method to modify dynamically the form Typically, you call jForms::create and then you can call addControl or whatever.

Don't do a jForms::get or jForms::fill in this method ! called in methods: index, precreate, create, preupdate, view

  • return: the form
  • since: 1.1
  • access: protected
jFormsBase _createForm ([ $formId = null])
  • $formId
_delete (line 561)

redefine this method if you want to do additionnal things before the deletion of a record

  • return: true if the record can be deleted
  • access: protected
boolean _delete (mixed $id, jResponseHtml $resp)
  • mixed $id: the id of the record to delete
  • jResponseHtml $resp: the response
_editUpdate (line 434)

redefine this method if you wan to do additionnal things on the response and on the edit template during the editupdate action.

  • access: protected
void _editUpdate (jFormsBase $form, jResponseHtml $resp, jtpl $tpl)
_getAction (line 156)

returned the selector of the action corresponding of the given method of the current controller.

  • return: an action selector
  • access: protected
string _getAction (string $method)
  • string $method: name of one of method of this controller
_getForm (line 146)

get an existing form. You can redefine this method to modify dynamically the form Typically, you call jForms::get and then you can call addControl or whatever.

Don't do a jForms::create or jForms::fill in this method ! called in methods: create, savecreate, editupdate, saveupdate

  • return: the form
  • since: 1.1
  • access: protected
jFormsBase _getForm ([ $formId = null])
  • $formId
_getResponse (line 122)

Returned a simple html response to display CRUD contents. You can redefine this

method to return a personnalized response

  • return: the response
  • access: protected
jResponseHtml _getResponse ()
_index (line 228)

redefine this method if you wan to do additionnal things on the response and on the list template during the index action.

  • access: protected
void _index (jResponseHtml $resp, jtpl $tpl)
  • jResponseHtml $resp: the response
  • jtpl $tpl: the template to display the record list
_indexSetConditions (line 237)

redefine this method if you wan to do additionnal conditions to the index's select during the index action.

  • access: protected
void _indexSetConditions (jDaoConditions $cond)
_preCreate (line 262)

redefine this method if you want to do additionnal during the precreate action

  • since: 1.1
  • access: protected
void _preCreate (jFormsBase $form)
_preUpdate (line 394)

redefine this method if you want to do additionnal things during preupdate action

  • since: 1.1
  • access: protected
void _preUpdate (jFormsBase $form)
_view (line 535)

redefine this method if you want to do additionnal things on the response and on the view template during the view action.

  • access: protected
void _view (jFormsBase $form, jResponseHtml $resp, jtpl $tpl)

Inherited Methods

Inherited From jController

jController::__construct()
jController::boolParam()
jController::floatParam()
jController::getResponse()
jController::intParam()
jController::param()
jController::params()

Documentation generated on Wed, 04 Jan 2017 22:52:44 +0100 by phpDocumentor 1.4.3