Changeset 1025

Show
Ignore:
Timestamp:
07/19/08 00:50:50 (5 months ago)
Author:
laurentj
Message:

ticket #627: new _preCreate and _preUpdate methods in jControllerCrud

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/jelix/controllers/jControllerDaoCrud.class.php

    r989 r1025  
    66* @contributor  Bastien Jaillot 
    77* @contributor  Thibault PIRONT < nuKs > 
    8 * @copyright    2007 Laurent Jouanneau 
     8* @copyright    2007-2008 Laurent Jouanneau 
    99* @copyright    2007 Thibault PIRONT 
    1010* @copyright    2007,2008 Bastien Jaillot 
     
    219219        // errors or already filled field. see ticket #292 
    220220        $form = jForms::create($this->form); 
     221        $this->_preCreate($form); 
    221222        $rep = $this->getResponse('redirect'); 
    222223        $rep->action = $this->_getAction('create'); 
    223224        return $rep; 
     225    } 
     226 
     227    /** 
     228     * overload this method if you want to do additionnal during the precreate action 
     229     * @param jFormsBase $form the form 
     230     * @since 1.1 
     231     */ 
     232    protected function _preCreate($form) { 
     233 
    224234    } 
    225235 
     
    245255 
    246256    /** 
    247      * overload this method if you wan to do additionnal things on the response and on the edit template 
     257     * overload this method if you want to do additionnal things on the response and on the edit template 
    248258     * during the create action. 
    249259     * @param jFormsBase $form the form 
     
    254264 
    255265    } 
    256      
     266 
    257267    /** 
    258268     * overload this method if you wan to do additionnal things on the dao generated by the  
     
    260270     * @param jFormsBase $form the form 
    261271     * @param jDaoRecordBase $form_daorec 
    262      */     
     272     * @since 1.1 
     273     */ 
    263274    protected function _beforeSaveCreate($form, $form_daorec) { 
    264275 
    265276    } 
    266      
     277 
    267278    /** 
    268279     * save data of a form in a new record 
     
    305316    } 
    306317 
    307  
    308318    /** 
    309319     * prepare a form in order to edit an existing record, and redirect to the editupdate action 
     
    326336            return $rep; 
    327337        } 
     338        $this->_preUpdate($form); 
    328339 
    329340        $rep->action = $this->_getAction('editupdate'); 
    330341        $rep->params['id'] = $id; 
    331342        return $rep; 
     343    } 
     344 
     345    /** 
     346     * overload this method if you want to do additionnal things during preupdate action 
     347     * @param jFormsBase $form the form object 
     348     * @since 1.1 
     349     */ 
     350    protected function _preUpdate($form) { 
     351 
    332352    } 
    333353 
     
    368388 
    369389    } 
    370      
     390 
    371391    /** 
    372392     * overload this method if you wan to do additionnal things on the dao generated by the  
     
    375395     * @param jDaoRecordBase $form_daorec 
    376396     * @param mixed $id the new id of the updated record 
    377      */     
     397     * @since 1.1 
     398     */ 
    378399    protected function _beforeSaveUpdate($form, $form_daorec, $id) { 
    379400 
     
    484505 
    485506} 
    486  
    487 ?> 
Download in other formats: Unified Diff Zip Archive