Source for file jFormsControlGroups.class.php

Documentation is available at jFormsControlGroups.class.php

  1. <?php
  2. /**
  3. @package     jelix
  4. @subpackage  forms
  5. @author      Laurent Jouanneau
  6. @contributor Julien Issler
  7. @copyright   2006-2008 Laurent Jouanneau
  8. @copyright   2008 Julien Issler
  9. @link        http://www.jelix.org
  10. @licence     http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file
  11. */
  12.  
  13.  
  14. /**
  15.  * abstract classes for controls which contain other controls
  16.  * @package     jelix
  17.  * @subpackage  forms
  18.  */
  19. abstract class jFormsControlGroups extends jFormsControl {
  20.     public $type = 'groups';
  21.  
  22.     /**
  23.      * all child controls of the group
  24.      */
  25.     protected $childControls = array();
  26.  
  27.     function check(){
  28.         $rv null;
  29.         foreach($this->childControls as $ctrl{
  30.             if(($rv2 $ctrl->check())!==null{
  31.                 $rv $rv2;
  32.             }
  33.         }
  34.         return $rv;
  35.     }
  36.  
  37.     function getDisplayValue($value){
  38.         return $value;
  39.     }
  40.  
  41.     function setValueFromRequest($request{
  42.         foreach($this->childControls as $name => $ctrl{
  43.             if(!$this->form->isActivated($name|| $this->form->isReadOnly($name))
  44.                 continue;
  45.             $ctrl->setValueFromRequest($request);
  46.         }
  47.         $this->setData($request->getParam($this->ref,''));
  48.     }
  49.  
  50.     function addChildControl($control$itemName ''{
  51.         $this->childControls[$control->ref]=$control;
  52.     }
  53.  
  54.     function getChildControls(return $this->childControls;}
  55.  
  56.     function setReadOnly($r true){
  57.         $this->container->setReadOnly($this->ref$r);
  58.         foreach($this->childControls as $ctrl{
  59.            $ctrl->setReadOnly($r);
  60.         }
  61.     }
  62.  
  63.     public function deactivate($deactivation=true{
  64.         $this->container->deactivate($this->ref$deactivation);
  65.         foreach($this->childControls as $ctrl{
  66.             $ctrl->deactivate($deactivation);
  67.         }
  68.     }
  69. }

Documentation generated on Wed, 04 Jan 2017 22:54:50 +0100 by phpDocumentor 1.4.3