[ Index ]
 

Code source de PRADO 3.0.6

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/framework/Web/UI/WebControls/ -> TRadioButtonList.php (source)

   1  <?php
   2  /**
   3   * TRadioButtonList class file
   4   *
   5   * @author Qiang Xue <qiang.xue@gmail.com>
   6   * @link http://www.pradosoft.com/
   7   * @copyright Copyright &copy; 2005 PradoSoft
   8   * @license http://www.pradosoft.com/license/
   9   * @version $Id: TRadioButtonList.php 1397 2006-09-07 07:55:53Z wei $
  10   * @package System.Web.UI.WebControls
  11   */
  12  
  13  /**
  14   * Includes TRadioButton class
  15   */
  16  Prado::using('System.Web.UI.WebControls.TRadioButton');
  17  /**
  18   * Includes TCheckBoxList class
  19   */
  20  Prado::using('System.Web.UI.WebControls.TCheckBoxList');
  21  
  22  /**
  23   * TRadioButtonList class
  24   *
  25   * TRadioButtonList displays a list of radiobuttons on a Web page.
  26   *
  27   * TRadioButtonList inherits all properties and events of {@link TCheckBoxList}.
  28   * Each TRadioButtonList displays one group of radiobuttons, i.e., at most
  29   * one radiobutton can be selected at a time.
  30   *
  31   * @author Qiang Xue <qiang.xue@gmail.com>
  32   * @version $Id: TRadioButtonList.php 1397 2006-09-07 07:55:53Z wei $
  33   * @package System.Web.UI.WebControls
  34   * @since 3.0
  35   */
  36  class TRadioButtonList extends TCheckBoxList
  37  {
  38      /**
  39       * @return boolean whether this control supports multiple selection. Always false for radiobutton list.
  40       */
  41  	protected function getIsMultiSelect()
  42      {
  43          return false;
  44      }
  45  
  46      /**
  47       * Creates a control used for repetition (used as a template).
  48       * @return TControl the control to be repeated
  49       */
  50  	protected function createRepeatedControl()
  51      {
  52          return new TRadioButton;
  53      }
  54  
  55      /**
  56       * Gets the name of the javascript class responsible for performing postback for this control.
  57       * This method overrides the parent implementation.
  58       * @return string the javascript class name
  59       */
  60  	protected function getClientClassName()
  61      {
  62          return 'Prado.WebUI.TRadioButtonList';
  63      }
  64  
  65      /**
  66       * Loads user input data.
  67       * This method is primarly used by framework developers.
  68       * @param string the key that can be used to retrieve data from the input data collection
  69       * @param array the input data collection
  70       * @return boolean whether the data of the control has been changed
  71       */
  72  	public function loadPostData($key,$values)
  73      {
  74          $value=isset($values[$key])?$values[$key]:'';
  75          $oldSelection=$this->getSelectedIndex();
  76          $this->ensureDataBound();
  77          foreach($this->getItems() as $index=>$item)
  78          {
  79              if($item->getEnabled() && $item->getValue()===$value)
  80              {
  81                  if($index===$oldSelection)
  82                      return false;
  83                  else
  84                  {
  85                      $this->setSelectedIndex($index);
  86                      return true;
  87                  }
  88              }
  89          }
  90          return false;
  91      }
  92  
  93      /**
  94       * @throws TNotSupportedException if this method is invoked
  95       */
  96  	public function setSelectedIndices($indices)
  97      {
  98          throw new TNotSupportedException('radiobuttonlist_selectedindices_unsupported');
  99      }
 100  }
 101  
 102  ?>


Généré le : Sun Feb 25 21:07:04 2007 par Balluche grâce à PHPXref 0.7