altocompta/include/class_iradio.php
Dany De Bontridder 868ecb3b3d Merged revisions 4202-4203,4211,4220 via svnmerge from
svn+ssh://danydb@svn/svn/phpcompta/branches/rel560

........
  r4202 | danydb | 2011-09-16 23:58:49 +0200 (Fri, 16 Sep 2011) | 1 line
  
  new fct set_checked
........
  r4203 | danydb | 2011-09-17 00:01:19 +0200 (Sat, 17 Sep 2011) | 1 line
  
  new fct set_checked
........
  r4211 | danydb | 2011-10-13 23:43:40 +0200 (Thu, 13 Oct 2011) | 1 line
  
  remove release
........
  r4220 | danydb | 2011-10-19 21:49:33 +0200 (Wed, 19 Oct 2011) | 1 line
  
  bug : & in interpreted as HTML entities
........
2011-10-19 20:47:32 +00:00

73 lines
2.2 KiB
PHP

<?php
/*
* This file is part of PhpCompta.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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$ */
// Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
/* !\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();
$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.=" $check > ";
return $r;
}
/* !\brief print in html the readonly value of the widget */
public function display()
{
$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()
{
}
}