Source for file WPasswordField.class.php

Documentation is available at WPasswordField.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: WPasswordField.class.php,v 1.3 2007/09/19 14:04:51 adamfranco Exp $
  10. */
  11.  
  12. require_once(POLYPHONY."/main/library/Wizard/WizardComponent.abstract.php");
  13.  
  14. /**
  15. * This adds an input type='password' field to a {@link Wizard}.
  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: WPasswordField.class.php,v 1.3 2007/09/19 14:04:51 adamfranco Exp $
  24. */
  25. class WPasswordField
  26. extends WizardComponent
  27. {
  28.  
  29. var $_size = 30;
  30. var $_maxlength = 255;
  31. var $_style = null;
  32. var $_value = null;
  33. /**
  34. * Sets the size of this password field.
  35. * @param int $size
  36. * @access public
  37. * @return void
  38. */
  39. function setSize ($size) {
  40. $this->_size = $size;
  41. }
  42. /**
  43. * Sets the maxlength of the value of this field.
  44. * @param integer $maxlength
  45. * @access public
  46. * @return void
  47. */
  48. function setMaxLength ($maxlength) {
  49. $this->_maxlength = $maxlength;
  50. }
  51. /**
  52. * Sets the CSS style of this field.
  53. * @param string $style
  54. * @access public
  55. * @return void
  56. */
  57. function setStyle ($style) {
  58. $this->_style = $style;
  59. }
  60. /**
  61. * Tells the wizard component to update itself - this may include getting
  62. * form post data or validation - whatever this particular component wants to
  63. * do every pageload.
  64. * @param string $fieldName The field name to use when outputting form data or
  65. * similar parameters/information.
  66. * @access public
  67. * @return boolean - TRUE if everything is OK
  68. */
  69. function update ($fieldName) {
  70. $val = RequestContext::value($fieldName);
  71. if ($val) $this->_value = $val;
  72. }
  73. /**
  74. * Returns the values of wizard-components. Should return an array if children are involved,
  75. * otherwise a whatever type of object is expected.
  76. * @access public
  77. * @return mixed
  78. */
  79. function getAllValues () {
  80. return $this->_value;
  81. }
  82. /**
  83. * Returns a block of XHTML-valid code that contains markup for this specific
  84. * component.
  85. * @param string $fieldName The field name to use when outputting form data or
  86. * similar parameters/information.
  87. * @access public
  88. * @return string
  89. */
  90. function getMarkup ($fieldName) {
  91. $name = RequestContext::name($fieldName);
  92. $m = "<input type='password' name='$name' size='".$this->_size."' maxlength='".$this->_maxlength."'";
  93. if ($this->_style) {
  94. $m .= " style=\"".addslashes($this->_style)."\"";
  95. }
  96. $m .= " />";
  97. return $m;
  98. }
  99. }
  100.  
  101. ?>

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