Author: danydb Date: 2011-09-17 00:01:19 +0200 (Sat, 17 Sep 2011) New Revision: 4203
Modified: phpcompta/branches/rel560/include/class_iradio.php Log: new fct set_checked Modified: phpcompta/branches/rel560/include/class_iradio.php =================================================================== --- phpcompta/branches/rel560/include/class_iradio.php 2011-09-16 21:58:49 UTC (rev 4202) +++ phpcompta/branches/rel560/include/class_iradio.php 2011-09-16 22:01:19 UTC (rev 4203) @@ -1,4 +1,5 @@ <?php + /* * This file is part of PhpCompta. * @@ -15,41 +16,58 @@ * You should have received a copy of the GNU General Public License * along with PhpCompta; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ + */ /* $Revision: 1615 $ */ // Copyright Author Dany De Bontridder [email protected] -/*!\file +/* !\file * \brief Html Input */ require_once('class_html_input.php'); + class IRadio extends HtmlInput -{ - /*!\brief show the html input of the widget*/ - public function input($p_name=null,$p_value=null) { - $this->name=($p_name==null)?$this->name:$p_name; - $this->value=($p_value==null)?$this->value:$p_value; - if ( $this->readOnly==true) return $this->display(); + /* !\brief show the html input of the widget */ - $check=( $this->selected==true||$this->selected=='t' )?"checked":"unchecked"; - $r='<input type="RADIO" name="'.$this->name.'"'; + public function input($p_name=null, $p_value=null) + { + $this->name = ($p_name == null) ? $this->name : $p_name; + $this->value = ($p_value == null) ? $this->value : $p_value; + if ($this->readOnly == true) + return $this->display(); + + $check = ( $this->selected == true || $this->selected == 't' ) ? "checked" : "unchecked"; + $r = '<input type="RADIO" name="' . $this->name . '"'; $r.=" VALUE=\"$this->value\""; - $r.=($this->javascript !='')? 'onclick="'.$this->javascript.'"':''; + $r.=($this->javascript != '') ? 'onclick="' . $this->javascript . '"' : ''; $r.=" $check > "; return $r; - } - /*!\brief print in html the readonly value of the widget*/ + } + + /* !\brief print in html the readonly value of the widget */ + public function display() - { + { - $check=( $this->selected==true || $this->selected=='t' )?"Yes":"no"; - $r=$check; + $check = ( $this->selected == true || $this->selected == 't' ) ? "Yes" : "no"; + $r = $check; return $r; + } - } + /** + * set selected to true (checked) if the value equal the parameter + * @param $p_value value to compare + */ + public function set_check($p_value) + { + if ($this->value == $p_value) + $this->selected = true; + } + static public function test_me() - { + { + + } + } -} _______________________________________________ Phpcompta-dev mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/phpcompta-dev
