cloneView(); if (isset($this->partialCounter)) { $view->partialCounter = $this->partialCounter; } if ((null !== $module) && is_string($module)) { #require_once 'Zend/Controller/Front.php'; $moduleDir = Zend_Controller_Front::getInstance()->getControllerDirectory($module); if (null === $moduleDir) { #require_once 'Zend/View/Helper/Partial/Exception.php'; $e = new Zend_View_Helper_Partial_Exception('Cannot render partial; module does not exist'); $e->setView($this->view); throw $e; } $viewsDir = dirname($moduleDir) . '/views'; $view->addBasePath($viewsDir); } elseif ((null == $model) && (null !== $module) && (is_array($module) || is_object($module))) { $model = $module; } if (!empty($model)) { if (is_array($model)) { $view->assign($model); } elseif (is_object($model)) { if (null !== ($objectKey = $this->getObjectKey())) { $view->assign($objectKey, $model); } elseif (method_exists($model, 'toArray')) { $view->assign($model->toArray()); } else { $view->assign(get_object_vars($model)); } } } return $view->render($name); } /** * Clone the current View * * @return Zend_View_Interface */ public function cloneView() { $view = clone $this->view; $view->clearVars(); return $view; } /** * Set object key * * @param string $key * @return Zend_View_Helper_Partial */ public function setObjectKey($key) { if (null === $key) { $this->_objectKey = null; } else { $this->_objectKey = (string) $key; } return $this; } /** * Retrieve object key * * The objectKey is the variable to which an object in the iterator will be * assigned. * * @return null|string */ public function getObjectKey() { return $this->_objectKey; } }