Class jControllerDaoCrud

Description

a base class for crud controllers

  • since: 1.0b3

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

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 _checkDatas ( $form,  $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 31)

selector of the dao to use for the crud.

It should be filled by child controller.

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

the jDb profile to use with the dao

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

template to display the form

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

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 78)

number of record to display in the list page

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

template to display the list of records

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

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

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

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 54)

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 98)

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 85)

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

of the html response

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

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 72)

template to display a record

  • access: protected

Inherited Variables

Inherited from jController

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

display a form to create a record

void create ()
delete (line 546)

delete a record

void delete ()
editupdate (line 407)

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 182)

list all records

void index ()
precreate (line 250)

prepare a form to create a record.

void precreate ()
preupdate (line 361)

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

void preupdate ()
savecreate (line 317)

save data of a form in a new record

void savecreate ()
saveupdate (line 457)

save data of a form in a new record

void saveupdate ()
view (line 503)

displays a record

void view ()
_afterCreate (line 354)

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 496)

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 310)

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 450)

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 167)

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
_checkDatas (line 175)

DEPRECATED, use _checkData instead

  • deprecated: since 1.1
  • access: protected
void _checkDatas ( $form,  $calltype)
  • $form
  • $calltype
_create (line 299)

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 132)

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 565)

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 438)

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 154)

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 144)

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 120)

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 232)

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 241)

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 266)

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

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

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

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

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 Mon, 19 Sep 2011 14:12:05 +0200 by phpDocumentor 1.4.3