Beispiel #1
0
 /**
  * render oxView object
  *
  * @param oxView $oViewObject view object to render
  *
  * @return string
  */
 protected function _render($oViewObject)
 {
     // get Smarty is important here as it sets template directory correct
     $oSmarty = oxRegistry::get("oxUtilsView")->getSmarty();
     // render it
     $sTemplateName = $oViewObject->render();
     // check if template dir exists
     $sTemplateFile = $this->getConfig()->getTemplatePath($sTemplateName, $this->isAdmin());
     if (!file_exists($sTemplateFile)) {
         $oEx = oxNew('oxSystemComponentException');
         $oEx->setMessage('EXCEPTION_SYSTEMCOMPONENT_TEMPLATENOTFOUND');
         $oEx->setComponent($sTemplateName);
         $sTemplateName = "message/exception.tpl";
         if ($this->_isDebugMode()) {
             oxRegistry::get("oxUtilsView")->addErrorToDisplay($oEx);
         }
         $oEx->debugOut();
     }
     // Output processing. This is useful for modules. As sometimes you may want to process output manually.
     $oOutput = $this->_getOutputManager();
     $aViewData = $oOutput->processViewArray($oViewObject->getViewData(), $oViewObject->getClassName());
     $oViewObject->setViewData($aViewData);
     //add all exceptions to display
     $aErrors = $this->_getErrors($oViewObject->getClassName());
     if (is_array($aErrors) && count($aErrors)) {
         oxRegistry::get("oxUtilsView")->passAllErrorsToView($aViewData, $aErrors);
     }
     foreach (array_keys($aViewData) as $sViewName) {
         $oSmarty->assign_by_ref($sViewName, $aViewData[$sViewName]);
     }
     // passing current view object to smarty
     $oSmarty->oxobject = $oViewObject;
     $sOutput = $oSmarty->fetch($sTemplateName, $oViewObject->getViewId());
     //Output processing - useful for modules as sometimes you may want to process output manually.
     $sOutput = $oOutput->process($sOutput, $oViewObject->getClassName());
     return $oOutput->addVersionTags($sOutput);
 }