Changeset 1138

Show
Ignore:
Timestamp:
10/29/08 09:17:32 (2 months ago)
Author:
julieni
Message:

ticket #728: jForms: new addControlBefore() method

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/jelix/CREDITS

    r1137 r1138  
    3838 - jTcpdf: added default font for header and footer (#693) 
    3939 - jDao: autoremove of empty groups in jDaoConditions (#724) 
     40 - jForms: new addControlBefore() method (#728) 
    4041 
    4142Bastien Jaillot (aka bastnic) 
  • trunk/lib/jelix/forms/jFormsBase.class.php

    r1133 r1138  
    66* @contributor Dominique Papin 
    77* @contributor Bastien Jaillot 
    8 * @contributor Christophe Thiriot 
     8* @contributor Christophe Thiriot, Julien Issler 
    99* @copyright   2006-2008 Laurent Jouanneau, 2007 Dominique Papin, 2008 Bastien Jaillot 
     10* @copyright   2008 Julien Issler 
    1011* @link        http://www.jelix.org 
    1112* @licence     http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file 
     
    636637    /** 
    637638    * add a control to the form 
    638     * @param $control jFormsControl 
     639    * @param jFormsControl $control the control to add 
    639640    */ 
    640641    public function addControl($control){ 
     
    646647                $this->addChildControl($ctrl); 
    647648        } 
     649    } 
     650 
     651    /** 
     652     * add a control to the form, before the specified control 
     653     * @param jFormsControl $control the control to add 
     654     * @param string $ref The ref of the control the new control should be inserted before 
     655     * @since 1.1 
     656     */ 
     657    public function addControlBefore($control, $ref){ 
     658        if(isset($this->rootControls[$ref])){ 
     659            $controls = array(); 
     660            foreach($this->rootControls as $k=>$c){ 
     661                if($k == $ref) 
     662                    $controls[$control->ref] = null; 
     663                $controls[$k] = $c; 
     664            } 
     665            $this->rootControls = $controls; 
     666        } 
     667        $this->addControl($control); 
    648668    } 
    649669 
     
    666686    /** 
    667687    * declare a child control to the form. The given control should be a child of an other control 
    668     * @param $control jFormsControl 
     688    * @param jFormsControl $control 
    669689    */ 
    670690    public function addChildControl($control){ 
Download in other formats: Unified Diff Zip Archive