File indexing completed on 2025-03-02 05:29:19
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 * Dijit layout container base class 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 abstract class Zend_Dojo_View_Helper_DijitContainer extends Zend_Dojo_View_Helper_Dijit 0036 { 0037 /** 0038 * Capture locks 0039 * @var array 0040 */ 0041 protected $_captureLock = array(); 0042 0043 /** 0044 * Metadata information to use with captured content 0045 * @var array 0046 */ 0047 protected $_captureInfo = array(); 0048 0049 /** 0050 * Begin capturing content for layout container 0051 * 0052 * @param string $id 0053 * @param array $params 0054 * @param array $attribs 0055 * @return void 0056 */ 0057 public function captureStart($id, array $params = array(), array $attribs = array()) 0058 { 0059 if (array_key_exists($id, $this->_captureLock)) { 0060 // require_once 'Zend/Dojo/View/Exception.php'; 0061 throw new Zend_Dojo_View_Exception(sprintf('Lock already exists for id "%s"', $id)); 0062 } 0063 0064 $this->_captureLock[$id] = true; 0065 $this->_captureInfo[$id] = array( 0066 'params' => $params, 0067 'attribs' => $attribs, 0068 ); 0069 0070 ob_start(); 0071 return; 0072 } 0073 0074 /** 0075 * Finish capturing content for layout container 0076 * 0077 * @param string $id 0078 * @return string 0079 */ 0080 public function captureEnd($id) 0081 { 0082 if (!array_key_exists($id, $this->_captureLock)) { 0083 // require_once 'Zend/Dojo/View/Exception.php'; 0084 throw new Zend_Dojo_View_Exception(sprintf('No capture lock exists for id "%s"; nothing to capture', $id)); 0085 } 0086 0087 $content = ob_get_clean(); 0088 extract($this->_captureInfo[$id]); 0089 unset($this->_captureLock[$id], $this->_captureInfo[$id]); 0090 return $this->_createLayoutContainer($id, $content, $params, $attribs); 0091 } 0092 }