Source for file radiolist.php

Documentation is available at radiolist.php

  1. <?php
  2. /**
  3. * a radio button list based on the ChoiceList class
  4. *
  5. @author    Stuart Prescott
  6. @copyright  Copyright Stuart Prescott
  7. @license    http://opensource.org/licenses/gpl-license.php GNU Public License
  8. @version    $Id$
  9. @package    Bumblebee
  10. @subpackage FormsLibrary
  11. */
  12.  
  13. /** Load ancillary functions */
  14. require_once 'inc/typeinfo.php';
  15.  
  16. /** parent object */
  17. require_once 'choicelist.php';
  18.  
  19. /**
  20. * a radio button list based on the ChoiceList class
  21. *
  22. @package    Bumblebee
  23. @subpackage FormsLibrary
  24. */
  25. class RadioList extends ChoiceList {
  26.   /** @var string   html/css class name to use in the generated output */
  27.   var $radioclass = 'item';
  28.  
  29.   /**
  30.   *  Create a new radiolist object
  31.   *
  32.   * @param string $name         the name of the field (db name, and html field name
  33.   * @param string $description  long name to be used in the label of the field in display
  34.   */
  35.   function RadioList($name$description=''{
  36.     //$this->DEBUG = 10;
  37.     $this->ChoiceList($name$description);
  38.   }
  39.  
  40.   function display({
  41.     return $this->selectable();
  42.   }
  43.  
  44.   function format($data{
  45.     //$aclass  = (isset($this->aclass) ? " class='$this->aclass'" : "");
  46.     #echo "<pre>".print_r($data,1)."</pre>";
  47.     #echo $this->value;
  48.     $selected ($data[$this->formatid== $this->getValue(' checked="1" ' '');
  49.     $t  '<label><input type="radio" name="'.$this->name.'" '  
  50.          .'value="'.$data[$this->formatid].'" '.$selected.' /> ';
  51.     foreach (array_keys($this->formatteras $k{
  52.       $t .= $this->formatter[$k]->format($data);
  53.     }
  54.     $t .= '</label>';
  55.     if (isset($data['_field']&& $data['_field']{
  56.       $t .= $data['_field']->selectable();
  57.     }
  58.     return $t;
  59.   }
  60.  
  61.  
  62.   function selectable({
  63.     $t '';
  64.     foreach ($this->list->choicelist as $v{
  65.       $t .= $this->format($v);
  66.       $t .= "<br />\n";
  67.     }
  68.     return $t;
  69.   }
  70.  
  71. // class RadioList
  72.  
  73.  
  74. ?>

Documentation generated on Tue, 06 Mar 2007 10:01:55 +0000 by phpDocumentor 1.3.0