Source for file WHiddenField.class.php

Documentation is available at WHiddenField.class.php

  1. <?php
  2. /**
  3. * @since Jul 21, 2005
  4. * @package polyphony.wizard.components
  5. *
  6. * @copyright Copyright &copy; 2005, Middlebury College
  7. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  8. *
  9. * @version $Id: WHiddenField.class.php,v 1.7 2007/09/19 14:04:51 adamfranco Exp $
  10. */
  11.  
  12. require_once(POLYPHONY.'/main/library/Wizard/WizardComponent.abstract.php');
  13.  
  14. /**
  15. * This class allows for the creation of a input type='hidden'
  16. *
  17. * @since Jul 21, 2005
  18. * @package polyphony.wizard.components
  19. *
  20. * @copyright Copyright &copy; 2005, Middlebury College
  21. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  22. *
  23. * @version $Id: WHiddenField.class.php,v 1.7 2007/09/19 14:04:51 adamfranco Exp $
  24. */
  25. class WHiddenField
  26. extends WizardComponent
  27. {
  28.  
  29. var $_value;
  30. /**
  31. * Virtual Constructor
  32. * @param string $value
  33. * @access public
  34. * @return ref object
  35. * @static
  36. */
  37. function withValue ($value) {
  38. $obj = new WHiddenField();
  39. $obj->_value = $value;
  40. return $obj;
  41. }
  42. /**
  43. * Virtual Constructor with fromString naming convention
  44. * @param string $aString
  45. * @access public
  46. * @return ref object
  47. * @static
  48. */
  49. function fromString ($aString) {
  50. $obj = new WHiddenField();
  51. $obj->_value = $aString;
  52. return $obj;
  53. }
  54. /**
  55. * Sets the value of this hidden field.
  56. * @param string $value
  57. * @access public
  58. * @return void
  59. */
  60. function setValue ($value) {
  61. $this->_value = $value;
  62. }
  63. /**
  64. * Tells the wizard component to update itself - this may include getting
  65. * form post data or validation - whatever this particular component wants to
  66. * do every pageload.
  67. * @param string $fieldName The field name to use when outputting form data or
  68. * similar parameters/information.
  69. * @access public
  70. * @return boolean - TRUE if everything is OK
  71. */
  72. function update ($fieldName) {
  73. $val = RequestContext::value($fieldName);
  74. if ($val !== false && $val !== null) $this->_value = $val;
  75. }
  76. /**
  77. * Returns the values of wizard-components. Should return an array if children are involved,
  78. * otherwise a whatever type of object is expected.
  79. *
  80. * In this case, a "1" or a "0" is returned, depending on the checked state of the checkbox.
  81. * @access public
  82. * @return mixed
  83. */
  84. function getAllValues () {
  85. return $this->_value;
  86. }
  87. /**
  88. * Returns a block of XHTML-valid code that contains markup for this specific
  89. * component.
  90. * @param string $fieldName The field name to use when outputting form data or
  91. * similar parameters/information.
  92. * @access public
  93. * @return string
  94. */
  95. function getMarkup ($fieldName) {
  96. $name = RequestContext::name($fieldName);
  97. $val = htmlspecialchars($this->_value, ENT_QUOTES);
  98. $m = "<input type='hidden' name='$name' id='$name' value='$val' />";
  99. return $m;
  100. }
  101. }
  102.  
  103. ?>

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