/zf/library/Zend/Dojo/Form/Element/HorizontalSlider.php

http://github.com/eryx/php-framework-benchmark · PHP · 208 lines · 90 code · 14 blank · 104 comment · 2 complexity · 693b3ddd6090a7131c356afe2c54acf6 MD5 · raw file

  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-2011 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_Slider */
  22. require_once 'Zend/Dojo/Form/Element/Slider.php';
  23. /**
  24. * HorizontalSlider dijit
  25. *
  26. * @uses Zend_Dojo_Form_Element_Slider
  27. * @package Zend_Dojo
  28. * @subpackage Form_Element
  29. * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
  30. * @license http://framework.zend.com/license/new-bsd New BSD License
  31. * @version $Id: HorizontalSlider.php 23775 2011-03-01 17:25:24Z ralph $
  32. */
  33. class Zend_Dojo_Form_Element_HorizontalSlider extends Zend_Dojo_Form_Element_Slider
  34. {
  35. /**
  36. * Use HorizontalSlider dijit view helper
  37. * @var string
  38. */
  39. public $helper = 'HorizontalSlider';
  40. /**
  41. * Get top decoration data
  42. *
  43. * @return array
  44. */
  45. public function getTopDecoration()
  46. {
  47. if ($this->hasDijitParam('topDecoration')) {
  48. return $this->getDijitParam('topDecoration');
  49. }
  50. return array();
  51. }
  52. /**
  53. * Set dijit to use with top decoration
  54. *
  55. * @param mixed $dijit
  56. * @return Zend_Dojo_Form_Element_HorizontalSlider
  57. */
  58. public function setTopDecorationDijit($dijit)
  59. {
  60. $decoration = $this->getTopDecoration();
  61. $decoration['dijit'] = (string) $dijit;
  62. $this->setDijitParam('topDecoration', $decoration);
  63. return $this;
  64. }
  65. /**
  66. * Set container to use with top decoration
  67. *
  68. * @param mixed $container
  69. * @return Zend_Dojo_Form_Element_HorizontalSlider
  70. */
  71. public function setTopDecorationContainer($container)
  72. {
  73. $decoration = $this->getTopDecoration();
  74. $decoration['container'] = (string) $container;
  75. $this->setDijitParam('topDecoration', $decoration);
  76. return $this;
  77. }
  78. /**
  79. * Set labels to use with top decoration
  80. *
  81. * @param array $labels
  82. * @return Zend_Dojo_Form_Element_HorizontalSlider
  83. */
  84. public function setTopDecorationLabels(array $labels)
  85. {
  86. $decoration = $this->getTopDecoration();
  87. $decoration['labels'] = array_values($labels);
  88. $this->setDijitParam('topDecoration', $decoration);
  89. return $this;
  90. }
  91. /**
  92. * Set params to use with top decoration
  93. *
  94. * @param array $params
  95. * @return Zend_Dojo_Form_Element_HorizontalSlider
  96. */
  97. public function setTopDecorationParams(array $params)
  98. {
  99. $decoration = $this->getTopDecoration();
  100. $decoration['params'] = $params;
  101. $this->setDijitParam('topDecoration', $decoration);
  102. return $this;
  103. }
  104. /**
  105. * Set attribs to use with top decoration
  106. *
  107. * @param array $attribs
  108. * @return Zend_Dojo_Form_Element_HorizontalSlider
  109. */
  110. public function setTopDecorationAttribs(array $attribs)
  111. {
  112. $decoration = $this->getTopDecoration();
  113. $decoration['attribs'] = $attribs;
  114. $this->setDijitParam('topDecoration', $decoration);
  115. return $this;
  116. }
  117. /**
  118. * Get bottom decoration data
  119. *
  120. * @return array
  121. */
  122. public function getBottomDecoration()
  123. {
  124. if ($this->hasDijitParam('bottomDecoration')) {
  125. return $this->getDijitParam('bottomDecoration');
  126. }
  127. return array();
  128. }
  129. /**
  130. * Set dijit to use with bottom decoration
  131. *
  132. * @param mixed $dijit
  133. * @return Zend_Dojo_Form_Element_HorizontalSlider
  134. */
  135. public function setBottomDecorationDijit($dijit)
  136. {
  137. $decoration = $this->getBottomDecoration();
  138. $decoration['dijit'] = (string) $dijit;
  139. $this->setDijitParam('bottomDecoration', $decoration);
  140. return $this;
  141. }
  142. /**
  143. * Set container to use with bottom decoration
  144. *
  145. * @param mixed $container
  146. * @return Zend_Dojo_Form_Element_HorizontalSlider
  147. */
  148. public function setBottomDecorationContainer($container)
  149. {
  150. $decoration = $this->getBottomDecoration();
  151. $decoration['container'] = (string) $container;
  152. $this->setDijitParam('bottomDecoration', $decoration);
  153. return $this;
  154. }
  155. /**
  156. * Set labels to use with bottom decoration
  157. *
  158. * @param array $labels
  159. * @return Zend_Dojo_Form_Element_HorizontalSlider
  160. */
  161. public function setBottomDecorationLabels(array $labels)
  162. {
  163. $decoration = $this->getBottomDecoration();
  164. $decoration['labels'] = array_values($labels);
  165. $this->setDijitParam('bottomDecoration', $decoration);
  166. return $this;
  167. }
  168. /**
  169. * Set params to use with bottom decoration
  170. *
  171. * @param array $params
  172. * @return Zend_Dojo_Form_Element_HorizontalSlider
  173. */
  174. public function setBottomDecorationParams(array $params)
  175. {
  176. $decoration = $this->getBottomDecoration();
  177. $decoration['params'] = $params;
  178. $this->setDijitParam('bottomDecoration', $decoration);
  179. return $this;
  180. }
  181. /**
  182. * Set attribs to use with bottom decoration
  183. *
  184. * @param array $attribs
  185. * @return Zend_Dojo_Form_Element_HorizontalSlider
  186. */
  187. public function setBottomDecorationAttribs(array $attribs)
  188. {
  189. $decoration = $this->getBottomDecoration();
  190. $decoration['attribs'] = $attribs;
  191. $this->setDijitParam('bottomDecoration', $decoration);
  192. return $this;
  193. }
  194. }