| [ Index ] |
PHP Cross Reference of Limb3 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * Limb PHP Framework 4 * 5 * @link http://limb-project.com 6 * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com) 7 * @license LGPL http://www.gnu.org/copyleft/lesser.html 8 */ 9 10 /** 11 * Represents an HTML input type="radio" tag 12 * Represents an HTML input type="checkbox" tag 13 * @package wact 14 * @version $Id$ 15 */ 16 class WactCheckableInputComponent extends WactFormElementComponent 17 { 18 function getName() 19 { 20 $name = parent :: getName(); 21 return str_replace('[]', '', $name) ; 22 } 23 24 function renderAttributes() 25 { 26 if($this->isChecked()) 27 $this->setAttribute('checked', "checked"); 28 else 29 $this->removeAttribute('checked'); 30 31 parent :: renderAttributes(); 32 } 33 34 function isChecked() 35 { 36 $value = $this->getValue(); 37 38 // Here we really hard try to guess if it's checked or not... 39 if(is_array($value) && in_array($this->getAttribute('value'), $value)) 40 return true; 41 elseif(is_scalar($value) && $value && $value == $this->getAttribute('value')) 42 return true; 43 elseif($value && !$this->getAttribute('value')) 44 return true; 45 elseif($this->hasAttribute('checked') && is_null($value)) 46 return true; 47 elseif($value && $value != $this->getAttribute('value')) 48 return false; 49 50 return false; 51 } 52 } 53 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Aug 21 04:38:04 2008 | Cross-referenced by PHPXref 0.7 |