TextBox.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Dojo
  17. * @subpackage Form_Element
  18. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. */
  21. /** Zend_Dojo_Form_Element_Dijit */
  22. require_once 'Zend/Dojo/Form/Element/Dijit.php';
  23. /**
  24. * TextBox dijit
  25. *
  26. * @category Zend
  27. * @package Zend_Dojo
  28. * @subpackage Form_Element
  29. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  30. * @license http://framework.zend.com/license/new-bsd New BSD License
  31. * @version $Id$
  32. */
  33. class Zend_Dojo_Form_Element_TextBox extends Zend_Dojo_Form_Element_Dijit
  34. {
  35. /**
  36. * Use TextBox dijit view helper
  37. * @var string
  38. */
  39. public $helper = 'TextBox';
  40. /**
  41. * Set lowercase flag
  42. *
  43. * @param bool $lowercase
  44. * @return Zend_Dojo_Form_Element_TextBox
  45. */
  46. public function setLowercase($flag)
  47. {
  48. $this->setDijitParam('lowercase', (bool) $flag);
  49. return $this;
  50. }
  51. /**
  52. * Retrieve lowercase flag
  53. *
  54. * @return bool
  55. */
  56. public function getLowercase()
  57. {
  58. if (!$this->hasDijitParam('lowercase')) {
  59. return false;
  60. }
  61. return $this->getDijitParam('lowercase');
  62. }
  63. /**
  64. * Set propercase flag
  65. *
  66. * @param bool $propercase
  67. * @return Zend_Dojo_Form_Element_TextBox
  68. */
  69. public function setPropercase($flag)
  70. {
  71. $this->setDijitParam('propercase', (bool) $flag);
  72. return $this;
  73. }
  74. /**
  75. * Retrieve propercase flag
  76. *
  77. * @return bool
  78. */
  79. public function getPropercase()
  80. {
  81. if (!$this->hasDijitParam('propercase')) {
  82. return false;
  83. }
  84. return $this->getDijitParam('propercase');
  85. }
  86. /**
  87. * Set uppercase flag
  88. *
  89. * @param bool $uppercase
  90. * @return Zend_Dojo_Form_Element_TextBox
  91. */
  92. public function setUppercase($flag)
  93. {
  94. $this->setDijitParam('uppercase', (bool) $flag);
  95. return $this;
  96. }
  97. /**
  98. * Retrieve uppercase flag
  99. *
  100. * @return bool
  101. */
  102. public function getUppercase()
  103. {
  104. if (!$this->hasDijitParam('uppercase')) {
  105. return false;
  106. }
  107. return $this->getDijitParam('uppercase');
  108. }
  109. /**
  110. * Set trim flag
  111. *
  112. * @param bool $trim
  113. * @return Zend_Dojo_Form_Element_TextBox
  114. */
  115. public function setTrim($flag)
  116. {
  117. $this->setDijitParam('trim', (bool) $flag);
  118. return $this;
  119. }
  120. /**
  121. * Retrieve trim flag
  122. *
  123. * @return bool
  124. */
  125. public function getTrim()
  126. {
  127. if (!$this->hasDijitParam('trim')) {
  128. return false;
  129. }
  130. return $this->getDijitParam('trim');
  131. }
  132. /**
  133. * Set maxLength
  134. *
  135. * @param int $length
  136. * @return Zend_Dojo_Form_Element_TextBox
  137. */
  138. public function setMaxLength($length)
  139. {
  140. $this->setDijitParam('maxLength', (int) $length);
  141. return $this;
  142. }
  143. /**
  144. * Retrieve maxLength
  145. *
  146. * @return int|null
  147. */
  148. public function getMaxLength()
  149. {
  150. return $this->getDijitParam('maxLength');
  151. }
  152. }