Source for file jFormsControlDatasource.class.php

Documentation is available at jFormsControlDatasource.class.php

  1. <?php
  2. /**
  3. @package     jelix
  4. @subpackage  forms
  5. @author      Laurent Jouanneau
  6. @copyright   2006-2008 Laurent Jouanneau
  7. @link        http://www.jelix.org
  8. @licence     http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file
  9. */
  10.  
  11. /**
  12.  * base class for controls which uses a datasource to fill their contents.
  13.  * @package     jelix
  14.  * @subpackage  forms
  15.  */
  16. abstract class jFormsControlDatasource extends jFormsControl {
  17.  
  18.     public $type="datasource";
  19.  
  20.     /**
  21.      * @var jIFormsDatasource 
  22.      */
  23.     public $datasource;
  24.     public $defaultValue=array();
  25.  
  26.     function getDisplayValue($value){
  27.         if(is_array($value)){
  28.             $labels array();
  29.             foreach($value as $val){
  30.                 $labels[$val$this->_getLabel($val);
  31.             }
  32.             return $labels;
  33.         }else{
  34.             return $this->_getLabel($value);
  35.         }
  36.     }
  37.  
  38.     protected function _getLabel($value){
  39.         if ($this->datasource instanceof jIFormsDatasource2)
  40.             return $this->datasource->getLabel2($value$this->form);
  41.         else
  42.             return $this->datasource->getLabel($value);
  43.     }
  44. }

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