Class jControllerDaoCrudDfk

Description

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)

  • since: 1.1

Located in /controllers/jControllerDaoCrudDfk.class.php (line 25)

jController
   |
   --jControllerDaoCrudDfk
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 (string $spk, jFormsBase $form, boolean $calltype)
void _create (jFormsBase $form, jResponseHtml $resp, jtpl $tpl)
boolean _delete (mixed $spk, mixed $dpk, jResponseHtml $resp)
void _editUpdate (jFormsBase $form, jResponseHtml $resp, jtpl $tpl)
string _getAction (string $method)
void _getPk ( $spk,  $dpk, [ $dao = null])
void _index (jResponseHtml $resp, jtpl $tpl)
void _isPkAutoIncrement ([ $dao = null])
void _preCreate (jFormsBase $form)
void _preUpdate (jFormsBase $form)
void _view (jFormsBase $form, jResponseHtml $resp, jtpl $tpl)
Variables
string $dao = '' (line 42)

selector of the dao to use for the crud.

It should be filled by child controller.

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

the jDb profile to use with the dao

  • access: protected
mixed $dpkName = 'id' (line 30)

name of the request parameter and of the field in the dao, for the dynamic primary key

  • access: protected
string $editTemplate = 'jelix~cruddfk_edit' (line 77)

template to display the form

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

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

number of record to display in the list page

  • access: protected
string $listTemplate = 'jelix~cruddfk_list' (line 71)

template to display the list of records

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

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

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

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

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_cruddf_roxor' (line 109)

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
mixed $spkName = 'spk' (line 35)

name of the request parameter and of the field in the dao, for the static primary key

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

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

of the html response

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

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~cruddfk_view' (line 83)

template to display a record

  • access: protected

Inherited Variables

Inherited from jController

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

display a form to create a record

void create ()
delete (line 585)

delete a record

void delete ()
editupdate (line 427)

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

list all records

void index ()
precreate (line 254)

prepare a form to create a record.

void precreate ()
preupdate (line 383)

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

save data of a form in a new record

void saveupdate ()
view (line 533)

displays a record

void view ()
_afterCreate (line 376)

overload 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 526)

overload 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 363)

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

jFormsBase::prepareDaoFromControls method

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

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

jFormsBase::prepareDaoFromControls method

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

you can do your own data check of a form by overloading 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 (string $spk, jFormsBase $form, boolean $calltype)
  • string $spk: the static value of the primary key of the record
  • jFormsBase $form: the current form
  • boolean $calltype: true for an update, false for a create
_create (line 306)

overload this method if you wan 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)
_delete (line 610)

overload 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 $spk, mixed $dpk, jResponseHtml $resp)
  • mixed $spk: the static value of the primary key of the record to delete
  • mixed $dpk: the dynamic value of the primary key of the record to delete
  • jResponseHtml $resp: the response
_editUpdate (line 465)

overload 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 140)

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
_getPk (line 167)
  • access: protected
void _getPk ( $spk,  $dpk, [ $dao = null])
  • $spk
  • $dpk
  • $dao
_getResponse (line 131)

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

method to return a personnalized response

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

overload 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 245)

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

  • access: protected
void _indexSetConditions (jDaoConditions $cond)
_isPkAutoIncrement (line 159)
  • access: protected
void _isPkAutoIncrement ([ $dao = null])
  • $dao
_preCreate (line 270)

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

  • access: protected
void _preCreate (jFormsBase $form)
_preUpdate (line 418)

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

  • access: protected
void _preUpdate (jFormsBase $form)
_view (line 578)

overload 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, 24 Sep 2014 21:57:02 +0200 by phpDocumentor 1.4.3