Changeset 10234
- Timestamp:
- 07/12/08 02:47:20 (4 months ago)
- Files:
-
- branches/dwhittle/1.1/lib/helper/PartialHelper.php (modified) (1 diff)
- branches/dwhittle/1.1/lib/view/sfPartialView.class.php (modified) (3 diffs)
- branches/dwhittle/1.2/lib/helper/PartialHelper.php (modified) (2 diffs)
- branches/dwhittle/1.2/lib/view/sfPartialView.class.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/dwhittle/1.1/lib/helper/PartialHelper.php
r9133 r10234 142 142 $actionName = '_'.$componentName; 143 143 144 $viewClass = sfConfig::get('mod_'.$moduleName.'_partial_view_class', 'sf').'PartialView'; 145 $view = new $viewClass($context, $moduleName, $actionName, ''); 146 $view->setPartialVars($vars); 147 148 if ($retval = $view->getCache()) 149 { 150 return $retval; 151 } 152 144 153 $allVars = _call_component($moduleName, $componentName, $vars); 145 154 146 155 if (!is_null($allVars)) 147 156 { 148 $viewClass = sfConfig::get('mod_'.$moduleName.'_partial_view_class', 'sf').'PartialView';149 150 // render151 $view = new $viewClass($context, $moduleName, $actionName, '');152 $view->setPartialVars($vars);153 157 $view->getAttributeHolder()->add($allVars); 154 158 branches/dwhittle/1.1/lib/view/sfPartialView.class.php
r9515 r10234 67 67 } 68 68 69 if ( sfConfig::get('sf_cache'))69 if ($retval = $this->getCache()) 70 70 { 71 $viewCache = $this->context->getViewCacheManager(); 72 $viewCache->registerConfiguration($this->moduleName); 73 74 $cacheKey = $viewCache->computeCacheKey($this->partialVars); 75 if ($retval = $viewCache->getPartialCache($this->moduleName, $this->actionName, $cacheKey)) 76 { 77 return $retval; 78 } 79 else 80 { 81 $mainResponse = $this->context->getResponse(); 82 $responseClass = get_class($mainResponse); 83 $this->context->setResponse($response = new $responseClass($this->context->getEventDispatcher(), $mainResponse->getOptions())); 84 } 71 return $retval; 72 } 73 else if (sfConfig::get('sf_cache')) 74 { 75 $mainResponse = $this->context->getResponse(); 76 $responseClass = get_class($mainResponse); 77 $this->context->setResponse($response = new $responseClass($this->context->getEventDispatcher(), $mainResponse->getOptions())); 85 78 } 86 79 … … 95 88 if (sfConfig::get('sf_cache')) 96 89 { 97 $retval = $ viewCache->setPartialCache($this->moduleName, $this->actionName, $cacheKey, $retval);90 $retval = $this->viewCache->setPartialCache($this->moduleName, $this->actionName, $this->cacheKey, $retval); 98 91 $this->context->setResponse($mainResponse); 99 92 $mainResponse->merge($response); … … 107 100 return $retval; 108 101 } 102 103 public function getCache() 104 { 105 if (!sfConfig::get('sf_cache')) 106 { 107 return null; 108 } 109 110 $this->viewCache = $this->context->getViewCacheManager(); 111 $this->viewCache->registerConfiguration($this->moduleName); 112 113 $this->cacheKey = $this->viewCache->computeCacheKey($this->partialVars); 114 if ($retval = $this->viewCache->getPartialCache($this->moduleName, $this->actionName, $this->cacheKey)) 115 { 116 return $retval; 117 } 118 } 109 119 } branches/dwhittle/1.2/lib/helper/PartialHelper.php
r9128 r10234 137 137 $actionName = '_'.$componentName; 138 138 139 $view = new sfPartialView($context, $moduleName, $actionName, ''); 140 $view->setPartialVars($vars); 141 142 if ($retval = $view->getCache()) 143 { 144 return $retval; 145 } 146 139 147 $allVars = _call_component($moduleName, $componentName, $vars); 140 148 … … 142 150 { 143 151 // render 144 $view = new sfPartialView($context, $moduleName, $actionName, '');145 $view->setPartialVars($vars);146 152 $view->getAttributeHolder()->add($allVars); 147 153 branches/dwhittle/1.2/lib/view/sfPartialView.class.php
r9496 r10234 67 67 } 68 68 69 if ( sfConfig::get('sf_cache'))69 if ($retval = $this->getCache()) 70 70 { 71 $viewCache = $this->context->getViewCacheManager(); 72 $viewCache->registerConfiguration($this->moduleName); 73 74 $cacheKey = $viewCache->computeCacheKey($this->partialVars); 75 if ($retval = $viewCache->getPartialCache($this->moduleName, $this->actionName, $cacheKey)) 76 { 77 return $retval; 78 } 79 else 80 { 81 $mainResponse = $this->context->getResponse(); 82 $responseClass = get_class($mainResponse); 83 $this->context->setResponse($response = new $responseClass($this->context->getEventDispatcher(), $mainResponse->getOptions())); 84 } 71 return $retval; 72 } 73 else if (sfConfig::get('sf_cache')) 74 { 75 $mainResponse = $this->context->getResponse(); 76 $responseClass = get_class($mainResponse); 77 $this->context->setResponse($response = new $responseClass($this->context->getEventDispatcher(), $mainResponse->getOptions())); 85 78 } 86 79 … … 95 88 if (sfConfig::get('sf_cache')) 96 89 { 97 $retval = $ viewCache->setPartialCache($this->moduleName, $this->actionName, $cacheKey, $retval);90 $retval = $this->viewCache->setPartialCache($this->moduleName, $this->actionName, $this->cacheKey, $retval); 98 91 $this->context->setResponse($mainResponse); 99 92 $mainResponse->merge($response); … … 107 100 return $retval; 108 101 } 102 103 public function getCache() 104 { 105 if (!sfConfig::get('sf_cache')) 106 { 107 return null; 108 } 109 110 $this->viewCache = $this->context->getViewCacheManager(); 111 $this->viewCache->registerConfiguration($this->moduleName); 112 113 $this->cacheKey = $this->viewCache->computeCacheKey($this->partialVars); 114 if ($retval = $this->viewCache->getPartialCache($this->moduleName, $this->actionName, $this->cacheKey)) 115 { 116 return $retval; 117 } 118 } 109 119 }