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.
18 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 * @version $Id: NumberSpinner.php 16204 2009-06-21 18:58:29Z thomas $
23 /** Zend_Dojo_View_Helper_Dijit */
24 require_once 'Zend/Dojo/View/Helper/Dijit.php';
27 * Dojo NumberSpinner dijit
29 * @uses Zend_Dojo_View_Helper_Dijit
32 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
33 * @license http://framework.zend.com/license/new-bsd New BSD License
35 class Zend_Dojo_View_Helper_NumberSpinner
extends Zend_Dojo_View_Helper_Dijit
41 protected $_dijit = 'dijit.form.NumberSpinner';
47 protected $_elementType = 'text';
53 protected $_module = 'dijit.form.NumberSpinner';
56 * dijit.form.NumberSpinner
60 * @param array $params Parameters to use for dijit creation
61 * @param array $attribs HTML attributes
64 public function numberSpinner($id, $value = null, array $params = array(), array $attribs = array())
66 // Get constraints and serialize to JSON if necessary
67 if (array_key_exists('constraints', $params)) {
68 if (!is_array($params['constraints'])) {
69 unset($params['constraints']);
72 $constraints = array();
73 if (array_key_exists('min', $params)) {
74 $constraints['min'] = $params['min'];
75 unset($params['min']);
77 if (array_key_exists('max', $params)) {
78 $constraints['max'] = $params['max'];
79 unset($params['max']);
81 if (array_key_exists('places', $params)) {
82 $constraints['places'] = $params['places'];
83 unset($params['places']);
85 $params['constraints'] = $constraints;
88 return $this->_createFormElement($id, $value, $params, $attribs);