File indexing completed on 2024-12-29 05:27:35

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Dojo
0017  * @subpackage View
0018  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0019  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0020  * @version    $Id$
0021  */
0022 
0023 /** Zend_Dojo_View_Helper_Dijit */
0024 // require_once 'Zend/Dojo/View/Helper/Dijit.php';
0025 
0026 /**
0027  * Dojo Form dijit
0028  *
0029  * @uses       Zend_Dojo_View_Helper_Dijit
0030  * @package    Zend_Dojo
0031  * @subpackage View
0032  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0033  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0034   */
0035 class Zend_Dojo_View_Helper_Form extends Zend_Dojo_View_Helper_Dijit
0036 {
0037     /**
0038      * Dijit being used
0039      * @var string
0040      */
0041     protected $_dijit  = 'dijit.form.Form';
0042 
0043     /**
0044      * Module being used
0045      * @var string
0046      */
0047     protected $_module = 'dijit.form.Form';
0048 
0049     /**
0050      * @var Zend_View_Helper_Form
0051      */
0052     protected $_helper;
0053 
0054     /**
0055      * dijit.form.Form
0056      *
0057      * @param  string $id
0058      * @param  null|array $attribs HTML attributes
0059      * @param  false|string $content
0060      * @return string
0061      */
0062     public function form($id, $attribs = null, $content = false)
0063     {
0064         if (!is_array($attribs)) {
0065             $attribs = (array) $attribs;
0066         }
0067         if (array_key_exists('id', $attribs)) {
0068             $attribs['name'] = $id;
0069         } else {
0070             $attribs['id'] = $id;
0071         }
0072 
0073         $attribs = $this->_prepareDijit($attribs, array(), 'layout');
0074 
0075         return $this->getFormHelper()->form($id, $attribs, $content);
0076     }
0077 
0078     /**
0079      * Get standard form helper
0080      *
0081      * @return Zend_View_Helper_Form
0082      */
0083     public function getFormHelper()
0084     {
0085         if (null === $this->_helper) {
0086             // require_once 'Zend/View/Helper/Form.php';
0087             $this->_helper = new Zend_View_Helper_Form;
0088             $this->_helper->setView($this->view);
0089         }
0090         return $this->_helper;
0091     }
0092 }