/usr/local/miolo2/classes/ui/controls/options.class

Go to the documentation of this file.
00001 <?
00006 class Option extends MControl
00007 {
00011     var $label;
00012 
00016     var $name;
00017 
00021     var $value;
00022 
00026     var $checked;
00027 
00031     var $type='circle';
00032 
00036     var $control;  // owner control of this Option
00037 
00038     
00052     function Option($name='',$value=null,$label='',$checked=false,$id=false)
00053     {
00054         $this->label   = $label;
00055         $this->name    = $name;
00056         $this->value   = $value;
00057         $this->checked = $checked;
00058     }
00059 
00069     function SetControl($control)
00070     {
00071         $this->control = $control;
00072     }
00073  
00081     function Generate()
00082     {
00083         if (is_array($this->control->value))
00084         {
00085             $found = array_search($this->value,$this->control->value);
00086             $checked = (!is_null($found)) && ($found !== false);
00087         }
00088         else
00089         {
00090             $checked = ($this->value == $this->control->value);
00091         }
00092         $this->checked = $this->checked || $checked;
00093         return HtmlPainter::Option($this->value, $this->label, $this->checked, $this->control->showValues);
00094     }
00095 
00096 }
00097 
00102 class OptionGroup extends MControl
00103 {
00107     var $label;
00108 
00112     var $name;
00113 
00117     var $options; // array of option objects
00118 
00119     
00131     function OptionGroup($name,$label='',$options=NULL)
00132     {
00133         $this->label   = $label;
00134         $this->name    = $name;
00135         $this->options = $options;
00136     }
00137 
00145     function Generate()
00146     {
00147         foreach( $this->options as $o )
00148         {            
00149             $content .= $o->Generate();
00150         }
00151         return HtmlPainter::OptionGroup('formCombo',"$this->label", $content);
00152     }
00153 }
00154 ?>
CopyLeft (L) 2001-2006 - [MIOLO Development Team] SOLIS - Cooperativa de Soluções Livres - Lajeado/RS - Brasil