Source for file WGUICheckBox.class.php

Documentation is available at WGUICheckBox.class.php

  1. <?php
  2. /**
  3. * @since 8/14/2006
  4. * @package polyphony.guiwizardcomponents
  5. *
  6. * @copyright Copyright &copy; 2006, Middlebury College
  7. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  8. *
  9. * @version $Id: WGUICheckBox.class.php,v 1.3 2007/09/19 14:04:45 adamfranco Exp $
  10. */
  11.  
  12.  
  13.  
  14. /**
  15. * This class make a checkbox associated with a style property
  16. *
  17. * @since 8/14/2006
  18. * @package polyphony.guiwizardcomponents
  19. *
  20. * @copyright Copyright &copy; 2006, Middlebury College
  21. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  22. *
  23. * @version $Id: WGUICheckBox.class.php,v 1.3 2007/09/19 14:04:45 adamfranco Exp $
  24. */
  25. class WGUICheckbox
  26. extends WGUIComponent
  27. {
  28.  
  29. var $_checkedVal;
  30. var $_unCheckedVal;
  31.  
  32. function WGUICheckbox($callBack, $collectionSelector, $styleProperty, $componentClass, $checked, $unchecked){
  33. $this->_wizardComponent = new WCheckBox();
  34. $this->_checkedVal = $checked;
  35. $this->_unCheckedVal = $unchecked;
  36. $this->init($callBack, $collectionSelector, $styleProperty, $componentClass);
  37. }
  38. /**
  39. * copy the value of the Wizard component to the StyleComponent
  40. */
  41. function exportValue(){
  42. $styleComponent =$this->getStyleComponent();
  43. if($this->_wizardComponent->getAllValues()){
  44. $styleComponent->setValue($this->_checkedVal);
  45. }else{
  46. $styleComponent->setValue($this->_unCheckedVal);
  47. }
  48. }
  49. /**
  50. * copy the value from the StyleComponent to the wizard component
  51. *
  52. * Default is unchecked
  53. */
  54. function importValue(){
  55. $styleComponent =$this->getStyleComponent();
  56. if($styleComponent->getValue()==$this->_checkedVal){
  57. $this->_wizardComponent->setValue(1);
  58. }elseif($styleComponent->getValue()==$this->_unCheckedVal){
  59. $this->_wizardComponent->setValue(0);
  60. }else{
  61. $this->useDefaultValue();
  62. }
  63. }
  64. /**
  65. * Is $value a legitamate value for this wizard component?
  66. *
  67. * @param string $value the value to test
  68. * @return boolean if the value is legitimate
  69. */
  70. function isPossibleValue($value){
  71. if($value!= $this->_checkedVal && $value!=$this->_unCheckedVal){
  72. return false;
  73. }
  74. return true;
  75. }
  76. }
  77.  
  78. ?>

Documentation generated on Wed, 19 Sep 2007 10:27:59 -0400 by phpDocumentor 1.3.0RC3